Author

Topic: List addresses! (Read 1511 times)

legendary
Activity: 3710
Merit: 1586
January 14, 2018, 01:26:28 AM
#13
This thread is old. Use addrequest with the --force option to get unused addresses: https://bitcointalksearch.org/topic/m.27959367 . Use it in a loop if you want lots of addresses.
newbie
Activity: 1
Merit: 0
January 13, 2018, 04:32:32 PM
#12
Electrum 3.04, command doesn't work (syntax error)
full member
Activity: 162
Merit: 109
January 04, 2017, 05:42:15 AM
#11
I saw sources of electrum-ltc ( https://github.com/pooler/electrum-ltc/blob/master/lib/wallet.py#L1431 ) and changed line to:
Code:
print "\n".join(i for i in wallet.get_receiving_addresses() if len(wallet.history.get(i,{})) == 0)
Now it works! Smiley
full member
Activity: 162
Merit: 109
January 04, 2017, 05:36:21 AM
#10
Code:
print "\n".join(i for i in wallet.addresses() if len(wallet.history.get(i,{})) == 0 and not wallet.is_change(i))

This doesn't work in Electrum 2.7.12
Code:
>> print "\n".join(i for i in wallet.addresses() if len(wallet.history.get(i,{})) == 0 and not wallet.is_change(i))
Traceback (most recent call last):
AttributeError: 'Standard_Wallet' object has no attribute 'addresses'
Sad
copper member
Activity: 242
Merit: 12
June 18, 2014, 01:15:17 PM
#9
Excellent !

I love this Community !

Thank you guys & especially DABURA!
sr. member
Activity: 475
Merit: 252
June 18, 2014, 06:38:42 AM
#8
Any ideas?

EDIT:
Here, I made a one line command window command that will generate a number of addresses for you that are related to your seed. combine it with two other lines (3 commands in a row) to get the addresses you want.

1. set an array called "addy" (line 1)
2. change the 50 in range(0,50) to tell the number of addresses you want to generate. However, from that number, any addresses with a history will be removed in the 3rd step. Also, the 0 can be changed to pick a staring point. (0 is first address, 1 is second address, 2 is third address, etc.)
3. just run the third line as is. It will print out all the addresses that don't have a tx history.
(Remember, don't copy over the ">>" when inputting)

Code:
>> addy = []
>> for i in range(0,50): addy.append(bitcoin.public_key_to_bc_address(('04' + '%064x' % (bitcoin.ecdsa.ellipticcurve.Point(bitcoin.ecdsa.ecdsa.curve_secp256k1, int(wallet.storage.get('master_public_key')[:64],16), int(wallet.storage.get('master_public_key')[64:],16), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141L) + (int(bitcoin.Hash("%d:%d:"%(i,0) + wallet.storage.get('master_public_key').decode('hex')).encode('hex'),16) * bitcoin.ecdsa.ellipticcurve.Point(bitcoin.ecdsa.ecdsa.curve_secp256k1, 0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798L, 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8L, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141L))).x() + '%064x' % (bitcoin.ecdsa.ellipticcurve.Point(bitcoin.ecdsa.ecdsa.curve_secp256k1, int(wallet.storage.get('master_public_key')[:64],16), int(wallet.storage.get('master_public_key')[64:],16), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141L) + (int(bitcoin.Hash("%d:%d:"%(i,0) + wallet.storage.get('master_public_key').decode('hex')).encode('hex'),16) * bitcoin.ecdsa.ellipticcurve.Point(bitcoin.ecdsa.ecdsa.curve_secp256k1, 0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798L, 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8L, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141L))).y()).decode('hex')))
>> print "\n".join(i for i in addy if len(wallet.history.get(i,{})) == 0)




VVV---OLD---VVV

Code:
print "\n".join(i for i in wallet.addresses() if len(wallet.history.get(i,{})) == 0 and not wallet.is_change(i))

Paste this into your console and it will only list addresses with 0 transaction history AND that are NOT CHANGE ADDRESSES.
NOTE: THIS WILL NOT LIST ADDRESSES WITH TRANSACTION HISTORY, EVEN WITH 0 BALANCE.

Notice the number of addresses listed will = your gap_limit. So before using the above command, use:

Code:
wallet.storage.put('gap_limit', XX)

1. Replace XX with the number of addresses you wish to generate, and then restart Electrum.
2. Run the "print "\n".join..." command
3. Copy the list that comes out of the console.

I think that electrum's console doesn't have a limit to the number of lines that can be displayed, but if you have any problems let me know.
copper member
Activity: 242
Merit: 12
June 18, 2014, 05:23:35 AM
#7
Any ideas?
copper member
Activity: 242
Merit: 12
June 17, 2014, 12:09:08 PM
#6
My main goal is to get a list of all unused addresses from my Electrum in a way that I can copy and paste them without doing that manually Smiley

Excellent would be if I were able to output them to a csv or simple textfile.

Or simply generate a specific amount of new addresses (50) and export these into a text file.

Of course they all belong to the same wallet and its seed & master public key.

With "unused" I mean -> receiving addresses that did not receive anything at all yet.
sr. member
Activity: 475
Merit: 252
June 17, 2014, 11:35:28 AM
#5
Another solution would be to just generate 50 new addresses and show them to me.

What is your definition of "new"?

Do you mean new addresses that are NOT a part of your seed?

If you want addresses that are a part of your seed, then what is your idea of "new"?

One that is not showing in the receive tab?

One that has not been used before? But is it ok if it's been shown on the receive tab before?



I think maybe it would be better to tell us what you want to do rather than asking how to make addresses.
copper member
Activity: 242
Merit: 12
June 17, 2014, 11:10:56 AM
#4
Thank you for your thorough answers Smiley


Still it is a lot to repeat manually.

Another solution would be to just generate 50 new addresses and show them to me.

How can I do this?
legendary
Activity: 3710
Merit: 1586
June 17, 2014, 10:41:39 AM
#3
He wants only unused addresses. listaddresses will show all main account addresses including used ones.

Edit:
I think you have to combine listaddresses with getaddresshistory. Loop over the output of listaddresses and then use getaddresshistory on each of them. If getaddresshistory returns empty then that's an unused address.

For stuff like this I prefer the command line rather than the elecrum console:

Code:
electrum listaddresses
electrum getaddresshistory 1BitcoinEaterAddressDontSendf59kuE

Electrum spawns a daemon process when you use the command line so multiple requests are more efficient. Still, getaddresshistory takes a few seconds per address so perhaps there is a more efficient way?
sr. member
Activity: 475
Merit: 252
June 17, 2014, 08:32:16 AM
#2
1.
Code:
wallet.storage.put('gap_limit', 50)

2. close, reopen electrum

3.
Code:
listaddresses()



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

BIP32 was based off of Electrum. But slightly different.

For more details about mpk and its calculations, peek into your /lib/accounts.py file and you should find the code somewhere in there.
copper member
Activity: 242
Merit: 12
June 17, 2014, 08:23:06 AM
#1
Can somebody tell me the console command to get an output of 50 unused addresses from my client?

Also is there a documentation how exactly the MPK works?
Jump to: