|
|
@@ -23,7 +23,50 @@ You can check your wallet balance using `drk`:
|
|
|
$ ./drk wallet --balance
|
|
|
```
|
|
|
|
|
|
-# Aliases
|
|
|
+
|
|
|
+
|
|
|
+# Creating tokens
|
|
|
+
|
|
|
+On the DarkFi network, we're able to mint custom tokens with some
|
|
|
+supply. To do this, we need to generate a mint authority keypair,
|
|
|
+and derive a token ID from it. We can simply do this by executing the
|
|
|
+following command:
|
|
|
+
|
|
|
+```
|
|
|
+$ ./drk token generate-mint
|
|
|
+```
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+This will generate a new token mint authority and will tell you what
|
|
|
+your new token ID is.
|
|
|
+
|
|
|
+You can list your mint authorities with:
|
|
|
+
|
|
|
+```
|
|
|
+$ ./drk token list
|
|
|
+```
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+For this tutorial we will need two tokens so execute the command again
|
|
|
+to generate another one.
|
|
|
+
|
|
|
+```
|
|
|
+$ ./drk token generate-mint
|
|
|
+```
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+Verify you have two tokens by running:
|
|
|
+
|
|
|
+```
|
|
|
+$ ./drk token list
|
|
|
+```
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+## Aliases
|
|
|
|
|
|
To make our life easier, we can create token ID aliases, so when we
|
|
|
are performing transactions with them, we can use that instead of the
|
|
|
@@ -47,47 +90,72 @@ $ ./drk alias show
|
|
|
Note: these aliases are only local to your machine. When exchanging
|
|
|
with other users, always verify that your aliases' token IDs match.
|
|
|
|
|
|
-# Minting tokens
|
|
|
-
|
|
|
-On the DarkFi network, we're also able to mint custom tokens with
|
|
|
-some supply. To do this, we need to generate a mint authority keypair,
|
|
|
-and derive a token ID from it. We can simply do this by executing the
|
|
|
-following command:
|
|
|
+Now let's add the two token IDs generated earlier to our aliases:
|
|
|
|
|
|
```
|
|
|
-$ ./drk token generate-mint
|
|
|
+$ ./drk alias add WCKD {TOKEN1}
|
|
|
```
|
|
|
|
|
|
-This will generate a new token mint authority and will tell you what
|
|
|
-your new token ID is. For this tutorial we will need two tokens so
|
|
|
-execute the command again to generate another one.
|
|
|
-
|
|
|
-You can list your mint authorities with:
|
|
|
+
|
|
|
|
|
|
```
|
|
|
-$ ./drk token list
|
|
|
+$ ./drk alias add MLDY {TOKEN2}
|
|
|
```
|
|
|
|
|
|
-Now let's add those two token IDs to our aliases:
|
|
|
+
|
|
|
|
|
|
```
|
|
|
-$ ./drk alias add WCKD {TOKEN1}
|
|
|
-$ ./drk alias add MLDY {TOKEN2}
|
|
|
+$ ./drk alias show
|
|
|
```
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+## Mint transaction
|
|
|
+
|
|
|
Now let's mint some tokens for ourselves. First grab your wallet address,
|
|
|
and then create the token mint transaction, and finally - broadcast it:
|
|
|
|
|
|
```
|
|
|
$ ./drk wallet --address
|
|
|
+```
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+```
|
|
|
$ ./drk token mint WCKD 42.69 {YOUR_ADDRESS} > mint_tx
|
|
|
+```
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+```
|
|
|
$ ./drk broadcast < mint_tx
|
|
|
+```
|
|
|
+
|
|
|
+
|
|
|
|
|
|
+```
|
|
|
$ ./drk token mint MLDY 20.0 {YOUR_ADDRESS} > mint_tx
|
|
|
+```
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+```
|
|
|
$ ./drk broadcast < mint_tx
|
|
|
```
|
|
|
|
|
|
+
|
|
|
+
|
|
|
Now the transaction should be published to the network. If you have
|
|
|
an active block subscription (which you can do with `drk subscribe`),
|
|
|
then when the transaction is confirmed, your wallet should have your
|
|
|
-new tokens listed when you request to see the balance.
|
|
|
+new tokens listed when you run:
|
|
|
+
|
|
|
+```
|
|
|
+$ ./drk wallet --balance
|
|
|
+```
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+*Note that the WCKD balance in the above image is 2x the expected about
|
|
|
+of 42.69 (i.e. 85.38). This is not a bug, it's because we accidentally
|
|
|
+applied the mint_tx twice. Yay!*
|