如何在单笔交易中将代币发送到多个地址?

问题描述 投票:0回答:1

我无法同时向多个地址发送令牌。所以我必须为每个收件人制作一个 tx,这需要很多时间,我必须等待下一笔交易。

有人可以帮我怎么做吗?

web3.eth.requestAccounts().then(function(accounts){ 
    var acc = accounts[0]; 
    Contract.methods.transfer(recipient, amt).send(
        {from: acc, gas: 54151 }
    ).then(function(tx){
        if(tx){ console.log(tx); 
    } 
  }); 
});
javascript smartcontracts web3js
1个回答
0
投票

如果您使用了您的私钥,您可以同时发送到多个地址。

如果没有私钥,每笔交易都必须经过发送方的批准,这将花费很多时间。使用 privateKey 将绕过此验证/批准过程,但这是危险的。

如果有人拿到了你的私钥,你的账户就会消失,metamask 或其他钱包也无济于事

© www.soinside.com 2019 - 2024. All rights reserved.