Sławomir Górawski
14
min read
Last Update:
March 18, 2024

Cryptocurrencies are currently the most popular application of blockchain technology. Once niche concepts used by a handful of tech-savvy geeks, nowadays they’re commonplace. An emergence of various wallet apps and trading platforms helped them gain such a wide adoption, but a cost to that is that inner workings of the tech behind these digital assets are no longer well known to their users. Having the complex details abstracted away behind a familiar interface with graphs and three-letter symbols surely is convenient, but also might make it harder to understand how cryptocurrencies actually differ from the fiat ones these days.

In this article I aim to explain:

  1. Bitcoin in simple words: idea, transactions, problems
  2. Motivation to create Bitcoin cryptocurrency
  3. Double-spending problem in cryptocurrency transactions
  4. Privacy in Bitcoin transactions
  5. Ethereum essentials: idea, transactions, applications
  6. Motivation to create Ethereum crytpocurrency
  7. What is an Ethereum account?
  8. What is Ethereum transaction?
  9. What is Ethereum used for?
  10. Creating Bitcoin wallets and Ethereum accounts
  11. Making transfers with Bitcoin and Ethereum
  12. Summary of the cryptocurrencies comparison

I only want to explain the concepts depicted in their respective white papers; I will neither discuss with them nor evaluate whether they make sense in today’s world.

Bitcoin essentials: idea, transactions, problems

How Bitcoin cryptocurrency was created

The idea of Bitcoin was introduced in a paper released in 2008, written by an author going by the name of Satoshi Nakamoto. In the introduction he pointed out a few things he didn’t like about the traditional banking systems, some of which were that:

  • For any two users willing to exchange funds, a trusted third party is required to ensure the correctness of the transaction.
  • Such a third party (a financial institution) must ask its users for their personal information.
  • “Non-reversible transfers are not really possible.”
  • All of the above result in additional cost and add complexity.

An alternative solution followed: a fully digital, distributed platform, which aimed to provide verifiable, mathematical solutions to the above problems, so that users could trust in the correctness of the system without needing any personal information from each other and without any kind of institutional oversight.

Coin in cryptocurrency

A fundamental building block in Bitcoin is the concept of a transaction – a piece of information representing one user sending money to another. Then, digital coins are thought to be chains of transactions representing transfers of the same assets – even though there is no physical currency involved. User B can use a transaction representing a transfer of a coin from user A to themselves to create a new one, from themselves to another user C. That way we create an impression of a coin changing owners from A to B, and then C, even though the only kind of information we operate on is a transaction.

This makes it easy to think about Bitcoin in traditional financial terms – in our example, user B can claim that they were in possession of the coin for some time, and user C can say, correctly, that they currently are. That will be true until they create a new transaction for another user D, which will cause the virtual coin to change its owner once more.

Now, we need to make sure that users making transfers are authorized to make them – we wouldn’t want one user spending coins of another – and to achieve that, digital signatures are used. Each user, to make financial operations in the Bitcoin network, must create a wallet for themselves. A Bitcoin wallet is basically a pair of keys: a public one and a private one. It has also some characteristics:

  • It has an address, derived from the public key, which is used to identify in the network.
  • It can be created 100% offline, and we don’t even need to inform anyone that we have one – when we’ll want to use it, we’ll be able to.

Now, when we receive money from someone, our address is encoded in the transaction, so it’s clear that these funds are meant for us. In turn, when it’s us who want to send money, we sign the transaction with our private key (we are creating a digital signature). To verify whether the transfer is legit, anyone can take our public key and see whether it matches the signature. If an impostor tried to create a transfer supposedly from our account, they couldn’t forge a signature without knowing our private key, and any honest network would reject this kind of an attempt.

Double-spending problem in cryptocurrency transactions

So far so good, but if we were to stop there, we’d encounter a rather serious issue with our approach. Financial transfers usually don’t exist in the void, and when we send someone our money, we usually get some product or service in return. Let’s consider a hypothetical scenario, where we bought a car, paid for it by creating a Bitcoin transaction, and then created another transaction, sending the same coin somewhere else. Does the second transaction overwrite the first? The only fair solution, which can preserve users’ trust in Bitcoin, is that if there are two transfers of the same coin from the same user, only the first one is valid.

The only way [...] is to be aware of all transactions”. - Satoshi Nakamoto

Usually it’s a financial institution that keeps track of all transactions and prevents such attempts of double-spending. In a distributed network, for all users to be able to verify any transaction, all users must know of all transactions.

Timestamp server

This is where blockchain technology comes into play. The blockchain is a data structure, which is like a linked list of blocks, and each block contains some transactions. The blocks are timestamped, and upon adding a new block to the chain a hash of it and the previous one is computed and saved – this prevents attempts of retroactive modifications of the transactions history saved in the blockchain, because any such attempt would change the hash of some block, and, in consequence, all the blocks following it including the most recent one.

All new transactions are broadcasted to the network, and then they are included in new blocks, which are added to the blockchain, and that extended blockchain is then broadcasted across all users to let them know of new transactions.

