Language

Choose a language

/build/rpc / postquantum

signmldsatransaction

  • workflowpost-quantum-signing·step 3 of 4Workflow: post-quantum-signing · step 3 of 4

signmldsatransaction "hexstring" input_index "seckey" "pubkey" level "tapscript" ( prevout_value "prevout_scriptpubkey" ) "internal_pubkey" "merkle_root" parity ( "sighash_type" [value,...] ["scriptpubkey",...] ) Sign a transaction input with ML-DSA secret key. For multi-input transactions, use prevout_values and prevout_scriptpubkeys arrays to provide info for ALL inputs. Arguments: 1. hexstring (string, required) The raw transaction hex string 2. input_index (numeric, required) The input index to sign 3. seckey (string, required) ML-DSA secret key (hex) 4. pubkey (string, required) ML-DSA public key (hex, raw FIPS 204) 5. level (numeric, required) ML-DSA parameter set (44/65/87) 6. tapscript (string, required) The tapscript being spent 7. prevout_value (numeric or string, optional) The value of the output being spent (in BTC). For single-input transactions only. 8. prevout_scriptpubkey (string, optional) The scriptPubKey of the output being spent. For single-input transactions only. 9. internal_pubkey (string, required) The internal pubkey (from generatemldsaaddress) 10. merkle_root (string, required) The merkle root (from generatemldsaaddress) 11. parity (boolean, required) The parity bit (from generatemldsaaddress) 12. sighash_type (string, optional, default="ALL") The sighash type (ALL, NONE, SINGLE, ALL|ANYONECANPAY, etc.) 13. prevout_values (json array, optional) Array of prevout values for ALL inputs (in BTC). Required for multi-input transactions. [ value, (numeric or string, required) Prevout value in BTC ... ] 14. prevout_scriptpubkeys (json array, optional) Array of prevout scriptPubKeys for ALL inputs (hex). Required for multi-input transactions. [ "scriptpubkey", (string, required) Prevout scriptPubKey (hex) ... ] Result: { (json object) "hex" : "hex", (string) The signed transaction hex "complete" : true|false (boolean) Whether the transaction is fully signed } Examples: > bitcoin-cli signmldsatransaction "<hex>" 0 "<seckey>" "<pubkey>" 65 "<tapscript>" 0.01 "<scriptpubkey>" "<internal_pubkey>" "<merkle_root>" true > curl --user myusername --data-binary '{"jsonrpc": "2.0", "id": "curltest", "method": "signmldsatransaction", "params": ["<hex>", 0, "<seckey>", "<pubkey>", 65, "<tapscript>", 0.01, "<scriptpubkey>", "<internal_pubkey>", "<merkle_root>", true]}' -H 'content-type: application/json' http://127.0.0.1:8332/

Signature

signmldsatransaction(hexstring: string, input_index: number, seckey: string, pubkey: string, level: number, tapscript: string, prevout_value?: any, prevout_scriptpubkey?: string, internal_pubkey: string, merkle_root: string, parity: boolean, sighash_type?: string, prevout_values?: array, prevout_scriptpubkeys?: array) → any

Code samples

curl --user "$RPC_USER:$RPC_PASS" \
  --data-binary '{"jsonrpc":"1.0","id":"docs","method":"signmldsatransaction","params":["\"<hexstring>\"",0,"\"<seckey>\"","\"<pubkey>\"",0,"\"<tapscript>\"","\"<prevout_value>\"","\"<prevout_scriptpubkey>\"","\"<internal_pubkey>\"","\"<merkle_root>\"",false,"ALL",[],[]]}' \
  -H 'content-type: text/plain;' \
  http://127.0.0.1:8332/

Parameters

NameTypeReq.Description
hexstringstringyesThe raw transaction hex string
input_indexnumberyesThe input index to sign
seckeystringyesML-DSA secret key (hex)
pubkeystringyesML-DSA public key (hex, raw FIPS 204)
levelnumberyesML-DSA parameter set (44/65/87)
tapscriptstringyesThe tapscript being spent
prevout_valuenumber | stringThe value of the output being spent (in BTC). For single-input transactions only.
prevout_scriptpubkeystringThe scriptPubKey of the output being spent. For single-input transactions only.
internal_pubkeystringyesThe internal pubkey (from generatemldsaaddress)
merkle_rootstringyesThe merkle root (from generatemldsaaddress)
paritybooleanyesThe parity bit (from generatemldsaaddress)
sighash_typestringThe sighash type (ALL, NONE, SINGLE, ALL|ANYONECANPAY, etc.)
prevout_valuesany[]Array of prevout values for ALL inputs (in BTC). Required for multi-input transactions. [ value, (numeric or string, required) Prevout value in BTC ... ]
prevout_scriptpubkeysany[]Array of prevout scriptPubKeys for ALL inputs (hex). Required for multi-input transactions. [ "scriptpubkey", (string, required) Prevout scriptPubKey (hex) ... ]

Result

Type:  any

{ (json object) "hex" : "hex", (string) The signed transaction hex "complete" : true|false (boolean) Whether the transaction is fully signed }

Source: services/core-node/bcore/src/wallet/rpc/pq.cpp:287

C++ symbol: signmldsatransaction