Data Transaction

Hi all,

We’re going to release data transaction on mainnet shortly.

A data transaction contains a number of key-value pairs that are recorded into the blockchain and become part of state. The values are tied to the account that authored the transaction, and are readable from both REST API and smart contract code. It is possible to overwrite values by publishing another transaction that provides another value for the same key. We currently don’t plan to have a way to delete a key-value pair.

Keys are arbitrary UTF8-encoded strings, so they can include punctuation, national alphabet characters, white space etc. Max key length is 100 characters.

Values are of one of 4 types: integer (8 bytes), boolean (1 byte), variable-length string (UTF8 encoded), and variable length byte array (max 32k bytes).

Transaction fee is 0.001 WAVES per kilobyte of data.

Here’s a (somewhat outdated) technical note

One decision to be made is how to encode binary arrays in JSON. Base58 is too slow for large arrays, so we’re thinking of using base16 or base64. Pros and cons:

  • base64: widely used, supported in every developer stack
    but: almost indistinguishable from Base58
  • base16: used in Ethereum, easy to tell from Base58
    but: less supported, produces longer strings

Comments are welcome!

1 Like

Base16 is used in Ethereum and they use only base16, their addresses also in base16. In our case, we can make our API more consistent also with base64. Base16 looks absolutely different and may be confusing. IMHO.

1 Like

Thanks @ikardanov – based on that and feedback from the discord channel, let’s choose base64. To avoid mixing up 64 and 58, we’ll require base64 strings to have a “base64:” prefix.

We plan a few other changes to Data transaction shortly:

  • Add a fourth data type, string, for a UTF8 encoded string. Strings may be useful as a more readable alternative to byte arrays.
  • Increase max size of byte arrays to 32k. The existing limit of 1k was found to be too restrictive.

Plus, we’ll probably use base64 for scripts (such as in SetScript and Issue transactions) as well as for data. Scripts may be large, using base58 for them is wasteful.

3 Likes

Any update on when data transaction will be added to the Mainnet? Also, the link to the technical note is broken. Thanks!

It’s been activated on Mainnet a couple days ago.
Fixed the link, thanks!

1 Like

:+1::metal: thanks!!!