TransWikia.com

Is there a reference about format of transaction?

Monero Asked on August 24, 2021

Is there a document provides the details of the structure of a transaction. And it provides every item’s space also.

For example:

"version": 1 bytes
"unlock_time": 1 bytes
"vin"...

I have checked the CRYPTONOTE STANDARD but I don’t think it fits the real Monero transactions..

Please help answer it, many thanks!

2 Answers

Beyond the somewhat dated CN doc you referenced, and if you need more specifics, the best resource is really the code. For example, you can see that the tx prefix is serialized (src):

BEGIN_SERIALIZE()
  VARINT_FIELD(version)
  if(version == 0 || CURRENT_TRANSACTION_VERSION < version) return false;
  VARINT_FIELD(unlock_time)
  FIELD(vin)
  FIELD(vout)
  FIELD(extra)
END_SERIALIZE()

Then just look at the BEGIN_SERIALIZE... for the sub-fields, such as the FIELD(vout) is defined as std::vector<tx_out> vout; and tx_out being (src), and so on. It's not terribly difficult when you get the hang of it.

As @koe mentioned, Zero2Monero also gives a fairly up-to-date overview. As he also points out, it's not "fixed" so to speak, which is why I'd advise to get comfortable navigating the code definitions, as outlined above.

Correct answer by jtgrassie on August 24, 2021

this is v1 structure

version 01 unlock time (varint, height, 60 here) 3c vin length (value in) 01 vin #1 (of 1) type (gen, 0xff) ff height for gen input 00 vout length (value out) 01 output #1 (of 1) amount (17592186044415 as varint) ffffffffffff03 output #1 type (to key, 0x02) 02 output #1 key (32 bytes) 9b2e4c0281c0b02e7c53291a94d1d0cbff8883f8024f5142ee494ffbbd088071 extra length in bytes (varint, here 33) 21 extra pubkey tag (0x01) 01 transaction pubkey (32 bytes) 7767aafcde9be00dcfd098715ebcf7f410daebc582fda69d24a28e9d0bc890d1

for v11,v12 u need to add some bytes behind tx pubkey to describe rct version etc.

someone else can help.

Answered by qmqpasq on August 24, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP