0

I want create a program that receives payments via bitcoin and sends them to other addresses. I'm going to generate unique address for each payment, then check if there are transactions with outputs for that address. When the required amount of bitcoins is received, I'm going to make a new transaction for the receiver addresses.

The question is, is it necessary to store the full blockchain on disk? Could I just query other nodes for newly generated blocks after the specific hash and check transactions in these blocks? That specific hash could be fetched from the blockchain explorer. Moreover, if the new block is generated every 10 minutes, is it enough to check new blocks every 10 minutes? Should I also check different nodes to ensure that the blocks are the same?

1 Answer 1

0

The question is, is it necessary to store the full blockchain on disk?

No, it is not required.

Could I just query other nodes for newly generated blocks after the specific hash and check transactions in these blocks?

No you can't arbitrarily query nodes like a database -- unless you are referring to a block explorer API.

For reference purposes you can look at a project I did called NoNodePay with the purpose to allow someone to accept bitcoin payments on shared hosting without a node or having to sign up with an API service. Again just a reference point, it has bugs.

1
  • By "query other nodes" I mean using getheaders or getblocks RPC call with a known hash of the last block. That hash could be fetched from the block explorer only once. Then use getdata to get transactions. Isn't it possible? I think that's how the blockchain is normally downloaded
    – AlexGlass
    Mar 20, 2022 at 2:04

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.