threefoldfoundation / tfchain

Official implementation of the ThreeFold blockchain
https://explorer.threefoldtoken.com
Apache License 2.0
13 stars 7 forks source link

agree on standard prefixes used for arbitrary data in order to know how to interpret it #204

Closed GlenDC closed 5 years ago

GlenDC commented 6 years ago

Currently the arbitrary data is a wild west, which is great, and that option should remain open.

However, it might be nice, to also on top of this wild west support an alternative world where one can indicate by using a prefix what kind of arbitrary data it is, so it is known how to interpret it.

Given arbitrary data can only be 83 bytes long in total, we would have to keep this prefix as minimal as possible.

The tfchain node code would ignore this "standard", but we could document it, and also have our user explorer projects (e.g. the official web explorer) support this standard.

GlenDC commented 5 years ago

Friday I'm in the office in the morning. Perhaps if we're all there, we could brainstom there quickly and come to a solution, might be the most efficient way of resolving this issue.

GlenDC commented 5 years ago

In SiaEncoding we use 8 bytes for the arb. data, yet we only use 1 byte for the length. Therefore we can support an optional type by hiding it in those 8 bytes without encoding it. Not sure if 1 byte is enough, seems to me like that should be OK, if so, we can support and it and start with 0==aplication-defined and 1==utf-8`, leaving room for 253 other types.

For RivineEncoding we would I guess just add a 1 byte after the length, given that for now we don't have anything done in RivineEncoding related to arbitrary data, we can still make such decisions.