Solidity:如何获取调用函数的帐户

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

我正在尝试创建一个测试应用程序,其中帐户只能调用一次函数。这可能吗?我需要的只是获取调用我的函数的帐户/地址的方法,AKA是“from”部分。

谢谢

ethereum solidity smartcontracts web3js web3
1个回答
0
投票

如果从帐户调用,则使用msg.sender。如果从合同中打电话,你可以看看tx.origin

https://ethereum.stackexchange.com/questions/1891/whats-the-difference-between-msg-sender-and-tx-origin

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