<p>I finally found a solution. here is the function to get tone address per token:</p>
<pre><code>try:
    addressjson=gateway.getaddressesbylabel(token)
    address=list(addressjson.keys())[0]
except:
    address=gateway.getnewaddress(token)
return address
</code></pre>
<p>this way if an address assiciated to the label: token exists we use. Otherwise we generate a new address with label token.</p>

CC BY-SA 4.0
2020-12-12T12:23:26.560Z
2020-12-12T12:23:26.560Z
Valometrics.com
<p>I'm using getnewaddress bitcoin-cli function to generate wallet addresses but i need one address per token.</p>
<p>Is it possible to use a parameter like seed for random numbers to get the same address when i use the same token?</p>

<bitcoind><address><address-generation>
How to generate new wallet address per token
Valometrics.com
# How to generate new wallet address per token

(Asked by: username_0 on 2020-12-11)

I'm using getnewaddress bitcoin-cli function to generate wallet addresses but i need one address per token.

Is it possible to use a parameter like seed for random numbers to get the same address when i use the same token?

**Tags:** bitcoind, address, address-generation


---

## 1 answers

### Answer by username_0 on 2020-12-12. Score: 0

I finally found a solution. here is the function to get tone address per token:
try:
    addressjson=gateway.getaddressesbylabel(token)
    address=list(addressjson.keys())[0]
except:
    address=gateway.getnewaddress(token)
return address

this way if an address assiciated to the label: token exists we use. Otherwise we generate a new address with label token.


---

