CLI Reference

bits is a cli tool and pure Python library for Bitcoin.

See subcommands below for managing crypto, or use base command as follows.

Convert input bits to bytes.

Input and output formats can be specified independently, such that this command may be used as a converter between formats.

Examples:

$ head -c 8 /dev/urandom | bits -1 -0x

$ echo 1001 | bits -1b -0b

$ echo hello world | bits -1 -0

usage: bits [-h] [-v] [--config-dir CONFIG_DIR] [-L LOG_LEVEL]
            [--in-file IN_FILE] [-1 [INPUT_FORMAT]] [--out-file OUT_FILE]
            [-0 [OUTPUT_FORMAT]]
            [subcommand] ...

Named Arguments

-v, -V, --version

show program’s version number and exit

--config-dir

Directory to look for optional config file (config.toml or config.json). TOML will take precedence over JSON if both files are defined, but TOML is only available for python 3.11+

Default: '/home/runner/.bits'

-L, --log-level

Possible choices: info, debug, warning, error

log level, e.g. ‘info’, ‘debug’, ‘warning’, or ‘error’

Default: 'error'

--in-file, -in, -i

input data file

Default: -

-1, --input-format

raw binary (-1), binary string (-1b), or hexadecimal string (-1x)

Default: hex

--out-file, -out, -o

output data file

Default: -

-0, --output-format

raw binary (-0), binary string (-0b), or hexadecimal string (-0x)

Default: hex

subcommands

Use bits <subcommand> -h for help on each command

[subcommand]

Possible choices: key, pubkey, wif, addr, mnemonic, hd, script, sig, ripemd160, sha256, hash160, hash256, base58, bech32, tx, send, p2p, blockchain, mine, rpc

Sub-commands

key

Generate Bitcoin private key integer.

This command support PEM encoded EC private key output, via the –output-format argument, for compatibility with external tools, e.g. openssl, if needed.

bits key [-h] [-L LOG_LEVEL] [--out-file OUT_FILE] [-0 [OUTPUT_FORMAT]]

Named Arguments

-L, --log-level

Possible choices: info, debug, warning, error

log level, e.g. ‘info’, ‘debug’, ‘warning’, or ‘error’

Default: 'error'

--out-file, -out, -o

output data file

Default: -

-0, --output-format

raw binary (-0), binary string (-0b), hexadecimal string (-0x), or PEM-encoded private key (-0pem)

Default: hex

pubkey

Calculate public key from private key integer. If the public key is provided as input, this sub-command may be used to compress / un-compress the key via the use of the -X flag.

This command support PEM encoded EC public key output, via the –output-format argument, for compatibility with external tools, e.g. openssl, if needed.

bits pubkey [-h] [-X] [-L LOG_LEVEL] [--in-file IN_FILE] [-1 [INPUT_FORMAT]]
            [--out-file OUT_FILE] [-0 [OUTPUT_FORMAT]]

Named Arguments

-X, --compressed

output compressed pubkey

Default: False

-L, --log-level

Possible choices: info, debug, warning, error

log level, e.g. ‘info’, ‘debug’, ‘warning’, or ‘error’

Default: 'error'

--in-file, -in, -i

input data file

Default: -

-1, --input-format

raw binary (-1), binary string (-1b), or hexadecimal string (-1x)

Default: hex

--out-file, -out, -o

output data file

Default: -

-0, --output-format

raw binary (-0), binary string (-0b), hexadecimal string (-0x), or PEM-encoded public key (-0pem)

Default: hex

wif

Encode (or decode) a private key in eWIF (extended wallet import format).

This method builds upon extended WIF as seen in electrum wallet. The idea is that an eWIF indicates the corresponding address type, as well as, all information necessary to derive such, and, spend associated funds.

Extended WIF is backwards compatible with normal WIF.

Just as normal WIF is described as the base58check encoding of,

version byte + private key + (optional 0x01 byte indicating a compressed pubkey)

Extended WIF is defined as the base58check encoding of the following,

(version byte + address type offset) + private key + (data)

Byte definitions:

version

