T
T
The APIS
Search…
Launch ERC721 Token
Launch an ERC721 Token with The APIS using two API calls (or less)
Creating an ERC721 token with APIS is easy - even if you don't know how to write a smart contract yourself. All you'll need is an Ethereum wallet address and an http client… and The APIS, of course!
Here are the 3 endpoints we’ll reference:
1
POST /api/v1/wallets (create wallet)
2
GET /api/v1/wallets (read wallet)
3
POST /api/v1/tokens (create token)
Copied!
First thing’s first… we need a wallet!

Create Wallet

Use the create wallet endpoint to generate a new Ethereum wallet address and private key. We’ll use this address for launching our token (we can discard it when we’re done if we want — more on that later).
post
https://api.dev.theapis.io
/api/v1/wallets?apiKey=<API_KEY>
Create Wallet
1
# Create wallet
2
curl \
3
--location \
4
--request POST 'https://api.dev.theapis.io/api/v1/wallets?apiKey=<API_KEY>' \
5
--header 'Content-Type: application/json' \
6
--data-raw '{
7
"chain": "ethereum",
8
"network": "mainnet"
9
}'
Copied!

Fund Wallet

    Transfer a little Ether to the new account for creating the smart contract
    Read the balance of the new account using APIS
get
https://api.dev.theapis.io
/api/v1/wallets?apiKey=<API_KEY>&chain=ethereum&network=rinkeby&address=<MY_ADDRESS>
Read Balance
1
curl "https://api.dev.theapis.io/api/v1/wallets?apiKey=<API_KEY>&chain=ethereum&network=rinkeby&address=<MY_ADDRESS>"
Copied!

Create ERC721 Token Contract

Now, the magic. Use the createToken endpoint to launch the APIS ERC721 token into both Ethereum and Binance smart chain with the following params: chain , uri, sender (address which can mint the ERC721 tokens), name and symbol (token symbol, in this case, APIS), and it returns the transaction hash (nice-to-have: return contract address). You can launch tokens on both Ethereum and Binance Smart chain from the same endpoint, Only need to specify the chain params accordingly
For Ethereum, chain : "ethereum" and for Binance Smart chain, chain : "binance_smart_chain"
Note: You may want to have a second, offline-generated address when working with the Ethereum mainnet, to provide as the minter and account. This way, the tokens are all owned by the offline wallet.
1
# Create token
2
curl \
3
--location \
4
--request POST 'https://api.dev.theapis.io/api/v1/tokens?apiKey=<API_KEY>&chain=ethereum&network=rinkeby' \
5
--header 'Content-Type: application/json' \
6
--data-raw '{
7
"chain": "ethereum",
8
"network": "mainnet",
9
"token": {
10
"name": "The APIS",
11
"symbol": "API",
12
"uri": "<token uri>",
13
},
14
"type": "APIS_ERC721",
15
"sender": "<MY_ADDRESS>",
16
"privateKey": "<MY_PRIVATE_KEY>"
17
}'
Copied!

Check Balance

Now that we’ve launched our contract, you can verify the tokens are there with an API call.
We must wait a short time for the block to be mined
1
curl https://api.theapis.io/api/v1/tokens/address=<MY_ADDRESS|MY_OFFLINE_ADDRESS>/balance?tokenAddress=<RETURNED_APISERC721_TOKEN_ADDRESS>&type=erc721&apiKey=<API_KEY>&chain=ethereum&network=rinkeby
Copied!
Voila! We have tokens, we have contracts, we have a new way to build on blockchain.

Last modified 2mo ago