文档
定价GitHub控制台

Zcash

signrawtransactionwithkey8 额度

使用提供的私钥为原始交易的输入签名

网络: zcash

参数

名称类型描述
hexstringstring十六进制编码的原始交易。
privkeysstring[]用于签名的 Base58(WIF)私钥。
prevtxsObject[]被花费的先前输出,每个为 { txid, vout, scriptPubKey, redeemScript?, witnessScript?, amount? }。P2SH 需要 redeemScript,P2WSH 需要 witnessScript,segwit 输入需要 amount。 (可选)
sighashtypestring签名哈希类型:ALL(默认)、NONE、SINGLE、ALL|ANYONECANPAY、NONE|ANYONECANPAY 或 SINGLE|ANYONECANPAY。 (可选)

返回值

类型

Object

hex(带签名的交易)、complete(所有输入均已签名),以及可选的 errors(每个失败输入的 txid、vout、scriptSig、sequence、error)。

代码示例

curl https://holy-burned-sky-zcash-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"
  ]
}'