mainnet -> 0x80 testnet -> 0xEF regtest -> 0xEF

address type offset

p2pkh = 0, p2wpkh = 1 p2sh-p2wpkh = 2 p2pk = 3 multisig = 4 p2sh = 5 p2wsh = 6 p2sh-p2wsh = 7

data

p2pkh -> 0x01 byte for compressed pubkey, omit for uncompressed p2wpkh -> omit (compressed pubkey implied) p2sh-p2wpkh -> omit (compressed pubkey implied) p2pk -> 0x01 byte for compressed pubkey, omit for uncompressed multisig -> redeem script p2sh -> redeem script p2wsh -> redeem script p2sh-p2wsh -> witness script

bits wif [-h] [--addr-type addr_type] [--data DATA] [--decode] [--print]
         [--network NETWORK] [-L LOG_LEVEL] [--in-file IN_FILE]
         [-1 [INPUT_FORMAT]] [--out-file OUT_FILE]

Named Arguments

--addr-type, -T

Possible choices: p2pkh, p2wpkh, p2pk, multisig, p2sh-p2wpkh, p2sh, p2wsh, p2sh-p2wsh

Address type

Default: 'p2pkh'

--data, -D

additional data (hex) to append to WIF key before base58check encoding

--decode

decode wif

Default: False

--print, -P

print newline at end

Default: False

--network, -N

Possible choices: mainnet, testnet, regtest

network, e.g. ‘mainnet’, ‘testnet’, or ‘regtest’

Default: 'mainnet'

-L, --log-level

Possible choices: info, debug, warning, error

log level, e.g. ‘info’, ‘debug’, ‘warning’, or ‘error’

Default: 'error'

--in-file, -in, -i

input private key data

Default: -

-1, --input-format

raw binary (-1), binary string (-1b), or hexadecimal string (-1x)

Default: hex

--out-file, -out, -o

output data file - raw binary

Default: -

addr

Encode Legacy or Segwit Bitcoin addresses from input payload. For p2pkh and p2sh, the input payload shall be the pubkeyhash (i.e. hash160(pubkey)) or scripthash (i.e. hash160(script)), respectively. Likewise, for witness v0 p2wpkh and p2wsh the input payload shall be pubkeyhash (i.e. hash160(pubkey)) or witness scripthash (i.e. hash256(script)), respectively.

bits addr [-h] [-T addr_type] [--witness-version witness_version] [--print]
          [--network NETWORK] [-L LOG_LEVEL] [--in-file IN_FILE]
          [-1 [INPUT_FORMAT]] [--out-file OUT_FILE]

Named Arguments

-T, --type

Possible choices: p2pkh, p2sh

Address type. Valid choices are p2pkh or p2sh. Ignored when –witness-version is present.

Default: 'p2pkh'

--witness-version, --wv

Possible choices: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16

Witness version for native Segwit addresses. Use of this option implies a Segwit address and addr_type (-T) is ignored.

--print, -P

print newline at end

Default: False

--network, -N

Possible choices: mainnet, testnet, regtest

network, e.g. ‘mainnet’, ‘testnet’, or ‘regtest’

Default: 'mainnet'

-L, --log-level

Possible choices: info, debug, warning, error

log level, e.g. ‘info’, ‘debug’, ‘warning’, or ‘error’

Default: 'error'

--in-file, -in, -i

input data file

Default: -

-1, --input-format

raw binary (-1), binary string (-1b), or hexadecimal string (-1x)

Default: hex

--out-file, -out, -o

output data file - raw binary

Default: -

mnemonic

Generate (or convert) mnemonic phrase.

This command with no further options will generate a new mnemonic seed phrase. When operating in this mode, the –strength (-S) argument can be used to specify the desired entropy strength, in bits. Alternatively, you may provide entropy bytes as input when using the –from-entropy flag. The –to-entropy flag can be used to translate the mnemonic back to its orginal entropy. The –to-seed and –to-master-key flags can be used to convert the mnemonic phrase to the seed or master key, per BIP39 / BIP32, respectively.

Examples:

  1. Generate a mnemonic

    $ bits mnemonic

  2. Generate a mnemonic (specify entropy strength in bits)

    $ bits mnemonic -S 256

  3. Generate a mnemonic from provided entropy

    $ head -c 32 /dev/urandom | bits mnemonic -1 –from-entropy

  4. Retrieve original entropy

    $ echo <mnemonic-phrase> | bits mnemonic –to-entropy

  5. Convert mnemonic to seed

    $ echo <mnemonic-phrase> | bits mnemonic –to-seed

  6. Convert mnemonic to master key

    $ echo <mnemonic-phrase> | bits mnemonic –to-master-key

bits mnemonic [-h] [--strength STRENGTH]
              [--from-entropy | --to-entropy | --to-seed | --to-master-key]
              [--print] [--network NETWORK] [-L LOG_LEVEL] [--in-file IN_FILE]
              [-1 [INPUT_FORMAT]] [--out-file OUT_FILE] [-0 [OUTPUT_FORMAT]]

Named Arguments

--strength, -S

Possible choices: 128, 160, 192, 224, 256

entropy strenghth (in bits) for mnemonic generation

Default: 256

--from-entropy
When this flag is present, converts entropy to mnemonic phrase.

Note: in_file is entropy bytes and stdin may be used.

Default: False

--to-entropy
When this flag is present, converts mnemonic phrase back to original entropy.

Note: in_file is mnemonic phrase and stdin may be used.

Default: False

--to-seed
When this flag is present, converts mnemonic to seed per BIP39.

Note: in_file is mnemonic phrase and stdin may be used.

Default: False

--to-master-key
When this flag is present, converts mnemonic (to seed, and then) to master key per BIP32.

Note: in_file is mnemonic phrase and stdin may be used.

Default: False

--print, -P

print newline at end

Default: False

--network, -N

Possible choices: mainnet, testnet, regtest

network, e.g. ‘mainnet’, ‘testnet’, or ‘regtest’

Default: 'mainnet'

-L, --log-level

Possible choices: info, debug, warning, error

log level, e.g. ‘info’, ‘debug’, ‘warning’, or ‘error’

Default: 'error'

--in-file, -in, -i

input data file

Default: -

-1, --input-format

raw binary (-1), binary string (-1b), or hexadecimal string (-1x)

Default: hex

--out-file, -out, -o

output data file

Default: -

-0, --output-format

raw binary (-0), binary string (-0b), or hexadecimal string (-0x)

Default: hex

hd

Derive extended keys at a particular path, e.g “m/0’/1” or “M/0/0”.

The leading m/ or M/ in path indicate private or public derivation, respectively. The extended key at which derivation starts need not be the root/master key.

Use –dump to deserialize & decode the derived key, and output json object to stderr.

bits hd [-h] [--xpub] [--dump] [--print] [-L LOG_LEVEL] [--in-file IN_FILE]
        path

Positional Arguments

path

path to extended key, e.g. m/0’/1 or M/0’/1

Named Arguments

--xpub, -xpub

Use this flag to output the extended public key

Default: False

--dump

Deserialize extended key and decode as json. Write to stderr.

Default: False

--print, -P

print newline at end

Default: False

-L, --log-level

Possible choices: info, debug, warning, error

log level, e.g. ‘info’, ‘debug’, ‘warning’, or ‘error’

Default: 'error'

--in-file, -in, -i

input data file - raw binary

Default: -

script

Encode (or decode) arbitrary Bitcoin Script.

For encoding, script_args shall either be OP_* or data. The script will be properly encoded with data push opcodes, as necessary, but since these are implied, they should not be specified in script_args.

For decoding, use the –decode flag. In this mode, script_args shall be any number of hex-encoded scripts, and will be decoded to to opcodes / data.

Use –witness to indicate witness script encoding / decoding and to follow witness script semantics (i.e. include stack size push and difference in handling data push bytes)

Standard transaction scripts:
P2PK:

scriptPubkey: <pubkey> OP_CHECKSIG scriptSig: <sig>

P2PKH:

