How do Bitcoin Transactions work?


There are many ways to explain this:

The Simplified Version

I share my intention and then the web is scanned to validate that:

  1. They have the bitcoin I want to send
  2. They have not been already sent to someone else

When that information is confirmed, the transaction is included in a “block,” which is attached to the previous block, this is called “Blockchain”.

The Long Version

In reality, the wallet never takes the Bitcoin, it keeps the Bitcoin with a record of all transactions, and therefore of the balance. This address is a long string of 34 letters and numbers, known as “public key”. Each directional key has a “private key” corresponding to 64 letters and numbers, this is crucial to keep it secret and safe because these two keys are related, but there is no way you to find out my private key from my public key. This is important! Any transaction problem on my Bitcoin address needs to be “signed” with my private key and to do that, I had to type my private key and the details of the transaction: the number of bitcoins I want to send, and to whom. With this information, the program provides a digital signature, that is sent to the web to be verified, meaning that it can confirms that he/she is the receiver of the bitcoin I’m transferring and that I’m not sending it to someone else.

This is one of the greatest things about the Bitcoin: if the signature is created with a private key corresponding to the public key, the program would validate the transaction without knowing what the private key is. The network confirms that I have not previously exchanged the Bitcoin running through my address history, which can be done because it knows my address. Once my transaction has been validated, which was included in a “block” along with lots of other transactions and other functions, as we will see below.

hash is produced by a “hash function” a complex mathematical equation that reduces any amount of text or 64 characters data string in a non haphazardly way, because every time you pass this data set in particular through the hash function, it will get the same string of 64 characters. But if you change even a single comma, you’ll get a completely different string of 64 characters. This entire article could be reduced to a hash, and unless they change, delete or add anything to the text, the same hash can occur again and again. This is a very effective way to know if something has changed, and how Blockchain can confirm that a transaction has not been tampered with.

Let us return to our blocks: each block includes, as part of their data, a hash of the previous block. That’s what makes it part of a chain, hence the term “Blockchain.” Therefore, if a small portion of the previous block were manipulated, the hash of the current block would have to change, you must remember that a small change in the input of the hash function changes the output. So if you want to change something in the previous block, you will also have to change the hash in the current block, because the currently included one is no longer correct. This is very hard to do, especially when it just have currently reached the middle of the road, there’s probably another block on top of the current one. Meaning, that you will probably have to also change this.