比特币RPC API命令中文手册

区块链API
GetBestBlockHash/获取链头区块哈希 GetBlock/获取指定哈希的区块 GetBlockChainInfo/获取区块链当前状态 GetBlockCount/获取区块数量 GetBlockHash/获取指定高度区块的哈希 GetBlockHeader/获取指定哈希区块头 GetChainTips/获取全部链头区块 GetDifficulty/获取出块难度 GetMemPoolAncestors GetMemPoolDescendants GetMemPoolEntry GetMemPoolInfo/获取交易池信息 GetRawMemPool/获取交易池详情 GetTxOut/获取交易输出信息 GetTxOutProof/获取交易在区块中的证据 GetTxOutSetInfo/获取交易输出集信息 PreciousBlock PruneBlockChain VerifyChain/校验本地区块 VerifyTxOutProof
节点控制API
GetRpcInfo/获取rpc服务器信息 Help Stop/关闭节点软件
区块构造与挖矿API
Generate/挖矿出块 GenerateToAddress/挖矿出块并奖励指定地址 GetBlockTemplate GetMiningInfo/获取挖矿信息 GetNetworkHashPS/获取全网哈希生成速率 PrioritiseTransaction SubmitBlock/提交区块
P2P网络通信API
AddNode ClearBanned DisconnectNode GetAddedNodeInfo GetConnectionCount GetNetTotals GetNetworkInfo GetPeerInfo ListBanned Ping SetBan SetNetworkActive
裸交易相关API
CreateRawTransaction/创建裸交易 FundRawTransaction/充值裸交易 DecodeRawTransaction/解码裸交易 DecodeScript/解码脚本 GetRawTransaction/获取指定裸交易 SendRawTransaction/广播裸交易 SignRawTransaction/签名裸交易
工具类
CreateMultiSig/创建多签地址与脚本 EstimateFee EstimatePriority GetMemoryInfo/获取内存利用信息 ValidateAddress/验证地址有效性 VerifyMessage/验证消息签名
钱包相关
AbandonTransaction/废弃交易 AddWitnessAddress/添加隔离见证地址 AddMultiSigAddress/添加多签地址 BackupWallet/备份钱包文件 BumpFee/提高交易手续费 DumpPrivKey/导出指定私钥 DumpWallet/导出钱包文件 EncryptWallet/加密钱包 GetAccountAddress/获取指定账户当前地址 GetAccount/获取指定地址所述账户 GetAddressesByAccount GetBalance/查询钱包余额 GetNewAddress/生成新地址 GetRawChangeAddress/生成新找零地址 GetReceivedByAccount GetReceivedByAddress/查询指定地址收币数量 GetTransaction/查询指定交易 GetUnconfirmedBalance/查询钱包未确认余额 GetWalletInfo/获取钱包信息 ImportAddress/导入地址 ImportMulti ImportPrunedFunds ImportPrivKey/导入私钥 ImportWallet/导入钱包转储文件 KeyPoolRefill/预填充密钥池 ListAccounts ListAddressGroupings/按地址分组查询余额 ListLockUnspent/获取锁定状态UTXO ListReceivedByAccount ListReceivedByAddress/按地址统计收币数量 ListSinceBlock/查询指定区块后发生的钱包交易 ListTransactions/查询最近发生的钱包交易 ListUnspent/查询钱包UTXO LockUnspent/锁定或解锁指定的UTXO Move RemovePrunedFunds SendFrom SendMany SendToAddress/向指定地址发送比特币 SetAccount SetTxFee/设置交易手续费率 SignMessage/签名消息 SignMessageWithPrivKey/用指定私钥签名消息 WalletLock/锁定钱包 WalletPassphrase/解锁钱包 WalletPassphraseChange/修改钱包密码
在线工具推荐: Three.js AI纹理开发包 - YOLO合成数据生成器 - GLTF/GLB在线编辑 - 3D模型格式在线转换 - 可编程3D场景编辑器

DecodeRawTransaction/解码裸交易

decoderawtransaction调用将一个序列化的交易字符串解码为JSON对象。

参数

  • SerializedTransaction:要解码的裸交易字符串

返回值

成功解码后,decoderawtransaction返回一个JSON对象,否则返回null。

示例代码

下面命令解码指定的裸交易:

~$ bitcoin-cli decoderawtransaction 0100000001bafe2175b9d7b3041ebac\
529056b393cf2997f7964485aa382ffa449ffdac02a000000008a47304402201\
3d212c22f0b46bb33106d148493b9a9723adb2c3dd3a3ebe3a9c9e3b95d8cb00\
220461661710202fbab550f973068af45c294667fc4dc526627a7463eb23ab39\
e9b01410479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815\
b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08\
ffb10d4b8ffffffff01b0a86a00000000001976a91401b81d5fa1e55e069e3cc\
2db9c19e2e80358f30688ac00000000

输出结果如下:

{
    "txid": "52309405287e737cf412fc42883d65a392ab950869fae80b2a5f1e33326aca46",
    "hash": "52309405287e737cf412fc42883d65a392ab950869fae80b2a5f1e33326aca46",
    "size": 223,
    "vsize": 223,
    "version": 1,
    "locktime": 0,
    "vin": [
        {
            "txid": "2ac0daff49a4ff82a35a4864797f99f23c396b0529c5ba1e04b3d7b97521feba",
            "vout": 0,
            "scriptSig": {
                "asm": "3044022013d212c22f0b46bb33106d148493b9a9723adb2c3dd3a3ebe3a9c9e3b95d8cb00220461661710202fbab550f973068af45c294667fc4dc526627a7463eb23ab39e9b[ALL] 0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",
                "hex": "473044022013d212c22f0b46bb33106d148493b9a9723adb2c3dd3a3ebe3a9c9e3b95d8cb00220461661710202fbab550f973068af45c294667fc4dc526627a7463eb23ab39e9b01410479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"
            },
            "sequence": 4294967295
        }
    ],
    "vout": [
        {
            "value": 0.06990000,
            "n": 0,
            "scriptPubKey": {
            "asm": "OP_DUP OP_HASH160 01b81d5fa1e55e069e3cc2db9c19e2e80358f306 OP_EQUALVERIFY OP_CHECKSIG",
                "hex": "76a91401b81d5fa1e55e069e3cc2db9c19e2e80358f30688ac",
                "reqSigs": 1,
                "type": "pubkeyhash",
                "addresses": [
                    "1A6Ei5cRfDJ8jjhwxfzLJph8B9ZEthR9Z"
                ]
            }
        }
    ]
}