Getting Started with Stellar Labs and Making a Custom Token aka Asset in Six Steps: Adventures in Cryptocurrency Programming

This is an old-skool sketchyTech post! I'm starting out on something that I know nothing about and learning on the job. Apologies in advance for the mistakes.

First up, I'm going to follow one of the many guides on the web for making custom assets (otherwise known as tokens) in Stellar. Why? Because it's there, and also because the Stellar network sells itself on being many magnitudes more power efficient than Bitcoin and at the same time providing a means to distribute your own custom tokens on their marketplace. There could be all types of uses for this, but first we need to figure out how to actually make and distribute these custom tokens which I'll be doing in this post and the ones that follow it.

No login, money, or account setup required for this experimenting, not even any coding. You start out in Stellar's own Laboratory.

Step 1: Create Your Source Account

Use a Chrome or Firefox browser (they're preferred) to visit the Laboratory and create your first account. This will be your Source Account and requires three clicks (with no personal details).

First click the Generate keypair button and then click Fund this account on the test network using the friendbot tool below when it appears. Finally click Get test network lumens.

Below are the before and after shots of how this will look.

Finally copy your public and secret keys into a text file with the heading Source Account.

Step 2a: Create Your Issuing and Distributor Accounts

Reload the Create Account page and generate two more keypairs DON'T fund the accounts with Friendbot this time. Write down your public and secret keys headed Issuing Account and Distributor Account.

Step 2b: Fund the Issuing and Distributor Accounts

Your two new accounts don't really exist until they are funded by your source account. So let's do that now:
  1. Place the public key from you Source Account (the second one you created) in the Source Account field.
  2. Click on Fetch next sequence number for account starting with [Distributor Account Public Key].
  3. Ignore the rest of the form.
  4. Open the dropdown menu next to the big number 1 (inside a box below the form).
  5. Select Create Account.
  6. In the Destination field enter the Issuing Account public key.
  7. In the Starting Balance field enter an amount, e.g. 100.
  8. Beneath it in the Source Account field place your Source Account number (not sure this is necessary, but doesn't hurt)
  9. Finally click on Sign in Transaction Signer at the very bottom of the page.

Step 3: Make the Accounts Trust One Another

First the Distributor Account needs to trust the Issuing Account. Click on the Build Transaction link.
  1. Place the public key from you Distributor Account (the second one you created) in the Source Account field.
  2. Click on Fetch next sequence number for account starting with [Distributor Account Public Key].
  3. Ignore the rest of the form.
  4. Open the dropdown menu next to the big number 1 (inside a box below the form).
  5. Select Change Trust.
  6. Choose Alphanumeric 4 for the asset type.
  7. Enter the code you wish your token to have (between 1 and 4 characters long).
  8. Beneath it place the public key from your Issuing Account  (the first one you created).
  9. Set the Trust Limit to 5000 and leave the rest of the form as is.
  10. Click on Sign in Transaction Signer at the very bottom of the page.
You will now be on a second page where you do the following (See Step 5 for screenshots):
  1. Copy and paste the Secret Key from your Distributor Account into the Add Signer field.
  2. Click on Sign with BIP Path.
  3. Ignore the Waiting for Wallet message.
  4. Click on Submit in Transaction Submitter button at the bottom of the page.
This is the third and final page:
  1. Simply press Submit Transaction.

Step 4: Signing the Transaction

This involves two steps (three clicks).
  1. Copy and paste the Secret Key from your Distributor Account into the Add Signer field.
  2. Click on Sign with BIP Path.
  3. Ignore the Waiting for Wallet message.
  4. Click on Submit in Transaction Submitter button at the bottom of the page.
  5. You will be taken to a new screen.
  6. Simply press Submit Transaction.
Before and after photos for the two steps.





Step 5: Creating a Token

Return to the Build Transaction page and clear the contents of the form with the link at the top right of the form.
  1. Place your Issuing Account public key in the Source Account field.
  2. Fetch an account sequence number.
  3. Select Operation Type of Payment.
  4. Enter your Distributor Account public key in the Destination field of the payment form.
  5. Select Alphanumeric 4 in the Asset field then enter the code you made up for your token earlier.
  6. Beneath the token code, enter the Issuing Account public key.
  7. In the amount field place 5000.
  8. Click on Sign in Transaction Signer.
  9. Repeat Step 4 BUT use the secret key from the Issuing Account.
(You only get the after photo this time, the before is identical to the one in Step 3.)


Step 6: Lock the Issuing Account

This is a throwing away of the key, so you cannot issue any further tokens of the same kind. This is not essential but is something that for the actual tokens you put on sale will increase confidence that you won't flood the market and lower the value of their coins.
  1. Return once again to the Build Transaction page and clear the contents.
  2. Enter the Issuing Account public key in the Source Account field.
  3. Fetch the next sequence number.
  4. Choose an Operation Type of Set Options
  5. Set Master Weight to 0
  6. Set Low Threshold to 1
  7. Set Medium Threshold to 1
  8. Click Sign in Transaction Signer.
  9. Follow Step 4.

All done!

You can see the fruits of your labour by visiting: https://horizon-testnet.stellar.org/accounts/{Your Distributor Public Key}

Among the output you will see balances:

Where next?

I'd suggest paying a visit to Stellar Expert to see the horizon-testnet listing of SKTC tokens to see an overview of the stats before proceeding to the second part of this series.




 

Comments