Bitcoin is mainly about transferring a value (Bitcoins) from A to B. And that’s exactly what happens with the help of transactions. But the exciting question is: what data does such a transaction actually contain?
Let’s take a look at an example: Let’s assume, for example, that Anneliese bought 1.5 Bitcoins a long time ago from a Bitcoin exchange office. And it is precisely these bitcoins that she would now like to send to Bertram. The transaction that Anneliese creates with the help of your wallet must therefore contain at least three pieces of information:
sender | Who is the original owner of the bitcoins? | Anneliese |
receiver | Who is the new owner of bitcoins? | Bertram |
amount | How many bitcoins should be transferred? | 1,5 |
However, the actual names of people are not used to specify the sender and recipient, only …
Bitcoin addresses
Similar to account numbers in a normal bank transfer, the sender and recipient of a Bitcoin transaction is uniquely identified by Bitcoin addresses. A Bitcoin address is ultimately always a number between 1 and approx. 1,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 (48 zeros). Since there is practically an infinite number of valid Bitcoin addresses, these can simply be created by a wallet at random without there being any serious probability that two different wallets will “assign” an address twice.
Note: Bitcoin addresses are never presented visually as a number, but in a much more space-saving format, which consists of a (usually) 34-character sequence of numbers and letters. For example 15Ee3gaLizh7YwFPebVaWxiV4T5UFBfLNm.
In our example, Anneliese has a balance of 1.5 BTC (Bitcoins) in her wallet. If Anneliese now creates a new transaction and enters Bertram’s Bitcoin address in the recipient field, your wallet knows both the sender address (the one she has created) and the recipient address. So (for the time being) only missing….
The bitcoin amount
Since Bitcoin is a digital currency, you might suspect that Bitcoin money (e.g. 1.5 BTC) is made up of data – i.e. (ultimately) a set of zeros and ones – simply converted from a wallet into a transaction can be inserted. However, this is not the case!
A Bitcoin transaction is more like a public announcement by the sender that he wants a certain amount of Bitcoin (which can be proven to belong to him) to belong to someone else from now on. It is important that this “announcement” is public, ie completely visible/transparent for all Bitcoin participants.
Bitcoin transactions are not encrypted. As soon as a transaction has been sent, anyone who wants to can view and analyze it. Technically, there is no anonymity at all! However, transactions do not contain names of people. So if you want to find out who the sender or recipient is, you have to be able to assign a Bitcoin address to a person. As a rule, however, this is not easily possible. However, if you post (one) of your Bitcoin addresses in a public web forum, for example, a “snoop” can find it relatively easily with a search engine such as Google and thus establish a logical link between the Bitcoin address and the forum account. Depending on how much he can find out about your correct identity with the help of the forum account,
After submitting the transaction
After Anneliese has clicked on “Send”, the following will happen: Shortly after it was started, your wallet automatically established connections to a few other wallets. And it is precisely this connection that Annelieses Wallet now uses to forward the new transaction to other wallets. The other wallets, in turn, forward the transaction to other wallets via their own connections. And so the transaction is spread within a few seconds in the entire Bitcoin network and also permanently stored.
As soon as Bertram starts its wallet, it will connect to other wallets and receive all new transactions (including Anneliese’s transaction). Bertram Wallets recognizes that the recipient address for Anneliese’s transaction is an address that Bertram Wallet generated itself. Therefore this transaction is shown as an incoming transaction. So Bertram knows that Anneliese sent him 1.5 bitcoins.
But how can Bertram’s wallet be sure that the bitcoins used in the transaction were actually Annelieses bitcoins before? To find out exactly that, we have to look at two important dates of a transaction. Namely the …
Entry and exit of a transaction
An outcome of a transaction is simply a Bitcoin address. An input is a reference to the output of another transaction (known to the Bitcoin network). For the sake of simplicity, we call the transaction with Anneliese who received 1.5 BTC from the exchange office “Transaction WS”. And we call the transaction that Annelieses wallet generates “transaction AL”.
Transaction WS
entrance | Reference to the outcome of another transaction |
output | Anneliese’s Bitcoin address |
Transaction AL
entrance | Reference to the outcome of “Transaction WS” |
output | Bertram’s Bitcoin address |
In each transaction, a reference is made to the outcome of an earlier transaction in the input. This creates a chain of Bitcoin ownership transfers, whereby the last “link in the chain” always determines who is allowed to “pass” the Bitcoins on next. Currently, the last link in the “transaction AL” in which Bertram’s Bitcoin address was specified as the exit.
And with this knowledge in mind, we can now find out how Bertram’s wallet can now determine whether the bitcoins that were specified as the receipt of the “transaction AL” were actually in the possession of Anneliese’s (wallet). For this, however, the “transaction AL” must contain further information. Namely the …
The sender’s digital signature
With a digital signature, the “transaction AL” can prove that the receipt was used lawfully. Before we go into the principle of the digital signature, we first have to understand how Bitcoin addresses are created in the first place. Earlier you learned that a Bitcoin address is generated randomly. From a “practical point of view,” the number is (ultimately) random, but technically this is not entirely correct. The Bitcoin address is calculated from a different number.
This other number is called the private key and is actually a number generated randomly by the wallet. With Bitcoin, the range of all valid numbers for private keys is so large that it is practically impossible for one wallet to accidentally generate the same private key as another.
And with exactly this private key, a Bitcoin address is created by a wallet. In simplified terms, you can imagine it as follows: A wallet uses a “Bitcoin address generator” to generate a Bitcoin address from a private key. The “generator” only works in one direction. That means you can generate a Bitcoin address from a private key. But it is (practically) impossible to determine the associated private key from a Bitcoin address. The generator uses a so-called one – way function to generate the Bitcoin address.
Note: The “Bitcoin address generator” is a simplified representation that is used here to make the principle of creating Bitcoin addresses easy to understand.
With the private key, however, not only a Bitcoin address is generated, but also a digital signature. To create this, the wallet uses the following …
Input data for creating a digital signature:
- private key
- Transaction data such as incoming and outgoing
A specific algorithm ( ECDSA ) is used to generate a digital signature from this data, which is only valid for this transaction. This algorithm can not only be used to generate a digital signature but also to check it. The decisive feature for checking a signature is that the private key is not required! So you only need the following …
Input data for checking a digital signature:
- Bitcoin address
- Transaction data such as incoming and outgoing
This means that the (secret) private key is required to create a digital signature. The corresponding (public) Bitcoin address is required for verification.
But let’s get back to the original question: How can Bertram’s wallet find out whether the bitcoins that were referred to in the “Transaction AL” input were also legitimately used by Anneliese? Let’s extend the two transactions above with the digital signatures:
Transaction WS
entrance | Reference to the outcome of another transaction |
output | Anneliese’s Bitcoin address |
Digital signature | Number (created from: private key of the exchange office wallet and data of this transaction) |
Transaction AL
entrance | Reference to the outcome of “Transaction WS” |
output | Bertram’s Bitcoin address |
Digital signature | number (created from: Annelieses private key and the data of this transaction) |
After Bertrams Wallet has received the “Transaction AL”, it proceeds as follows:
- Check what was specified as the input
- Get “Transaction WS” and look in its output to see which Bitcoin address was given as the recipient (the Bitcoin address of Anneliese)
- Check the digital signature of the “Transaction AL”. Use the following input data for the verification function:
- the Bitcoin address found in the previous step
- the data of the current transaction
So Bertram’s wallet can use Anneliese’s digital signature and the “Transaction WS” to determine that the transaction is legitimate. Incidentally, not only does Bertram’s wallet check this transaction but practically every other wallet as well. And if a transaction is not legitimate, the wallets will not forward it either. And so the problem of proving Bitcoin ownership would be solved!
Unfortunately, there is another problem: Although Anneliese is legally in possession of the 1.5 BTC, she could use it in two different transactions. That means, for example, it could create a transaction for Bertram as well as for Christoph with the same bitcoins and send it to the bitcoin network. A simple solution would be that just one of the transactions would be accepted and the / all others would not.
The problem is: who decides which transaction should be accepted? Exactly this problem of double-spending is solved with Bitcoin through a special process that is explained in the next part of the Bitcoin basics.