SDK Overview

iotex-antenna is our SDK allowing you to interact with a local or remote iotex blockchain node, using a gRPC or gRPC-web connection.


In your JS project root, use npm install or yarn add.

npm install iotex-antenna

In your Golang project root, use go dep or go mod.

go get -u

Quick Start

Using JS/Golang SDK

  1. generate an account / recover an account from the private key
  2. transfer tokens
  3. run smart contracts
  4. make RPC calls
  5. check the complete API references

Using GraphQL

  1. Documentation
  2. GraphQL Playground

Having questions? Ask in our gitter chat room.


The antenna.iotx.accounts contains functions to generate Iotex accounts and sign transactions and data.


    antenna.iotx.accounts create, sign, and send a transaction of transfer to iotex blockchain network.

      To see the result of the transfer action, you can ether go to or query like

        Smart Contract

        The iotx.Contract class makes it easy to interact with smart contracts on the iotex blockchain. When you create a new contract object, you give it the json interface of the respective smart contract, and it will auto converts all calls into low-level ABI calls over RPC for you.

        This allows you to interact with smart contracts as if they were JavaScript objects.

        Compiling Solidity

        iotex-antenna does not compile solidity. However, you can use the following ways to get ABI and bytecode.

        1. option 1: use

        2. option 2: in Node.js, use [email protected]

        import solc from "solc";
        const solidityFileString = `
        pragma solidity ^0.4.16;
        contract SimpleStorage {
           uint storedData;
           function set(uint x) public {
               storedData = x;
           function get() public view returns (uint) {
               return storedData;
        const contractName = ":SimpleStorage";
        const output = solc.compile(solidityFileString, 1);
        const abi = JSON.parse(output.contracts[contractName].interface);
        const bytecode = output.contracts[contractName].bytecode;
        1. option 3: in browser, use browser-solc. Here is an example from iotex-explorer.

        Deploying Contract

        Once you get the abi and bytecode from the step above, then you can deploy it by sending the execution to the iotex blockchain network.

          Need a full example? Check our integration test.

          Once the action is broadcast, you can query the action.

            Once the action is minted, you can query the receipt.

              Interacting with Smart Contract

              After you get the contract address from the receipt, you can interact with the contract by constructing the contract first, and then calling contract functions.

              There are methods set and get in the example contract SimpleStorage defined in the solidity string above, so you can call them as the following.

                RPC Methods

                The rpc-method(provider) package allows you to make gRPC calls to Iotex blockchain.

                Use the umbrella antenna.iotex package:

                  Use this standalone package:


                    The XRC20 package provide facility api for XEC20 contract to Iotex blockchain.

                      Working with Desktop Wallet

                      In the client-side, use [email protected]^0.22.0. Here is an example of setting up WsSignerPlugin to connect to the wallet. It is nothing more than applying the plugin when initializing Antenna instance, and NOT adding your private key to the SDK as specified in the earlier documenation.

                      Before receiving the transfer or the contract call above, please open and unlock your wallet. Once the wallet is ready, you can run the script below in both the browser and the node environment and then you can see the message to sign. Please click "Yes, sign transaction" to continue.


                      import sleepPromise from "sleep-promise";
                      import Antenna from "iotex-antenna";
                      import { WsSignerPlugin } from "iotex-antenna/lib/plugin/ws";
                      import { toRau } from "iotex-antenna/lib/account/utils";
                      import { Contract } from "iotex-antenna/lib/contract/contract";
                      (async () => {
                        const antenna = new Antenna("", {
                          signer: new WsSignerPlugin()
                        await sleepPromise(3000);
                        // example for transfer
                        let resp = await antenna.iotx.sendTransfer({
                          to: "io1mwekae7qqwlr23220k5n9z3fmjxz72tuchra3m",
                          from: antenna.iotx.accounts[0].address,
                          value: toRau("1", "Iotx"),
                          gasLimit: "100000",
                          gasPrice: toRau("1", "Qev")
                        // example for contract call
                        // option 1: using simple executeContract shortcut
                        resp = await antenna.iotx.executeContract(
                            contractAddress: "io1jmq0epcswzu7vyquxlr9j9jvplwpvtc4d50ze9",
                            amount: "0",
                            method: "set",
                            gasLimit: "100000",
                            gasPrice: toRau("1", "Qev"),
                            from: antenna.iotx.accounts[0].address
                        // example for contract call
                        // option 2: using full-featured contract class
                        const contract = new Contract(
                              constant: false,
                              inputs: [{ name: "x", type: "uint256" }],
                              name: "set",
                              outputs: [],
                              payable: false,
                              stateMutability: "nonpayable",
                              type: "function"
                              constant: true,
                              inputs: [],
                              name: "get",
                              outputs: [{ name: "", type: "uint256" }],
                              payable: false,
                              stateMutability: "view",
                              type: "function"
                          { provider: antenna.iotx, signer: antenna.iotx.signer }
                        resp = await contract.methods.set(999, {
                          account: antenna.iotx.accounts[0],
                          gasLimit: "300000",
                          gasPrice: "1000000000000",
                          amount: toRau(0, "IOTX")
                        console.log(`contract.set() => ${resp}`);
                        await sleepPromise(20000);
                        resp = await contract.methods.get({ from: antenna.iotx.accounts[0].address });
                        console.log(`contract.get() => ${resp}`);