SimpleCoin icon indicating copy to clipboard operation
SimpleCoin copied to clipboard

Move blockchain out of memory

Open cosme12 opened this issue 6 years ago • 8 comments

As blockchain gets bigger, it will be necessary to be moved out of memory. Since this is a simplified version of a blockchain, saving it in a text file may be enough.

cosme12 avatar Jan 14 '18 19:01 cosme12

feather and pandas should do it if we only allow one input to one output transactions.

For more complex transactions, json with a fast json library: http://artem.krylysov.com/blog/2015/09/29/benchmark-python-json-libraries/

kennethgoodman avatar Jan 22 '18 04:01 kennethgoodman

Perhaps TinyDB could be a option? If you don't need concurrent access to the file...

http://tinydb.readthedocs.io/en/latest/

Just store the blockchain in it as a json format...

rdenadai avatar Jan 24 '18 15:01 rdenadai

I would suggest a combination of SQLite/PostgreSQL and SQLAlchemy. Preferably Postgres in production.

I’ve never personally used Feather or Pandas, but I have seen the combo that I’ve suggested used in production by other block chains, and it works more than well.

In my opinion, I don’t believe TinyDB or any flat file option would be efficient enough.

Aareon avatar Feb 01 '18 21:02 Aareon

@Aareon as i said, if concurrent access is not necessary...

I use TinyDB in a project, but since then i need concurrent access to my database so i change it to rethinkdb.

It was a simple migration between both of the, by simple rewriting my DAO class...

Postgresql + SQLAlchemy are always welcome but it brings a new layer of complexy to the project which main goal claims to be simple...

rdenadai avatar Feb 01 '18 22:02 rdenadai

Neither one of those solutions are ACID compliant. I don’t think we want to use something that has a chance of losing data. It may be simpler, but does not by any means mean better. My solution may be more complicated, but it will be much more reliable. If you’re okay with losing data in your ledger, be my guest.

Aareon avatar Feb 01 '18 22:02 Aareon

Right now I can mine between 33-36 blocks, depending on how I choose to handle the Pipes. The limiting factor is the Pipe though, not the size of the blockchain in memory. do a test and don't send information around in pipes. I can handle thousands of them, with pipes, less than 40.

HourGlss avatar Sep 11 '18 17:09 HourGlss

I fixed it using Queue and restructuring the way that multiprocessing works

HourGlss avatar Sep 11 '18 19:09 HourGlss

Implemented a blockchain class which utilizes a sqldatabase https://github.com/hourglss/hourcrypto WORK IS ONGOING, PROJECT IS CURRENTLY nonfunctional.

HourGlss avatar Nov 02 '18 20:11 HourGlss