signrawtransactionwithkey
Changed params/results since v30.2
Summary
Sign inputs for raw transaction (serialized, hex-encoded).
Description
Sign inputs for raw transaction (serialized, hex-encoded). The second argument is an array of private keys that will be the only keys used to sign the transaction. Accepted formats are legacy base58 WIF keys and explicit pqc(KEY) expressions. For pqc(KEY), KEY must be either a hex-encoded raw PQC secret key (64 bytes) or a concrete non-ranged extended private key expression accepted by mr(pk(...)) descriptors. The third optional argument (may be null) is an array of previous transaction outputs that this transaction depends on but may not yet be in the block chain.
Change Buckets
- Changed params/results since v30.2
Arguments
hexstring(STR, required): The transaction hex stringprivkeys(ARR, required): Private keys for signingprivatekey(STR): Either a legacy WIF private key, or pqc(KEY) where KEY is raw PQC secret key hex (64 bytes) or a concrete extended private key expressionprevtxs(ARR): The previous dependent transaction outputsvalue(OBJ): No description.txid(STR_HEX, required): The transaction idvout(NUM, required): The output numberscriptPubKey(STR_HEX, required): output scriptredeemScript(STR_HEX): (required for P2SH) redeem scriptwitnessScript(STR_HEX): (required for P2WSH or P2SH-P2WSH) witness scriptp2mrScript(STR_HEX): (required with p2mrControlBlock for P2MR script-path spends) P2MR leaf scriptp2mrControlBlock(STR_HEX): (required with p2mrScript for P2MR script-path spends) P2MR control block matching scriptPubKeyp2mrLeafVersion(NUM): (optional for P2MR script-path spends, defaults to the control block leaf version) leaf version for p2mrScriptamount(AMOUNT): (required for Segwit inputs) the amount spent
sighashtype(STR): The signature hash type. Must be one of: "DEFAULT" "ALL" "NONE" "SINGLE" "ALL|ANYONECANPAY" "NONE|ANYONECANPAY" "SINGLE|ANYONECANPAY"
Results
value(OBJ): No description.hex(STR_HEX): The hex-encoded raw transaction with signature(s)complete(BOOL): If the transaction has a complete set of signatureserrors(ARR, optional): Script verification errors (if there are any)value(OBJ): No description.txid(STR_HEX): The hash of the referenced, previous transactionvout(NUM): The index of the output to spent and used as inputwitness(ARR): No description.witness(STR_HEX): No description.
scriptSig(STR_HEX): The hex-encoded signature scriptsequence(NUM): Script sequence numbererror(STR): Verification or signing error related to the input
Examples
qbit-cli signrawtransactionwithkey "myhex" "[\"key1\",\"key2\"]"
curl --user myusername --data-binary '{"jsonrpc": "2.0", "id": "curltest", "method": "signrawtransactionwithkey", "params": ["myhex", "[\"key1\",\"key2\"]"]}' -H 'content-type: application/json' http://127.0.0.1:8352/
qbit-cli signrawtransactionwithkey "myhex" "[\"pqc(tprv.../87h/1h/0h/0/0)\"]" "[{\"txid\":\"id\",\"vout\":0,\"scriptPubKey\":\"5220...\",\"amount\":1.0,\"p2mrScript\":\"20...b3\",\"p2mrControlBlock\":\"c1\"}]"