1

有大佬知道一次调用如何产生多笔交易吗? | 登链社区 | 技术问答

 2 years ago
source link: https://learnblockchain.cn/question/2805
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

5 有大佬知道一次调用如何产生多笔交易吗?

我用web3调用我的合约,不管转账多少次都在一个tx里,我想问有没有什么办法, 在我web3只调用一次的情况下让他产生两笔or多笔交易,说白了就是, 让他在执行合约的过程中创建交易,

或者有别的办法? 前提是外部一次调用

我需要分析某些数据, 需要在一个块里的不同的Position里, 如果是一个交易的话,Position就是一个了!

目前的合约代码⬇️

....
function transfer(address[] memory _to, uint256 _value) public {
        for (uint i = 0; i < _to.length; i++){
            use_token.transfer(_to[i],_value);
        }

    }

目前的执行结果, 都在一个tx里⬇️

image.png

我是个solidity小白, 大佬如果有办法希望说的清楚一些?感谢

最佳答案 6小时前

不可以, 在执行合约的过程中创建交易,也是在当前的交易内,或者说不可以创建新的交易。

交易是指由用户签名发起的调用(也包括转账及创建合约)。

Tiny熊 - 布道者
擅长:智能合约,以太坊 | 采纳率 40% | 回答于 6小时前

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK