<p>As Vojtěch writes in the linked topic, the inscriptions will be found in an unexecuted part of the leaf script of the taproot input. “The leaf script is the second to last element of the witness stack after removing the optional annex (which is currently non-standard and has never been used on mainnet)”¹, which you find in <code>vin.txinwitness</code>. The Ordinal Theory Handbook describes the <a href="https://docs.ordinals.com/inscriptions.html" rel="nofollow noreferrer">serialization format</a>.</p>
<p>You could take a look at the <code>ord</code> software to find an implementation of the deserialization of inscriptions there. This file may or may not be related:<a href="https://github.com/casey/ord/blob/52c4d57ddf515ca828e97694121e67dd263b226e/src/inscription.rs" rel="nofollow noreferrer">incription.rs</a></p>
<hr />
<p><sub>¹ Thanks to Vojtěch for correcting my answer and providing this more precise description.</sub></p>

CC BY-SA 4.0
2023-05-22T14:51:33.727Z
The script is called "leaf script", not "witness script" ([source](https://github.com/Xekyo/bips/pull/1)), and it's the second to last element of the witness stack after removing the optional annex (which is currently non-standard and has never been used on mainnet).
Vojtěch Strnad
CC BY-SA 4.0
2023-05-22T15:00:36.793Z
Thanks, I’m glad you’re keeping me honest.
Murch
CC BY-SA 4.0
2023-05-27T18:32:01.320Z
so pretty much have to call into Rust from whatever lang im using...
BAR
CC BY-SA 4.0
2023-05-29T14:30:47.953Z
No, I was just pointing at an example for how inscriptions are deserialized which happens to be in Rust.
Murch
CC BY-SA 4.0
2023-05-22T14:36:26.157Z
2023-05-22T14:59:27.150Z
2023-05-22T14:59:27.150Z
Murch
<p>I want to read an ordinal transaction on the Bitcoin blockchain and see its payload data.</p>
<p>Say I use the getrawtransaction RPC Method for bitcoin receiving a JSON of the form specified <a href="https://www.quicknode.com/docs/bitcoin/getrawtransaction" rel="nofollow noreferrer">here</a>.  Where would the ordinal data be assuming we received an ordinal transaction?  Is it in <code>vin.hex</code>?  If so how would you decode it?  It would depend on if its a text or image or video right?</p>

CC BY-SA 4.0
2023-05-20T18:46:55.463Z
Does this answer your question? [Understanding how ordinals work with the Bitcoin blockchain. What is exactly stored on the blockchain?](https://bitcoin.stackexchange.com/questions/117018/understanding-how-ordinals-work-with-the-bitcoin-blockchain-what-is-exactly-sto)
Vojtěch Strnad
CC BY-SA 4.0
2023-05-21T18:02:30.113Z
This doesn't answer where in the data structure i linked to the script data would be.
BAR
<json-rpc><block><ordinals>
Read ordinal transaction data
BAR
# Read ordinal transaction data

(Asked by: username_0 on 2023-05-20)

I want to read an ordinal transaction on the Bitcoin blockchain and see its payload data.

Say I use the getrawtransaction RPC Method for bitcoin receiving a JSON of the form specified [here](https://www.quicknode.com/docs/bitcoin/getrawtransaction). Where would the ordinal data be assuming we received an ordinal transaction? Is it in `vin.hex`? If so how would you decode it? It would depend on if its a text or image or video right?

**Tags:** json-rpc, block, ordinals

> **Comments:**
> **username_1**: Does this answer your question? [Understanding how ordinals work with the Bitcoin blockchain. What is exactly stored on the blockchain?](https://bitcoin.stackexchange.com/questions/117018/understanding-how-ordinals-work-with-the-bitcoin-blockchain-what-is-exactly-sto)  
> **username_0**: This doesn't answer where in the data structure i linked to the script data would be.  

---

## 1 answers

### Answer by username_2 on 2023-05-22. Score: 2

As Vojtěch writes in the linked topic, the inscriptions will be found in an unexecuted part of the leaf script of the taproot input. “The leaf script is the second to last element of the witness stack after removing the optional annex (which is currently non-standard and has never been used on mainnet)”¹, which you find in `vin.txinwitness`. The Ordinal Theory Handbook describes the [serialization format](https://docs.ordinals.com/inscriptions.html).

You could take a look at the `ord` software to find an implementation of the deserialization of inscriptions there. This file may or may not be related:[incription.rs](https://github.com/casey/ord/blob/52c4d57ddf515ca828e97694121e67dd263b226e/src/inscription.rs)

---

¹ Thanks to Vojtěch for correcting my answer and providing this more precise description.

> **Comments:**
> **username_1**: The script is called "leaf script", not "witness script" ([source](https://github.com/Xekyo/bips/pull/1)), and it's the second to last element of the witness stack after removing the optional annex (which is currently non-standard and has never been used on mainnet).  
> **username_2**: Thanks, I’m glad you’re keeping me honest.  
> **username_0**: so pretty much have to call into Rust from whatever lang im using...  
> **username_2**: No, I was just pointing at an example for how inscriptions are deserialized which happens to be in Rust.  

---

