Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Website] Token Productization Docs #5575

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions frontend/website/pages/docs/tokens.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import Page from '@reason/pages/Docs';
export default Page({title: "Tokens"});

# Tokens

Using the Coda CLI (command-line interface) is the primary way to create new token accounts, create new tokens, and mint tokens on the Coda blockchain.

In this section, you will find out how to use the Coda CLI to create new tokens, create new token accounts, and mint non-default tokens!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence is a little repetitive given the prior one. Can we combine these somehow?


## Creating Tokens

With the CLI, you are able to create your own layer 2 tokens! Layer 2 tokens are a new type of token that is introduced to the Coda blockchain. These new types of tokens have a unique identifier that differentiate them from all other tokens in the blockchain. Users with an associated token account can then receive/send this new type of token that is totally separate from the native Coda token itself! When you create a new token, you are then able to mint more of the token to be used (see below in Minting Tokens).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to avoid the language "layer 2 tokens" because people may get confused that this is similar to a layer-2 protocol. Can we call this "tokens on Coda"?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Make "Minting Tokens" a link

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: please update "layer 2 tokens" elsewhere in the doc as well.


When creating a new token, a new token ID is created as well as a token account public key. This token account owns the token and can mint more of the token. The account will also (eventually) have the power to enable/disable accounts, and to set whether new accounts may be created for the token.


There is a fee to create a new token. The fee is the amount you are willing to pay to process the transaction. If this flag is not specified, the default value is 5 Coda. Additionally, the fee for creating the new token account is charged in addition to the transaction fee.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change the first sentence so as to not bury the lede as much? Maybe: "Creating new tokens requires an additional fee on top of the ever-present transaction fee"



### Create a new token

```
$ coda client create-token -sender <PUBLIC_KEY>
```

<Alert>

The required field for creating a new token account is:

- sender : The public key from which you want to send the transaction

</Alert>

See
```
$ coda client create-token -help
```

to learn more about how to use the command.



## Creating Token Accounts

With the CLI, you are able to create a token account for existing tokens. Token accounts are like regular accounts but solely meant to interact with the layer 2 tokens that exist in the Coda protocol. There is a unique token account for each type of token you wish to interact with.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a unique token account for each type of token you wish to interact with.

You must create a separate unique token account for each type of token you wish to interact with


<Alert kind="warning">

To send or receive an existing token, you must have a token account with the specified token. If there is no valid token account with the token, the transaction will fail

</Alert>

### Create a new token account

```

$ coda client create-token-account -token-owner <PUBLICKEY> -receiver <PUBLICKEY> -sender <KEY> -token <TOKEN_ID>

```


<Alert>

The CLI requires that the token-owner to be passed explicitly. If the token owner is not given, the CLI will query to find the token owner. If no owner is found, the command will fail with an error.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: The CLI doesn't require the token-owner be passed explicitly (otherwise we wouldn't need a default)


The required fields for creating a new token account are:

-receiver : The public key to create the new account for

-sender : The public key from which you want to send the transaction

-token : The ID of the token from which you want to send the transaction

</Alert>

See
```
$ coda client create-token-account -help
```

to learn more about how to use the command

## Minting Tokens

With the CLI, you are able to mint your own tokens! Minting your own tokens simply increases the supply of a particular token. Minting tokens is how all non-default tokens are created, there are no other protocol-events or commands that can create non-default tokens. This command may only be issued by the token owner, but the tokens may be minted in any existing account for that token.


### Mint a token

```
$ coda client mint-tokens -amount <VALUE> -sender <PUBLIC-KEY> -token <TOKEN_ID>
```

<Alert>

The required fields for creating a new token account are:

-amount : Number of new tokens to create

-sender : Public key from which you want to send the transaction

-token : The ID of the token to mint


</Alert>

See
```
$ coda client mint-tokens -help
```

to learn more about how to use the command
1 change: 1 addition & 0 deletions frontend/website/src/components/DocsSideNav.re
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ let make = (~currentSlug) => {
<Page title="GUI Wallet" slug="gui-wallet" />
<Page title="Snapps" slug="snapps" />
<Page title="CLI Reference" slug="cli-reference" />
<Page title="Tokens" slug="tokens" />
<Page title="Troubleshooting" slug="troubleshooting" />
<Page title="FAQ" slug="faq" />
<Page title="Glossary" slug="glossary" />
Expand Down