Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Cryptolator on January 28, 2014, 02:16:03 AM



Title: Simple way to get address balance ?
Post by: Cryptolator on January 28, 2014, 02:16:03 AM
I need to make a simple website that will monitor a list of address balance, what would be the easiest way to gather the information ?

Thanks in advance for you help ! ;)


Title: Re: Simple way to get address balance ?
Post by: Cryptolator on January 28, 2014, 04:47:59 AM
Their must be a simple way to query something and receive the current balance.

I've look everywhere and can't find anything that work :(



Title: Re: Simple way to get address balance ?
Post by: empoweoqwj on January 28, 2014, 04:49:01 AM
Their must be a simple way to query something and receive the current balance.

I've look everywhere and can't find anything that work :(



That's not how bitcoin works, it works on inputs and outputs.


Title: Re: Simple way to get address balance ?
Post by: Cryptolator on January 28, 2014, 04:54:39 AM
Their must be a simple way to query something and receive the current balance.

I've look everywhere and can't find anything that work :(



That's not how bitcoin works, it works on inputs and outputs.

I do understand that, but why is that on Blockchain.info you can get the current balance ?

http://image.bayimg.com/d42b63f83d7bca7dc84e01508e7d26ea910eb53c.jpg


Title: Re: Simple way to get address balance ?
Post by: eternaluniverse on January 28, 2014, 05:14:01 AM
because they created a value for (addressX_input - addressX_output). You can get the balance of specific addresses via client but the way its calculated for everyone is through the blockchain


Title: Re: Simple way to get address balance ?
Post by: Cryptolator on January 28, 2014, 05:22:41 AM
because they created a value for (addressX_input - addressX_output). You can get the balance of specific addresses via client but the way its calculated for everyone is through the blockchain

Ok, but their must be a way to grab the balance by querying blockchain.info ?

By the way thanks for your info, it's really appreciated !


Title: Re: Simple way to get address balance ?
Post by: empoweoqwj on January 28, 2014, 05:25:55 AM
because they created a value for (addressX_input - addressX_output). You can get the balance of specific addresses via client but the way its calculated for everyone is through the blockchain

Ok, but their must be a way to grab the balance by querying blockchain.info ?

By the way thanks for your info, it's really appreciated !


Have you looked through the blockchain API?


Title: Re: Simple way to get address balance ?
Post by: Cryptolator on January 28, 2014, 05:31:37 AM
because they created a value for (addressX_input - addressX_output). You can get the balance of specific addresses via client but the way its calculated for everyone is through the blockchain

Ok, but their must be a way to grab the balance by querying blockchain.info ?

By the way thanks for your info, it's really appreciated !


Have you looked through the blockchain API?

Yes, I think the solution may be:
http://blockchain.info/address/$bitcoin_address?format=json

Which will return this:

{
   "hash160":"660d4ef3a743e3e696ad990364e555c271ad504b",
   "address":"1AJbsFZ64EpEfS5UAjAfcUG8pH8Jn3rn1F",
   "n_tx":17,
   "n_unredeemed":2,
   "total_received":1031350000,
   "total_sent":931250000,
   "final_balance":100100000,
   "txs":[--Array of Transactions--]
}

And then, I isolate the "final_balance" value

Not too sure how to implement it on a website tho, but I think it might be the way to go...



Title: Re: Simple way to get address balance ?
Post by: empoweoqwj on January 28, 2014, 05:39:23 AM
because they created a value for (addressX_input - addressX_output). You can get the balance of specific addresses via client but the way its calculated for everyone is through the blockchain

Ok, but their must be a way to grab the balance by querying blockchain.info ?

By the way thanks for your info, it's really appreciated !


Have you looked through the blockchain API?

Yes, I think the solution may be:
http://blockchain.info/address/$bitcoin_address?format=json

Which will return this:

{
   "hash160":"660d4ef3a743e3e696ad990364e555c271ad504b",
   "address":"1AJbsFZ64EpEfS5UAjAfcUG8pH8Jn3rn1F",
   "n_tx":17,
   "n_unredeemed":2,
   "total_received":1031350000,
   "total_sent":931250000,
   "final_balance":100100000,
   "txs":[--Array of Transactions--]
}

And then, I isolate the "final_balance" value

Not too sure how to implement it on a website tho, but I think it might be the way to go...



There you go :)


Title: Re: Simple way to get address balance ?
Post by: thinkloop on January 28, 2014, 07:59:45 AM
Yes, I think the solution may be:
http://blockchain.info/address/$bitcoin_address?format=json

Which will return this:

{
   "hash160":"660d4ef3a743e3e696ad990364e555c271ad504b",
   "address":"1AJbsFZ64EpEfS5UAjAfcUG8pH8Jn3rn1F",
   "n_tx":17,
   "n_unredeemed":2,
   "total_received":1031350000,
   "total_sent":931250000,
   "final_balance":100100000,
   "txs":[--Array of Transactions--]
}

And then, I isolate the "final_balance" value

Not too sure how to implement it on a website tho, but I think it might be the way to go...

I think you will need to get an api key from blockchain to be able to use that in code: http://blockchain.info/api/api_create_code


Title: Re: Simple way to get address balance ?
Post by: Minthos on January 28, 2014, 08:11:38 AM
because they created a value for (addressX_input - addressX_output). You can get the balance of specific addresses via client but the way its calculated for everyone is through the blockchain

Ok, but their must be a way to grab the balance by querying blockchain.info ?

By the way thanks for your info, it's really appreciated !


Have you looked through the blockchain API?

Yes, I think the solution may be:
http://blockchain.info/address/$bitcoin_address?format=json

Which will return this:

{
   "hash160":"660d4ef3a743e3e696ad990364e555c271ad504b",
   "address":"1AJbsFZ64EpEfS5UAjAfcUG8pH8Jn3rn1F",
   "n_tx":17,
   "n_unredeemed":2,
   "total_received":1031350000,
   "total_sent":931250000,
   "final_balance":100100000,
   "txs":[--Array of Transactions--]
}

And then, I isolate the "final_balance" value

Not too sure how to implement it on a website tho, but I think it might be the way to go...



JSON is javascript. If you know javascript, all you have to do is read the API documentation from blockchain.info and write the code. If you don't know javascript you must learn it :)


Title: Re: Simple way to get address balance ?
Post by: bitpop on January 28, 2014, 10:12:47 AM
Btcbalance.net


Title: Re: Simple way to get address balance ?
Post by: Cryptolator on January 28, 2014, 07:41:31 PM
because they created a value for (addressX_input - addressX_output). You can get the balance of specific addresses via client but the way its calculated for everyone is through the blockchain

Ok, but their must be a way to grab the balance by querying blockchain.info ?

By the way thanks for your info, it's really appreciated !


Have you looked through the blockchain API?

Yes, I think the solution may be:
http://blockchain.info/address/$bitcoin_address?format=json

Which will return this:

{
   "hash160":"660d4ef3a743e3e696ad990364e555c271ad504b",
   "address":"1AJbsFZ64EpEfS5UAjAfcUG8pH8Jn3rn1F",
   "n_tx":17,
   "n_unredeemed":2,
   "total_received":1031350000,
   "total_sent":931250000,
   "final_balance":100100000,
   "txs":[--Array of Transactions--]
}

And then, I isolate the "final_balance" value

Not too sure how to implement it on a website tho, but I think it might be the way to go...



JSON is javascript. If you know javascript, all you have to do is read the API documentation from blockchain.info and write the code. If you don't know javascript you must learn it :)

My JavaScript skills are limited, I think I'll have to hire someone ! :)


Title: Re: Simple way to get address balance ?
Post by: thinkloop on January 28, 2014, 10:02:33 PM
because they created a value for (addressX_input - addressX_output). You can get the balance of specific addresses via client but the way its calculated for everyone is through the blockchain

Ok, but their must be a way to grab the balance by querying blockchain.info ?

By the way thanks for your info, it's really appreciated !


Have you looked through the blockchain API?

Yes, I think the solution may be:
http://blockchain.info/address/$bitcoin_address?format=json

Which will return this:

{
   "hash160":"660d4ef3a743e3e696ad990364e555c271ad504b",
   "address":"1AJbsFZ64EpEfS5UAjAfcUG8pH8Jn3rn1F",
   "n_tx":17,
   "n_unredeemed":2,
   "total_received":1031350000,
   "total_sent":931250000,
   "final_balance":100100000,
   "txs":[--Array of Transactions--]
}

And then, I isolate the "final_balance" value

Not too sure how to implement it on a website tho, but I think it might be the way to go...



JSON is javascript. If you know javascript, all you have to do is read the API documentation from blockchain.info and write the code. If you don't know javascript you must learn it :)

My JavaScript skills are limited, I think I'll have to hire someone ! :)

You looking for something like this: http://jsfiddle.net/thinkloop/XW9AF/


Title: Re: Simple way to get address balance ?
Post by: empoweoqwj on January 29, 2014, 03:47:46 AM
because they created a value for (addressX_input - addressX_output). You can get the balance of specific addresses via client but the way its calculated for everyone is through the blockchain

Ok, but their must be a way to grab the balance by querying blockchain.info ?

By the way thanks for your info, it's really appreciated !


Have you looked through the blockchain API?

Yes, I think the solution may be:
http://blockchain.info/address/$bitcoin_address?format=json

Which will return this:

{
   "hash160":"660d4ef3a743e3e696ad990364e555c271ad504b",
   "address":"1AJbsFZ64EpEfS5UAjAfcUG8pH8Jn3rn1F",
   "n_tx":17,
   "n_unredeemed":2,
   "total_received":1031350000,
   "total_sent":931250000,
   "final_balance":100100000,
   "txs":[--Array of Transactions--]
}

And then, I isolate the "final_balance" value

Not too sure how to implement it on a website tho, but I think it might be the way to go...



JSON is javascript. If you know javascript, all you have to do is read the API documentation from blockchain.info and write the code. If you don't know javascript you must learn it :)

My JavaScript skills are limited, I think I'll have to hire someone ! :)

You should learn it dude - its not hard. Web programming is (often) heavily dependent on .js now


Title: Re: Simple way to get address balance ?
Post by: Cryptolator on January 29, 2014, 04:08:13 AM
because they created a value for (addressX_input - addressX_output). You can get the balance of specific addresses via client but the way its calculated for everyone is through the blockchain

Ok, but their must be a way to grab the balance by querying blockchain.info ?

By the way thanks for your info, it's really appreciated !


Have you looked through the blockchain API?

Yes, I think the solution may be:
http://blockchain.info/address/$bitcoin_address?format=json

Which will return this:

{
   "hash160":"660d4ef3a743e3e696ad990364e555c271ad504b",
   "address":"1AJbsFZ64EpEfS5UAjAfcUG8pH8Jn3rn1F",
   "n_tx":17,
   "n_unredeemed":2,
   "total_received":1031350000,
   "total_sent":931250000,
   "final_balance":100100000,
   "txs":[--Array of Transactions--]
}

And then, I isolate the "final_balance" value

Not too sure how to implement it on a website tho, but I think it might be the way to go...



JSON is javascript. If you know javascript, all you have to do is read the API documentation from blockchain.info and write the code. If you don't know javascript you must learn it :)

My JavaScript skills are limited, I think I'll have to hire someone ! :)

You should learn it dude - its not hard. Web programming is (often) heavily dependent on .js now

I'll give a try ! ;)


Title: Re: Simple way to get address balance ?
Post by: thinkloop on January 29, 2014, 04:23:29 AM
Cryptolator no comment on http://jsfiddle.net/thinkloop/XW9AF/....  :-\


Title: Re: Simple way to get address balance ?
Post by: Cryptolator on January 29, 2014, 04:32:23 AM
Cryptolator no comment on http://jsfiddle.net/thinkloop/XW9AF/....  :-\

What do you mean by "no comment" ?


Title: Re: Simple way to get address balance ?
Post by: thinkloop on January 29, 2014, 04:36:14 AM
Cryptolator no comment on http://jsfiddle.net/thinkloop/XW9AF/....  :-\

What do you mean by "no comment" ?


Isn't the fiddle kinda what you're looking for :)


Title: Re: Simple way to get address balance ?
Post by: Cryptolator on January 29, 2014, 04:37:24 AM
Cryptolator no comment on http://jsfiddle.net/thinkloop/XW9AF/....  :-\

What do you mean by "no comment" ?


Isn't the fiddle kinda what you're looking for :)

