Skip to main content

Transaction RPCs

RPC commands for creating, decoding, signing, and broadcasting raw transactions and PSBTs on the BTX network.

Raw Transactions

createrawtransaction

Create a raw transaction spending the given inputs and creating new outputs. The transaction is not signed or broadcast.

ParameterTypeRequiredDescription
inputsarrayYesArray of input objects, each with txid (hex), vout (number), and optional sequence
outputsarrayYesArray of output objects: address-amount pairs or data (hex for OP_RETURN)
locktimenumberNo (default 0)Raw locktime. Non-0 value also locktime-activates inputs.
replaceablebooleanNo (default true)Mark as BIP125-replaceable
btx-cli createrawtransaction '[{"txid":"myid","vout":0}]' '[{"btx1z...":0.01}]'

Returns the hex-encoded unsigned transaction.

decoderawtransaction

Decode a hex-encoded raw transaction into a JSON object.

ParameterTypeRequiredDescription
hexstringstring (hex)YesThe serialized transaction hex
iswitnessbooleanNoWhether to force witness deserialization
btx-cli decoderawtransaction "hexstring"

Response includes txid, hash, size, vsize, weight, version, locktime, vin (inputs with txid, vout, scriptSig, txinwitness, sequence), vout (outputs with value, n, scriptPubKey), and optionally a shielded bundle summary for shielded or bridge transactions.

decodescript

Decode a hex-encoded script.

ParameterTypeRequiredDescription
hexstringstring (hex)YesThe hex-encoded script
btx-cli decodescript "hexstring"

Returns asm, type, address, reqSigs, p2sh, and segwit information.

getrawtransaction

Return the raw transaction data. By default only returns mempool transactions. Enable -txindex for full blockchain lookups.

ParameterTypeRequiredDescription
txidstring (hex)YesThe transaction id
verbositynumberNo (default 0)0 = hex data, 1 = JSON object, 2 = JSON with fee and prevout info
blockhashstring (hex)NoBlock hash to look in (avoids needing txindex)
btx-cli getrawtransaction "txid" 1
btx-cli getrawtransaction "txid" 2 "blockhash"

Verbosity 1+ adds blockhash, confirmations, blocktime, decoded transaction fields, and for shielded transactions a shielded bundle summary. Verbosity 2 adds fee and prevout details on each input.

sendrawtransaction

Submit a signed raw transaction to the local node and network.

ParameterTypeRequiredDescription
hexstringstring (hex)YesHex-encoded signed transaction
maxfeerateamountNoReject if fee rate exceeds this (BTX/kvB). Set to 0 to accept any fee.
maxburnamountamountNoReject if provably unspendable outputs exceed this amount
btx-cli sendrawtransaction "signedhex"

Returns the transaction hash (hex).

signrawtransactionwithkey

Sign inputs for a raw transaction using provided private keys.

ParameterTypeRequiredDescription
hexstringstring (hex)YesThe unsigned transaction hex
privkeysarrayYesArray of WIF-encoded private keys
prevtxsarrayNoPrevious transaction outputs being spent
sighashtypestringNo (default "ALL")Signature hash type
btx-cli signrawtransactionwithkey "hexstring" '["privkey1"]'

Returns hex (signed transaction), complete (boolean), and errors (array of signing errors, if any).

testmempoolaccept

Test whether raw transactions would be accepted by the mempool without actually submitting them.

ParameterTypeRequiredDescription
rawtxsarrayYesArray of hex-encoded raw transactions
maxfeerateamountNoReject if fee rate exceeds this (BTX/kvB)
btx-cli testmempoolaccept '["signedhex"]'

Returns array of results, each with txid, allowed (boolean), vsize, and reject-reason (if rejected).

Mempool

getmempoolinfo

Returns details on the active state of the transaction memory pool.

btx-cli getmempoolinfo

Response includes loaded, size (transaction count), bytes (total size), usage (memory usage), total_fee, maxmempool (max memory usage), mempoolminfee, minrelaytxfee, incrementalrelayfee, and unbroadcastcount.

getmempoolentry

Returns mempool data for a given transaction.

ParameterTypeRequiredDescription
txidstring (hex)YesThe transaction id
btx-cli getmempoolentry "txid"

Returns vsize, weight, time, height, descendantcount, descendantsize, ancestorcount, ancestorsize, fees (base, modified, ancestor, descendant), and depends (unconfirmed parent txids).

getrawmempool

Returns all transaction ids in the memory pool.

ParameterTypeRequiredDescription
verbosebooleanNo (default false)true for detailed info per transaction
mempool_sequencebooleanNo (default false)true to include mempool sequence values
btx-cli getrawmempool true

Returns an array of txids, or an object keyed by txid with detailed mempool entry data when verbose is true.

Partially Signed Bitcoin Transactions (PSBT)

PSBTs (BIP 174) enable multi-party transaction construction and signing workflows. BTX extends PSBT support with PQ (post-quantum) signature types for ML-DSA-44 and SLH-DSA-128s keys.

createpsbt

Create an unsigned PSBT with the given inputs and outputs. Identical interface to createrawtransaction but outputs a PSBT.

ParameterTypeRequiredDescription
inputsarrayYesArray of input objects (txid, vout, optional sequence)
outputsarrayYesArray of output objects (address:amount pairs or data)
locktimenumberNo (default 0)Raw locktime
replaceablebooleanNo (default true)Mark as BIP125-replaceable
btx-cli createpsbt '[{"txid":"myid","vout":0}]' '[{"btx1z...":0.01}]'

Returns the base64-encoded unsigned PSBT.

decodepsbt

Decode a base64-encoded PSBT into a detailed JSON representation.

ParameterTypeRequiredDescription
psbtstringYesThe base64-encoded PSBT
btx-cli decodepsbt "base64psbt"

Returns tx (decoded transaction), global_xpubs, psbt_version, proprietary, unknown, inputs (with UTXO data, partial signatures, sighash, BIP32 derivation paths, final scripts), outputs (with redeem/witness scripts, BIP32 derivation), and fee.

finalizepsbt

Finalize a PSBT: attempt to build the final scriptSig and scriptWitness for all inputs.

ParameterTypeRequiredDescription
psbtstringYesBase64-encoded PSBT
extractbooleanNo (default true)If true and complete, extract the raw transaction hex
btx-cli finalizepsbt "base64psbt"

Returns psbt (updated base64 PSBT if incomplete), hex (final raw transaction if complete and extract=true), and complete (boolean).

combinepsbt

Combine multiple PSBTs into one (merge partial signatures from different signers).

ParameterTypeRequiredDescription
txsarrayYesArray of base64-encoded PSBTs
btx-cli combinepsbt '["psbt1", "psbt2"]'

Returns a single combined base64-encoded PSBT.

utxoupdatepsbt

Update a PSBT with information from the UTXO set, mempool, txindex, and provided descriptors.

ParameterTypeRequiredDescription
psbtstringYesBase64-encoded PSBT
descriptorsarrayNoOutput descriptors to add derivation info
btx-cli utxoupdatepsbt "base64psbt"

Returns the updated base64-encoded PSBT.

joinpsbts

Join multiple distinct PSBTs into a single PSBT (combines inputs and outputs, not signatures).

ParameterTypeRequiredDescription
txsarrayYesArray of base64-encoded PSBTs to join
btx-cli joinpsbts '["psbt1", "psbt2"]'

Returns a single joined base64-encoded PSBT.

PSBT Workflow Example

A typical multi-party signing workflow:

  1. Create: One party creates the unsigned PSBT with createpsbt
  2. Update: Add UTXO data with utxoupdatepsbt
  3. Sign: Each signer signs with walletprocesspsbt (wallet RPC) or an external PQ signer
  4. Combine: Merge partial signatures with combinepsbt
  5. Finalize: Finalize and extract the raw transaction with finalizepsbt
  6. Broadcast: Submit with sendrawtransaction

PQ multisig: BTX PSBTs support ML-DSA-44 and SLH-DSA-128s partial signatures via OP_CHECKSIG_MLDSA, OP_CHECKSIGADD_MLDSA, OP_CHECKSIG_SLHDSA, and OP_CHECKSIGADD_SLHDSA opcodes. The threshold is enforced with OP_NUMEQUAL.