Skip to content

Commit c34203b

Browse files
committed
add to CashTokens guide
1 parent af40acf commit c34203b

1 file changed

Lines changed: 20 additions & 5 deletions

File tree

website/docs/guides/cashtokens.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ title: CashTokens
33
sidebar_label: CashTokens
44
---
55

6-
CashTokens are native tokens on Bitcoin Cash, meaning that they are validated by each full node on the network and their transaction rules checked by each miner when constructing new blocks. CashTokens added fungible and non-fungible token primitives.
6+
CashTokens are native tokens on Bitcoin Cash, meaning that they are validated by all full nodes on the network and their transaction rules checked by each miner when constructing new blocks. CashTokens added fungible and non-fungible token primitives.
77
CashTokens was first proposed in February of 2022 and actived on Bitcoin Cash mainchain in May of 2023.
88

99
:::tip
10-
You can read more about CashTokens on [cashtokens.org](https://cashtokens.org/) or can refer to the original specification document: ['CHIP-2022-02-CashTokens: Token Primitives for Bitcoin '](https://github.com/cashtokens/cashtokens).
10+
You can read more about CashTokens on [cashtokens.org](https://cashtokens.org/) which has the full specification as well as a list of [Usage Examples](https://cashtokens.org/docs/spec/examples).
1111
:::
1212

1313
## CashTokens Utxo data
@@ -31,13 +31,18 @@ interface TokenDetails {
3131
};
3232
}
3333
```
34+
### Fungible Tokens
3435

3536
The `amount` field is the amount of fungible tokens on the UTXO, the `category` is the "tokenId" for the token on the UTXO.
36-
Next we have the optional `nft` object, which will only be present if the UTXO contains an NFT.
37-
The `nft` object has 2 properties: the `capability` and the `commitment`. The `commitment` is the data field for the NFT.
37+
The maximum size for a fungible token `amount` is the max signed 64-bit integer or `9223372036854775807`.
38+
39+
### Non-Fungible Tokens
40+
41+
The `nft` info on a UTXO will only be present if the UTXO contains an NFT. The `nft` object has 2 properties: the `capability` and the `commitment`. The `commitment` is the data field for the NFT which can is allowed to be up to 40 bytes.
42+
3843
Capability `none` then refers to an immutible NFT where the commitment cannot be changes. The `mutable` capability means the `commitment` field can change over time, usually to contain smart contract state. Lastly the `minting` capability means that the NFT can create new NFTs from the same `category`.
3944

40-
:::note
45+
:::tip
4146
A UTXO can hold both an `amount` of fungible tokens as well as an `nft`, as long as both tokens have the same `category`.
4247
This is quite a common pattern for covenants which want to hold contract state and fungible tokens on the same UTXO.
4348
:::
@@ -100,3 +105,13 @@ contrast this with the following scenario where there is also fungible tokens of
100105
require(tx.inputs[0].tokenAmount == 10);
101106
require(tx.inputs[0].tokenCategory == providedTokenId);
102107
```
108+
109+
## CashTokens Genesis transactions
110+
111+
A CashTokens genesis transaction is a transaction which creates a new `category` of CashTokens. To create a CashTokens genesis transaction you need a `vout0` UTXO because the txid of the UTXO will be you newly created `category`.
112+
113+
The requirement for a `vout0` UTXO can mean that you might need to create a setup transaction "pre-genesis" which will create this output. The "pre-genesis" txid then is your token's `category`.
114+
115+
:::tip
116+
CashTokens Creation is illustrated very nicely by transaction diagram in the specification document in the [sectction on token categories](https://cashtokens.org/docs/spec/chip#token-categories).
117+
:::

0 commit comments

Comments
 (0)