比特币RPC API中文手册

区块链API
GetBestBlockHash GetBlock GetBlockChainInfo GetBlockCount GetBlockHash GetBlockHeader GetChainTips GetDifficulty GetMemPoolAncestors GetMemPoolDescendants GetMemPoolEntry GetMemPoolInfo GetRawMemPool GetTxOut GetTxOutProof GetTxOutSetInfo PreciousBlock PruneBlockChain VerifyChain VerifyTxOutProof
节点控制API
GetInfo 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 ListReceivedByAccount ListReceivedByAddress ListSinceBlock ListTransactions ListUnspent LockUnspent Move RemovePrunedFunds SendFrom SendMany SendToAddress SetAccount SetTxFee SignMessage SignMessageWithPrivKey WalletLock WalletPassphrase WalletPassphraseChange

SendRawTransaction

sendrawtransaction调用验证指定交易并将其广播到P2P网络中。

参数

  • Transaction:序列化的交易码流,16进制字符串
  • AllowHighFees:是否允许高额手续费,可选,默认值:false

返回值

成功时sendrawtransaction调用返回交易ID,否则返回错误信息。

示例代码

下面的命令验证指定的序列化签名交易并将其广播至其他节点:

~$ bitcoin-cli -testnet sendrawtransaction 01000000011da9283b4ddf8d\
89eb996988b89ead56cecdc44041ab38bf787f1206cd90b51e000000006a4730\
4402200ebea9f630f3ee35fa467ffc234592c79538ecd6eb1c9199eb23c4a16a\
0485a20220172ecaf6975902584987d295b8dddf8f46ec32ca19122510e22405\
ba52d1f13201210256d16d76a49e6c8e2edc1c265d600ec1a64a45153d45c29a\
2fd0228c24c3a524ffffffff01405dc600000000001976a9140dfc8bafc84198\
53b34d5e072ad37d1a5159f58488ac00000000

输出结果如下:

f5a5ce5988cc72b9b90e8d1d6c910cda53c88d2175177357cc2f2cf0899fbaad