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

new implement repo added and remove the blank at line end #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all 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
70 changes: 35 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Rune

A reference implementation of the rune protocol. The goal of this project is to find consensus around the rune protocol and implement an index.
A reference implementation of the rune protocol. The goal of this project is to find consensus around the rune protocol and implement an index.

## Testing

Expand All @@ -12,46 +12,46 @@ cargo test

- https://runescan.space/ (web)
- https://geniidata.com/user/poshi/rune-index (web)
- https://github.com/wyixin/runes-go (GO)
- https://github.com/alphabatem/btc_rune (GO)
- https://github.com/Anarkoic/runes (Python)
- https://gist.github.com/revofusion/ba74dc11e0b007feba84b7b492e5ee87 (Javascript)
- https://github.com/rot13maxi/ruin (Rust)
- https://github.com/casey/runestone (Rust)

## Example
## Example

Let's examine the hex of the first ordinalswallet rune tx. See https://mempool.space/api/tx/1aa98283f61cea9125aea58441067baca2533e2bbf8218b5e4f9ef7b8c0d8c30/hex
Let's examine the hex of the first ordinalswallet rune tx. See https://mempool.space/api/tx/1aa98283f61cea9125aea58441067baca2533e2bbf8218b5e4f9ef7b8c0d8c30/hex

#### ScriptPubKey
The rune data is provided within the ScriptPubKey section, introduced by the OP_RETURN opcode, 0x6a. It is divided into substrings by OP_PUSHBYTES opcodes, here 0x01, 0x0b, 0x0a:
- 0601520b0001ff00752b7d000000000aff987806010000000012
= OP_RETURN 01 52 0b 0001ff00752b7d00000000 0a ff987806010000000012
-> datapush R, datapush transfer, datapush issuance

**R:** All rune tx start their ScriptPubKey with 1 pushbyte encoding the letter **R** in hex:
- 0x 01 52
= OP_PUSHBYTES_1 52
= R

**transfer:** This is followed by a **transfer** data push:
- 0x 0b 0001ff00752b7d00000000
= OP_PUSHBYTES_11 00 01 ff 00 75 2b 7d 00 00 00 00
= 00, 01, 00 00 00 00 7d 2b 75 00
= _ID (hex)_ 0, _OUTPUT (hex)_ 1, _AMOUNT (varint)_ 21000000

**issuance:** In a mint tx this is then followed by an additional **issuance** data push:
- 0x 0a ff987806010000000012
= OP_PUSHBYTES_10 ff 98 78 06 01 00 00 00 00 12
= 00 00 00 00 01 06 78 98, 12
= _SYMBOL (base26)_ RUNE, _DECIMALS (hex)_ 18

**Note** that the ordinalswallet implementation is encoding the _Symbol_ through Base64 and varint into little endian!
How to decode the _Symbol_ pushstring: ff 98 78 06 01 00 00 00 00
- 0xff tells us the next 8 bytes are little endian, which means we need to swap them around:
00 00 00 00 01 06 78 98
- This hex decodes to a decimal:
17201304
- Which in turn decodes to a character string via base26 with 00=A:
17 20 13 04
= RUNE

The rune data is provided within the ScriptPubKey section, introduced by the OP_RETURN opcode, 0x6a. It is divided into substrings by OP_PUSHBYTES opcodes, here 0x01, 0x0b, 0x0a:
- 0601520b0001ff00752b7d000000000aff987806010000000012
= OP_RETURN 01 52 0b 0001ff00752b7d00000000 0a ff987806010000000012
-> datapush R, datapush transfer, datapush issuance

**R:** All rune tx start their ScriptPubKey with 1 pushbyte encoding the letter **R** in hex:
- 0x 01 52
= OP_PUSHBYTES_1 52
= R

**transfer:** This is followed by a **transfer** data push:
- 0x 0b 0001ff00752b7d00000000
= OP_PUSHBYTES_11 00 01 ff 00 75 2b 7d 00 00 00 00
= 00, 01, 00 00 00 00 7d 2b 75 00
= _ID (hex)_ 0, _OUTPUT (hex)_ 1, _AMOUNT (varint)_ 21000000

**issuance:** In a mint tx this is then followed by an additional **issuance** data push:
- 0x 0a ff987806010000000012
= OP_PUSHBYTES_10 ff 98 78 06 01 00 00 00 00 12
= 00 00 00 00 01 06 78 98, 12
= _SYMBOL (base26)_ RUNE, _DECIMALS (hex)_ 18

**Note** that the ordinalswallet implementation is encoding the _Symbol_ through Base64 and varint into little endian!
How to decode the _Symbol_ pushstring: ff 98 78 06 01 00 00 00 00
- 0xff tells us the next 8 bytes are little endian, which means we need to swap them around:
00 00 00 00 01 06 78 98
- This hex decodes to a decimal:
17201304
- Which in turn decodes to a character string via base26 with 00=A:
17 20 13 04
= RUNE