3

While reading the js library API, I saw this line:

https://github.com/iotaledger/iota.lib.js/#getnewaddress

GetNewAddress:
If the index is provided, the generation of the address is not deterministic.

I also read here https://learn.iota.org/tutorial/generating-addresses-learn-the-basics

As previously mentioned, when generating an address you need to know the key index of the private key in order to get the same address each time. The libraries give you two options in order to get that key index: one is to supply it as an optional input parameter, the other is to get it deterministically.

However can anyone explain the meaning of deterministic? What can be nondeterministic if I use index to generate a new address?

1 Answer 1

4

I agree with you that the attribute deterministic is a little misleading.

At the end the crucial point is the assignment or not of the index value of option parameter in getNewAddress call.

  1. If you don't assign the index value of the option parameter, getNewAddress call will generate all the addresses for a certain seed, starting from index=0 and incrementing index value until it will find a value for index whose related generated address has not been already used in the Tangle. This one will be the address returned.

  2. Viceversa if you assign a value to the index, getNewAddress call will only generate the address based on the value of the seed plus the assigned index value. In this case, the address returned is not checked as in the case above and it is up to you to decide whether to use it or not in the Tangle keeping in mind that you shouldn't reuse an address twice for payment.

In both cases getNewAddress deterministically generates addresses but it is in the case 1. where this term suggests some sort of usability for the address.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.