= NODE Bitcoin Node. Connects to the network and downloads the blockchain into local storage. == Usage To run the node with the default options (download the blockchain into ./bitcoin.db using the sequel::sqlite3 STORAGE backend): bitcoin_node You can specify options (see +--help+) or pass a config file with +--config+ (see CONFIG). Some common options you might want to use: -n --network :: Network to use. Usually +bitcoin+. Support for +namecoin+ is also quite good. Use +testnet+ for development. -c --config :: Read options from config file. See also CONFIG. --connect :: List of peers to connect to. -s --storage :: Storage backend to use. See also STORAGE. --import :: Import blockchain in bitcoind/qt format from given directory. --skip-validation:: Skip validation of received blockchain data. Can be used to speed up import/sync when blockchain data is received from a trusted source. --check-blocks :: Check consistency of the +count+ most recent blocks. Pass -1 to check all blocks. -v --verbose:: Display debug output. -h --help:: Display all available options. It will take a long time to download/store the entire blockchain at first, so be patient ;) == Command socket The node opens a separate command socket which you can connect to and query statistics or get notified about new blocks/tx, etc. See below for a list of available commands. === CLI interface The easiest way is to just call `bitcoin_node` again in the same way you started it, but with an extra command argument: bitcoin_node info bitcoin_node -c config.yml info bitcoin_node monitor "block tx" === CommandClient If you are programming in an EventMachine context, you might find the Bitcoin::Network::CommandClient convenient. === Raw socket Of course you can also connect to the socket by any other means you like, just send [, ] pairs and receive [, ] pairs back (both encoded in JSON): $ echo -e '["tslb", []]\0' | nc 127.0.0.1 9999 ["tslb",{"tslb":2700}] === Commands ==== info Get various statistics. bitcoin_node info ==== config Get the currently active configuration. bitcoin_node config ==== connections Get currently connected peers. bitcoin_node connections ==== connect Connect to given peer(s). bitcoin_node connect :[,:] ==== disconnect Disconnect given peer(s). bitcoin_node disconnect :[,,] ==== getblocks Trigger the node to ask its peers for new blocks. bitcoin_node getblocks ==== getaddr Trigger the node to ask its for new peer addresses. bitcoin_node getaddr ==== addrs Get known peer addresses (used by bin/bitcoin_dns_seed) bitcoin_node addrs [count] ==== tslb Get Time Since Last Block. bitcoin_node tslb ==== create_tx TODO ==== assemble_tx TODO ==== relay_tx Relay given transaction (in hex). bitcoin_node relay_tx ==== store_block Validate and store given block (in hex) as if it was received by a peer. bitcoin_node store_block ==== store_tx Store given transaction (in hex) as if it was received by a peer. bitcoin_node store_tx ==== stop Stop the bitcoin node. bitcoin_node stop ==== help List all available commands. bitcoin_node help