获得智能合约,web3 python

发布于 2025-01-18 01:09:58 字数 287 浏览 3 评论 0原文

如何仅使用合约地址来访问智能合约调用?正确地,我理解地址就足够了,因为在它的帮助下我可以参考合同日期字段,并通过解码 abi?

还不清楚为什么在 web3 中,当引用合约时,必须同时使用地址和 abi?

token_contract = w3.eth.contract(address=address, abi=abi)

为什么不:

token_contract = w3.eth.contract(address=address)

How can I access smart contract calls with only the address of the contract? Correctly, I understand that the address will be enough, because with the help of it I can refer to the contract date field, and by decoding the abi?

It is also not clear why in web3, when referring to a contract, it is obligatory to use both the address and abi?

token_contract = w3.eth.contract(address=address, abi=abi)

why not:

token_contract = w3.eth.contract(address=address)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

給妳壹絲溫柔 2025-01-25 01:09:58

Abi 讲述如何与您的合约交互/使用您的合约。仅地址是不够的,它只是指向以二进制形式(操作码)存储的区块链上的合约。 Abi就像智能合约的用户手册。

Abi tells how to interact with/use your contract. Address alone is not enough, it just points to contract on blockchain which is stored in binary form(opcodes). Abi is like an user manual of smart contract.

2025-01-25 01:09:58

ABI 对有关智能合约功能的信息进行编码,
事件。它充当 EVM 级字节码和
高级智能合约程序代码。与智能人互动
部署在以太坊区块链上的合约、外部程序
需要 ABI 和智能合约的地址。

The ABI encodes information about smart contracts' functions and
events. It acts as an interface between EVM-level bytecode and
high-level smart contract program code. To interact with a smart
contract deployed on the Ethereum blockchain, external programs
require an ABI and the address of the smart contract.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文