sagivo / accept-bitcoin

Accept bitcoin payments using Node.js
http://bit.ly/accept-bitcoin
Apache License 2.0
159 stars 51 forks source link

Question: Recover from boot and waiting for too many keys? #6

Open hems opened 7 years ago

hems commented 7 years ago

I'm wondering once the application is restarted how can i still listen events for the payments that are still not finished?

Using the example from the help file:

key = ac.generateAddress({alertWhenHasBalance: true});
console.log("Hello buyer! please pay to: " + key.address());
key.on('hasBalance', function(amount){
  console.log("thanks for paying me " + amount); //do stuff
  key.transferBalanceToMyAccount(function(err, d){
    if (d.status === 'success') console.log("Cool, the bitcoins are in my private account!");
  });
});

And assuming a new key is generated when i run

key = ac.generateAddress({alertWhenHasBalance: true});

Once the application restarts how am i supposed to retrieve the addresses that still didn't receive any BTC and wait for them to be paid?

Also let's say a bunch of users never pay and the application is never restarted and i end up with a whole lot of "keys" waiting for "hashBalance" how would that impact the performance of the application?

Thank You for this amazing library!

gametesterco commented 6 years ago

Is there any news on this? Looks like the library is dead.

hems commented 6 years ago

@gametesterco it seems this is not being updated or issues answered, so perhaps using a 3rd party api or another library would be the way to go //=

sagivo commented 6 years ago

@gametesterco @hems sorry i have no time recently to maintain this repo, please feel free to submit PR if you need a change.