scriptPubkey: OP_DUP OP_HASH160 <pubkeyhash> OP_EQUALVERIFY OP_CHECKSIG scriptSig: <sig> <pubkey>

P2SH:

scriptPubkey: OP_HASH160 <scripthash> OP_EQUAL scriptSig: <sig> … <redeemScript>

Multisig:

scriptPubkey: OP_M <pubkey> … OP_N OP_CHECKMULTISIG scriptSig: OP_0 <sig> …

Null:

scriptPubkey: OP_RETURN <data>

P2WPKH:

scriptPubkey: OP_0 <20-byte-pubkeyhash> scriptSig: (empty) witness: <sig> <pubkey>

P2WSH:

scriptPubkey: OP_0 <32-byte-scripthash> scriptSig: (empty) witness: <redeem-script>

P2SH-P2WPKH:

scriptPubkey: OP_HASH160 <20-byte-script-hash> OP_EQUAL scriptSig: Script(OP_0 <20-byte-pubkeyhash>) witness: <sig> <pubkey>

P2SH-P2WSH:

scriptPubkey: OP_HASH160 <20-byte-script-hash> OP_EQUAL scriptSig: Script(OP_0 <32-byte-script-hash>) witness: <redeem-script>

bits script [-h] [--decode] [--witness] [-L LOG_LEVEL] [script_args ...]

Positional Arguments

script_args

Script arguments, e.g. OP_* or <data>. Or, hex-encoded script(s) when using –decode

Named Arguments

--decode

Use this flag to decode hex-encoded script to opcodes / data.

Default: False

--witness

Use this flag to indicate this is a witness script and to follow witness script encoding / decoding semantics.

Default: False

-L, --log-level

Possible choices: info, debug, warning, error

log level, e.g. ‘info’, ‘debug’, ‘warning’, or ‘error’

Default: 'error'

sig

Create or verify Bitcoin signature

For signing, the input file shall be the private key. For verifying, the input file shall be the public key.

A signature (sig) is created by taking the provided msg argument (msg shall be provided as a hex string), appending a 4-byte SIGHASH flag, hashing, signing, and appending the single byte SIGHASH.

The –msg-preimage flag can be used, to signify that the msg is the preimage and already has the SIGHASH flag appended. The msg is still hashed, signed, and a single byte SIGHASH appended.

Examples:

$ bits sig -i <privatekey> <msg> –sighash all

$ bits sig –verify -i <publickey> <msg> –signature <sig>

bits sig [-h] [--sighash {all,none,single}] [--anyone-can-pay] [--verify]
         [--signature SIGNATURE] [--msg-preimage] [-L LOG_LEVEL]
         [--in-file IN_FILE] [-1 [INPUT_FORMAT]] [--out-file OUT_FILE]
         [-0 [OUTPUT_FORMAT]]
         msg

Positional Arguments

msg

message data to hash and sign (before sighash append)

Named Arguments

--sighash

Possible choices: all, none, single

Sighash type to append to msg before HASH256

Default: 'all'

--anyone-can-pay

If present, ORs –sighash flag with SIGHASH_ANYONECANPAY

Default: False

--verify

verfiy signature

Default: False

--signature

signature in hex format

--msg-preimage

indicates msg is pre-image, i.e. already has 4-byte sighash_flag appended. msg is still hashed, signed, then single-byte sighash_flag appended

Default: False

-L, --log-level

Possible choices: info, debug, warning, error

log level, e.g. ‘info’, ‘debug’, ‘warning’, or ‘error’

Default: 'error'

--in-file, -in, -i

input data file

Default: -

-1, --input-format

raw binary (-1), binary string (-1b), or hexadecimal string (-1x)

Default: hex

--out-file, -out, -o

output data file

Default: -

-0, --output-format

raw binary (-0), binary string (-0b), or hexadecimal string (-0x)

Default: hex

ripemd160

Calculate ripemd160 of input data

bits ripemd160 [-h] [-L LOG_LEVEL] [--in-file IN_FILE] [-1 [INPUT_FORMAT]]
               [--out-file OUT_FILE] [-0 [OUTPUT_FORMAT]]

