# Staking(3,3) on BRC-20

## Introduction

BRC-20 started as an experiment which got widely adopted in the community today. A lot of improvements have been suggested by a lot of awesome devs. Here we are providing you a detailing on how STAKING can/will be implemented for BRC-20.

**Please note that this standard is very early and the idea was shared on 14th May by @0x\_web3 twitter handle. It can change as the ecosystem gets more mature!**

**Note**: The staking enabled BRC-20 tokens are BACKWARD COMPATIBLE. Means, tokens can be bought/sold/visualised on existing tools/infra supporting BRC-20 ecosystem.

## Permissible Operations for (3,3) on BRC-20

There are 4 possible 'op' (operations) to enable staking on BRC-20.

1. Deploy
2. Mint
3. Transfer
4. Untransfer

### Deploy

Deploy method is used to deploy a BRC-20 token with staking support. Here is the JSON format for inscribing ‘deploy’

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

Everything mentioned here is referred from [domo’s gitbook](https://domo-2.gitbook.io/brc-20-experiment/) (existing BRC-20 standard) except ‘yield’.

**What does yield represent?**

‘yield' indicates appreciation of tokens (per block). It's a nested JSON object where key "6000" represents first 6000 blocks and its yield, next 8000 blocks, and so on. Example: Holding 1000[ $bYLD](https://twitter.com/search?q=%24bYLD\&src=cashtag_click) tokens in a staking vault for 100 blocks gives you 1070 tokens (70 reward).

<table><thead><tr><th width="104">Key</th><th width="107">Required?</th><th>Description</th></tr></thead><tbody><tr><td>p</td><td>Yes</td><td>Protocol: Helps other systems identify and process brc-20 events</td></tr><tr><td>op</td><td>Yes</td><td>Operation: Type of event (Deploy, Mint, Transfer, Untransfer)</td></tr><tr><td>tick</td><td>Yes</td><td>Ticker: 4 letter identifier of the brc-20</td></tr><tr><td>max</td><td>Yes</td><td>Max represents the maximum mintable supply. <mark style="color:red;"><strong>NOTE</strong>: The total supply (max supply + staking rewards) will be inflationary just like any staking token on any chain.</mark></td></tr><tr><td>lim</td><td>No</td><td>Mint limit: If letting users mint to themselves, limit per inscription<a href="https://app.gitbook.com/o/Qq5JCPlw0qva2E3WNkDF/s/P6FgWTbEkvefbtS0HVAr/~/changes/15/staking-3-3-on-brc-20/staking-and-unstaking-of-brc-20-tokens">NextStaking &#x26; Unstaking of BRC-20 tokens</a></td></tr><tr><td>dec</td><td>No</td><td>Decimals: set decimal precision, default to 18</td></tr><tr><td>deploy</td><td>No</td><td>Nested Json object specifying the yield rates for first x blocks, then y blocks etc. If this key is mentioned, it means <strong>stalking is allowed</strong> for the ticker.</td></tr></tbody></table>

<mark style="color:red;">Note: The value in nested json for set of blocks is reward per token per block.</mark>

### Mint

[Mint works exactly same as existing BRC-20 tokens](https://domo-2.gitbook.io/brc-20-experiment/#mint-brc-20).&#x20;

<mark style="color:red;">Careful if using inscription service. Some tools inscribe to themselves first then forward it to the customer (thus the intermediate inscription service owned address keeps the balance)</mark>

### Transfer

T[ransfer works exactly same as existing BRC-20 tokens](https://domo-2.gitbook.io/brc-20-experiment/#transfer-brc-20)

<mark style="color:red;">Careful if using inscription service. Some tools inscribe to themselves first then forward it to the customer (thus because the intermediate inscription service owned address has no balance and the transfer function is wasted). Some ordinal wallets generate a different address each time, make sure to send to the address that holds the balance.</mark>

### Untransfer

**Note**: Untransfer works only for staked tokens

Untransfer is a new operation compared to 3 existing operations on BRC-20 tokens. Given there are no smart contracts in BRC-20 ecosystem, we can not have locking/staking of tokens in any code. To enable STAKING, we will introduce a common staking address (similar to burn address) whose keys will not be accessible to anyone. Whenever anyone inscribes untransfer and sends it to STAKING address, it would be as given below:

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

<table><thead><tr><th width="104">Key</th><th width="127">Required?</th><th>Description</th></tr></thead><tbody><tr><td>p</td><td>Yes</td><td>Protocol: Helps other systems identify and process brc-20 events</td></tr><tr><td>op</td><td>Yes</td><td>Operation: Type of event (Deploy, Mint, Transfer, Untransfer)</td></tr><tr><td>tick</td><td>Yes</td><td>Ticker: 4 letter identifier of the brc-20</td></tr><tr><td>txn</td><td>Yes</td><td>Inscription id of the ‘transfer’ which was sent to STAKING address</td></tr></tbody></table>

<mark style="color:red;">Careful if using inscription service. Some tools inscribe to themselves first then forward it to the customer (thus because the intermediate inscription service owned address has not staked and untransfer function is wasted). Some ordinal wallets generate a different address each time, make sure to send to the address that holds the balance.</mark>

#### What is valid?

A valid transfer function is required to transfer a balance. Validity can be determined by the following:

* Valid transfer functions are ones where the amount stated in the inscription does not exceed <mark style="color:red;">**Available balance**</mark> when inscribed.
* <mark style="color:red;">**Available balance**</mark> defined as: \[<mark style="color:red;">**Overall balance**</mark>] - \[valid/active transfer function inscriptions in wallet (<mark style="color:red;">**Transferable balance**</mark>)]. If there are no valid/active transfer functions held by an address <mark style="color:red;">**Available balance**</mark> and <mark style="color:red;">**Overall balance**</mark> are equivalent.
* Example: A wallet holds an <mark style="color:red;">**Overall balance**</mark> of 1000 "$bYLD", and the holder then inscribes a transfer function of 700 "$bYLD". Once the inscription is confirmed, the following is true: <mark style="color:red;">**Overall balance**</mark> = 1000, <mark style="color:red;">**Available balance**</mark> = 300, <mark style="color:red;">**Transferable balance**</mark> = 700. If in the next block, the user tried to inscribe a transfer function of 500 "$bYLD", this would not be valid as the maximum amount that can be inscribed is 300 (<mark style="color:red;">**Available balance**</mark>).&#x20;
* If multiple transfer functions are inscribed in the same block, validity is determined by the order they were confirmed in the block
* If user sends the transfer inscription to STAKING address, then the balance will be deducted from the wallet. Eg. If you had 100 tokens and sent 30 tokens to STAKING address, your wallet will show 70 tokens. On BitStake dashboard, you can see the <mark style="color:red;">**staked tokens**</mark> and their balance (<mark style="color:red;">**including rewards**</mark>). When you send <mark style="color:red;">**untransfer**</mark> call, the balance (30+ some rewards) will get back to your wallet and it will show (100+ rewards) as your balance. <mark style="color:red;">**Unisat might not support it**</mark> as of now but they might very soon start indexing in a way catering to the staking process.&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bitstake.gitbook.io/bitstake-a-staking-protocol-for-brc-20/staking-3-3-on-brc-20.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
