If you are a developer coming from Ethereum, the biggest practical difference is that Hydra's account model is built on Bitcoin's UTXOs.
In Ethereum, you'd typically have an account with an unique address that holds a balance. You'd be sending/receiving money and interacting with Smart Contracts using one account.
In HYDRA, you don't really have accounts. Instead, you have a collection of UTXOs, each of which has its own address. An UTXO may be used only once when you send money or interact with a Smart Contract. If an UTXO has more value than you intend to use, it'd be split up into multiple UTXOs after a transaction.
In this chapter we'll explore the UTXO model by sending some money using the cli command, and peeking into the transaction data.
Later in Part II we'll see how HYDRA's Smart Contract implementation bridges Bitcoin's UTXO model with Ethereum's account model.
UTXO Address
With UTXO, you can reuse a payment address. For better anonymity, though, you'd typically generate new addresses for each payment you'd like to receive.
An UTXO address is 20 bytes (160 bits) long, base58 encoded. This is the same length as Ethereum's address. We can convert it to an Ethereum compatible hexadecimal address:
Now let's send money to an UTXO address. You'd be sending money to yourself, but this is exactly the same process as when you send money to somebody else.
Note that both of these UTXOs share the same txid. In other words, one send money transaction created two new UTXOs:
hdiqg2mp646KhSQjVud3whv6C34hNHQnL2: Receiving address, holding value of 10.
hddyh9oMU44qZ28bEY9WhCDbmCaALVDr1k: The original sender UTXO had 20k HYDRA, the amount generated. This a new UTXO created to hold the change, minus fees.
Decoding Transaction Data
We can dig a little deeper into the transaction data to see that HYDRA really shares the same UTXO data structure as Bitcoin. From the earlier gettransaction output, we got the raw transaction data in hexadecimals (i.e. 02000000017d2...ac90060000).
HYDRA manages money using Bitcoin's UTXO model. Instead of using accounts to track balances, a HYDRA wallet keeps track of the collection of UTXOs. When a transaction is created, the wallet searches the collection to find UTXOs that add up to enough value to pay for the amount transferred and the fees.