Member-only story
Calling Smart Contracts From Python
Ethereum brought the advancement of a smart contract, and which is publicily verifiable code. If we change the state of a contract, it will cost of us some gas. Now, let’s create a Python program which can call up a smart contract on Ethereum. As we don’t want it to cost us anything, we will run Ganche, and which is a local Ethereum instance.
We first go to Remix.ethereum.org and add our code:
The code we will add includes the functions of add(), sub(), mul(), sqr() and sqrt():
Now we compile our smart contract, and which produces ABI (Application Binary Interface). With ABI we can create an abstraction of all of the data elements and functions in the smart contract. This is normally defined in a JSON format. In our case the ABI is (and which can be copied from the ABI copy button in Remix):