> For the complete documentation index, see [llms.txt](https://bitstake.gitbook.io/bitstake-a-staking-protocol-for-brc-20/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bitstake.gitbook.io/bitstake-a-staking-protocol-for-brc-20/staking-3-3-on-brc-20/examples.md).

# Examples

## **Most of it is referred from** [**domo's**](https://domo-2.gitbook.io/brc-20-experiment/examples) **gitbook.**

Let's say you want to inscribe your own token (assume ABCD) with staking rewards. One can perform given ops

## **Deploy a token**

You can deploy your token using following code

```json
{
"p":"brc-20",
"op":"deploy",
"tick":"bYLD",
"max":"10000000",
"lim":"10000",
"yield": {"6000": "0.0007","8000": "0.0002", "1000000":"0.00002"}
}
```

<mark style="color:red;">**$abcd might be already inscribed or fully minted. Example for demonstration purposes only.**</mark>

* Now, you will own whole of supply (BRC-20 standard proposition) until people mint it. There is no whitelist/limits per wallet in current scheme of BRC-20 things. However, there is limit per inscription.
* Yield is a nested json which shows first 6000 blocks yield (per token per block), 8000 blocks yield etc.

## **Mint a token**

Minter populates mint function with required information

```json
{ 
"p": "brc-20",
"op": "mint",
"tick": "bYLD",
"amt": "1"
}
```

* Inscribe the function to your own ordinal enabled wallet taproot address. <mark style="color:red;">**Make sure not using inscription service that mints to itself first.**</mark>&#x20;
* You now have 1 "bYLD"

## Transfer 500 "ordi" to Satoshi's wallet

Satoshi wallet just an example. Can send to any ordinal compatible taproot address.&#x20;

```json
{ 
  "p": "brc-20",
  "op": "transfer",
  "tick": "bYLD",
  "amt": "500"
}
```

* Inscribe the function to your own ordinal enabled wallets taproot address that holds the balance. <mark style="color:red;">**Make sure not using inscription service that mints to itself first. Some ordinal wallets generate a different address each time, make sure to send to the address that holds the balance.**</mark>&#x20;
* Send the inscription from your wallet to Satoshi's ordinal enabled wallets taproot address (if he had one).&#x20;
* Satoshi now has 500 "bYLD"

| User    | Balance at start | Balance at end |
| ------- | ---------------- | -------------- |
| Sender  | 500              | 0              |
| Satoshi | 0                | 500            |

## Staking

Staking is done by incribing a transfer inscription & depositing tokens in the staking wallet address. To stake 100 $bYLD tokens, we will perform transfer as:

```json
{
  "p":"brc-20",
  "op":"transfer",
  "tick":"bYLD",
  "amt":"100"
}
```

* Transfer the tokens to staking wallet & block time is captured upon transfer to calculate the yield

## Unstake

Let us assume we had staked 1000 $bYLD tokens for 100 blocks. The balance shown on staking dashboard will be `1000 * (1+0.0007*100) = 1070 tokens.`We need to inscribe an untransfer op and send it to the staking address. Below is an example of such un-transfer inscription:

```json
{
  "p":"brc-20",
  "op":"untransfer",
  "tick":"bYLD",
  "txn":"c63ac7663b77b01dc941fc990caf04bb48cb9aeeade8ddi0"
}
```

* Untransfer op is defined only for staking protocol, its not a part of original BRC20 design. Please ensure you correctly perform this action.&#x20;
* Txn is the original transaction inscription id for staking the tokens.
* <mark style="color:red;">If you inscribe this from a wallet multiple times, only first one will be catered (txn is unique identifier per stake set).</mark>
* <mark style="color:red;">If you inscribe this from a wallet which has never STAKED OR txn is invalid, then this inscription will be a waste.</mark>