Now, if adding the blocks was instant, this wouldn’t really solve our problem – the blockchain cannot be changed, but any user could branch from its earlier point and add to it new blocks, and then broadcast his version. What was needed here was sort of a delay, which would make adding new blocks to the blockchain hard enough that a single malicious user wouldn't be able to do that fast enough on their own.

Proof-of-work

Following that conclusion, the process of adding a new block to the blockchain was artificially made harder than it needed to be. Currently it involves solving a mathematical puzzle, which can use up a substantial amount of CPU power and takes time even on a fast computer. Other users can verify whether the puzzle was solved correctly in a simple way, but finding that correct solution is hard.

Incentive

Now, if solving the riddle to add a new block is so hard, an incentive for users to actually want to do it is required. Adding a new block to the blockchain results in a reward for whoever did that, and that is how new coins make their way into the network. Their total number is capped, so that reward is decreasing with time, but is still substantial. The users who do that – use up their computing power to solve puzzles and add new blocks to the blockchain – are called miners, and the process – mining.

If we want to encourage the miners to include our transaction in a new block sooner (which is not guaranteed, as there usually is too many of them for one block), we can add a miners’ fee to it, and whoever mined the block and got a reward gets to keep that too.

Combining and splitting value

So far we reasoned about transactions as information about a transfer of a single digital coin, however this is too much of a simplification. Quoting the white paper, “it would be unwieldy to make a separate transaction for every cent in a transfer”, so transactions can contain multiple inputs and outputs. To create a transaction, we pick earlier transfers directed to us as inputs, and their combined value would be the total amount of funds transferred. Then we create one output for every user that we want to receive some of that money. If the latter doesn’t add up to the former (the inputs’ sum is too high and we’d like to keep some of it), we create one more output for ourselves, with our address. That is called a change transfer.

Privacy in Bitcoin transactions

One of the biggest advantages of Bitcoin is the privacy it offers – we mentioned earlier that we don’t provide our personal information to anyone to create a wallet. Users are identified by their addresses and their real world identities remain secret, unless they choose to reveal them themselves. All transactions are public and anyone can verify their correctness, but we don’t need to know who the author is for that – if the digital signature is correct, we know that the transfer was made by someone with their’ private key, so therefore by them. Of course a private key could be stolen, but this is outside of the scope of Bitcoin – within its assumptions it deserved recognition for providing a really safe, simple and elegant privacy model.

Ethereum essentials: idea, transactions, applications

Motivation to create Ethereum crytpocurrency

Regarding cryptocurrencies, Ethereum might seem like an attempt to do just what Bitcoin did before, but in a different way. This is, however, not the case, and Ethereum was to be much more ambitious than that. While Bitcoin in its white paper is explicitly stated to be focused on financial operations, Ethereum aimed to provide a generic platform for performing all kinds of possible operations, in a distributed network powered by the blockchain technology.

Now, digital money transfers are also possible, of course, but along with all the other kinds of things that can be done they are abstracted away into a fundamental idea of a global (distributed) state, and operations that change it. One part of this state is the balance of all accounts in the network, which changes whenever new transfers are made. More can be achieved due to a new idea introduced by Vitalik Buterin in 2014 – smart contracts.

What is an Ethereum account?

A smart contract is a certain kind of account in the network, so let’s explain in more detail what the latter is first. Accounts’ function in the network is similar to the one of Bitcoin wallets: they represent an entity that can perform various operations, which identifies itself with an address and authorizes the operations with a private key. The main difference is that Ethereum accounts don’t need to be managed by a human person – they can be provided with a piece of code, which can react to what’s happening and make its own decisions. That kind of an account is called a smart contract, and once included in the blockchain, it can change the network’s state and be interacted with, just like a regular user.

What is Ethereum transaction?

Interactions between accounts take the form of transactions. They are, in essence, pieces of information, that once included in the blockchain contribute to changing its state. The most basic type of transaction is a transfer of funds between two accounts – the sender only has to specify the recipient and the amount that they wish to send (in a straightforward way – no mangling with inputs/outputs like in Bitcoin). We can do more than that, though – it is possible to include more information in the transaction, and send it to a smart contract. That information can contain instructions and data, which can lead to the contract executing some computations and changing the network state. That’s how they are interacted with and how they interact between themselves.

Blockchain and mining

A question might arise, if we send a transaction to a smart contract which should result in some computations, where exactly are these executed? A hand-wavy answer here would be “the network”, but any computer network is just a set of individual machines, and it may not be clear, which one takes on the burden.

To understand that, we will use our understanding of Bitcoin, and try to follow what happens to a newly created transaction. First, it must be signed by its creator’s private key to confirm that they authorize the operation, then it’s broadcasted to the network and the users save it in their memory pools. Then, miners can choose to include it in a new block and start mining it. Before they do that, they need to verify that a transaction is correct, otherwise the rest of the network would reject their newly mined block and the effort that went into the mining would be wasted.

