This route requires admin authentication.

Step 1. Add your API key to the request headers

API_KEY=API_KEY

Step 2. Create a contract

Every token needs a smart contract on the blockchain. But it’s our job on the protocol to make it simple. With only one request you can create a Solidity contract.

curl --request POST \
--url https://protocol-sandbox.lumx.io/v1/contracts \
--header 'Bearer: $API_KEY' \
--header 'Content-Type: application/json' \
--data '
{
  "type": "fungible",
  "name": "First fungible contract",
  "description": "My first fungible contract",
  "blockchainName": "polygon",
}
'

You will receive a status 200 with an object containing the ID of the contract.

Step 3. Create an item type

Now it’s time to create an item type and associate it to the contract that we created above. Think of an item type as the template for the token that you want to have.

curl --request POST \
--url https://protocol-sandbox.lumx.io/v1/contracts/<contract_id_you_received_on_step_2>/item-types \
--header 'Bearer: $API_KEY' \
--header 'Content-Type: application/json' \
--data '
{
  "description": "My first item type",
  "name": "First item type",
  "supply": 100
}
'

You will receive a status 200 with an object containing the ID of item type.

Step 4. It’s time to deploy it

The last step is to deploy your contract to the blockchain. You can do that with one simple request.

curl --request POST \
--url https://protocol-sandbox.lumx.io/v1/contracts/<contract_id_you_received_on_step_2>/deploy \
--header 'Bearer: $API_KEY'

You will receive a status 200 with an object containing the contract address on the blockchain.

Congratulations! You can check your contract on the block explorer.

Coming up next, let’s create a wallet to receive the tokens you’ll want to mint from this newly created contract.

Any problems during this recipe? Check some possible troubleshooting.