Bitcoin Forum

Bitcoin => Electrum => Topic started by: gdiepen on January 17, 2017, 05:23:28 PM



Title: Get unused address in commandline
Post by: gdiepen on January 17, 2017, 05:23:28 PM
I was wondering if it is possible to use the get_unused_address functionality of a wallet from the commandline.

I was looking at the example to receive bitcoins on the website and based on this I wanted to see if I could create a donate link that would always show the latest unused address (i.e. after any donation, the next request on the webserver will automatically show the next unused bitcoin address).

I understand from the source that the addrequest command does this internally, but it will actually use up all the addresses within the gap every time you are calling addrequest.

Is it possible to call the get_unused_address from the commandline of electrum?


Title: Re: Get unused address in commandline
Post by: kolloh on January 17, 2017, 08:25:48 PM
I was wondering if it is possible to use the get_unused_address functionality of a wallet from the commandline.

I was looking at the example to receive bitcoins on the website and based on this I wanted to see if I could create a donate link that would always show the latest unused address (i.e. after any donation, the next request on the webserver will automatically show the next unused bitcoin address).

I understand from the source that the addrequest command does this internally, but it will actually use up all the addresses within the gap every time you are calling addrequest.

Is it possible to call the get_unused_address from the commandline of electrum?

It doesn't seem like you can call get_unused_address via commandline from what I can tell. I checked and it doesn't look like you can issue that via JSONRPC either. However, you could issue it via the python console.

Electrum recommends using addrequest to accept payments via a website so I wouldn't think there would be any negative side effects for doing it in that manner.


Title: Re: Get unused address in commandline
Post by: gdiepen on January 18, 2017, 07:00:56 AM
I was wondering if it is possible to use the get_unused_address functionality of a wallet from the commandline.

I was looking at the example to receive bitcoins on the website and based on this I wanted to see if I could create a donate link that would always show the latest unused address (i.e. after any donation, the next request on the webserver will automatically show the next unused bitcoin address).

I understand from the source that the addrequest command does this internally, but it will actually use up all the addresses within the gap every time you are calling addrequest.

Is it possible to call the get_unused_address from the commandline of electrum?

It doesn't seem like you can call get_unused_address via commandline from what I can tell. I checked and it doesn't look like you can issue that via JSONRPC either. However, you could issue it via the python console.

Electrum recommends using addrequest to accept payments via a website so I wouldn't think there would be any negative side effects for doing it in that manner.

I did see that in the commandline version there should be something like listaddresses with the option of --unused. I tried this, but unfortunately did not see anything change, even the addresses that received already were shown.

The reason why I am hesitant with addrequest is that you quickly exceed the number of addresses, which is something I wanted to prevent. In the case of a Donate link I would like to keep on using one donation address as long as nothing has been transferred to this address. Whenever the address is used, I would like to switch to the next unused address.


Title: Re: Get unused address in commandline
Post by: Abdussamad on January 18, 2017, 08:13:25 AM
edit: I missed some posts  :)

Why not use addrequest in combination with getaddressbalance? if an address has a balance then it's used and you get a new one with addrequest.