In this article, we will discuss one of the important differences between Bitcoin (BTC) and Ethereum (ETH). Apart from the Turing-complete and non-Turing-complete difference, there is another discrepancy between the two protocols: UTXOs (Unspent Transaction Output) and “accounts”.

[coin-widget id= »bitcoin »] [coin-widget id= »ethereum »]

This subject is a little less often addressed in the articles and yet it is just as interesting. This also has certain consequences on the operation of the two systems which are often compared without mentioning this major element .

UTXOS (UNSPENT TRANSACTIONS OUTPUT)

We are going to do a little reminder on how Bitcoin works. It is important to understand how a Bitcoin transaction works to understand the differences with Ethereum.

Transaction example:

Input:
Previous tx: f5d8ee39a430901c91a5917b9f2dc19d6d1a0e9cea205b009ca73dd04470b9a6
Index: 0
scriptSig: 304502206e21798a42fae0e854281abd38bacd1aeed3ee3738d9e1446618c4571d1090db022100e2ac980643b0b82c0e88ffdfec6b64e3e6ba35e7ba5fdd7d5d6cc8d25c6b241501

Output:
Value: 5000000000
scriptPubKey: OP_DUP OP_HASH160 404371705fa9bd789a2fcd52d2c580b65d35549d
OP_EQUALVERIFY OP_CHECKSIG

A Bitcoin transaction has two fields of particular interest to us: Input and Ouput . There can be several inputs/outputs per transaction. Today we are going to take the case where we have a single input and a single output .

There is another type of transaction called coinbase transaction . This transaction has the particularity of having no input . It is introduced by miners when they find a block and is usually assigned to their own account. This is how new bitcoins are put into circulation every 10 minutes. Each miner is allowed to produce 12.5BTC per block (today) via this transaction.

OUTPUT

Output:
Value: 5000000000
scriptPubKey: OP_DUP OP_HASH160 404371705fa9bd789a2fcd52d2c580b65d35549d
OP_EQUALVERIFY OP_CHECKSIG

The Ouput field allows you to specify the number of satoshis that you want to attach to it (its value) and the script defines under what conditions this output can be used (therefore spent) as input in another transaction . An output can be assimilated to a line which corresponds to a receipt of money in an accounting book. Here, this addition is 500000000 satoshis.

See also  Solana: 5 things to know before buying it

When we add up all the outputs that have not yet been used – unspent – ​​and of which we know that we are the only ones able to fulfill the condition defined in the script (this part will be more in-depth in another article dedicated to scripts), we can deduce our balance, the quantity of bitcoins that we hold.

INPUT

Input:
Previous tx: f5d8ee39a430901c91a5917b9f2dc19d6d1a0e9cea205b009ca73dd04470b9a6
Index: 0
scriptSig: 304502206e21798a42fae0e854281abd38bacd1aeed3ee3738d9e1446618c4571d1090db022100e2ac980643b0b82c0e88ffdfec6b64e3e6ba35e7ba5fdd7d5d6cc8d25c6b241501

The input is a previous ouput that we have not used and that we want to use in our transaction . The Previous tx field tells us the hash of the subsequent transaction in which we created our previous ouput . Index gives us its position in the transaction.

ScriptSig is the solution to the infamous spend condition . It is this that the nodes will check and which must be validated to validate a block.

OVERVIEW OF A TRANSACTION

This may seem a bit complicated at first glance, but it makes sense when you imagine several accounts in a bank. A transaction between two bank accounts consists of debiting the account of customer A and crediting the same amount to the account of customer B. Both actions must be performed and validated simultaneously to avoid any accounting problem.

Comparing Bitcoin to the workings of a bank may seem ironic, but there are many similarities between the two systems. There is also a lot to learn from the banks’ IT system which has been perfected over decades with the best engineers, and to understand the obstacles they have faced.

ETHEREUM ACCOUNTS

Disclaimer: My experience on the Ethereum project is a bit more limited. There may be an error or two in my explanation.

The Ethereum project, on the other hand, is based on a general state idea . That is to say that we have a statement of accounts at a certain moment, as if we had taken a photo . We will then send a transaction that will modify this state to a new one. In the transaction, we must specify a from and a to which are the two accounts concerned by the transaction (and therefore which modifies the state of the accounts), fields which are also absent in Bitcoin transactions.

Etherscan screenshot of a transaction on Ethereum

This model has the advantage of being easier to understand . Transactions are also smaller because you don’t need to reference previous transactions. There is, however, a non-negligible consequence to this model, succeeding in defining the order of transactions .

See also  Discover the Syscoin project ($SYS)

For Bitcoin if we send two transactions with two different inputs, the order in which they are executed does not matter. Remember, too, that it is the miners who choose which transaction goes into which block (generally these are the transactions with the highest fees).

In the case of Ethereum, it’s a bit different. The order of transactions is very important . Maybe in a contract we want to first call  Function 1 then Function 2  which will give us State A, but change the order and we will have State B . We must therefore find a way to force the order , for this Ethereum uses a nonce, a number which will be incremented with each transaction carried out for an account.

This also means that a transaction with a nonce that does not directly follow that of the last transaction will be refused by miners . The nonce also protects against a replay attack . Otherwise, it would be easy to send the exact same transaction again and again since once we have the signature of the transaction it would remain valid for an identical transaction.

Ethereum transactions also have a data field that allows you to specify which function of a contract is called. This field is missing when transferring ether to two accounts that are not contracts.

CONCLUSION

Ethereum’s global state concept requires the use of accounts and a different transaction format compared to UTXOs. Ethereum gains space, with smaller transactions, but loses flexibility. It is not possible to process two transactions from the same account in parallel. This also means that you have to wait for the confirmation of the first transaction to avoid the risk of sending a transaction with an invalid nonce.

See also  eToro review and test (2022): is this crypto trading site reliable?

Sources:

If you liked this article, please subscribe to our reddit community to discuss it. You can also find us on Twitter and Facebook.

5/5 - (1 vote)