Skip to main content

10. Set up the minting backend

The Immutable Unity SDK does not support asset minting, so you must use the Immutable Typescript SDK to mint in-game assets instead.

Project Overview

The code for the minting backend server is included in the repository, but it's considered out of scope. Before you continue, review the code to understand how to set up your backend.

You can run the backend code on your local machine without deploying it for the Immutable Runner game to use. However, if you want to play the game on a mobile device, you must connect it to your local machine running the server. To accomplish this, both the mobile device and machine must be connected to the same network, and you will need to know the IP address of your machine. We'll cover this in detail later in the tutorial when we explain how to run the game on a mobile device.

Before you can run the server, you must configure the server with the contracts you deployed:

  1. Rename the file mint-backend/.env.example to mint-backend/.env.
  2. Update the PRIVATE_KEY to the private key of your admin wallet. This wallet has the minter role you granted in steps 9 and 10 and will be used to mint assets for the players.
  3. Update FOX_CONTRACT_ADDRESS to the contract address of the Immutable Runner Token you deployed in step 9.
  4. Update TOKEN_CONTRACT_ADDRESS to the contract address of the Immutable Character Token you deployed in step 10.

Run the minting backend server:

  1. cd mint-backend
  2. yarn install
  3. yarn build
  4. yarn start

The minting backend server is now accessible via http://localhost:3000.

Mint Immutable Runner Fox

To mint Immutable Runner Fox to a wallet, run this cURL command in your terminal:

curl --location 'http://localhost:3000/mint/fox' \
--header 'Content-Type: application/json' \
--data '{
"to": "THE_WALLET_ADDRESS_TO_MINT_TO",
"quantity": THE_NUMER_OF_FOXES_TO_MINT
}'

Mint Immutable Runner Token

To mint Immutable Runner Token to a wallet, run this cURL command in your terminal:

curl --location 'http://localhost:3000/mint/token' \
--header 'Content-Type: application/json' \
--data '{
"to": "THE_WALLET_ADDRESS_TO_MINT_TO",
"quantity": THE_NUMER_OF_TOKENS_TO_MINT
}'