8

If I have 3 addresses in my seed and each address received 10 IOTAs. I guess my wallet will show 30 IOTAs. Now I send 12 IOTAs to someone. How do I know which address will be empty, which will have 8 IOTAs and which will still have 10 IOTAs in the address? Because I have to know which address will have this re-use security problem, right?

2 Answers 2

11

First of all, there seems to be a misconception in your question. If you spend 2 iotas from an address with 10 iotas, that address will not then contain 8 iotas, the address will actually be empty and will be 'struck out' in your wallet history. The 8 iotas are instead sent to a new 'change address'. This is why users do not have to worry about address reuse in most cases, the wallet automatically handles this for you.

So let's step through how the wallet decides which addresses to pay from if your seed is associated with several potential addresses with sufficient balance.

If you look at the prepareTransfers command in the IOTA API, which prepares a transaction for Proof-of-Work then sending, you'll see that it iterates through an array of addresses it is passed until the payment amount is reached or exceeded. Where does it get this array of addresses from? The wallet builds up this list in its getUnspentInputs function, which calls the getInputs API command, which generates addresses from your seed starting at the lowest key index until hitting an unused address (this seems extremely inefficient to do every time you send a tx, but never mind).

So in summary, the wallet will spend from the lowest addresses that your seed owns by key index, i.e. the oldest addresses whose total balances reach or exceed the payment amount. Any extra amount over the payment amount will be sent to a new address called the change address, which means you will not have to worry about address reuse in typical cases.

-6

Your IOTAs are not stored in adresses (public keys) itself they're stored in your seed, adresses are used only to send from and receive into your seed as they're the public portion of you cryptographed signature therefore how many IOTAs were transacted within each address doesn't matter once the transaction is confirmed. The Tangle uses Lamport one-time signature scheme that publishes part of the private key along with the message (transaction) this implies that every time an address is reused it halves the security level of the private key enabling attackers to assemble a fake private key and take profit of it.

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.