3

I have a use-case where I'd only need to be monitoring the mempool transactions and recently-committed blocks/transactions (the last month's worth of blocks would be sufficient). Is there a way to tell bitcoinjs to not store the whole blockchain, but start from most current instead?

I could create my own "Storage" object for the server that doesn't write anything if the block is older than a month, but I'm pretty sure it would still try to download the whole blockchain every time it connected.

Or is there an even more lightweight bitcoin p2p node implementation that gives this sort of functionality?

(Usage Details: the use case for this is an ecommerce solution; the seller creates a new one-time use payment address (it's never been used before, so we don't care about the whole blockchain history) and tells the user to make a payment to it. Now the back end starts monitoring the bitcoin p2p network for an incoming (unconfirmed) transaction. At that point the site can tell the user the first step of ordering is complete, and move them to a "pending orders" page which long-polls for confirmations on those spends. Recent blocks would be used to track confirmations, and once confirmed, wouldn't be needed any more.)

4
  • If you don't have the entire blockchain, then the unconfirmed transaction could come from a double-spend, or indeed an address that has no bitcoins to send. I imagine you would be waiting for confirmation before providing whatever you are selling, but it is something to be aware of Commented Apr 29, 2013 at 18:24
  • Right; as I mentioned, this would just be for a visual indicator on the site that the user did the first step correctly. The order would still wait for confirmations before sending. Commented Apr 30, 2013 at 11:22
  • Do you really need to use BitcoinJS? Why not just poll blockchin.info API? E.g. https://blockchain.info/address/...?format=json will show you if there any transactions for the address. Commented Mar 3, 2014 at 19:24
  • I'm guessing you're gonna refuse using a Payment Processor. You should consider using a SPV wallet, but it is quite dangerous as you lose privacy and your users may be able to mount a doublespend attack against you quite easily. Otherwise, run a full node with prune mode, then storage will not be a problem.
    – rny
    Commented Dec 1, 2016 at 10:56

0

Your Answer

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

Browse other questions tagged or ask your own question.