Ethereumjs noob here. Using the code below, I'm able to create a new blockchain and add blocks to it. But the blocks are not being saved to the database.

var blockdb = levelup("./blockdb", {createIfMissing: true});
var blockchain = new Blockchain({"blockDB": blockdb, "validate": false})

blockchain.getHead(function (err, head) {

    var myblock = blockFromRpc(blockdata);

    blockchain.putBlock(myblock, function(a,b) {


This seems to work fine. But when I try reloading the blockchain with the same DB's as above, it's empty. How do I save the blockchain with the added blocks?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.