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.
| Parameter | Type | Required | Description |
|---|---|---|---|
inputs | array | Yes | Array of input objects, each with txid (hex), vout (number), and optional sequence |
outputs | array | Yes | Array of output objects: address-amount pairs or data (hex for OP_RETURN) |
locktime | number | No (default 0) | Raw locktime. Non-0 value also locktime-activates inputs. |
replaceable | boolean | No (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.
| Parameter | Type | Required | Description |
|---|---|---|---|
hexstring | string (hex) | Yes | The serialized transaction hex |
iswitness | boolean | No | Whether 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
hexstring | string (hex) | Yes | The 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
txid | string (hex) | Yes | The transaction id |
verbosity | number | No (default 0) | 0 = hex data, 1 = JSON object, 2 = JSON with fee and prevout info |
blockhash | string (hex) | No | Block 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
hexstring | string (hex) | Yes | Hex-encoded signed transaction |
maxfeerate | amount | No | Reject if fee rate exceeds this (BTX/kvB). Set to 0 to accept any fee. |
maxburnamount | amount | No | Reject 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
hexstring | string (hex) | Yes | The unsigned transaction hex |
privkeys | array | Yes | Array of WIF-encoded private keys |
prevtxs | array | No | Previous transaction outputs being spent |
sighashtype | string | No (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.
| Parameter | Type | Required | Description |
|---|---|---|---|
rawtxs | array | Yes | Array of hex-encoded raw transactions |
maxfeerate | amount | No | Reject 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
txid | string (hex) | Yes | The 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
verbose | boolean | No (default false) | true for detailed info per transaction |
mempool_sequence | boolean | No (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.
| Parameter | Type | Required | Description |
|---|---|---|---|
inputs | array | Yes | Array of input objects (txid, vout, optional sequence) |
outputs | array | Yes | Array of output objects (address:amount pairs or data) |
locktime | number | No (default 0) | Raw locktime |
replaceable | boolean | No (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.
| Parameter | Type | Required | Description |
|---|---|---|---|
psbt | string | Yes | The 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
psbt | string | Yes | Base64-encoded PSBT |
extract | boolean | No (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).
| Parameter | Type | Required | Description |
|---|---|---|---|
txs | array | Yes | Array 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
psbt | string | Yes | Base64-encoded PSBT |
descriptors | array | No | Output 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).
| Parameter | Type | Required | Description |
|---|---|---|---|
txs | array | Yes | Array 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:
- Create: One party creates the unsigned PSBT with
createpsbt - Update: Add UTXO data with
utxoupdatepsbt - Sign: Each signer signs with
walletprocesspsbt(wallet RPC) or an external PQ signer - Combine: Merge partial signatures with
combinepsbt - Finalize: Finalize and extract the raw transaction with
finalizepsbt - 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, andOP_CHECKSIGADD_SLHDSAopcodes. The threshold is enforced withOP_NUMEQUAL.