Bitcoin Forum
May 04, 2024, 10:21:13 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Bitcoin core node with watch-only [electrum generated]  (Read 214 times)
BuySomeBitcoins (OP)
Sr. Member
****
Offline Offline

Activity: 434
Merit: 253



View Profile
January 20, 2019, 07:30:00 PM
Last edit: February 22, 2019, 04:55:14 PM by BuySomeBitcoins
Merited by ABCbits (1)
 #1

Greetings,


Let's say I want to use bitcoin core full node to programmatically interact via RPC with a watch only wallet.

That watch only wallet has been generated from a MULTI-SIG (3-of-5) Electrum client, where one signature could be a Trezor, another signature a Ledger and a 3rd one a simple xpriv on an HSM.

Is it possible to directly interact with that watch-only wallet directly from bitcoin-core cli / RPC  : to get new address, get address balance and other stuff ??

Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714861273
Hero Member
*
Offline Offline

Posts: 1714861273

View Profile Personal Message (Offline)

Ignore
1714861273
Reply with quote  #2

1714861273
Report to moderator
1714861273
Hero Member
*
Offline Offline

Posts: 1714861273

View Profile Personal Message (Offline)

Ignore
1714861273
Reply with quote  #2

1714861273
Report to moderator
BuySomeBitcoins (OP)
Sr. Member
****
Offline Offline

Activity: 434
Merit: 253



View Profile
January 20, 2019, 08:02:00 PM
 #2

Yes, it's possible if you add each address with importaddress/importpubkey, but beware that by default it will rescan whole blockchain which took few minutes.


Adding an address after another is counter-productive, plus I need to generate them automatically on a server-side machin in the first place. That's why I seek to import the wallet master public key once, then generate addresses from it.

I can't find the "importpubkey" parameter in the documentation you've attached by the way and the search bar of that website does not seems to work.

Thank you.
BuySomeBitcoins (OP)
Sr. Member
****
Offline Offline

Activity: 434
Merit: 253



View Profile
January 20, 2019, 08:34:08 PM
 #3

Thank you for your reply,

I think it's not possible at all to import the watch-only wallet, even if Bitcoin core does support multi-sig wallets AND watch-only wallets, it will very unlikely support a watch only wallet with 5 xpubs.

I will dive a bit into the importaddress parameter, and write a python script to compute/generate addresses from those 5 public keys.


Does Bitcoin Core support notification when I add an address via importaddress parameter ? whenever I google a feature it's either removed from recent version or will be, quite frustrating.
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3388
Merit: 6581


Just writing some code


View Profile WWW
January 20, 2019, 09:08:44 PM
Merited by ABCbits (1)
 #4

You cannot import extended public or private keys into Bitcoin Core.

You can import the addresses that you would like to watch using the importaddress or importmulti commands. You should still see notifications for transactions to and from watch only addresses. To be able to see watch only balances and transactions using RPC, you will need to set the watch_only parameters to true for the commands that have that (e.g. getbalance, fundrawtransaction, etc).

BuySomeBitcoins (OP)
Sr. Member
****
Offline Offline

Activity: 434
Merit: 253



View Profile
January 20, 2019, 09:50:47 PM
 #5

You can import the addresses that you would like to watch using the importaddress or importmulti commands. You should still see notifications for transactions to and from watch only addresses. To be able to see watch only balances and transactions using RPC, you will need to set the watch_only parameters to true for the commands that have that (e.g. getbalance, fundrawtransaction, etc).

But there is no parameter to automatically get the bitcoin-cli to notify me whenever one of the watched addresses receives a payment ? Do I have to make a query to get balances after every new block is found ?


achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3388
Merit: 6581


Just writing some code


View Profile WWW
January 21, 2019, 12:23:30 AM
Merited by suchmoon (4)
 #6

But there is no parameter to automatically get the bitcoin-cli to notify me whenever one of the watched addresses receives a payment ? Do I have to make a query to get balances after every new block is found ?
You can start Bitcoin Core (bitcoind) with the -walletnotify=<cmd> option where <cmd> is a command that you want Bitcoin Core to execute every time a new transaction to the wallet is received. Read the help (start with -help option) for more info on how to use it.

BuySomeBitcoins (OP)
Sr. Member
****
Offline Offline

Activity: 434
Merit: 253



View Profile
January 21, 2019, 01:03:56 AM
 #7

But there is no parameter to automatically get the bitcoin-cli to notify me whenever one of the watched addresses receives a payment ? Do I have to make a query to get balances after every new block is found ?
You can start Bitcoin Core (bitcoind) with the -walletnotify=<cmd> option where <cmd> is a command that you want Bitcoin Core to execute every time a new transaction to the wallet is received. Read the help (start with -help option) for more info on how to use it.


Perfect, that's exactly what I needed and I found a thread discussing this feature : https://bitcointalk.org/index.php?topic=1442574.0

Edit : Per this thread, one can even add the -walletnotify parameter in the config file : https://bitcoin.stackexchange.com/questions/24457/how-do-i-use-walletnotify

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!