0

I made an address with cardano-cli (here) and I funded it from my Yoroi wallet, but I don't know where this change address came from. Shouldn't the change address be the input itself or Am I missing something here? (transaction)

3

Cardano utilizes a UTXO-style accounting model (similar to bitcoin, but with extra features), as opposed to an accounting model, like what Ehtereum uses. Here is a quick overview of the differences.

In short, a UTXO is an output of a previous transaction that "sits and waits" at an address to be used as an input for a future transaction. It is analogous to how cash works; if I send you 30 ADA, you can almost imagine that a 30-ADA "bill" (think dollar-bill = UTXO) is created at your address. If you now want to spend this 30-ADA UTXO, you cannot rip off a piece of it anymore than you could rip off a piece of a dollar bill when you want to spend it. Instead, you spend the entire bill, and receive change back in the form of smaller denomination bills. UTXO's work the same way.

In your case, you had a 36 ADA UTXO in your Yoroi wallet, and you wanted to send 1 ADA to your CLI wallet. Yoroi automatically created a transaction with 1 input (the original 36-ADA UTXO), and two outputs (1-ADA UTXO to the CLI wallet, and 35-ADA UTXO sent back as "change" to your Yoroi wallet). Wallet software like Yoroi makes such change management simple and user friendly; it auto-generates a change address for your wallet and send your change there as one of the TX-outputs.

If you now try sending funds from the CLI wallet you'll have to build the full transaction manually, which is a great way to get a feel for how UTXO accounting works.

2
  • Thanks, but why the change address is different from the first one? I mean, I had 36 ADA in my wallet at first and transferred one of them to somewhere else. So isn't it more logical to send back the 35 ADA to my first address?
    – Mfr
    Jan 14 at 16:29
  • 1
    This is possible - in fact you can do this yourself if you use the CLI method. However, it is not done by default for privacy reasons - there is no public-facing cryptographic link between your original address and your change address, so this greatly obfuscates the movement of funds. (Note: staking keys complicate things though, but if we leave that aside, change addresses have virtually zero downside and a great privacy upside)
    – nomad0
    Jan 14 at 16:33
1

Yoroi follows the same nomenclature that cardano-wallet does with change addresses. A number of other wallets (adalite, typhon and my python wrapper wallet https://github.com/input-output-hk/adawallet re-use the same address as the change address).

The way it works is explained here in detail: https://github.com/cardano-foundation/CIPs/tree/master/CIP-1852

Addresses are derived from the root key that comes from the mnemonic of your wallet. Receiving payment keys use the derivation path: 1852H/1815H/0H/0/0. However change addresses are derived from 1852H/1815H/0H/1/0. The stake key (currently) is always: 1852H/ 1815H/0H/2/0`.

So essentially anytime you send a tx, it will generate a new address not in the receiving address path and send the change to that address.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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