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.)

  • 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 – George Pearce Apr 29 '13 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. – MidnightLightning Apr 30 '13 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. – max taldykin Mar 3 '14 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. – renlord Dec 1 '16 at 10:56

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.