Named Arguments

-L, --log-level

Possible choices: info, debug, warning, error

log level, e.g. ‘info’, ‘debug’, ‘warning’, or ‘error’

Default: 'error'

--in-file, -in, -i

input data file

Default: -

-1, --input-format

raw binary (-1), binary string (-1b), or hexadecimal string (-1x)

Default: hex

--out-file, -out, -o

output data file

Default: -

-0, --output-format

raw binary (-0), binary string (-0b), or hexadecimal string (-0x)

Default: hex

sha256

Calculate sha256 of input data

bits sha256 [-h] [-L LOG_LEVEL] [--in-file IN_FILE] [-1 [INPUT_FORMAT]]
            [--out-file OUT_FILE] [-0 [OUTPUT_FORMAT]]

Named Arguments

-L, --log-level

Possible choices: info, debug, warning, error

log level, e.g. ‘info’, ‘debug’, ‘warning’, or ‘error’

Default: 'error'

--in-file, -in, -i

input data file

Default: -

-1, --input-format

raw binary (-1), binary string (-1b), or hexadecimal string (-1x)

Default: hex

--out-file, -out, -o

output data file

Default: -

-0, --output-format

raw binary (-0), binary string (-0b), or hexadecimal string (-0x)

Default: hex

hash160

Calculate HASH160 of input data, i.e. ripemd160(sha256(data))

bits hash160 [-h] [-L LOG_LEVEL] [--in-file IN_FILE] [-1 [INPUT_FORMAT]]
             [--out-file OUT_FILE] [-0 [OUTPUT_FORMAT]]

Named Arguments

-L, --log-level

Possible choices: info, debug, warning, error

log level, e.g. ‘info’, ‘debug’, ‘warning’, or ‘error’

Default: 'error'

--in-file, -in, -i

input data file

Default: -

-1, --input-format

raw binary (-1), binary string (-1b), or hexadecimal string (-1x)

Default: hex

--out-file, -out, -o

output data file

Default: -

-0, --output-format

raw binary (-0), binary string (-0b), or hexadecimal string (-0x)

Default: hex

hash256

Calculate HASH256 of input data, i.e. sha256(sha256(data))

bits hash256 [-h] [-L LOG_LEVEL] [--in-file IN_FILE] [-1 [INPUT_FORMAT]]
             [--out-file OUT_FILE] [-0 [OUTPUT_FORMAT]]

Named Arguments

-L, --log-level

Possible choices: info, debug, warning, error

log level, e.g. ‘info’, ‘debug’, ‘warning’, or ‘error’

Default: 'error'

--in-file, -in, -i

input data file

Default: -

-1, --input-format

raw binary (-1), binary string (-1b), or hexadecimal string (-1x)

Default: hex

--out-file, -out, -o

output data file

Default: -

-0, --output-format

raw binary (-0), binary string (-0b), or hexadecimal string (-0x)

Default: hex

base58

Base58(/check) encode (or decode) input data.

bits base58 [-h] [--check] [--decode] [--print] [-L LOG_LEVEL]
            [--in-file IN_FILE] [-1 [INPUT_FORMAT]] [--out-file OUT_FILE]

Named Arguments

--check

base58check

Default: False

--decode

decode base58(check) input

Default: False

--print, -P

print newline at end

Default: False

-L, --log-level

Possible choices: info, debug, warning, error

log level, e.g. ‘info’, ‘debug’, ‘warning’, or ‘error’

Default: 'error'

--in-file, -in, -i

input data file

Default: -

-1, --input-format

raw binary (-1), binary string (-1b), or hexadecimal string (-1x)

Default: hex

--out-file, -out, -o

output data file - raw binary

Default: -

bech32

Encode (or decode) bech32 or segwit data

bits bech32 [-h] [--hrp HRP] [--witness-version WITNESS_VERSION] [--decode]
            [--print] [-L LOG_LEVEL] [--in-file IN_FILE] [-1 [INPUT_FORMAT]]
            [--out-file OUT_FILE] [-0 [OUTPUT_FORMAT]]

Named Arguments