Totally !! Thanks for the hint ! I'll play with that ! :P

Thanks !


Title: Re: Simple way to get address balance ?
Post by: flatfly on January 29, 2014, 07:14:02 AM
Why make it complicated?  One-liner:

https://blockchain.info/q/addressbalance/1337sfeChyyzZLzdHLewXzcaAaJSNTM893


Title: Re: Simple way to get address balance ?
Post by: empoweoqwj on January 29, 2014, 10:12:46 AM
Cryptolator no comment on http://jsfiddle.net/thinkloop/XW9AF/....  :-\

What do you mean by "no comment" ?


Isn't the fiddle kinda what you're looking for :)

Totally !! Thanks for the hint ! I'll play with that ! :P

Thanks !

I'm totally lost where this thread has headed ...


Title: Re: Simple way to get address balance ?
Post by: Abdussamad on January 29, 2014, 12:30:41 PM
JSON is not javascript. It's a common data format for use on the web. Most programming languages have json parsing support. For example php, python both have it.

But if you just want the balance you can grab it in plain text format:

https://blockchain.info/q/addressbalance/1337sfeChyyzZLzdHLewXzcaAaJSNTM893?format=json

If you want confirmed balance then see here:

https://blockchain.info/q


Title: Re: Simple way to get address balance ?
Post by: Cryptolator on January 29, 2014, 04:12:36 PM
Cryptolator no comment on http://jsfiddle.net/thinkloop/XW9AF/....  :-\

