stacks.js icon indicating copy to clipboard operation
stacks.js copied to clipboard

Allow to put arbitrary JSON to DHT while updating

Open aagorelik opened this issue 10 years ago • 3 comments

Trying to do blockstack update <my.id> '<json>', but constantly recieving Zonefile data is invalid.

That json is arbitrary and as it supposed from docs, it shall be accepted by Blockstack.

But, due to this code: https://github.com/blockstack/blockstack-cli/blob/9a5493b95add8d224c94f5163d0507e6ce29e8d4/blockstack_client/actions.py#L830 it is not working that way

aagorelik avatar Aug 19 '16 02:08 aagorelik

super needed feature :) or is it a some sort of bug? Or is it a team decision to limit format of zonefile?

aagorelik avatar Aug 19 '16 03:08 aagorelik

Hi @aagorelik

Have you considered using the set_profile command? It lets you set arbitrary JSON, but instead of writing the hash to the blockchain (which update does), it uses the data private key in your wallet to sign the JSON and replicate it. The data public key lives in the zonefile (whose hash is written to the blockchain), and the CLI will automatically fetch the zonefile, get the public key, and verify the signature on the profile JSON. This way, you get the same end-to-end authenticity guarantee as writing the JSON's hash to the blockchain, but without the expense.

The underlying design philosophy is to minimize the number of blockchain writes. The zonefile is only meant to store pointers (URLs) to profile data, and to establish the public key for other users to use to verify profiles. It can also be used to store hashes of data stored elsewhere, but it's not really meant to store data (in fact, the size is limited to 4KB).

The reason for keeping zonefiles small and limited in scope is that it makes it much easier to keep them widely-replicated. Blockstack servers try to maintain a 100% replica of all zonefiles in existence, so they know where to refer clients to for data. But in order to do this effectively and securely, zonefiles have to be kept small and simple.

Hope this clarifies things!

jcnelson avatar Aug 19 '16 04:08 jcnelson

This has been fixed in 0.14.0. The hash can refer to any data as long as its smaller than 4K (however, if the data is not a zonefile, then the profile-level commands for lookups, accounts, storage, etc. will not work). However, the server and client will no longer prevent you from using arbitrary data.

jcnelson avatar Oct 30 '16 19:10 jcnelson