Bitcoin Forum
May 06, 2024, 11:30:26 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 [2]  All
  Print  
Author Topic: Get all Bitcoin Addresses with balance >= 0.00000001  (Read 8128 times)
DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4616



View Profile
February 18, 2015, 07:37:14 PM
 #21

But can you guys just confirm if what I said in the other post is correct?
Quote
so like this I will be able to fetch all Bitcoin used addresses EVER on the mainnet, right?
Is this assumption correct?

If you create a well written process to get all blocks, and process all transactions from all blocks, you should be able to fetch all output scripts ever used on the mainnet.  Note that most of the output scripts will be addresses, but many won't be.  It will be up to you to decide how you want to handle output scripts that do not represent bitcoin addresses.
1714995026
Hero Member
*
Offline Offline

Posts: 1714995026

View Profile Personal Message (Offline)

Ignore
1714995026
Reply with quote  #2

1714995026
Report to moderator
1714995026
Hero Member
*
Offline Offline

Posts: 1714995026

View Profile Personal Message (Offline)

Ignore
1714995026
Reply with quote  #2

1714995026
Report to moderator
1714995026
Hero Member
*
Offline Offline

Posts: 1714995026

View Profile Personal Message (Offline)

Ignore
1714995026
Reply with quote  #2

1714995026
Report to moderator
The Bitcoin software, network, and concept is called "Bitcoin" with a capitalized "B". Bitcoin currency units are called "bitcoins" with a lowercase "b" -- this is often abbreviated BTC.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714995026
Hero Member
*
Offline Offline

Posts: 1714995026

View Profile Personal Message (Offline)

Ignore
1714995026
Reply with quote  #2

1714995026
Report to moderator
1714995026
Hero Member
*
Offline Offline

Posts: 1714995026

View Profile Personal Message (Offline)

Ignore
1714995026
Reply with quote  #2

1714995026
Report to moderator
newIndia
Legendary
*
Offline Offline

Activity: 2198
Merit: 1049


View Profile
February 18, 2015, 09:06:11 PM
 #22

Hi everyone,

How can I get a list of all Bitcoin addresses with the current balance >= 0.00000001?

I already searched for many ways, including coding, but I get nowhere.

Any ideas?

Thanks

If you want to set aside the technical nitty-gritty and directly get to your job done, then this site might be helpful.

www.phpbitadmin.com

Thread: https://bitcointalk.org/index.php?topic=874266.0

nuno12345
Sr. Member
****
Offline Offline

Activity: 276
Merit: 284


View Profile
February 18, 2015, 09:25:03 PM
 #23

- snip -
Second approach.
1-Setup bitcoind.
2-Set txindex=1 and rescan the blockchain.
3-Get latest block with getblockcount.
4-Use getblockhash block_number to get it's hash.
5-Use getblock hash to get that block transactions.
6-Parse every transaction with getrawtransaction hash 1 (1 for verbose).
7-Get the vout address of each transaction and add to sql.
8-Run a query to delete duplicates.
9-Use blockchain.info api to get each address balance.
10-If balance > desired_amount drop the address from the new sql table.
11-Done.
- snip -

- snip -
Btw isn't there a way to calculate the Balance somehow with your second option? (without doing blockchain.info API requests)

Yes.

Step 6 and 7 are incorrect.

getrawtransaction will return a hex representation of the raw transaction.  Here's an example of transaction ID 62886d0b5e7e88981839afb6996010d149f934f30a04f428456cd5e10a772846

Code:
010000000102651693fc8811883bd5f4a90d9825f1bc18a55ad9026264bcfc1e63a6b7f089000000006a4730440220673be38060c769b260ba9b0d0bee89fc0f9db1a3dbf09060c43adc499c082d7a02202aabd0eea4ee119c04234dee43c3543426fbd23547252e52fd4496d06b2e1fd4012102bc2af3ca047923b71f4e1d2aae0564ea97d0ec86f1aa7f4c2d4fb2acc3f9fe75ffffffff02411fc605000000001976a914c08407401f334b9e936391fee7753ea9bb45613688aca4688e00000000001976a914892f2d2752a0dc59f59be9ddffe56bccdd0440bc88ac00000000

Then if you run decoderawtransaction on that raw data, you'll get a json object with the data parsed out.  Here's an example of that same transaction:

