output is spent (e.g. if appear in "vin" to some other transaction), I store an indicator.
Now single block is processed for 1-2 sec.
Implication of this is,
if you want to check address balance, you will need to check each "input" and to compile list of unspent inputs.
Still unsure if this is best way to go.
Update 1
I finally upload the software in github here:
https://github.com/nmmmnu/BlockchainWalker
Update 2
Here are how keys looks like if we want to find the balance for address "1EoMoJK3FJPHg4EwrP31zPVu4iLqmCtQ6":
127.0.0.1:2000> HGETALL a:1EoMoJK3FJPHg4EwrP31zPVu4iLqmCtQ6
1) "a:1EoMoJK3FJPHg4EwrP31zPVu4iLqmCtQ6:28c76c9d89f23c1b1f5435d8f4bb5cc66e6cb9d0798f1f0f4293faaac88fb7d0.0"
2) "0.01270199"
This is funding transaction:
- 28c76c9d89f23c1b1f5435d8f4bb5cc66e6cb9d0798f1f0f4293faaac88fb7d0, output 0
This is value:
Then we need to check if this is spent, so we check each input as follows:
127.0.0.1:2000> get t:28c76c9d89f23c1b1f5435d8f4bb5cc66e6cb9d0798f1f0f4293faaac88fb7d0.0:s
"055bd8148143c5b05bc2808ccafe54be43b292381449d41cc23462d02d3f85d8"
Transaction 055bd8148143c5b05bc2808ccafe54be43b292381449d41cc23462d02d3f85d8, is the transaction where this output is spent.
As each output is spent this means the address 1EoMoJK3FJPHg4EwrP31zPVu4iLqmCtQ6 have balance of zero.
In case we want to check / list a transaction "055bd8148143c5b05bc2808ccafe54be43b292381449d41cc23462d02d3f85d8", we can do:
127.0.0.1:2000> HGETALL t:055bd8148143c5b05bc2808ccafe54be43b292381449d41cc23462d02d3f85d8
1) "t:055bd8148143c5b05bc2808ccafe54be43b292381449d41cc23462d02d3f85d8.-:i:28c76c9d89f23c1b1f5435d8f4bb5cc66e6cb9d0798f1f0f4293faaac88fb7d0.0"
2) "1"
3) "t:055bd8148143c5b05bc2808ccafe54be43b292381449d41cc23462d02d3f85d8.-:i:39edb8741b701b6da2dbc4e02290e8e78cba244bdbad96da203e41ee2704c525.0"
4) "1"
5) "t:055bd8148143c5b05bc2808ccafe54be43b292381449d41cc23462d02d3f85d8.0:o"
6) "1Kj76Sxe8c3UK85RAQwwdqScAxaBwAY2eb:0.00500000"
7) "t:055bd8148143c5b05bc2808ccafe54be43b292381449d41cc23462d02d3f85d8.0:s"
8) "49f8bd582439a3b2351f92e0fdb5fcb1032acd42e3ab469c16d805627889ce14"
9) "t:055bd8148143c5b05bc2808ccafe54be43b292381449d41cc23462d02d3f85d8.1:o"
10) "14yAJga4ZkULbaMz4LUW5vj8GhQYyzCPoW:0.01118727"
11) "t:055bd8148143c5b05bc2808ccafe54be43b292381449d41cc23462d02d3f85d8.1:s"
12) "edf55ace1396229c7a91a4b21cd63293c631ae2ddcc5987402b04ed540b9e5d8"
Those "t:xxxxx.-:i:xxxx" are inputs.
Those "t:xxxxx.N:o" are outputs
Those "t:xxxxx.N:s" are indicators, if output is spent or not.
Please note this is not Redis, it is database I developing that have Redis interface. You can check it here:
https://github.com/nmmmnu/HM4
How do you handle blockchain reorgs? – Jakub Fedyczak – 2017-09-14T18:37:32.003
honestly, no idea what this is. By try and error, I did this code: https://github.com/nmmmnu/BlockchainWalker/blob/master/blockchainwalker.php#L121 , it handles all transactions so far, tried 07-2017 to 08-2017, then beginning to end of 2016
– Nick – 2017-09-14T18:47:59.563I also handle transactions with wrong addresses like 71bbaef28e09d8d6fadd41f053db7768dbb5fa4570f06b961dfc29db3dc00b1d – Nick – 2017-09-14T18:48:32.677