kevacoin-project / kevacoin

Kevacoin source tree
https://www.kevacoin.org
MIT License
32 stars 16 forks source link

Valid key/value data types #31

Open d47081 opened 9 months ago

d47081 commented 9 months ago

By decoding raw transactions in kvazar app, found that data types like integer, boolean, null and others available in blockchain

It is a bug of or feature (can't find any documentation)

If that's bug/hole, where no validation available in wallet DTH input, users able to insert any data base58 encoded maybe it's could be the answer to:

https://github.com/kvazar-network/crawler/issues/1 https://github.com/kevacoin-project/kevacoin/issues/24#issuecomment-1946172927

canrnd commented 9 months ago

There is no set data types so a key/value can be anything as long as you can serialize it. This means the application reading/creating the data should handle expectations accordingly weather it be input validations or processing/rendering. While normally not an issue for purpose built applications it does make things tricky for things like explorers if they do not know how data for a namespace is meant to be handled.

canrnd commented 9 months ago

Also in reference to #24 I think what you are seeing as hidden records is a key update when same key is used over again. Core wallet will only provide back the most recent through the namespace commands however if blocks themselves are processed you can reveal the complete history. My explorer goes by blocks and showcases this: https://keva.one/NWn2wUdctLvoatDuqFmcfxEuJmFx9EbSre

I'm unfamiliar with kvazar but at first glance does look like a bug. The transaction decodes for me as namespace: NPRhzHUT8VfSaqwX4ZQvY5bxhsqS8z9NXa key: key4 value: eos

d47081 commented 9 months ago

Thank you for reply,

yes it should work, because binary is also string and finally the data encoded with base58 there

but getting error like could not parse incoming data when trying to send binary with kevaPut using this library tried to play with curl flags but no success and can send the data string encoded to base64 only (that more expensive)

p.s. is your explorer open source?

canrnd commented 9 months ago

The jsonrpc interface expects strings which is why error occurring when binary data passed in. If the input data is binary then base64 going to be needed here to ensure data remains as expected. Although if data coming from a text input you may be able to avoid base64 but would require some validations that could fall back to base64 in event input data can't just be passed in. I haven't built web interface yet to really see what kinda quirks might arise though (my apps so far build raw transactions for processing).

At the moment my explorer hasn't been made open, eventually I will have a variant of it made available to accent my open source wallet but that is a ways off yet. I always happy to share how I've addresses various challenges. If not yet in Kevacoin's Discord it is worth joining for easier dialog https://discord.gg/5zPHhbG