Skip to content
buhtignew edited this page Jul 5, 2020 · 9 revisions

The Slimcoin transaction format is based on Peercoin's format.

A transaction is normally stored in binary format and is displayed by the client in hexadecimal numbers. You can decode it into a human-readable (JSON) format with the decoderawtransaction command. The createrawtransaction command only supports a very basic transaction format. If you want to create more complex types (e.g. OP_RETURN, contracts, etc.) or want to read transactions from the raw blockchain data, you must bother with the hex format.

Note that in all items the bytes are stored in reverse order. For example, if you want to encode a value of 0.01 SLM (which is equivalent to 10000 minimal Slimcoin units - the equivalent of Bitcoin's "Satoshis" -, in hex format: 00 00 00 00 00 00 27 10), it becomes 10 27 00 00 00 00 00 00.

(This is a draft, so it may contain errors or imprecisions.)

A transaction - byte by byte

First part - common to all transactions

  • Transaction version (4 bytes). It is currently 01000000
  • Transaction nTime (4 bytes)
  • Number of inputs (1 byte)

Second part - one by input

  • Output's transaction hash (32 bytes)
  • Number of transaction output (4 bytes)

Third part - coinbase transactions

  • Coinbase transaction ID length (1 byte)
  • Coinbase transaction ID (variable length, defined in previous item)

Third part - other transactions

  • Script length (1 byte)
  • Script (variable length, defined in previous item)

Fourth part: common to all transactions

  • Sequence (4 bytes) (seems to be not used currently, will mostly be FFFFFFFF )
  • Number of outputs (1 byte)

Fifth part - one by output

  • Value (8 bytes). Also called BTCnum in Bitcoin. Take into account that Slimcoin's "granularity" is 0.000001 SLM and not 0.00000001 and that consensus enforces a minimum of 0.01 SLM (plus a 0.01 SLM/kB transaction fee) per output.
  • Scriptsig length (1 byte)
  • Scriptsig (variable length, defined in the previous item)

Sixth part - common to all transactions

  • Block locktime (4 bytes)

Credits

This article is based on the Anatomy of the Genesis Block on the Slimcoin homepage, by Graham Higgins, and Bitcoins the Hard Way, by Ken Shirriff, and own investigations.