In this article, we will analyze bitcoin transactions and learn how to parse RawTX very quickly from the blockchain network to the Google Drive folder, all this will help us better understand how bitcoin transactions work and what all its contents are on the blockchain network.
First, we need to know that all bitcoin transactions are stored in [txid].
txid is the transaction ID stored on the bitcoin blockchain, RawTX is stored in the form of a double hash.
This means that RawTX went through the SHA256 algorithm twice to get the transaction hash that we see on the blockchain.
For example, a transaction with this hash: d76641afb4d0cc648a2f74db09f86ea264498341c49434a933ba8eef9352ab6f
Transactions on the bitcoin blockchain are stored in the form of a double hash:
SHA256(SHA256(0100000001f2068914e2fea859cacd8df990daf4008f11296b3cb953794051147a265d850a000000008b483045022043784344e1e0cb498c1d73b4cee970fb0f9adf38b7891d0b1310fdb9cbc23929022100a734f4e97a05bd169a9f0eb296fc841fa57f8753db09869f8f6f8cc1232616d4014104d6597d465408e6e11264c116dd98b539740e802dc756d7eb88741696e20dfe7d3588695d2e7ad23cbf0aa056d42afada63036d66a1d9b97070dd6bc0c87ceb0dffffffff0100b864d9450000001976a9142df31a60b02cce392822c9a87198753578ef7de888ac00000000) = d76641afb4d0cc648a2f74db09f86ea264498341c49434a933ba8eef9352ab6f
To get RawTX we just need to enter the transaction id [txid],
further we will receive information in HEX format, this is our cherished RawTX.
but as we know, there can be a lot of transactions [txid] in one Bitcoin Address and this is the main problem, which takes a lot of time to find, loads our PC and takes up a lot of disk space.
To solve this problem, just use
API the site https://chain.so/api/
And so, we specify one Bitcoin Address in the bash script:
getrawtx.sh «address» and then we extract the entire previous output hash – all inputs refer to the output
The UTXO is the (unspent transaction output) that will be spent on the new input. The hash value of this is
UTXOstored in reverse order.
As a result, all unspent transaction output will be stored in a file:
RawTX Bitcoin Addresses, use the Bash script: getrawtx.sh
How to parse to the Google Drive folder?
To do this, you can use the Terminal for Google Colab [TerminalGoogleColab]
Earlier I recorded a video tutorial: “TERMINAL in Google Colab creating all the conveniences for working in GITHUB”
Let’s take a closer look at how the Bash script works: getrawtx.sh
Bitcoin The address that we specify for the utility command
What advantage do we get as a result:
- RawTX parsing is fast and everything is saved in one file in the Google Drive folder
- unlike the getrawtransaction command
«txid», in the console
Bitcoin Сorewe do not need to enter
«txid», just enter Bitcoin Address getrawtx.sh “address”
- bash script: getrawtx.sh through site API https://chain.so/api/ finds unspent transaction output
Source code: https://github.com/demining/CryptoDeepTools/tree/main/01BlockchainGoogleDrive