You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TXO 2.0 is mostly backwards compatible with TXO 1.0, with several additions.
What's New
"b" is for base64: Now the b attribute is ONLY used for base64. Previously, the b attributes had somewhat of an ambiguous meaning: it could be a base64 representation, but could also mean an Opcode. Now b attributes are only used for base64. This brings up a question: How do we represent opcodes?
"o" is for opcode: The Genesis update will remove all opcode usage limitations. This means there will be an explosion of different bitcoin transaction types, and being able to query based on opcodes will become very important going forward. We need an easy, human readable way to filter by opcode patterns. Therefore it is best to use human readable opcode names instead of numbers. This means, instead of indexing { "b0": { "op": 106 } } we use { "o0": "OP_RETURN" } for example.
"len" is for script sequence size: Each input or output script is a sequence of chunks (either a buffer chunk or an opcode chunk). There has been no native way to get how many chunks are in a script. With TXO2.0, now we have a len attribute.
"seq" is for nSequence: Enabled with the Genesis update.
"lock" is for nLocktime: Enabled with the Genesis update.
"str" removed: The "str" attribute was simply an ASM representation of a Bitcoin script. Technically this was a redundant feature and waste of storage space, because everything in the "str" attribute was already supported by other attributes such as "b", "h", and "s" attributes. But many people have been using "str" just to get opcode names because previously the "o" attribute didn't exist. Now you can use the "o" attribute for this purpose.
Example
Here's an example of the V2.0 TXO format. See Schema for the actual specification.
{
"tx": {
"h": <Transaction ID>
},
"blk": {
"i": <Block Height (Index)>,
"h": <Block Hash>,
"t": <Block Time in Unix Time>
},
"in": [ <Input>, <Input>, ..., <Input> ],
"out": [ <Output>, ..., <Output> ],
"lock": <nLocktime>,
"timestamp": <The timestamp at which the transaction was stored (optional)>
}
Level 1: Script Level
The in and out attributes are arrays of input scripts and output scripts.
A script is a sequence of chunks made up of opcodes or data buffers.
1. Input Script
{
"i": <Input script index within the transaction>,
"seq": <nSquence>,
"e": {
"h": <Previous Transaction ID>,
"i": <Previous Output Index>,
"a": <Sender Address (P2PKH)>
},
"s0": <Data buffer chunk at index 0, in UTF8>,
"b0": <Data buffer chunk at index 0, in Base64>,
"h0": <Data buffer chunk at index 0, in Hex>,
"s1": <Data buffer chunk at index 1, in UTF8>,
"b1": <Data buffer chunk at index 1, in Base64>,
"h1": <Data buffer chunk at index 1, in Hex>,
...
"len": <Total chunk length>
}
{
"i": <Input index within the transaction>,
"e": {
"v": <Transferred amount in Satoshis>,
"i": <Output index>,
"a": <Receiver address (P2PKH)>
},
"o0": <Opcode chunk at index 0>,
"s1": <Data buffer chunk at index 1, in UTF8>,
"b1": <Data buffer chunk at index 1, in Base64>,
"h1": <Data buffer chunk at index 1, in Hex>,
"s2": <Data buffer chunk at index 2, in UTF8>,
"b2": <Data buffer chunk at index 0, in Base64>,
"h2": <Data buffer chunk at index 0, in Hex>,
...
"len": <Total chunk length>
}
TXO 2.0 is mostly backwards compatible with TXO 1.0, with several additions.
What's New
b
attribute is ONLY used for base64. Previously, theb
attributes had somewhat of an ambiguous meaning: it could be a base64 representation, but could also mean an Opcode. Nowb
attributes are only used for base64. This brings up a question: How do we represent opcodes?len
attribute.Example
Here's an example of the V2.0 TXO format. See Schema for the actual specification.
Schema
Level 0: Transacton Level
Level 1: Script Level
The
in
andout
attributes are arrays of input scripts and output scripts.A script is a sequence of chunks made up of opcodes or data buffers.
1. Input Script
Here's an example:
2. Output Script
Here's an example:
The text was updated successfully, but these errors were encountered: