I have few question around algorand smart contracts and ASA creation.


  1. Creation of ASA can be done using some sdk or it can be done using smart contracts?
    2.The approach i am following in an application is
    I created a ASA using normal java transaction.
    I created another api to create application and in the approval program wrote a inner trx to check for transfer of asa
    next is after compiling approval program the result that is returned i changed that to escrow address.
    next i created a group transaction with app call txn,optin asset txn and transfer asa in java and compiled this group tnx to transfer asa

Is this the right approach?


Badly confused.

  1. Both can be done. It depends on the use case. But I would say 90% of the applications most likely do not need the ASA to be created by a smart contract. This is only for advanced use cases where ASA need to be dynamically created.

  2. This looks good.

If you could share how to create ASA using smart contracts.

Is it using the goal command?
Binding goal with smart contract to check for the constraints (verifications of constraints passed as arguments in goal command)

Or any other way?

And while implementing the use case mentioned above
while creating a group tnx (Application call,OptIn and ASA transfer)
Getting this error
If you have any idea about it

Creating an ASA from a smart contract is an advanced process.
You can do it using inner transactions:

But once again, this is only for advanced use cases where you do not know in advance which assets and how many assets will be created by the smart contract.

It looks like you are not using a stateful smart contract but you are using a smart signature.

See Introduction - Algorand Developer Portal

that means the complication/deployment of the smart contract will be done using goal command not any simple java transaction.

Everything you can do with goal, you can also do it using any of the 4 official SDK Java, JS, Go, Python and a connection to an algod / API service.

To be precise, this is true apart from participation in consensus, which does not matter for dApps.

ASA can be created either with SDKs (signing the AssetCreate both with a Single Signature or Multi Signature accounts) either with Smart Contract (signing the AssetCreate both with a Smart Signature or an Inner Transaction).

1 Like

If you could provide me with any sample for the creation of ASA using smart contracts and steps to run the code, please.
unable to run the code defined in docs

This talk from Decipher is something you may really want to look at: on minute 22:00 Inner Transactions are used to create an ASA.

This is a PyTEAL code snippet from the talk:

appAddr = Global.current_application_address()

           TxnField.type_enum: TxnType.AssetConfig,
           TxnField.config_asset_name: Bytes("PyTEAL Coin"),
           TxnField.config_asset_unit_name: Bytes("PyTEAL"),
           TxnField.config_asset_url: Bytes(""),
           TxnField.config_asset_decimals: Int(6),
           TxnField.config_asset_total: Int(800_000_000),
           TxnField.config_asset_manager: appAddr,
   InnerTxnBuilder.Submit(), # create a PyTEAL Coin asset
   App.globalPut(Bytes("PyTealCoinId"), InnerTxn.created_asset_id()) # remember the asset ID
1 Like


What would be the command to deploy this smart contract on the network?

Hello @chahat , also was going through this problem, I think still the best way is to create lots of ASAs using the goal command(you can calculate how many your project needs by factoring in how much you will issue on a liquidity pool if you will so as to price your ASA, and then some other for your project’s application), then create a smart contract that algorithmically churns out ASAs based on the logic you prefer and then now manually send the ASAs you created using goal again to this smart contract, then reconfigure that smart contract as the new reserve address. I still think it is a waste creating ASAs purely by a smart contract especially using PyTeal/TEAL, you can use Reach though if you want to have a contract command both creation and issuing of ASAs, at least with Reach you wouldn’t need a security audit

Hello @chahat , the Algorand documentation is the best place. there is literally everything you need, search up goal SDK.

4 posts were split to a new topic: ASA created from inner transaction does not appear in explorers

Hi @chahat

Here you have a complete example dApp that mints NFTs (using Inner Transactions). You have both the PyTEAL source code and a CLI to deploy the dApp and mint the NFTs.

In this specific example the dApp is a mango tree that mints delicious ARC-3 compliant non-fungible-mangos :mango:.

The CLI is in Portuguese, but all the commands are very straight forward: you should be able to read the CLI’s source code and understand how to deploy and interact with the dApp.

One note: there is a “specific” word to be passed as CLI argument to withdraw the NFT, but it’s very easy to find it! :wink: