gpt4 book ai didi

go - 如何使用 btcutil 在原始比特币交易中设置费用

转载 作者:IT老高 更新时间:2023-10-28 13:08:33 24 4
gpt4 key购买 nike

根据文档 (http://godoc.org/github.com/btcsuite/btcrpcclient) 可以使用设置费用

SetTxFee(fee btcutil.Amount) // hard coded0.0006 BTC

我将费用设置为 0.0000016 比特币/千字节并执行以下操作:

  1. 列出未使用的
  2. 设置TxFee
  3. CreateRawTransaction
  4. SignRawTransaction
  5. SendRawTransaction

但是当我尝试发送交易时,我得到了

-26: 256: absurdly-high-fee

有没有其他方法可以使用这个库来设置费用?

Debug.log

ThreadRPCServer method=listunspent
ThreadRPCServer method=settxfee
ThreadRPCServer method=createrawtransaction
ThreadRPCServer method=signrawtransaction
ThreadRPCServer method=sendrawtransaction

金额:

amounts := map[btcutil.Address]btcutil.Amount{
destAddress: destAmount,
}

更新它似乎试图发送交易的全部金额,而不是我希望发送的金额。

如果A的交易是1 BTC,我想将0.3 BTC发送到另一个地址,设置金额时如何实现?

最佳答案

settxfee 不适用于 createrawtransaction 命令。

如果您有一个 1 BTC 的输入并且您将发送 0.9 BTC,那么剩余金额就是交易费用。

如果您不想为 0.1 BTC 设置交易费用,您可以发送 0.09 来更改地址并留下 0.01,这是您的交易费用。

关于go - 如何使用 btcutil 在原始比特币交易中设置费用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45663254/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com