在循环中重新混合从多个帐户发送相同的交易

Send the same transaction from multiple accounts in remix in loop

例如,是否可以在注入的 web3 连接(元掩码)中从多个帐户批准和发送相同的交易,并且只接受一次?或者我们是否需要切换帐户并每次都接受 metmask 中的每笔交易?是否可以注入 web3?

Remix 目前不允许自动循环多个帐户并自动从每个帐户发送交易。

另外,MetaMask不支持一次性批准一批交易,需要每笔交易单独批准。


您可以在 node.js 中获得想要的结果,例如:

const web3 = new Web3('<provider with multiple accounts>');

for (let account of web3.eth.getAccounts()) {
    contract.methods.foo().send({from: account});
}