当我们进行任何交易时,我们需要为每笔交易提供天然气,因此我为成功交易需要多少天然气,因为有些时间交易是成功的,有些时间会给出错误
“错误:返回错误:天然气资金不足*价格+价值”
Thanks in advance .
exports.sendTransactions = (sender_account, to_account, p_key, value ) => {
console.log("sendTRansactions", sender_account, to_account , p_key , value );
var admin = sender_account;
var contract_address = to_account;
var tx = {
from: admin,
to: contract_address,
gas: 184000,
data: "",
value: value
};
return web3.eth.accounts.signTransaction(tx, p_key).then((hash) => {
return web3.eth.sendSignedTransaction(hash.rawTransaction).then((receipt) => {
return receipt
}, (error) => {
return error
console.log(error);
// reject(500);
})
}, (error) => {
return error
// reject(500);
});
}
答案 0 :(得分:3)
我刚刚制作气体是在字符串示例中: 煤气:' 184000',
它适合我。