What do you mean by "no comment" ?


Isn't the fiddle kinda what you're looking for :)

Totally !! Thanks for the hint ! I'll play with that ! :P

Thanks !

I'm totally lost where this thread has headed ...

Why ? The solution he gave me is working fine...


Title: Re: Simple way to get address balance ?
Post by: Cryptolator on January 29, 2014, 04:13:44 PM
JSON is not javascript. It's a common data format for use on the web. Most programming languages have json parsing support. For example php, python both have it.

But if you just want the balance you can grab it in plain text format:

https://blockchain.info/q/addressbalance/1337sfeChyyzZLzdHLewXzcaAaJSNTM893?format=json

If you want confirmed balance then see here:

https://blockchain.info/q

This option does not work, the value given is not the one I'm looking for...


Title: Re: Simple way to get address balance ?
Post by: Cryptolator on January 29, 2014, 04:14:36 PM
Why make it complicated?  One-liner:

https://blockchain.info/q/addressbalance/1337sfeChyyzZLzdHLewXzcaAaJSNTM893

This option does not work, the value given is not the one I'm looking for...


Title: Re: Simple way to get address balance ?
Post by: bitpop on January 29, 2014, 04:17:10 PM
Why make it complicated?  One-liner:

https://blockchain.info/q/addressbalance/1337sfeChyyzZLzdHLewXzcaAaJSNTM893

This option does not work, the value given is not the one I'm looking for...

Then you need to be more open minded and pay us to work.


Title: Re: Simple way to get address balance ?
Post by: Cryptolator on January 29, 2014, 04:25:41 PM
Why make it complicated?  One-liner:

https://blockchain.info/q/addressbalance/1337sfeChyyzZLzdHLewXzcaAaJSNTM893

This option does not work, the value given is not the one I'm looking for...

Then you need to be more open minded and pay us to work.

In fact, this option is working: http://jsfiddle.net/thinkloop/XW9AF/

I'm playing with it right now, but, yes, I'll probably pay someone here if he can do what I want, I've already paid another member here for another project, so I guess that I am already "open minded" :P



Title: Re: Simple way to get address balance ?
Post by: bitpop on January 29, 2014, 04:30:56 PM
Why make it complicated?  One-liner:

https://blockchain.info/q/addressbalance/1337sfeChyyzZLzdHLewXzcaAaJSNTM893

This option does not work, the value given is not the one I'm looking for...

Then you need to be more open minded and pay us to work.

In fact, this option is working: http://jsfiddle.net/thinkloop/XW9AF/

I'm playing with it right now, but, yes, I'll probably pay someone here if he can do what I want, I've already paid another member here for another project, so I guess that I am already "open minded" :P



How exactly is that not working?


Title: Re: Simple way to get address balance ?
Post by: Cryptolator on January 29, 2014, 04:37:57 PM
Why make it complicated?  One-liner:

https://blockchain.info/q/addressbalance/1337sfeChyyzZLzdHLewXzcaAaJSNTM893

This option does not work, the value given is not the one I'm looking for...

Then you need to be more open minded and pay us to work.

In fact, this option is working: http://jsfiddle.net/thinkloop/XW9AF/

I'm playing with it right now, but, yes, I'll probably pay someone here if he can do what I want, I've already paid another member here for another project, so I guess that I am already "open minded" :P



How exactly is that not working?

Like I said, it Is working.

But to be clear on what I need I'll be more specific.
I want to have a list of address on a website, and you'll have three possible states for each of the address: "not funded" , "partially funded" and "fully funded", those states will be based on a predefined value, for exemple, "1 bitcoin" so it will need a database that will contain the address and value.

Ideally I would like to be able to have a search box where I can enter the first 8 char of the address and list the full address and the states.

Hope that make my intentions clearer ! :)



Title: Re: Simple way to get address balance ?
Post by: rnp on January 29, 2014, 04:43:24 PM
I've been playing around trying to make it Client-Side here:

http://rabidnerd.com/bitcoin/coinbalance.php

Only BTC works because the others don't have CORS enabled (even Litecoin)...

It's incredibly messy right now with comments and such.. And really is very early.

Obviously Bitcoin doesn't exactly work this way, wallet balance is more valuable than address balance, but I was bored.

Very cool jsFiddle btw.. For some reason I couldn't get the JSON to work (I think I tried before I put the CORS), so I went old-school and parsed it. I also did the received-sent in order to try to get it to work on other currencies.. But without CORS they're useless.


Title: Re: Simple way to get address balance ?
Post by: thinkloop on January 29, 2014, 07:08:17 PM
Why make it complicated?  One-liner:

https://blockchain.info/q/addressbalance/1337sfeChyyzZLzdHLewXzcaAaJSNTM893

This option does not work, the value given is not the one I'm looking for...

Then you need to be more open minded and pay us to work.

In fact, this option is working: http://jsfiddle.net/thinkloop/XW9AF/

I'm playing with it right now, but, yes, I'll probably pay someone here if he can do what I want, I've already paid another member here for another project, so I guess that I am already "open minded" :P



How exactly is that not working?

Like I said, it Is working.

But to be clear on what I need I'll be more specific.
I want to have a list of address on a website, and you'll have three possible states for each of the address: "not funded" , "partially funded" and "fully funded", those states will be based on a predefined value, for exemple, "1 bitcoin" so it will need a database that will contain the address and value.

Ideally I would like to be able to have a search box where I can enter the first 8 char of the address and list the full address and the states.

Hope that make my intentions clearer ! :)

Cryptolator are you trying to spread out your btc in 1 btc increments between differing addresses, and trying to build this system to manage that? Is this for privacy/security?


Title: Re: Simple way to get address balance ?
Post by: Cryptolator on January 30, 2014, 05:34:04 AM
Why make it complicated?  One-liner:

https://blockchain.info/q/addressbalance/1337sfeChyyzZLzdHLewXzcaAaJSNTM893

This option does not work, the value given is not the one I'm looking for...

Then you need to be more open minded and pay us to work.

In fact, this option is working: http://jsfiddle.net/thinkloop/XW9AF/

I'm playing with it right now, but, yes, I'll probably pay someone here if he can do what I want, I've already paid another member here for another project, so I guess that I am already "open minded" :P



How exactly is that not working?

Like I said, it Is working.

But to be clear on what I need I'll be more specific.
I want to have a list of address on a website, and you'll have three possible states for each of the address: "not funded" , "partially funded" and "fully funded", those states will be based on a predefined value, for exemple, "1 bitcoin" so it will need a database that will contain the address and value.

Ideally I would like to be able to have a search box where I can enter the first 8 char of the address and list the full address and the states.

Hope that make my intentions clearer ! :)

Cryptolator are you trying to spread out your btc in 1 btc increments between differing addresses, and trying to build this system to manage that? Is this for privacy/security?

Not exactly, but that's close, can't really talk about it right now...