bcoin-org/bcoin

watch mempool only

roccomuso opened this issue · 7 comments

Is there a way to watch for mempool txs only?

I tried to play with the basic example but I don't see any ŧx event fired.

I'm only getting these errors log:

[info] (net) Error: Verification failure: premature-version2-tx (code=nonstandard score=0 hash=74690760027760a6eefd7ad80d9d316a910506b2aca812873c26d61a608535f9)

PS: I did not sync the chain as I don't need that. I only want to see the mempool incoming txs.

Thanks

Mempool does not work if chain is not synced. How else is it supposed to verify whether incoming TXs are even valid?

The tx event will only fire when a TX is added to the mempool, so invalid transactions will not be emitted.

Got it.

Is there a way to have a lite sync or emit all txs (even invalid ones)?

I saw in the examples that a sync could be done in memory:

// Create a blockchain and store it in memory.
const blocks = bcoin.blockstore.create({
  memory: true
});

Is it syncing the whole chain in memory? or just some headers? it looks unfeasible to me.

Bcoin is not designed to emit TX it can not validate. And currently Bitcoin as a protocol has no "fast sync" mode. You can run bcoin in memory, and might fully sync in pruning mode, but it won't save that much time and if you stop the process for any reason you will lose all data and verification progress.

What are you trying to do here ultimately?

If you are just building and testing something I highly recommend using regtest mode instead of main net. There is nothing to sync! And generating blocks is easy locally.

What are you trying to do here ultimately?

I just want to get mainnet incoming transactions in real-time. I don't need to validate them.

And I was wondering if this could be done without fully syncing the chain

I just want to get mainnet incoming transactions in real-time. I don't need to validate them.

Yes you do actually ;-)

And I was wondering if this could be done without fully syncing the chain

No.

Well. Technically you could modify a node to output all p2p messages directly from the network manager instead of the mempool. It would be like running Bitcoin through Wireshark and just logging all tx messages. But I feel like that data can't be useful without validation.

Consider this as resolved