Creating assets
Transaction Authorizer: Any account with sufficient Algo balance
Create assets using either the SDKs or goal
. When using the SDKs supply all creation parameters. With goal
, managing the various addresses associated with the asset must be done after executing an asset creation. See Modifying an Asset in the next section for more details on changing addresses for the asset.
1 """2 Send an asset create transaction creating a fungible ASA with 10 million units3
4 Parameters for creating a new asset.5 - sender: The address of the account that will send the transaction6 - total: The total amount of the smallest divisible unit to create7 - decimals: The amount of decimal places the asset should have, defaults to None8 - default_frozen: Whether the asset is frozen by default in the creator address, defaults to None9 - manager: The address that can change the manager, reserve, clawback, and freeze addresses, defaults to None10 - reserve: The address that holds the uncirculated supply, defaults to None11 - freeze: The address that can freeze the asset in any account, defaults to None12 - clawback: The address that can clawback the asset from any account, defaults to None13 - unit_name: The short ticker name for the asset, defaults to None14 - asset_name: The full name of the asset, defaults to None15 """16 txn_result = algorand_client.send.asset_create(17 AssetCreateParams(18 sender=account_a.address,19 total=10_000_000,20 decimals=6,21 default_frozen=False, # optional22 manager=account_a.address, # optional. Can be permanently disabled by setting to None23 reserve=account_a.address, # optional. Can be permanently disabled by setting to None24 freeze=account_a.address, # optional. Can be permanently disabled by setting to None25 clawback=account_a.address, # optional. Can be permanently disabled by setting to None26 unit_name="MYA",27 asset_name="My Asset",28 )29 )30
31 """32 Send an asset create transaction creating a 1 to 1 unique NFT33 """34 txn_result = algorand_client.send.asset_create(35 AssetCreateParams(36 sender=account_a.address,37 total=1,38 asset_name="My NFT",39 unit_name="MNFT",40 decimals=0,41 url="metadata URL",42 metadata_hash=b"Hash of the metadata URL",43 )44 )
const suggestedParams = await algodClient.getTransactionParams().do();const txn = algosdk.makeAssetCreateTxnWithSuggestedParamsFromObject({ from: creator.addr, suggestedParams, defaultFrozen: false, unitName: 'rug', assetName: 'Really Useful Gift', manager: creator.addr, reserve: creator.addr, freeze: creator.addr, clawback: creator.addr, assetURL: 'http://path/to/my/asset/details', total: 1000, decimals: 0,});
const signedTxn = txn.signTxn(creator.privateKey);await algodClient.sendRawTransaction(signedTxn).do();const result = await algosdk.waitForConfirmation( algodClient, txn.txID().toString(), 3);
const assetIndex = result['asset-index'];console.log(`Asset ID created: ${assetIndex}`);
goal asset create --creator <address> --total 1000 --unitname <unit-name> --asseturl "https://path/to/my/asset/details" --decimals 0 -d data
See also