Bitcoin Forum
April 26, 2024, 03:59:04 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Electrum: How to generate many recipient addresses?  (Read 273 times)
ericpp (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 2


View Profile
December 21, 2018, 07:16:46 AM
Merited by LoyceV (1)
 #1

Hello,
I'm working on a website project to collect bitcoins (btc); with one address for each payment.

I don't want tu use a third-party supplier to collect btc and want to do it on my own.

http://docs.electrum.org/en/latest/merchant.html shows how to accept btc on a website. This "first solution" seems the best but I don't have technical skeems to do it and would like first to test the project with a simpler and manual system. Then I'll probably ask someone to implement the first solution.

I read how to create two wallets, one of which is a watch only.
This following "second solution" sounds perfect:
-   One offline wallet to generate new btc addresses and hold received btc.
-   One watch only wallet to check received transactions (and latter to create transactions that have to be signed with the offline wallet before being broadcast on the online one).
In the offline wallet (addresses tab), I can see some receiving addresses (virgin = with no history).

My question: ideally without going through lines of code, how to generate many other addresses (everytime I need it, from this offline wallet) and then export them?
If code is necessary, can it be done under windows 10 by a dumy?!

Thanks in advance ;-)
Make sure you back up your wallet regularly! Unlike a bank account, nobody can help you if you lose access to your BTC.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714147144
Hero Member
*
Offline Offline

Posts: 1714147144

View Profile Personal Message (Offline)

Ignore
1714147144
Reply with quote  #2

1714147144
Report to moderator
1714147144
Hero Member
*
Offline Offline

Posts: 1714147144

View Profile Personal Message (Offline)

Ignore
1714147144
Reply with quote  #2

1714147144
Report to moderator
1714147144
Hero Member
*
Offline Offline

Posts: 1714147144

View Profile Personal Message (Offline)

Ignore
1714147144
Reply with quote  #2

1714147144
Report to moderator
Abdussamad
Legendary
*
Offline Offline

Activity: 3598
Merit: 1560



View Profile
December 21, 2018, 10:08:33 AM
 #2

What shopping cart software are you planning on using?
bob123
Legendary
*
Offline Offline

Activity: 1624
Merit: 2481



View Profile WWW
December 21, 2018, 11:20:59 AM
Merited by bitmover (5), mocacinno (1)
 #3

You can use your watch-only (online) wallet to create addresses whenever you need them.

The master public key (xpub) is all what is needed to generate addresses. You don't need to access your offline wallet just to create new receiving addresses.


And to finally answer your question, you can generate X addresses by entering this command into the electrum console:

Code:
for i in range (X): print (wallet.create_new_address(False))


Obviously you have to replace X by the amount of addresses you want to generate.


For a single address:
Code:
print (wallet.create_new_address(False))

rabbitfairferry
Jr. Member
*
Offline Offline

Activity: 49
Merit: 23


View Profile
December 22, 2018, 05:44:12 AM
 #4

You can use your watch-only (online) wallet to create addresses whenever you need them.

The master public key (xpub) is all what is needed to generate addresses. You don't need to access your offline wallet just to create new receiving addresses.


And to finally answer your question, you can generate X addresses by entering this command into the electrum console:

Code:
for i in range (X): print (wallet.create_new_address(False))


Obviously you have to replace X by the amount of addresses you want to generate.


For a single address:
Code:
print (wallet.create_new_address(False))

Also interested. If I create new addresses using your command, is there a possibility that I would generate similar addresses in the future? Just wondering if I should keep track of the addresses generated myself. Thank you.
pooya87
Legendary
*
Offline Offline

Activity: 3430
Merit: 10504



View Profile
December 22, 2018, 10:22:30 AM
 #5

~
Also interested. If I create new addresses using your command, is there a possibility that I would generate similar addresses in the future? Just wondering if I should keep track of the addresses generated myself. Thank you.

since Electrum is an HD wallet that means each time you create a new key pair (a new address) you will use your master key to create it. basically your wallet increases the index of the key and derives a new one. for example if you have already used 10 addresses and request a new one it will give you the 11th address and anytime you wanted to recover you simply generate all 11 addresses again.
although in your wallet when you restore with the master key it automatically checks all addresses from index 0 upwards with a limit for balance so you don't have to worry about these numbers.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
ericpp (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 2


View Profile
December 31, 2018, 02:37:13 AM
Merited by LoyceV (1)
 #6

The emails informing me of replies had gone to spam :-(
Thank you very much.

Searching on Electrum doc, I also finded this: http://docs.electrum.org/en/latest/faq.html#how-can-i-pre-generate-new-addresses
= If you wish to generate more than one address, you can use a “for” loop. For example, if you wanted to generate 50 addresses, you could do this:
for x in range(0, 50): print wallet.create_new_address(False)

> Does it mean the first 50 addresses of the wallet? Or "just" generate 50 new addresses?

I also found something interesting: increase the gap limit.
You can of course force either wallet to generate addresses. The easiest way is to change the gap limit to a higher value. You should read about the gap limit to understand what it means. In short, it's the number of consecutive unused addresses the wallet will generate until it stops looking for transactions. By default, it is 20.
If you increase the gap limit, and actually create "gaps" larger than the default gap limit, you will need to increase the gap limit after you restore from seed again; otherwise some coins will not be found!
Go into the Console tab (View>Show Console), and type:
wallet.change_gap_limit(100)

So I can see 100 addresses or more.
> Do you know how to easily copy all (or selected) addresses (in the clipboard)?

For me it seems to be a better solution: I get as much addresses I want BUT ALSO increase the gap limit (as I'm afraid it will be a problem with my business).
pooya87
Legendary
*
Offline Offline

Activity: 3430
Merit: 10504



View Profile
December 31, 2018, 04:15:31 AM
Merited by LoyceV (1), bones261 (1)
 #7

> Does it mean the first 50 addresses of the wallet? Or "just" generate 50 new addresses?
it creates 50 "new" addresses which means beyond your gap limit.
https://github.com/spesmilo/electrum/blob/664b0c234eca5afec9a7de9c7533cbc41227af14/electrum/commands.py#L658
additionally if you check the source code you can see it is getting the length of your address list and then creates the next one
https://github.com/spesmilo/electrum/blob/664b0c234eca5afec9a7de9c7533cbc41227af14/electrum/wallet.py#L1567-L1580
false is also indicating you are not creating a change address!

Quote
> Do you know how to easily copy all (or selected) addresses (in the clipboard)?
run listaddresses() and it will list all your addresses. then you have to copy them manually.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
ericpp (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 2


View Profile
January 09, 2019, 12:58:44 PM
 #8

Thanks.

About the first solution (http://docs.electrum.org/en/latest/merchant.html = how to accept btc on a website) I hope to use soon:
Still being on my protected machine, I'll export the Master Public Key (xpub).
Then, using the xpub, the read-only wallet will be (re-)created on the server machine.

On my protected machine, I can increase the gap limit (i.e. wallet.change_gap_limit(100)), but what will happen if more than 20 unused addresses are found by Electrum (on the merchant server)?

We'll also have, on the server machine, to do the same (wallet.change_gap_limit(100)) in order Electrum continue to check for incoming payments and acknowledge receipt?

Sorry, it's confused for me.
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!