0

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!

  • 1
    The closest I know about is section 6.3 of ZtM2, and Appendix A. As I understand it, the 'structure of a transaction' isn't 'fixed'. Depending where you look, it has a different representation. Examples: how a tx is packaged to send from a user to a node and then between nodes, how a tx is packaged for manipulation in code, how a tx is stored in the database. I'm not an expert on those areas of the infrastructure though. – koe Jul 2 at 17:35
2

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.

| improve this answer | |
0

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.

| improve this answer | |
  • 1
    SE does have formatting tools, please make use of them. – jtgrassie Jul 3 at 1:36
  • 1
    THis is not real answer. qmqpasq above describe v1 coinbase transaction. Can anyone else describe v12? Thnx. – maroon Jul 3 at 6:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.