Bitcoin Forum
May 25, 2024, 09:43:32 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Questions for developing application for bitcoin  (Read 141 times)
Jessica432 (OP)
Newbie
*
Offline Offline

Activity: 16
Merit: 1


View Profile
September 26, 2018, 09:24:23 AM
 #1

I am new to bitcoin world. I want to set up a local bitcoin full running node and develop my Node JS code talks to node, and provides web api for:
1) Getting balance for any bitcoin address
2) Doing a transfer of bitcoins from any account to any other account. (It may need private key of sender for transfer)

I tried bitcoin core earlier, but seems I can not get balance of any address there.

I will really appreciate any pointers how can I achieve this.

Thanks,
Jessica
aleksej996
Sr. Member
****
Offline Offline

Activity: 490
Merit: 389


Do not trust the government


View Profile
September 26, 2018, 10:32:33 AM
 #2

In order to get balance for an address that isn't in your wallet in Bitcoin Core, you need to import it first and do a rescan of the blockchain.

You can use importaddress command for this, which will by default do a rescan automatically once the address is imported, unless specified otherwise in an argument.

Furthermore, when checking the balance of an address with getbalance command, you need to set include_watchonly argument to true, in case you imported an address without importing it's private keys.
Jessica432 (OP)
Newbie
*
Offline Offline

Activity: 16
Merit: 1


View Profile
September 27, 2018, 12:19:23 AM
 #3

In order to get balance for an address that isn't in your wallet in Bitcoin Core, you need to import it first and do a rescan of the blockchain.

Can above be done programmatically? If yes, would it slow down the execution significantly?
NeuroticFish
Legendary
*
Offline Offline

Activity: 3682
Merit: 6406


Looking for campaign manager? Contact icopress!


View Profile
September 27, 2018, 06:28:57 AM
 #4

While researching I've found this "Bitcoin transaction explorer" code.
What caught my eyes and may be interesting for this topic was:
Quote
If this explorer is run on top of a node that has an address index such as this one: https://github.com/btcdrak/bitcoin/tree/addrindex-0.11 then this explorer will be able to look up the balance of an address and show every output associated with it.
The problem is that I didn't understand that "address index" part, nor what's at that link. However, it can be a direction...

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
Pages: [1]
  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!