Bitcoin

How does a transaction work? | Cointelegraph

Sending every bitcoin begins in a very simple way: by opening our wallet. From that moment on, the whole process begins to make every transaction in Bitcoin a reality. But let’s take a closer look at how this is possible.

Simplified explanation

When we create a Bitcoin wallet, we first create a series of asymmetric keys. These keys are divided into two parts: a private key and a public key. The first is similar to the safe and the combination for our bitcoins. Every bitcoin in our possession is preserved We belong to each other because this private key enables us to fully manage them.

On the other hand, the public key resembles an armored security envelope. One into which we insert information, close it, and send that information with the certainty that it will never. open. Indeed, heThe only person who can open it is the one who created it. said about first. This creator is our private key because we can derive an infinite number of public keys from it when we need it.

How does a transaction work? | Cointelegraph
How does a transaction work? | Cointelegraph

In addition, Bitcoin intensively uses hashes and digital signatures for transactions. The hashes functions are used to create the transaction identifier. It is also used to add levels of security in various elements that make the transaction at a very low level.

Example of a transaction

This is the basic mechanism by which we can send bitcoins between different people. Let’s look at an example of this:

Ana will send Daniel 0.01 BTC. For this reason, Ana and Daniel open their respective wallets. Each of these wallets is assigned a private key (a safe) that only they can control individually. To prepare the delivery, Ana asks Daniel for an address.

So í Daniel generates a Bitcoin address (a shielded envelope), which is actually a public key derived from his private key. Daniel gives Ana this address and she prepares the delivery. He gives the amount of 0.1 BTC, the mining commission, and gives him the shipping (puts the money and sends the envelope to Daniel). At this point, Ana’s wallet digitally generated the transaction and signed a unique identifier using the SHA-256 hash function.

Next, the wallet generates our transaction, gives it a unique identifier and sends it to the network. In a few minutes, the Bitcoin network processes this shielded envelope and includes it in its billing history. So í Daniel has his 0.1 BTC under his control. To do this, it uses its private key (to open the armored envelope) to take full ownership of the new BTCs, and the transaction has been successfully completed.

This simple example shows us roughly how a transaction is generated and possible. It also explains in a simple way how we can securely send money through asymmetric cryptography and hash functions. But there is a lot more to it than that and we will examine these elements.

Extended explanation

At the low level, however, the Bitcoin script is the element that enables transactions to be executed in Bitcoin. This is a scripting programming language that you can use to add programming properties to Bitcoin.

The previous example from Ana and Daniel would then be reduced to simple programmed actions in Bitcoin Script. This is most accurately done in Bitcoin. As a matter of fact Every time we make a transaction, a number of steps are performed, such as those described below.::

  1. First, Ana and Daniel prepare their wallets for access to your private keys.
  2. Daniel, generate a Bitcoin address. For this purpose the private key is used to generate an associated public key. This Daniel public key is converted into a Bitcoin address.
  3. Ana takes the direction of Daniel. Enter the payment details in your wallet. Include the quantity, mining fee, and address to which it should be sent. these bitcoins.
  4. Ana’s wallet immediately begins to generate the transaction. For this purpose, the wallet takes any unspent Ana outlet (UTXO). This means that any money transfer that Ana has received will be accepted. and will add to generate the payment to Daniel. At this point, Ana’s wallet generates a sig script for each of these entries. The purpose of this script is to demonstrate that Ana really does have this money. Therefore, in this script, we find Ana’s ECDSA digital signature and associated public key for each issue that Ana will use á to send the money to Daniel.
  5. Next, Ana’s wallet generates the lock scripts or scriptPubKey. In these scripts we find the instructions that need to be followed for Ana to finally hand over ownership of her bitcoins. This scriptPubKey has the destination address of the money. But even if Ana needs to get a change, it will generate a scriptPubKey that will return you á Change to an address under your control.
  6. The structure of the transaction is then generated. Use á the previous scripts and data, such as the date or timestamp of the transaction, to generate a unique and non-repeatable SHA-256 hash that is identified about the transaction.
  7. The wallet then outputs the transaction to the network. Arrived there He arrives in the network mempool, a kind of waiting room.
  8. When the miners start generating a block, they take the transactions, group them and generate a block through mining. Once you have generated the block, send it to the nodes, which check whether they are valid.
  9. When the nodes receive a valid block, they take each of the transactions and execute the instructions for them. At that moment, the change happens, Ana’s money passes into Daniel’s hands. The block ultimately remains executed and its actions are recorded in the blockchain.
  10. Daniel can see Ana’s transaction confirmed in her handbag. Daniel can take your money with his private key.
  11. On the other hand, Ana can see that she now has no 0.1 BTC. Instead, he sees the transaction made to Daniel and an exchange transaction that takes back the rest of the money he had in his purse.

As you can see, this example is much more complex. However, it shows how the transactions work at a much lower level. Certainly a genius who combines the best of cryptography and a programmable system to create a unique form of money.

Related: Qu é and how Bitcoin mining works. Everything about how to mine bitcoins

Similar Posts