Bitcoin Forum
April 16, 2024, 07:49:54 PM *
News: Latest Bitcoin Core release: 26.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Receiving address generated by `bitmerchant` doesn't show in Electrum.  (Read 87 times)
c.slednev (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 3


View Profile
March 16, 2022, 04:24:16 AM
Merited by OmegaStarScream (3)
 #1

Hey everybody.

I generated receiving address using `bitmerchant`
Here is how I did it using the example from official website:

Code:
root# python
Python 3.9.9 (main, Dec 21 2021, 10:03:34)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from bitmerchant.wallet import Wallet
>>> w=Wallet.deserialize('xpub661MyMwAqRbcFciEbeqHfsrGpXYWCL1NPNjop7W5XQR79ZHJqLCPVn9BcJDJeFzkTuDNPGZ5zg5Qhp1X4WLDUpRsFro86KTqPR9pYY6sfzm')
>>> w.create_new_address_for_user(2).to_address()
'17cKY31xCa9gzmEF8Fn82HpA1YtAn56kCp'

After it, I sent from my Electrum wallet to the `17cKY31xCa9gzmEF8Fn82HpA1YtAn56kCp` 0.0001BTC.
here is the transaction that confirm that transfer was success.

But on my Electrum I didn't find the income on the History tab (only exchange income) and there is no address `17cKY31xCa9gzmEF8Fn82HpA1YtAn56kCp` in the Address tab.

Is there a way to receive these generated addresses automatically and notification/information directly in Electrum? I would like to generate these addresses on my website side and manage BTC on my laptop through Electrum.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1713296994
Hero Member
*
Offline Offline

Posts: 1713296994

View Profile Personal Message (Offline)

Ignore
1713296994
Reply with quote  #2

1713296994
Report to moderator
pooya87
Legendary
*
Offline Offline

Activity: 3416
Merit: 10487



View Profile
March 16, 2022, 05:45:15 AM
 #2

The derived address you posted is the third address at m/ whereas Electrum standard wallet (P2PKH addresses) are derived at m/0.
You have to find a way to feed the derivation path to your code so that you get correct keys.
Code:
m/2 -> 17cKY31xCa9gzmEF8Fn82HpA1YtAn56kCp
m/0/2 -> 1KoyfEmjmmuhGLeMPJe2XmZx5UzNcMk2uh

P.S. The better idea is to use Electrum itself instead of a third party library.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
nc50lc
Legendary
*
Offline Offline

Activity: 2380
Merit: 5475


Self-proclaimed Genius


View Profile
March 16, 2022, 06:48:15 AM
Merited by pooya87 (2)
 #3

Is there a way to receive these generated addresses automatically and notification/information directly in Electrum? I would like to generate these addresses on my website side and manage BTC on my laptop through Electrum.
Try Electrum's merchant wallet: https://electrum.readthedocs.io/en/latest/merchant.html
Basically, you'll have to run a watching-only Electrum daemon on your website's server and from there, you can create payment requests containing addresses.

bitmerchant is a bad idea since the project is long abandoned as the warnings in their repo state.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
Abdussamad
Legendary
*
Offline Offline

Activity: 3598
Merit: 1560



View Profile
March 16, 2022, 11:19:20 AM
Merited by nc50lc (2)
 #4

You can derive the corresponding private key by going to the console tab (view menu > show console if it isn't visible) and typing in this code:

Code:
from electrum import bip32 as bip32
from electrum import bitcoin as bitcoin
mk=bip32.BIP32Node.from_xkey(getmasterprivate())
mkderived=mk.subkey_at_private_derivation("m/2")
bitcoin.serialize_privkey(mkderived.eckey.get_secret_bytes(), True, "p2pkh")

You may be asked to enter your password at some point in this process.

Then you copy what it spits out to the clipboard (p2pkh:...) and either sweep the private key (will cost you fees) or create an imported private key wallet with it:

https://bitcoinelectrum.com/sweeping-your-private-keys-into-electrum/
https://bitcoinelectrum.com/importing-your-private-keys-into-electrum/
c.slednev (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 3


View Profile
March 17, 2022, 09:33:57 AM
 #5

Hey everybody.

I generated receiving address using `bitmerchant`
Here is how I did it using the example from official website:

Code:
root# python
Python 3.9.9 (main, Dec 21 2021, 10:03:34)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from bitmerchant.wallet import Wallet
>>> w=Wallet.deserialize('xpub661MyMwAqRbcFciEbeqHfsrGpXYWCL1NPNjop7W5XQR79ZHJqLCPVn9BcJDJeFzkTuDNPGZ5zg5Qhp1X4WLDUpRsFro86KTqPR9pYY6sfzm')
>>> w.create_new_address_for_user(2).to_address()
'17cKY31xCa9gzmEF8Fn82HpA1YtAn56kCp'

After it, I sent from my Electrum wallet to the `17cKY31xCa9gzmEF8Fn82HpA1YtAn56kCp` 0.0001BTC.
here is the transaction that confirm that transfer was success.

But on my Electrum I didn't find the income on the History tab (only exchange income) and there is no address `17cKY31xCa9gzmEF8Fn82HpA1YtAn56kCp` in the Address tab.

Is there a way to receive these generated addresses automatically and notification/information directly in Electrum? I would like to generate these addresses on my website side and manage BTC on my laptop through Electrum.
The derived address you posted is the third address at m/ whereas Electrum standard wallet (P2PKH addresses) are derived at m/0.
You have to find a way to feed the derivation path to your code so that you get correct keys.
Code:
m/2 -> 17cKY31xCa9gzmEF8Fn82HpA1YtAn56kCp
m/0/2 -> 1KoyfEmjmmuhGLeMPJe2XmZx5UzNcMk2uh

P.S. The better idea is to use Electrum itself instead of a third party library.

First of all, I would like to say thank you all for your replies.

I have additional questions:
1) What is `m/0/2` and `/m/2` what is the different and how did you get it?
2) That way, could I use `bitmetchant` pythonic library and receive bitcoins generated by the library in my "second" bitcoin wallet created by `Abdussamad` suggestions?
3) How many addresses I could generate and see in the wallet? 1000 ?
Thanks in advance!
Abdussamad
Legendary
*
Offline Offline

Activity: 3598
Merit: 1560



View Profile
March 17, 2022, 11:19:14 AM
Merited by pooya87 (2)
 #6

1. m/0/2 is the derivation path. see  bip32:

https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki

You can derive an entire hierarchy of key pairs and addresses from a seed and the derivation path denotes where in the tree your particular key pair/address are.

2. No you can't since I've only shown you how to derive the one private key. You better use electrum in watch only mode and use the electrum command line interface to derive addresses. on linux `electrum help` should show you the command line options.

3. Electrum gets slow when you have a lot of addresses and you have to be mindful of the gap limit as well.  The gap limit is the number of unused addressses that electrum keeps track of. By default it is just 20. So if you need thousands of adddresses you may be better of using bitcoin core
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!