Code:
{
    "txid" : "cc4aa7b2a873515edf55167126fb18919a67abb5f3cac35cd48c1e2b834c3edc",
    "version" : 1,
    "locktime" : 0,
    "vin" : [
        {
            "txid" : "89f0b7a6631efcbc646202d95aa518bcf125980da9f4d53b881188fc93166502",
            "vout" : 0,
            "scriptSig" : {
                "asm" : "30440220673be38060c769b260ba9b0d0bee89fc0f9db1a3dbf09060c43adc499c082d7a02202aabd0eea4ee119c04234dee43c3543426fbd23547252e52fd4496d06b2e1fd401 02bc2af3ca047923b71f4e1d2aae0564ea97d0ec86f1aa7f4c2d4fb2acc3f9fe75",
                "hex" : "4730440220673be38060c769b260ba9b0d0bee89fc0f9db1a3dbf09060c43adc499c082d7a02202aabd0eea4ee119c04234dee43c3543426fbd23547252e52fd4496d06b2e1fd4012102bc2af3ca047923b71f4e1d2aae0564ea97d0ec86f1aa7f4c2d4fb2acc3f9fe75"
            },
            "sequence" : 4294967295
        }
    ],
    "vout" : [
        {
            "value" : 0.96870209,
            "n" : 0,
            "scriptPubKey" : {
                "asm" : "OP_DUP OP_HASH160 c08407401f334b9e936391fee7753ea9bb456136 OP_EQUALVERIFY OP_CHECKSIG",
                "hex" : "76a914c08407401f334b9e936391fee7753ea9bb45613688ac",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [
                    "1JYvuKZmqyyn8MTaTSwCQ6CrcJfcLGAruM"
                ]
            }
        },
        {
            "value" : 0.09332900,
            "n" : 1,
            "scriptPubKey" : {
                "asm" : "OP_DUP OP_HASH160 892f2d2752a0dc59f59be9ddffe56bccdd0440bc OP_EQUALVERIFY OP_CHECKSIG",
                "hex" : "76a914892f2d2752a0dc59f59be9ddffe56bccdd0440bc88ac",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [
                    "1DWN69tNjUQJv3QeJMHVLSJfHXXr2QusST"
                ]
            }
        }
    ]
}

You can see here that the transaction defines an array inputs that are being spent "vin" and an array of new unspent of outputs that are being created "vout".

This particular transaction creates 2 outputs identified by "n".

Output 0 contains 0.96870209 BTC (identified by "value") and is associated with address 1JYvuKZmqyyn8MTaTSwCQ6CrcJfcLGAruM.
Output 1 contains 0.09332900 BTC and is associated with address 1DWN69tNjUQJv3QeJMHVLSJfHXXr2QusST.

This particular transaction also spends 1 previously unspent output from transaction 89f0b7a6631efcbc646202d95aa518bcf125980da9f4d53b881188fc93166502.  The "vout" in the "vin" indicates that it was the output from the transaction that had "n":0

Therefore, your program can remove output 0 of transaction 89f0b7a6631efcbc646202d95aa518bcf125980da9f4d53b881188fc93166502 from it's list of unspent outputs. And can add two new outputs (0 and 1) of transaction cc4aa7b2a873515edf55167126fb18919a67abb5f3cac35cd48c1e2b834c3edc to it's list of unspent outputs.

Once your program is done running, it can just dump the list of addresses from it's list of unspent outputs and remove any duplicate addresses.

I think you read it to fast.
Code:
./bitcoind getrawtransaction ed1669565811c974e91acb8b8697631b3685825c72479473ce8d7e4e1c278229
0100000001f1afcb6e6d8878e119536413bc3b125a4381148f6da88b89364389eea8340af3010000008b483045022100994d4df845cdfee5cb5987b9d9ec0fa72e9a47256765c1c44cc2f5b5ff1146ea02205280f9ecf845223a1125d8b8ec8eec7e1edabcb4bdc3cf6a9912e305f5f56093014104bcbb6be87e5a87e66275f5864793db6c61d36143fac54a32314fa62c3197baf72e27ae44dd4d4c115c9ef757758c3b35ed1b4b9506e6c0026ca373cdb85652b1ffffffff0210270000000000001976a914540b4a2870d17ed12498681729ff1c63a042b4a788acd0871e2f000000001976a914fcacbd98c748153a6cf08d8f2a38babf2ea1946f88ac00000000

