Smart Contract Interactions
The iotx.Contract
class of Antenna makes it easy to interact with smart contracts on the IoTeX blockchain. When you create a new Contract
object, just initialize it with the JSON interface (ABI) of the respective contract, and the Contract object will take care of converting all contract method calls into low-level ABI calls over RPC for you.
Need a full example? Check the integration test.
Compiling Solidity Code
Antenna SDK does not compile solidity code itself; however you can get the ABI and bytecode of your contract in one of the following options:
Option 1: in Node.js, import and use the
solc
node package, as in the following example:
Option 2: on the browser side, you can use browser-solc package. Check out this example from iotex-explorer.
Deploying a Smart Contract
Once you get the ABI and bytecode from the step above, then you can deploy it by sending the deploy action to the IoTeX blockchain network.
Once the action is broadcast, you can query it:
Finally, once the action is minted, you can query the receipt
Last updated