BlockchainCharlotte / blockchain

A simple Blockchain in Python
MIT License
0 stars 2 forks source link

Implement key value store for persistence. #3

Open fritzhealy opened 6 years ago

fritzhealy commented 6 years ago

I was looking into leveldb as an embedded db, wanted to know peoples though on storing stringified json blocks as value and block num AS key. This would give fast write speed, moderate lookup with variable length block size. Also thought about TokyoCabinet which reportedly has fast lookup and fast sequential writes.

jcopley commented 6 years ago

I was thinking of just using shelve or something to begin with; as long as blockchains are kept in memory for a running node, they need only be written when a block is created and read when a node is initialized.

But I would also suggest that the storage medium would be irrelevant to the protocol itself; maybe use an abstraction layer to save and fetch chains (also node lists and uncommitted xactions), then use a Config file or something to allow nodes to use their own specific data store.