Bitcoin Forum
May 11, 2024, 11:51:01 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Import New Address BitcoinCore Without Rescan  (Read 133 times)
deceive3w (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
September 06, 2020, 11:48:45 AM
 #1

i am have external wallet with hdwallet every time user create new address i am call JSON rpc import address this is not efficient because that is new address
The forum was founded in 2009 by Satoshi and Sirius. It replaced a SourceForge forum.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715428261
Hero Member
*
Offline Offline

Posts: 1715428261

View Profile Personal Message (Offline)

Ignore
1715428261
Reply with quote  #2

1715428261
Report to moderator
bob123
Legendary
*
Offline Offline

Activity: 1624
Merit: 2481



View Profile WWW
September 06, 2020, 12:20:58 PM
 #2

Core is also a HD wallet.
Why would you create an address outside of core, just to import it into core afterwards?

You are right, that's definitely not efficient.
What wallet are you using to generate the addresses? Electrum? If so, then why do you import them into core?

deceive3w (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
September 06, 2020, 01:40:16 PM
 #3

i am using bitcoinjs to generate address that's on my backend server. since i am new using bitcoin node i am insecure to import my private key. i am using bitcoin node just for get all my balances and matching my unspent with my backend
bob123
Legendary
*
Offline Offline

Activity: 1624
Merit: 2481



View Profile WWW
September 06, 2020, 01:52:08 PM
 #4

i am using bitcoinjs to generate address that's on my backend server. since i am new using bitcoin node i am insecure to import my private key. i am using bitcoin node just for get all my balances and matching my unspent with my backend

Since i don't know how your backend works, a general how-to would be:
  • Have the xpriv backed up offline
  • Use the xpub on an online server go generate addresses on-the-fly
  • Assign addresses generated from the xpub to customers and save that in the database
  • Use walletnotify and blocknotify with core to check for new blocks/transactions and update database entries based on that (e.g. customer has paid, transaction has X confirmations, ...)

You don't need to import private keys into core.
Either use cores HD wallet or only use core to check for transactions.

gmaxwell
Moderator
Legendary
*
expert
Offline Offline

Activity: 4172
Merit: 8419



View Profile WWW
September 06, 2020, 03:08:31 PM
Merited by LoyceV (6), ABCbits (2), Husna QA (1)
 #5

i am using bitcoinjs to generate address

FWIW, bitcoinjs has several times had bugs where it would generate incorrect pubkeys which no one could sign for. Personally I would be extremely wary about using it for any serious application.

Most other implementations of bitcoin's crypto are extremely scary-- e.g. contain very little to no testing, had no rigorous review, were subject to no formal validation, are not implemented in a fault tolerant way, and are (IMO) unfit for high value usage compared to Bitcoin Core.

I'm aware of at least one non-public incident where over 10,000 BTC was lost due to less thoughtfully created "HD wallet" crypto code generating bad pubkeys.

I would strongly suggest that at a minimum to implement a redundant check of some sort.  Bitcoin core signs and verifies a message after generating each key.

When you import an address you can set a flag to force it to not rescan-- see the help for importmulti. So long as you're sure that you import it before any use was possible there is no need to rescan.
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!