aisland-dao / docsig

Document Signing on Blockchain
Apache License 2.0
1 stars 1 forks source link

M1.4 - Storage on Chain #31

Closed poseidon-aisland closed 1 year ago

poseidon-aisland commented 1 year ago

Documents Storage - We will optionally store on-chain the signed contracts. We wish to give immutability of whole document even if it's little bit more expensive. Actually the MVP is storing only the hash of the document and keeping the document in the server storage. The pallet will be modified to accept the storage of an encrypted binary blob with some limitations in size to be configured in the pallet itself. We will add 2 functions to the current pallet: newBlob(id,documentdata), deleteBlob(id)

poseidon-aisland commented 1 year ago

rocksdb is the underlying db engine in substrate,here the limits for key and value: In general, RocksDB is not designed for large keys. The maximum recommended sizes for key and value are 8MB and 3GB respectively.

poseidon-aisland commented 1 year ago

we could divide in chunks of 100K maximum and compute the gas fees properly for the size stored

poseidon-aisland commented 1 year ago

the data structure may be: { document_id: uint chunk_id: uint documentdata: blob }

poseidon-aisland commented 1 year ago

Set the correct weight for the data stored: https://substrate-developer-hub.github.io/substrate-how-to-guides/docs/weights/conditional-weight-struct

poseidon-aisland commented 1 year ago
poseidon-aisland commented 1 year ago

unit tests have been completed.