Comments (7)
Thanks for your help
from libbitcoin-client.
It would be helpful if you could clarify "real time", since "all Bitcoin addresses" are a vast amount of historical data.
from libbitcoin-client.
In other words, if something has happened in the distant past, "real time" isn't a meaningful concept.
from libbitcoin-client.
"realtime" here:
I need to update my list of bitcoin addresses with positive balance just any address balance turned to zero or a new address got non-zero balance, as soon as possible.
It was better to say: I need a list of bitcoin addresses with non-zero balance which updates if any address balance is changed or new address got balance.
from libbitcoin-client.
That's helpful.
To obtain balances for all addresses, you need to query all addresses. There is an index of all addresses, with payments and therefore balance. You can query any address to obtain its balance. However there is no query to obtain all addresses. The only way to obtain all addresses is to query all transactions (which means all blocks).
Getting real-time changes is straightforward, you just subscribe to confirmed blocks or transactions. You will however have to handle the case of reorganization, since blocks/transactions can become unconfirmed.
from libbitcoin-client.
In Version3 you can query only standard addresses, basically p2sh and p2pkh. Version4 will support query for any type of payment, with or without any address format. But given your requirements, I would not query for addresses at all, I would simply query all blocks and then subscribe to new blocks (which includes reorgs).
I would then maintain a database of output scripts with an entry for each input and output against that script. To obtain balance you would simply run a summary query against each unique output script.
Note that for inputs this means obtaining the corresponding output script. This is done by querying for the transaction output that is referenced by the input. This is also easily accomplished using a transaction query.
Reorgs remove existing entries from the table. You would need to maintain the transaction hash for all entries to make this possible.
For standard payments (i.e. ones that actually have addresses) you can compute the address from the script and store it in the table. But not all transfers correspond to addresses.
from libbitcoin-client.
Note that libbitcoin's store is indexed for the purpose of validating the chain (i.e. as a node) to support mining and wallet queries. Its additional payments index exists so that, given an address, one can query for all payments to/from that address (and therefore may also obtain balance). This provides support for block explorers and SPV wallets.
Arbitrary queries against blockchain data (such as all addresses with a certain balance) require a general purpose query engine or creation of a custom index for each query.
from libbitcoin-client.
Related Issues (20)
- send_request failures suppressed by client API
- Build Fails early HOT 1
- Detect disconnect and terminate poller. HOT 1
- Refactor client to simplify architecture using new protocol lib. HOT 2
- Missing spends when using blockchain_fetch_history3 for P2SH HOT 32
- duplicate HOT 1
- Build fails due to package installation HOT 3
- Uncaught exception of type std::overflow_error: addition HOT 42
- [master] Test failures HOT 2
- Wrong mulitisig verification on duplicate signatures HOT 5
- Compile errors: cannot include bitcoin.hpp and client.hpp HOT 17
- [master] unused variable warnings. HOT 3
- [master] test failures. HOT 5
- Network test failures. HOT 1
- No Diagnostic Output and No Response From Server HOT 3
- Refactor the client implementation to mirror server.
- libbitcoin-client zmq binding fails. Undefined symbols for architecture x86_64 HOT 1
- libbitcoin-client build fails looking for removed "output_point" HOT 3
- Access to pre 2.0 libbitcoin source HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libbitcoin-client.