Code:
./bitcoind getrawtransaction ed1669565811c974e91acb8b8697631b3685825c72479473ce8d7e4e1c278229 1
{
    "hex" : "0100000001f1afcb6e6d8878e119536413bc3b125a4381148f6da88b89364389eea8340af3010000008b483045022100994d4df845cdfee5cb5987b9d9ec0fa72e9a47256765c1c44cc2f5b5ff1146ea02205280f9ecf845223a1125d8b8ec8eec7e1edabcb4bdc3cf6a9912e305f5f56093014104bcbb6be87e5a87e66275f5864793db6c61d36143fac54a32314fa62c3197baf72e27ae44dd4d4c115c9ef757758c3b35ed1b4b9506e6c0026ca373cdb85652b1ffffffff0210270000000000001976a914540b4a2870d17ed12498681729ff1c63a042b4a788acd0871e2f000000001976a914fcacbd98c748153a6cf08d8f2a38babf2ea1946f88ac00000000",
    "txid" : "ed1669565811c974e91acb8b8697631b3685825c72479473ce8d7e4e1c278229",
    "version" : 1,
    "locktime" : 0,
    "vin" : [
        {
            "txid" : "f30a34a8ee894336898ba86d8f1481435a123bbc13645319e178886d6ecbaff1",
            "vout" : 1,
            "scriptSig" : {
                "asm" : "3045022100994d4df845cdfee5cb5987b9d9ec0fa72e9a47256765c1c44cc2f5b5ff1146ea02205280f9ecf845223a1125d8b8ec8eec7e1edabcb4bdc3cf6a9912e305f5f5609301 04bcbb6be87e5a87e66275f5864793db6c61d36143fac54a32314fa62c3197baf72e27ae44dd4d4c115c9ef757758c3b35ed1b4b9506e6c0026ca373cdb85652b1",
                "hex" : "483045022100994d4df845cdfee5cb5987b9d9ec0fa72e9a47256765c1c44cc2f5b5ff1146ea02205280f9ecf845223a1125d8b8ec8eec7e1edabcb4bdc3cf6a9912e305f5f56093014104bcbb6be87e5a87e66275f5864793db6c61d36143fac54a32314fa62c3197baf72e27ae44dd4d4c115c9ef757758c3b35ed1b4b9506e6c0026ca373cdb85652b1"
            },
            "sequence" : 4294967295
        }
    ],
    "vout" : [
        {
            "value" : 0.00010000,
            "n" : 0,
            "scriptPubKey" : {
                "asm" : "OP_DUP OP_HASH160 540b4a2870d17ed12498681729ff1c63a042b4a7 OP_EQUALVERIFY OP_CHECKSIG",
                "hex" : "76a914540b4a2870d17ed12498681729ff1c63a042b4a788ac",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [
                    "18fPHXzsSXhQMkLfSGkwv2Ej7iBEFFVyPi"
                ]
            }
        },
        {
            "value" : 7.90530000,
            "n" : 1,
            "scriptPubKey" : {
                "asm" : "OP_DUP OP_HASH160 fcacbd98c748153a6cf08d8f2a38babf2ea1946f OP_EQUALVERIFY OP_CHECKSIG",
                "hex" : "76a914fcacbd98c748153a6cf08d8f2a38babf2ea1946f88ac",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [
                    "1Q32Da2aCdmVsb5MUBDxLc7aBAa1AtTbq4"
                ]
            }
        }
    ],
    "blockhash" : "0000000000000000017e0f51248c20e040fa09ecae948ff1510f08566feb4d9d",
    "confirmations" : 164,
    "time" : 1424207400,
    "blocktime" : 1424207400
}

Code:
getrawtransaction	<txid> [verbose=0]	version 0.7 Returns raw transaction representation for given transaction id.	N
DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4616



View Profile
February 18, 2015, 09:31:33 PM
 #24

- snip -
I think you read it to fast.
- snip -
Code:
getrawtransaction	<txid> [verbose=0]	version 0.7 Returns raw transaction representation for given transaction id.	N

Nah.  I was just unaware of the verbose flag on getrawtransaction.  I'm not sure if I simply missed the fact that it was added in version 0.7, or if I learned about it and then forgot.
Rintila (OP)
Newbie
*
Offline Offline

Activity: 36
Merit: 0


View Profile
February 18, 2015, 11:03:14 PM
 #25

But can you guys just confirm if what I said in the other post is correct?
Quote
so like this I will be able to fetch all Bitcoin used addresses EVER on the mainnet, right?
Is this assumption correct?

If you create a well written process to get all blocks, and process all transactions from all blocks, you should be able to fetch all output scripts ever used on the mainnet.  Note that most of the output scripts will be addresses, but many won't be.  It will be up to you to decide how you want to handle output scripts that do not represent bitcoin addresses.

Ok then all is clear for now, I will put some code to check the length of the string or something.

Thanks to all
Pages: « 1 [2]  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!