Git Product home page Git Product logo

bitcoin-submittx's Introduction

What is this?

This is a stand-alone P2P transaction submission tool.

The motivation for this command is the -walletbroadcast=0 command introduced in Bitcoin Core 0.11 (see the release notes.)

Usage

Usage:

usage: bitcoin-submittx [-h] [--proxy PROXY] [--timeout TIMEOUT]
                        NETWORK TXHEX NODES [NODES ...]

Transaction submission tool

positional arguments:
  NETWORK               Network to connect to (mainnet, regtest, testnet).
                        This also determines the default port
  TXHEX                 Serialized transactions to broadcast, separated by
                        commas
  NODES                 Nodes to connect to, denoted either host or host:port

optional arguments:
  -h, --help            show this help message and exit
  --proxy PROXY, -p PROXY
                        SOCKS5 proxy to connect through
  --timeout TIMEOUT, -t TIMEOUT
                        Number of seconds to wait before disconnecting from
                        nodes (default is 10)

The tool will connect to the provided nodes and announce the transactions. If the nodes subsequently request them within the timeout, they are sent.

The return status of the program will be 0 if at least one node requested the transaction, and 1 otherwise.

Example w/ Bitcoin Core

  • Send the transaction as normal, either e.g. through RPC sendtoaddress or the GUI
$ bitcoin-cli sendtoaddress mjqhocRebTHZRhkbkQs8Uzzb1T3GhEvEB4 0.25
f91948e5...
  • Using the transaction hash, retrieve the transaction data through RPC using gettransaction (NOT getrawtransaction). The hex field of the result will contain the raw hexadecimal representation of the transaction
$ bitcoin-cli gettransaction f91948e5...
{
  ...
  "txid": "f91948e5...",
  ...
  "hex": "010000000..."
}
  • Provide the hex field as TXHEX to this tool. e.g.
$ bitcoin-submittx mainnet '010000000...' 127.0.0.1

(normally one would not submit the transaction to the localhost node, but this is just an illustrative example)

TODOs and contribution ideas

  • Automatically fetch list of nodes to submit to
    • possibly from DNS seeds (but this won't work behind Tor)
  • IPv6 support
  • Provide feedback if the transaction is rejected, apart from
   recv msg_reject(messsage=tx, ccode=@, reason=non-final)
  • Tor stream isolation (like -proxyrandomize in Bitcoin Core)
  • Load node lists / transactions from file
  • Multi-hop proxies, different proxy types?
  • Feature to handle incoming connections: can be handy when submitting transactions to nodes that are not listening

Dependencies

bitcoin-submittx's People

Contributors

laanwj avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.