Bitcoin is one of the cryptocurrencies that leads the market. The market capitalization of Bitcoin exceeds\u00a050% of the whole sector. The attraction to Bitcoin caused its value to hit its\u00a0highest price\u00a0in late\u00a02017. However, people do not know the details of Bitcoin. Here we will examine the transactions in the Bitcoin blockchain. Transactions are one of the central parts of the Bitcoin blockchain. Since Bitcoin is the currency, then it should have ledgers and transaction details, at least. Those transactions are grouped and put into blocks by the system. Because transactions are necessary, this type of record is called a transaction-based ledger. It is required to know the difference between account-based and transaction-based bookkeeping. Difference Between Transaction and Account-based Accounting An account-based ledger\u00a0is the ledger that main focus of records is the accounts. Each transaction refers to the accounts of people and determines whether there is an adequate amount of coins to do the transactions. We know that blockchain consists of hundreds of blocks. If we try to determine that the sending account has the right amount of money, then we have to analyze all blocks and calculate if it is correct. This process is very cumbersome. If we look at the first table, it is hard to identify Alice has the right amount of money to transfer at the end of the table. It is a short list we can calculate, but in real blockchain, it is hard to do. After calculation, we will see that it is not a valid transaction. A\u00a0transaction-based ledger is a ledger the main focus of the records is the transactions themselves. Each transaction refers to another transaction to check its validity. The number in the input line refers to another transaction and the exact person. In reality, those index numbers are the hash pointers to those transactions. Each transaction has its hash value. So just by finding the previous transaction, we can identify that Alice has a specified amount of money in her account. Since you have to spend all of your coins once, you have to send another part of the money back to yourself, usually to your other account. If you want to transfer to two separate accounts, then you can do it by adding two different people to the output of the transaction. On the other hand, if you want to send from two separate transactions, then you can merge them in one input. Deep Into Transaction We examined how the transaction works. Now it is time to delve into more programming side of the transaction. I am sure that it will be interesting for many people since they think of bitcoin as an abstract system. Here we will try to look close to the transaction. We know that transaction has input and output, and it is also valid for the script. Additionally, there is a metadata part that gives us some information about the transaction. In the metadata, there are some important keywords to analyze. Firstly,\u00a0\u201chash\u201d\u00a0is the hash value of the transaction. It is the hash value that can be used as a hash pointer to this transaction in the future. Secondly,\u00a0\u201cvin_sz\u201d\u00a0is the number of inputs in the transaction. Here there are two inputs. Next,\u00a0\u201cvout_sz\u201d\u00a0is the number of outputs in the transaction. Here there is one output.\u00a0\u201csize\u201d\u00a0is the size of the transaction. After the metadata, the inputs section comes to the scene. We have two inputs, and we will have two similar coding pieces. Firstly,\u00a0\u201chash\u201d\u00a0is the hash value of the previous transaction, and\u00a0\u201cn\u201d shows the index from the transaction. The index of the output is zero, and zero is the first output from the previous. In the end, there is\u00a0\u201cscriptSig\u201d, it is our signature that we are able to require those funds from the previous transaction. The last section is the output part of the code. The output consists of two parts: value and script.\u00a0\u201cvalue\u201d\u00a0is the coins that you want to send.\u00a0\u201cscriptPubKey\u201d\u00a0does not just include public key but also other things. As its name suggests, it is a script. It is the Bitcoin scripting language. This language is simple, compact, and specially made for cryptography. It is a stack-based language. In this programming language, there is no loop function. It means every command is executed once in a linear way. Let\u2019s examine the scripts in the output. <sig> <pubKey> OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG In this script,\u00a0<sig>\u00a0and\u00a0<pubKey>\u00a0are specified by the recipient who will receive the payment.\u00a0OP_DUP\u00a0is the operation that takes and duplicates the last stacked value (in this case\u00a0<pubkey>), which is at the top of the stack.\u00a0OP_HASH160\u00a0finds the hash value of the last stacked value (<pubkey>). Then the algorithm adds\u00a0<pubKeyHash>, which is the public key provided by the sender. Next,\u00a0OP_EQUALVERIFY\u00a0is the operation that verifies that the hash of the public key provided by the recipient and the sender are the same. If they are true, then the last two stacks will disappear. Finally, we already find that the public key is correct, and\u00a0OP_CHECKSIG\u00a0is the command that verifies the signature again and approves that signature is true for the whole transaction. It is the power of Bitcoin scripting language that it does not call any library. It is all in the Bitcoin scripting language. If the error occurs, then the whole process stops, and the transaction will not add to the blockchain. In most cases, it is hard to understand the working principles of Bitcoin. In this blog, we tried to give you information about the transactions to help you visualize it. With that visualization, we are sure that your trust in Bitcoin will improve.