Demonstration of Algorand Standard Asset (ASA) with JavaScript SDK


In the previous work we have demonstrated how to use JavaScript SDK to open accounts and transfer Algos between them in Algorand. Here we further demonstrate another important feature about digital assets in Algorand, known as Algorand Standard Asset (ASA), and see how to use JavaScript SDK to create, manage and delete digital assets. We will also use AlgoSigner, a browser plug-in wallet for Algorand recently released by PureStake, to perform transfer of digital assets between accounts.

Quick Overview of ASA and AlgoSigner

For those having experience in Ethereum, digital assets (always known as tokens) are implemented through (smart) contract, riding on top of an Ethereum network. This is called Layer-2 implementation. Algorand is taking a different approach, making digital assets as states of any given accounts. It is called Layer-1 implementation. When we inspect the account information of a given account, we can see the balance of Algos, the native currency in Algorand, and all the digital assets held in this account.


This work is largely based on a complete example by Ryan Fox (link). His work can be found here. For better illustration, I broke it down into steps. Besides, when ASA transactions are signed and submitted, Ryan’s code provides a decent way to wait for confirmation and show the asset details. I am not using this here, but it is highly recommended when we are developing a better application. Here I just use a separate script to inspect the account information.


We create two accounts, each of which comes with the 25-word mnemonic. For simplicity we specify them as Alice and Bob. Here are the addresses of both Alice and Bob’s account.

  1. Alice sends Bob 200k KCCOINs. This fails as Bob does not opt-in KCCOIN yet.
  2. Bob opt-in KCCOIN. And Alice sends Bob 200k KCCOINs with success.
  3. Use AlgoSigner to observe both accounts.
  4. Alice sends Bob 100k KCCOINs using AlgoSigner.
  5. Alice destroys KCCOINs. This fails as Alice does not hold all the KCCOINs (some are still in Bob’s Account)
  6. Bob sends Alice back all (300k) KCCOINs.
  7. Alice deletes KCCOINs.
  8. Bob removes KCCOIN in his account.
  • The asset-ID for the asset you have created.

Step 1: Create ASA

Here is the script asa_aliceCreate.js to let Alice create KCCOINs.

Step 2: Transfer of ASA with Receiver not Opt-in

Here is the script asa_aliceSendToBob.js to perform a transfer of 200k KCCOINs from Alice to Bob.

Step 3: Opt-in and Successful Transfer of ASA

The script asa_bobOptIn.js makes Bob opt-in to KCCOIN.

After opt-in Asset is seen in Bob’s account with amount zero.

Step 4: Observation in AlgoSigner

I have imported both Alice and Bob’s account into AlgoSigner. Here is the current status. We see Alice and Bob have one asset (ASA).

Both accounts are imported to my AlgoSigner wallet.
Alice’s account
Bob’s account

Step 5: Alice sends 100k KCCOINs to Bob with AlgoSigner

We choose Alice account, click Send, and specify Bob’s address with the amount and the selected ASA (KCCOIN here).

Alice sends 100k KCCOINs to Bob in AlgoSigner

Step 6: Destroy ASA with Outstanding ASAs

Alice now destroys this asset with script asa_aliceDestroy.js. Note that as there are still outstanding KCCOINs in other accounts, the deletion fails.

Step 7: Return all ASA to Creator

We use AlgoSigner again to have Bob sending back 300k KCCOINs to Alice.

Bob sends 300k KCCOINs to Alice in AlgoSigner

Step 8: Destroy ASA

Now Alice can destroy ASA.

Step 9: Remove Opt-in

We use asa_bobRemoveOptIn.js to remove Bob’s opt-in.


We showed how to use JavaScript SDK to perform the basic lifecycle of digital assets in Algorand. We also used AlgoSigner, a chrome plug-in Algorand wallet, to make asset transfers. As mentioned before, ASA provides lots of options and feel free to explore more here. Besides, here is the complete code on JavaScript developed by Ryan Fox.

Visit for all my works. Reach me on or follow me @kctheservant in Twitter.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store