如何与已经部署的智能合约连接?
我是一个崭露头角的区块链开发人员,我一直在用来深入研究事物,因为这是我最喜欢的语言。
我现在处于僵局,希望我能得到一些帮助。
与GO一起使用智能合约时,我看到的几乎所有教程都涉及使用Geth将固体源代码编译为其ABI和二进制表单,然后生成一个.go文件,并具有对部署和其他操作的合同的绑定。
当使用我自己的创建合同时,这很好,但是如何与已经部署的第三方合同(例如Cryptokitties)进行交流?基本上,在我可能无法访问合同源代码来生成绑定的情况下。
通过牢固,我只需要定义所需合同的界面,但是Go似乎并不那么简单。
I'm a budding blockchain dev, and I've been using Go to dive into things as that's the language I'm most comfortable with.
I've at an impasse now, and hope I can get some help.
Pretty much all the tutorials I've seen on working with smart contracts with Go involve using geth to compile the Solidity source code to its ABI and binary forms then generating a .go file with bindings to the contract for deployment and other actions.
This is fine when working with my own created contracts, but how would I go around interfacing with already deployed third-party contracts such as Cryptokitties for instance? Basically, in the cases where I may not have the luxury of having access to the contract source code to generate bindings.
Going through the Cryptozombies course, with Solidity I just had to define the interfaces of the desired contract, but Go doesn't seem to be as straightforward.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以手动将ABI文件从etherscan到本地工作区保存,以生成绑定。
例如,您可以从此
注意:
阅读更多: https://geth.ethereum.org/docs/docs/docs/dapp/native/native/native/native-binding
You could manually save the ABI files from Etherscan to your local workspace to generate the binding.
For example, you can copy ABI from this CryptoKitties contract. As long as the contracts are verified, you can always get the ABIs.
Note:
Read more: https://geth.ethereum.org/docs/dapp/native-bindings