What Happens When You Hit Send on a Blockcahin?
Have you ever wondered about the intricacies of the Bitcoin Network? What actually happens when you click send and transfer some BTC to another address? We’ll explore what a bitcoin transaction entails in-depth.
Let's talk about what exactly happens when you hit send.
Source: Pixabay | Artist: geralt
So, let’s use James and Pete as examples today. If James sends Pete some bitcoin, what exactly happens behind the scenes between the time the bitcoin leaves James wallet until it reaches Pete’s wallet?
Push and Pull Networks
Source: Unsplash | Photographer: Tim Mossholder
To fully understand this, we’ll also need to understand what happens with a standard network application. This is the general way network applications are built and it uses something called a push network.
According to Wikipedia,
Push technology, or server push, is a style of Internet-based communication where the request for a given transaction is initiated by the publisher or central server. It is contrasted with pull/get, where the request for the transmission of information is initiated by the receiver or client.
So, assuming again James sends a normal network message with a standard application to Pete, James’ phone sends the message to the cloud. The cloud server then contacts Pete’s phone and “pushes” the message down to Pete’s phone. It works basically like a mail man making a delivery. The mail man comes to your door and knocks and goes “Hey! I have a delivery for you”, then you receive the delivery.
In this case of push networks, the server knows about all the devices on the network. The server knows about Pete’s phone to be able to push the message to Pete.
Source: Unsplash | Photographer: Wynand van Poortvliet
Now, in bitcoin architecture, unlike a mail man arriving at your door, you have to go get your mail at the post office. Bitcoin uses something called a pull architecture. This isn’t exclusive to just bitcoin but it isn’t usually the standard way to build applications either.
According to Wikipedia,
Pull coding or client pull is a style of network communication where the initial request for data originates from the client, and then is responded to by the server. The reverse is known as push technology, where the server pushes data to clients.
Pull requests form the foundation of network computing, where many clients request data from centralised servers. Pull is used extensively on the Internet for HTTP page requests from websites.
With a pull application, the bitcoin is sent to the network just like a message is sent to the cloud in push applications. The difference now is how the bitcoin gets to the target device. In pull networks, the data or message or bitcoin in this case IS NOT PUSHED down to the recipient phone. Instead it leaves the responsibility to constantly check if there is any data to be collected. If there is, the data is then pulled from the network into the phone.
You could imagine all phones on a pull network hence as an annoying toddler constantly asking “Are we there yet?” every second over and over. So, the recipient phone will look out to the cloud or network itself constantly and check is there is data sent to it.
This way, the network or server doesn’t need to constantly keep track of all phones on the network. The phones do the job of constantly asking for any data meant for them.
What is the exact order in which the events take place in the case of a bitcoin transaction?
First, the sender’s phone broadcasts the transaction to a number of nearby miners.
Next, the miners relay the transaction to more miners. This transaction is then consequently spread across the globe to all other miners.
Finally, when a majority of the network accepts the transaction and saves the block, the receiver considers the transaction complete.
Now the recipient doesn’t receive any notification from the network about the confirmation of the transaction. Instead, the recipient’s phone has to constantly send pull requests to ask if the transaction has been confirmed by majority of the network.
Does this mean that the phone has to be on or any device used for that matter?
The phone isn’t the one literally sending the pull request. Sending bitcoin is merely adding data to the public ledger. When the receiver logs back on, they’ll see the updates to the ledger and determine their new balance. Nothing is actually sent to the phone itself. The app in the phone is just basically looking into the public list and asking if there is anything there.
So, that is basically what happens in a bitcoin transaction between when you hit send and when the transaction is deemed done.
Join me on Twitter to push the Hive campaign onward and get more people onboard Hive.