[英]How to get minimum fee for a transaction using bitcore-lib (NodeJs)?
I'm doing a transaction of BTC using bitcore-lib nodejs package. 我正在使用bitcore-lib nodejs包进行BTC交易。 when I set 1 satoshi fee per byte it shows an error like "Fee is too small: expected more than x but got y" .
当我为每个字节设置1个satoshi费用时,它会显示类似“费用太小:期望大于x但得到y”的错误 。 Is there any way to get that x value to set fee?
有什么方法可以让x值确定费用?
let tx = bitcore.Transaction();
tx.from(utxos);
tx.to(toAddress,sendAmountInSatoshi);
tx.change(fromAddress);
tx.fee(fee);
tx.sign(pKey);
While I'm not sure if it's part of the API specification you can use their _estimateFee()
method: 虽然我不确定它是否属于API规范,但可以使用其
_estimateFee()
方法:
https://github.com/bitpay/bitcore-lib/blob/86583608814dfc513e675d7b853806caf9bd95e7/lib/transaction/transaction.js#L242 https://github.com/bitpay/bitcore-lib/blob/86583608814dfc513e675d7b853806caf9bd95e7/lib/transaction/transaction.js#L242
If you are using the bitcoin testnet make sure to include the minimum amount of fees which is 3000 satoshis . 如果您使用的是比特币测试网,请确保包括最低费用3000聪 。
You can set the fees as low as you want in the livenet , but the testnet require this as the minimum amount so as to ensure people continue mining on the testnet to help the developer community . 您可以设置收费低至您在livenet想要的,但testnet需要以此为最低量,以确保人们继续对testnet挖掘,以帮助开发人员社区 。
Cheers! 干杯!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.