# POW-20 Protocol

## Introduction

Proof-of-Work is the backbone of Bitcoin (BTC) and other PoW chains like Litecoin (LTC), Doge (DOGE), Bitcoin Cash (BCH), Bitcoin SV (BSV), etc. However, derivative assets (tokens/NFTs) like [BRC-20](https://domo-2.gitbook.io/brc-20-experiment/) that run on these base layers have traditionally been issued or distributed through means other than PoW. While [Atomicals](https://docs.atomicals.xyz/) recently enabled a version of PoW token mining, it does so at a cost, namely understandability for the average person and a learning curve to get started. It's fairly complex if you're not a dev. It also introduces challenges for exchanges and indexers that may wish to implement them.

What is needed is something simple that "extends" what we already have with [BRC-20](https://domo-2.gitbook.io/brc-20-experiment/), making it easy for users, exchanges, and indexers to get started or implement with a few lines of code.

The protocol is straight forward and should look familiar.

### Deploy

```json
{
  "p": "pow-20",
  "op": "deploy",
  "tick": "DOTI",
  "max": "21000000",
  "lim": "1000",
  "difficulty": "5",
  "startBlock": "875000"
  "dec": "8" // max 15
  "icon": "534cede12f90729d961dbdaf7dc889e9ac6567fd43759097567bca2f2791dcd8i0"
}
```

**New Fields**

* **difficulty:** The number of leading zeros required in the double sha256 hash of the solution
* **startBlock:** Any future block number
* **icon (optional)**: a reference inscriptionId or link to the icon

### Mint

```json
{
  "p": "pow-20",
  "op": "mint",
  "tick": "DOTI",
  "amt": "1000",
  "solution": "<TICK>:<BTC_ADDRESS>:<START_BLOCK_HEADER>:<NONCE>"
}
```

**New Fields**

* **solution:** A unique string that is  <mark style="background-color:yellow;">**double**</mark> <mark style="background-color:yellow;"></mark><mark style="background-color:yellow;">sha256</mark> hashed to meet the difficulty specified in the deploy inscription

A solution is composed of 4 parts delimited by a colon:

1. <mark style="color:blue;">**TICK**</mark>  -  The ticker symbol
2. <mark style="color:blue;">**BTC\_ADDRESS**</mark>  -  The BTC ordinal address that the inscription is inscribed to (to prevent mempool sniping)
3. <mark style="color:blue;">**START\_BLOCK\_HEADER**</mark>  -  The future block header/hash of the `startBlock` specified in the deploy inscription (to prevent pre-mines)
4. <mark style="color:blue;">**NONCE**</mark>  -  A random nonce

### Transfer

```json
{ 
  "p": "pow-20",
  "op": "transfer",
  "tick": "DOTI",
  "amt": "500"
}
```

{% hint style="info" %}

### New Indexer Rules

1. Is the address the same address found in the inscription? Must be `true`
2. Does the solution contain the correct `START_BLOCK_HEADER` header for the `startBlock` found in the deploy inscription? Must be `true`
3. Does the double sha256 hash of the solution meet the `difficulty` found in the deploy inscription? Must be `true`
4. Has the solution been seen before? Must be `false`
   {% endhint %}

### Examples

<mark style="background-color:green;">**Valid Deploy:**</mark>

```json
{
  "p": "pow-20",
  "op": "deploy",
  "tick": "TEST",
  "max": "21000000",
  "dec": "8", // max 15
  "lim": "1000",
  "difficulty": "3",
  "startBlock": "826728"
}
```

<mark style="background-color:green;">**Valid Mint:**</mark>

```json
{
  "p": "pow-20",
  "op": "mint",
  "tick": "TEST",
  "amt": "1000",
  "solution": "TEST:bc1p5d7rjq7g6rdk2yhzks9smlaqtedr4dekq08ge8ztwac72sfr9rusxg3297:00000000000000000003b29163d794f519b3395338bd20420aa3772c9bbf3434:5390"
}
```

The double sha256 hash of the above solution produces the following hash which meets the example deployment difficulty requirement of 3:&#x20;

```
00050f8fa258111ce0c040baaf5b97339cc241dab85587c3e59fb5d864e53f7f
```

<mark style="background-color:green;">**Valid Transfer:**</mark>

```json
{
  "p": "pow-20",
  "op": "transfer",
  "tick": "TEST",
  "amt": "250",
}
```

<mark style="background-color:red;">**Invalid Mint:**</mark>

```json
{
  "p": "pow-20",
  "op": "mint",
  "tick": "TEST",
  "amt": "1000",
  "solution": "TEST:bc1p5d7rjq7g6rdk2yhzks9smlaqtedr4dekq08ge8ztwac72sfr9rusxg3297:00000000000000000003b29163d794f519b3395338bd20420aa3772c9bbf3434:1258"
}
```

The double sha256 hash of the above solution produces the following hash which does ***NOT*** meet the deployment difficulty requirement and is invalid:

```none
4edd19656a5f82c771f376a3db4d641cd6a58b09a4b1db530344977045b1515d
```

{% hint style="info" %}
NOTE: The above protocol applies to all layer-1 chains other than BSV which implements an [sCrypt](https://scrypt.io/) Hash-to-Mint (HTM) [smart-contract](https://github.com/danwag06/htm-contract) for [BSV-20(v2)](https://docs.1satordinals.com/bsv20#new-in-v2-tickerless-mode) token issuance based on provided proof-of-work.
{% endhint %}
