Home

Minting Accounts

Learn how to use your dev account to mint assets.

Using your dev account to create (minting) digital assets on blockchain networks. They're designed for situations where controlled minting is necessary, typically governed by a contract allowing only certain addresses to mint new assets.

These accounts are included in a contract's allowlist, which specifies who can mint assets. To set up a minting account, a dev account is created, and its address is added to this allowlist. This process ensures that only authorized dev accounts can initiate the minting process.

Requisites#

To escrow assets to your dev account you need to either:

  • Support ERC-2771 transactions: The assets you want to escrow need to support ERC-2771 transactions (i.e. meta transactions). You can check the list of supported forwarder contracts.
  • Fund dev account: You need to fund your dev account with the native tokens of the network you're interacting with.

Quickstart#

In this guide you'll learn how to mint an NFT using your dev account.

1. Create a dev account#

You might have contracts deployed that need to be minted on-demand, (we recommend having a pre-defined allowlist of addresses that are able to mint assets for the contract). First, create your dev account in your dashboard or via API.

addDevAccount

2. Minting an asset#

To minting an asset create a new transactionIntent using the dev account.

To sponsor the transaction, the contract NFT supports ERC-2771 transactions. If not, you need to fund the dev account with the native tokens of the network you're interacting with.

Therefore, we set a policy with a policy rule account_functions that allows the dev account interactions. Learn how to create a policy sponsor.

If you would like to mint an asset to a player's account, do the following:

server.ts

_21
// Set your secret key. Remember to switch to your live secret key in production.
_21
// See your keys here: https://dashboard.openfort.xyz/apikeys
_21
const Openfort = require('@openfort/openfort-node').default;
_21
const openfort = new Openfort(YOUR_SECRET_KEY);
_21
_21
const devAccount = 'dac_...';
_21
const playerId = 'pla_...';
_21
const policyId = 'pol_...';
_21
_21
const transactionintents = await openfort.transactionIntents.create({
_21
account: devAccount,
_21
chainId: 80002,
_21
policy: policyId,
_21
optimistic: true,
_21
interactions:{
_21
contract: 'con_....',
_21
// The function name and arguments depend on the contract you're interacting with
_21
functionName: 'mint',
_21
functionArgs: [playerId]
_21
}
_21
})