Now, this consists basically of two steps:

  1. Make sure that the transaction was authorised by its sender (verify the digital signature)
  2. Make sure that the transaction changes the network state to a correct one

Regarding step #2, if the transaction is just about sending Ether, it’s simple – we have to make sure that the sender has enough funds on their account. If there’s additional data in the transaction, however, it must be verified as well. And in case of a contract call, we have to retrieve the contract from the blockchain (by its account address, which would be the receiver of the transaction), and execute whatever instructions are provided in the transaction. Now, if the results are correct, we save them in the block as well (in the called contract account’s storage), and after we mine it and broadcast, the changed state will be included in the blockchain. So there we have our answer – smart contracts’ computations are executed by whoever wants to mine blocks with transactions triggering those computations.

Gas and Ether

Mining such transactions – the contract calls – is harder than the ones that are just money transfers, so to provide an incentive for the miners to do that, a new resource was introduced. It’s called gas, each computation step done by the miner corresponds to one unit of it, and each byte of transaction data to five. Every transaction must include a gas price, given by the sender, that specifies how much they will be willing to pay for a miner’s single unit of work. After mining a block with a given transaction, the miner sums up the gas that their work on it was worth, multiplies it by the transaction’s gas price, and takes the resulting amount from the sender’s account as a fee.

Transactions’ gas prices and accounts’ balances are given in Ether (ETH), the main cryptocurrency of Ethereum, which also is an utility token used to pay the transaction fees.

What is Ethereum used for?

  • Token Systems
  • Identity and Reputation Systems
  • Decentralized File Storage
  • Decentralized Autonomous Organizations
  • Comparison

As we’ve established before, Ethereum is much more powerful than Bitcoin in terms of what it can be used for, and therefore comparing the two is hard. We can however quickly sum up their aspect related directly to operations on cryptocurrencies and see how both perform in this domain.

Creating Bitcoin wallets and Ethereum accounts

Both Bitcoin wallets and Ethereum accounts are based on asymmetric cryptography where users first create a public–private key pair, then derive an address from the public key, and then use the address to identify themselves in the network, and the private key to authorize themselves (sign transactions). The format of the addresses differs a bit – it’s hexadecimal in Ethereum – but the underlying principle is the same in both blockchains.

Some interesting implications of this are that we can create our wallets or accounts 100% offline, as many as we want, without disclosing any of our personal details to anyone. This is definitely one of the biggest advantages that cryptocurrencies have over traditional banking systems – none of the latter come close to that level of comfort when it comes to protecting privacy.

Viewing balances

Once we’ve created our wallet, we likely want a convenient way to view its balance and see how many funds we have at our disposal. Most applications that we use to manage our crypto assets hide the details of this operation under an abstraction resembling a traditional bank website, however on a lower level there are differences.

In Ethereum, our account’s Ether balance is a part of its state saved in the blockchain after every modification, and we can retrieve that piece of information quite easily. In Bitcoin, however, that is not the case – only transactions are saved in the blockchain. In theory, to determine what is our current account balance, we’d have to crawl through the entirety of it, possibly several years back, to find all transfers related to our wallet and then use those to calculate our current amount of crypto. In practise, applications dealing with Bitcoin employ caching and indexing to not have to do this every time we view our wallet.

Making transfers with Bitcoin

A Bitcoin transaction typically contains multiple inputs and outputs, inputs must be consumed in their entirety, and one of the outputs is typically a change transfer from ourselves to ourselves. This makes it a bit hard to reason about if we just want to send a given amount of money to someone – which is straightforward in Ethereum due to its inherently stateful nature. All we have to do there is specify the recipient and the amount in the transaction object, sign it with our account’s private key and broadcast to the network – no additional complexity. In addition, Ethereum network mines blocks much faster than the Bitcoin one and we don’t have to wait long to be sure that our transaction was accepted.

There is, however, one case where the Bitcoin mechanism offers an advantage – a transfer for multiple recipients. In Bitcoin we can just create one transaction with one output for each of them. In Ethereum, each transfer can have only one recipient, so we have to pay the fee more than once, and then monitor several separate transactions to be sure that everyone received what they should have.

Summary of the cryptocurrencies comparison

Following the comparison, it would seem that Ethereum offers a better way of handling cryptocurrency assets, and indeed that was my experience as well. From the user’s perspective it’s easier to interact with and the transfers are processed much faster. Taking only technical factors into consideration, it would be hard to justify choosing Bitcoin instead. (Of course, there are non-technical factors as well, which can change that outcome.)

It’s worth remembering, however, that Bitcoin was the original widespread cryptocurrency, and Ethereum built upon its foundations years later. However outdated or counter-intuitive Bitcoin’s design may seem from today’s perspective, Bitcoin since its emergence has had a truly remarkable impact and inspired many other projects, and for that it surely deserves some respect.

At Ulam Labs, we would love to talk to you more about developing your services in blockchain technology.

Blockchain made easy

Talk to us

Don’t Miss Our Next Piece

Two new articles monthly.
Sign up for the newsletter to stay informed!

Sign Up