Bitcoin transactions: How do Bitcoin transactions work?

in #cryptocurrency6 years ago

Validation of a bitcoin transactions are similar across cryptocurrencies. It’s also known as mining (why is it called mining will be mentioned below)

The financial banking systems, have a system to check

  • If the senders have enough balance to carry out transaction &
  • To check if same amount isn’t spent twice

These are the two most important validations that are made in a transaction validation process.

Since the blockchain at it’s core is decentralized in nature & have no middlemen to charge fees, there should be someone who does these validations.

So, the developer (Satoshi Nakamoto) of first cryptocurrency, Bitcoin designed the ecosystem in such a way that generating new cryptocurrencies and validating the pending transactions go in parallel. In fact, generating new units of cryptocurrencies is a by product of validating the transactions.

The same concept is in hereditary in most of the altcoins.

Here’s how & what happens.

If you don’t already know, blockchain is a public database which can be accessed by anyone with an Internet connection.

There’s a group of volunteers who spend their time & energy to validate the transactions, these are called miners.

A transaction gets in the queue for being validated in the blockchain. A certain number of transactions together make a block. Each block is taken by a miner (its a stack, where miners pick one block at a time ) and all the transactions are validated one by one by the miner.

Technically, it’s the algorithm that does the heavy lifting, miners just control the machines that run the algorithms.

Bitcoin transactions: A bird’s eye view

You intend to send one bitcoin to us, you hit send button and the algorithm scans the entire network to check two thing we mentioned above, your balance and double spend check.

Still want detailed working? Keep reading on…

Bitcoins, or any cryptocurrency for that matter are stored in a software wallet. Technically, the wallet doesn’t store the bitcoin, it store the bitcoin address. This bitcoin address keeps the records of all the transactions that are made by the wallet, and hence the account balance.

The wallet contains two types of addresses, one directly linked, other indirectly. When someone receives bitcoin from your end, they’ll see a 34 characters long, alpha-numeric public address. Furthermore, public address is visible to anyone who rolls their eyes on the transaction.

And then there’s a 64 character long, alpha-numeric private address, which is literally private. Whoever has the private address is the owner of the bitcoins, be it 1 BTC or 21 Million BTC. Its that important.

There can be any number of public addresses for one private address, not the other way round. Which also tells us that though two keys are directly related, there’s no way one can figure out the private address using public address. This ensures privacy & security at the same time.

Note: Private address is needed only to “sign” a transaction. Just like you sign a document digitally. This private key is like an agreement that you own the bitcoin and you haven’t sent to it someone else, twice.

To make a transaction, you will need to enter the private address and transactions details, i.e. the amount that you need to send. The best part of Bitcoin, a masterpiece we’d say is this.

Every transaction has a public key and signature linked to it. Though the public key is directly linked to the private key, and even the signature is the result of private key, there’s no way to figure the private key out. Neither the program can figure it out nor a human can do this manually. Brilliant!

Furthermore, the network then checks across all the miners if the same transaction is being addresses by someone else too. This is to avoid double spend. Since the transactions are being broadcasted throughout the blockchain, this has to be done. Else people would spend several times for same thing.

Post this, the algorithm gives a transaction id which is then fed to the blockchain and then the ball in the miner’s court.

This is where it gets even more complicated. Still wanna read?

Go on…

Now that the transaction is validated, it enters into a block with several other transactions waiting for approval.

Validating a transaction will debit bitcoin from the wallet and approving will credit bitcoins in the receiver’s wallet.

Before we get into the details of approval process, let us help you understand what “hash” is. Hash is again a 64 character long string that is generated by the hash function. A hash function is a program that converts any data to a 64 character string.

No matter how many times you feed in the data, unless the input is same, output remains same. You can change a single comma, the whole string would change altogether.

A whole book can be converted to a hash, and no one would know about it. Unfortunately, there are no decrypters to unhash the hash key. If that become available, you can only imagine the amount of compression that would happen. Hash functions will play a very important role in data encryption, but that’s different topic altogether.

If you’re a computer science nerd and know about data structures, you’d relate this better.

Just like the nodes in data structures have two parts, the data part and address to the previous node. This makes the data in a structured format.

Similarly, every block has the transaction data and the hash to the previous block. This way, every block has two hash addresses, one to the previous and one to the next. This forms a chain of blocks, hence the name blockchain.

Now, a very interesting part from security stand point.

If someone tries to tamper the blocks in a blockchain, the data in it will change, hence the hash address. If hash changes, the link will break and this way, the whole network would know.

This way, the security of the whole network is made brilliantly transparent and highly secure.

Amidst all this, miners generate new units of cryptocurrencies and a portion of it is given to them as rewards and the rest flows into the market for consumer use. As far as Bitcoins are concerned, there will 21 million units of BTC in the market, out of which, 17 million have already been mined.

This is a brief, here’s a detailed article on Bitcoin Mining.

Furthermore, it’s nearly impossible to tamper the blocks. Even the miners cannot do it, once it’s gone, it’s gone forever.

If you want to go even deeper, you’d want to start talking in 0’s & 1’s so that you can talk to a computer and figure out what’s happening at a atomic level.

Till then, have some fun by going to BitBonkersor see things in live action at Blockchain.info

We hope we helped you understand how exactly cryptocurrency transactions work and what is mining.

If you find this post any helpful, please share it with people who’re interested in learning about this. It keeps us motivated.


Originally published at https://www.bitfolio.org/bitcoin-transactions.

Coin Marketplace

STEEM 0.29
TRX 0.12
JST 0.033
BTC 69831.92
ETH 3744.43
USDT 1.00
SBD 3.77