--hrp

human readable part for bech32 encoding

--witness-version, --wv

witness version, if encoding a segwit address

--decode

Decode input data

Default: False

--print, -P

print newline at end

Default: False

-L, --log-level

Possible choices: info, debug, warning, error

log level, e.g. ‘info’, ‘debug’, ‘warning’, or ‘error’

Default: 'error'

--in-file, -in, -i

input data file

Default: -

-1, --input-format

raw binary (-1), binary string (-1b), or hexadecimal string (-1x)

Default: hex

--out-file, -out, -o

output data file

Default: -

-0, --output-format

raw binary (-0), binary string (-0b), or hexadecimal string (-0x)

Default: hex

tx

Create (or decode) raw transactions.

Examples:

  1. Create raw transaction

    $ bits tx -txin ‘{“txid”: “<txid>”, “vout”: <vout>, “scriptsig”: “<scriptsig>”}’ -txout ‘{“satoshis”: <satoshis>, “scriptpubkey”: “<scriptpubkey>”}’

  2. Decode raw transaction

    $ echo <rawtx> | bits tx –decode

bits tx [-h] [-txin TXINS] [-txout TXOUTS] [-v VERSION] [-l LOCKTIME]
        [--script-witness SCRIPT_WITNESSES] [--decode] [-L LOG_LEVEL]
        [--in-file IN_FILE] [-1 [INPUT_FORMAT]] [--out-file OUT_FILE]
        [-0 [OUTPUT_FORMAT]]

Named Arguments

-txin, --txin

Transaction input data provided as a dictionary with the following keys: txid, vout, scriptsig.

Default: []

-txout, --txout

Transaction output data provided as a dictionary with the following keys: satoshis, scriptpubkey

Default: []

-v, --version

transaction version

Default: 1

-l, --locktime

transaction locktime

Default: 0

--script-witness

witness script. This argument can be specified multiple times, but must appear in order corresponding to txins

Default: []

--decode

decode raw tx to JSON from input file

Default: False

-L, --log-level

Possible choices: info, debug, warning, error

log level, e.g. ‘info’, ‘debug’, ‘warning’, or ‘error’

Default: 'error'

--in-file, -in, -i

input data file

Default: -

-1, --input-format

raw binary (-1), binary string (-1b), or hexadecimal string (-1x)

Default: hex

--out-file, -out, -o

output data file

Default: -

-0, --output-format

raw binary (-0), binary string (-0b), or hexadecimal string (-0x)

Default: hex

send

Utility for creating a send transaction, sending funds from sender address to recipient address, with optional change address.

Depends on a configured Bitcoin Core RPC node.

This command will, by default, send all funds associated with the sender address to the recipient address. If a –send-fraction is provided, only the fractional amount will be sent (minus –miner-fee). If a fractional amount is sent, and –change-address is not provided, the leftover amount, i.e. total amount - fractional amount, will be returned to the sender address. If –change-address is provided, the leftover amount will be sent here instead.

This utility provides convenience by forming (and optionally signing) the transaction from the arguments provided. It works by inferring the transaction semantics from the address type of sender_addr and recipient_addr, respectively, which may be either a pubkey, legacy address, segwit address, or raw scriptpubkey. The presence of the –sighash option implies that the transaction shall be signed and note that signature operations will occur. To unlock the funds sent from the sender address, the necessary WIF key(s) must be provided via IN_FILE. If multiple keys are needed to unlock funds, they can be specified, ordered, and separated by whitespace, in IN_FILE.

See “bits wif -h” for help on creating WIF-encoded keys.

bits send [-h] [--change-addr CHANGE_ADDR] [--send-fraction SEND_FRACTION]
          [--miner-fee MINER_FEE] [--version VERSION] [--locktime LOCKTIME]
          [--sighash {all,none,single}] [--anyone-can-pay] [-L LOG_LEVEL]
          [--in-file IN_FILE] [--out-file OUT_FILE] [-0 [OUTPUT_FORMAT]]
          sender_addr recipient_addr

Positional Arguments

sender_addr

Sender address

recipient_addr

