⚡ We welcome businesses to test our enterprise-grade service

bch
Bitcoin Cash (BCH)

Method: POST fundrawtransaction

dropdown

方法 RPC fundrawtransaction 例如 Bitcoin Cash (BCH)

POST fundrawtransaction

如果交易没有输入,它们将被自动选择以满足其输出值。

它将最多向输出添加一个更改输出。

除非指定了“subtractFeeFromOutputs”,否则不会修改现有的输出。

请注意,已签名的输入可能需要在完成后重新签名,因为输入/输出已添加。

添加的输入不会被签名,为此使用 signrawtransactionwithkey 或 signrawtransactionwithwallet。

请注意,所有现有输入必须将其先前的输出交易放在钱包中。

请注意,选择的所有输入都必须是标准格式,并且 P2SH 脚本必须使用 importaddress 或 addmultisigaddress(以计算费用)在钱包中。

您可以通过检查 listunspent 输出中的“可解决”字段来查看是否是这种情况。

目前仅支持付费公钥、多重签名和 P2SH 版本的 watch-only。

Parameters

hexstring - 字符串,必填

原始交易的十六进制字符串

options - json 对象,可选

为了向后兼容:传入 true 而不是对象将导致 {"includeWatching":true}

iswitness - 布尔值,可选,默认值=取决于启发式测试

交易十六进制是否为序列化见证交易。

如果不存在 iswitness,则将在解码中使用启发式测试。

如果为 true,则只会尝试见证反序列化。

如果为 false,则只会尝试非见证反序列化。

如果调用者知道,这个布尔值应该反映交易是否有输入(例如完全有效或链上交易)。

Request

curl --location --request POST 'https://bch.getblock.io/mainnet/' 
--header 'x-api-key: YOUR-API-KEY' 
--header 'Content-Type: application/json' 
--data-raw '{"jsonrpc": "2.0",
"method": "fundrawtransaction",
"params": ["hexstring", "", null],
"id": "getblock.io"}'


Response

{
    "error": null,
    "id": "getblock.io",
    "result": "01000000000101e17e03d21d051aa2bd9d336c3ac0693cfa92ce71592ceec521b1c48019ff77a101000000171600146d76e574b5f4825fe740ba6c41aaf1b319dfb80cffffffff02819a010000000000160014422002d927a1cae901eac668444cce8dd0ae60d529b31b0b0000000017a914f5b48d1130dc3d366d1eabf6783a552d1c8e08f4870247304402206701306a4750908fd48dead54331a3c7b4dce04ec10bfc6dd32049e2cff061a5022013c9d66827fabbeaadeb30b41c09aca2daddf4628cd00e3b993b1c86a12ff5190121034bcb9be1daf6ce1193774d15f863768b621bc95a363f1da5810129e961a2317400000000"
}