TarifsGitHubTableau de bord

Bitcoin

signrawtransactionwithkey40 crédits

Signs inputs for a raw transaction using provided private keys

Réseau: bitcoin

Paramètres

NomTypeDescription
hexstringstringHex-encoded raw transaction.
privkeysstring[]Base58 (WIF) private keys to sign with.
prevtxsObject[]Previous outputs being spent, each { txid, vout, scriptPubKey, redeemScript?, witnessScript?, amount? }. redeemScript is needed for P2SH, witnessScript for P2WSH, amount for segwit inputs. (facultatif)
sighashtypestringSignature hash type: ALL (default), NONE, SINGLE, ALL|ANYONECANPAY, NONE|ANYONECANPAY or SINGLE|ANYONECANPAY. (facultatif)

Valeur renvoyée

Type

Object

hex (transaction with signatures), complete (all inputs signed) and optional errors (txid, vout, scriptSig, sequence, error per failed input).

Exemples de code

curl https://holy-burned-sky-bitcoin-mainnet.rpcnode.dev/7c9e6679-7425-40de-944b-e07fc1f90ae7 \
  -X POST \
  -H 'content-type: application/json' \
  -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "signrawtransactionwithkey",
  "params": [
    "0200000001…",
    [
      "cVt…"
    ],
    [
      {
        "txid": "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b",
        "vout": 0,
        "scriptPubKey": "0014…",
        "amount": 0.01
      }
    ],
    "ALL"
  ]
}'