For every contract deployed or verified on EthVigil, it automatically generates REST API endpoints over HTTPS which are available as an OpenAPI Specification.
Get the OpenAPI spec link
The contract being used for this guide comes bundled with the CLI tool by the name
ERC20MintablePresupplied.sol and implements the standard interface for an ERC20 token contract. The modification introduced is where the Ethereum account that deploys the contract automatically gets a number of minted tokens,
1000000000000000000000000 to be exact.
On visiting the contract's dashboard, you can find the OpenAPI spec link on the top left corner with a copy button and as well as right above the name of the contract.
Import the OpenAPI spec in Postman
Click on the import button in the top left corner and select the
You will see the Contract methods populated as HTTP GET and POST endpoints.
GET HTTP endpoints
EthVigil exposes the following as GET endpoints from the Solidity source code of a smart contract
publicmethod that does not alter the state of the contract i.e.
Let us try out a couple of GET calls on the contract that reads the state data on chain.
name of the ERC20 contract
For example, against the public variable
name, EthVigil automatically exposes it as a GET endpoint as if it were an accessor.
totalSupply of this ERC20 contract
This tells us the total tokens in supply through this contract amounts to
POST HTTP endpoints
EthVigil exposes the following as POST endpoints from the Solidity source code of a smart contract
publicmethod that alters the state of the contract i.e.
To perform POST calls on EthVigil API, an HTTP header
X-API-KEY is also expected. This holds the API key(Write) associated with your EthVigil account
The HTTP request headers are already populated with the necessary parameters, courtesy the tight integration between Postman and OpenAPI Specs. Ensure you put the API key(Write) associated with your account in the header field shown below.
Once entering the necessary body and header request parameters, we complete the HTTP POST to
It returns the transaction hash sent out on the blockchain network corresponding to this request, which is,
Verifying the state changes
We make a call to the public mapping
balanceOf on the ERC20 smart contract that holds a mapping of Ethereum addresses to their allocated tokens. Enter the account address to which the transfer was made in the previous section against the path parameter in Postman.
As you can see, the transfer has resulted in the balance of
0x008604d4997a15a77f00CA37aA9f6A376E129DC5 to be set to
1000, i.e. the value passed to the
transfer method call.