Minting tokens onchain has become increasingly expensive as Ethereum and gas prices have risen. For example, minting an ERC-721 NFT costs between 100,000 to 200,000 gas per asset. These prices are prohibitively expensive for many use cases. Offchain minting solves this problem.
The operator needs to inform their users that the operator controls the offchain minting policy. |
Figure 1. Offchain minting flow for ERC-721 token
Offchain minting is a StarkEx operation that creates offchain representations of ERC-20, ERC-721, and ERC-1155 assets.
The onchain contract is unaware of the asset until you withdraw it onchain.
The asset ID is encoded in a compressed form called the minting blob, which is required in order to withdraw onchain. The minting blob is not stored onchain. The operator defines it and stores it in the application.
For more information on the types of assets and how to compute them, see the following sections in StarkEx Specific Concepts:
1. The application sends a minting request to StarkEx.
The application sends a mint request transaction to the StarkEx gateway, using the add_transaction
API with the MintRequest
transaction type.
The request includes the following information:
vault_id | The ID of the vault into which the token is minted. |
stark_key | The public Stark key of the vault owner, as registered on the StarkEx contract. |
token_id | Identifies the asset uniquely in StarkEx. |
amount | The amount of tokens to be minted. For ERC-721 tokens, this value must be |