[quote=“glv, post:3, topic:2923”]It is probably not the easiest solution, but you could use FuzzyBear’s explorer (PHP) with the current master branch of Peerunity (which contains the getrawtransaction RPC).
did you finish writing the db to couch? out of interest what was the size of the final db? also couch and mongo are good for reading data, not so good for writing data at same time, so reading the BC would be fine but how it update to the latest block? is this something we need to investigate further for better optimisation?
[quote=“FuzzyBear, post:7, topic:2923”]did you finish writing the db to couch? out of interest what was the size of the final db? also couch and mongo are good for reading data, not so good for writing data at same time, so reading the BC would be fine but how it update to the latest block? is this something we need to investigate further for better optimisation?
fuzzy, I was away for a few days. I’ll update you as soon as I can find time for this.
I think that block chain data is quite easy to write into any database, as any action on the blockchain comes with home made identifier.
So… I’ve written the whole testnet blockchain into a CouchDB Database.
File size: roughly 1.6 GB.
As a next step, I’m planning to write a database proxy for fuzzys blockexplorer so most of the load goes to Couchdb.
Let me say why this is particularly important for testnet: I’ve seen a few blocks with over 10.000 transactions in them. Processing just one of those fat blocks with all of it’s transactions is really CPU intensive. Using a database like Couch/Mongo, the decoding is already done and only the delivery needs to be done.
Peerunityd will write new blocks into the database. Nothing more. The rest is planned to be done by the database server. The implementation for confirmed transactions is quite simple, as the software only needs to compare the current block count with the blocks counted in the database.
Unconfirmed Transactions are a bit more tricky though. I think I’ll postpone implementing those, so you will only be able to check confirmed blocks/transactions through the proxy at first. Any ideas how to easily integrate unconfirmed transactions?
You can get the hashes of the unconfirmed transactions with the ‘getrawmempool’ RPC, and then decode them with ‘getrawtransaction’.
So one way to integrate unconfirmed transactions could be to have a table in the database to put them, and each time a new block is found, wipe the unconfirmed transactions table clean, write the new block in the database, and refill the unconfirmed transactions table with the new mempool (and update it regularly).