Recipient address

Named Arguments

--change-addr

Change address

--send-fraction

fraction of sender address’s UTXO value to send

Default: 1.0

--miner-fee

satoshis to include as miner fee

Default: 1000

--version, -v

transaction version

Default: 1

--locktime

transaction locktime

Default: 0

--sighash

Possible choices: all, none, single

SIGHASH flag to use for signing (if key(s) are provided)

--anyone-can-pay

If present, ORs SIGHASH_FLAG with SIGHASH_ANYONECANPAY

Default: False

-L, --log-level

Possible choices: info, debug, warning, error

log level, e.g. ‘info’, ‘debug’, ‘warning’, or ‘error’

Default: 'error'

--in-file, -in, -i

WIF unlocking key(s) for sender address

Default: -

--out-file, -out, -o

output data file

Default: -

-0, --output-format

raw binary (-0), binary string (-0b), or hexadecimal string (-0x)

Default: hex

p2p

start p2p node

bits p2p [-h] [--seeds SEEDS] [--network NETWORK] [-L LOG_LEVEL]

Named Arguments

--seeds

comma separated list of seed nodes

--network, -N

Possible choices: mainnet, testnet, regtest

network, e.g. ‘mainnet’, ‘testnet’, or ‘regtest’

Default: 'mainnet'

-L, --log-level

Possible choices: info, debug, warning, error

log level, e.g. ‘info’, ‘debug’, ‘warning’, or ‘error’

Default: 'error'

blockchain

Blockchain lulz

bits blockchain [-h] [--header-only] [--decode] [--network NETWORK]
                [-L LOG_LEVEL] [--in-file IN_FILE] [-1 [INPUT_FORMAT]]
                [--out-file OUT_FILE] [-0 [OUTPUT_FORMAT]]
                [blockheight]

Positional Arguments

blockheight

block height

Named Arguments

--header-only, -H

output block header only

Default: False

--decode

decode block provided via in_file

Default: False

--network, -N

Possible choices: mainnet, testnet, regtest

network, e.g. ‘mainnet’, ‘testnet’, or ‘regtest’

Default: 'mainnet'

-L, --log-level

Possible choices: info, debug, warning, error

log level, e.g. ‘info’, ‘debug’, ‘warning’, or ‘error’

Default: 'error'

--in-file, -in, -i

input data file

Default: -

-1, --input-format

raw binary (-1), binary string (-1b), or hexadecimal string (-1x)

Default: hex

--out-file, -out, -o

output data file

Default: -

-0, --output-format

raw binary (-0), binary string (-0b), or hexadecimal string (-0x)

Default: hex

mine

Mine blocks.

bits mine [-h] --recv-addr RECV_ADDR [--limit LIMIT] [-L LOG_LEVEL]

Named Arguments

--recv-addr

Address to send block reward to.

--limit

Set a limit of the number of blocks to mine before exit. Useful in regtest mode for generating a set number of blocks

-L, --log-level

Possible choices: info, debug, warning, error

log level, e.g. ‘info’, ‘debug’, ‘warning’, or ‘error’

Default: 'error'

rpc

Send command to RPC node

bits rpc [-h] [-rpc-url RPC_URL] [-rpc-user RPC_USER]
         [-rpc-password RPC_PASSWORD] [-rpc-datadir RPC_DATADIR]
         [--network NETWORK] [-L LOG_LEVEL]
         rpc_command [params ...]

Positional Arguments

rpc_command

rpc command

params

params for rpc_command

Named Arguments

-rpc-url, --rpc-url

rpc url

-rpc-user, --rpc-user

rpc user

-rpc-password, --rpc-password

rpc password

-rpc-datadir, --rpc-datadir

For cookie based rpc auth, supply rpc datadir.

--network, -N

Possible choices: mainnet, testnet, regtest

network, e.g. ‘mainnet’, ‘testnet’, or ‘regtest’

Default: 'mainnet'

-L, --log-level

Possible choices: info, debug, warning, error

log level, e.g. ‘info’, ‘debug’, ‘warning’, or ‘error’

Default: 'error'