1

I'm using bcoin and it's class FullNode to run a full Bitcoin Node. Here's the configuration:

const node = new bcoin.FullNode({
        prefix: '/mnt/d/bcoin',
        network: 'testnet',
        indexTX: true,
        indexAddress: true
});

And then I start the node with this code, identical to the one they use in their official example.

(async () => {
        await node.open()
        await node.connect();

        node.on('connect', (entry, block) => {
                console.log('%s (%d) added to chain.', entry.rhash(), entry.height);
        });

        node.on('tx', (tx) => {
                 console.log('%s added to mempool.', tx.txid());
         });

        node.startSync();
})().catch((err) => {
        console.error(err.stack);
        process.exit(1);
});

It seems to be working fine, I get notifications of the blocks added in the console. the program crashes once in a while to the lack of memory, however, I found a fix to that. The progress of sync seems to never be saved, however. If I were to restart the app when it's on 1,000,000 blocks in (testnet) - the sync will start over. The files are created in the /mnt/d/bcoin folder and it's already 10 GB in size. In comparison to the official bitcoin node - it always carries on the sync that's already in progress. I have never been able to finish the inital blockchain download with bcoin because I run it in my PC and it always fails for various reasons. So is it expected behavior for bcoin to reset its IBD progress every time? Would it read the existing block files after IBD?

1 Answer 1

1

I think the configuration you are missing is

memory: false

See the default full node application script here: https://github.com/bcoin-org/bcoin/blob/cec3c3e788834d3e9fc3c0b21bc3e340d573dcfd/bin/node#L31

By default, bcoin objects (like chain and walletDB) run in memory.

So actually I'm curious what is taking up the 10GB in that directory? Could it be data from a previous run with a different configuration? There could be a bug, but just looking at the script you have posted here, I would expect the Full Node to run entirely in memory and therefore start over on each execution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.