TXID | Transaction ID (2024)

Transaction ID

  • TXID | Transaction ID (1)Greg Walker
  • TXID | Transaction ID (2)

A TXID (Transaction ID) is a unique reference for a bitcoin transaction.

They're used for looking up specific transactions in a blockchain explorer. For example:

  • f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16 — First ever Bitcoin transaction to Hal Finney in 2009.
  • a1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48dPizza transaction for 10,000 BTC in 2010.
  • 4ce18f49ba153a51bcda9bb80d7f978e3de6e81b5fc326f00465464530c052f4 — The transaction containing the first donation I received for making this website.

The letters and numbers in a TXID have no special meaning. They're just random-looking bunches of 32 bytes (represented as 64 hexadecimal characters). But they are unique to each transaction.

Creating

How do you create a TXID?

A TXID is created by hashing the transaction data. More precisely, it's created by putting specific parts of the transaction data through the SHA256 hash function, then putting the result through the SHA256 again (this double-SHA256 hashing is referred to as HASH256).

  • For legacy transactions you HASH256 all of the transaction data.
  • For segwit transactions you HASH256 all of the transaction data except the marker, flag, witness fields.

So for segwit transactions the signatures are no longer included as part of the TXID.

The TXIDs you see on blockchain explorers are actually in reverse byte order. This is just a quirk of bitcoin.

Code

A TXID is created in the same way as a block hash. You just need to HASH256 the correct parts of transaction data to create the TXID:

require 'digest'# ----------------# transaction data# ----------------data = "0100000001c997a5e56e104102fa209c6a852dd90660a20b2d9c352423edce25857fcd3704000000004847304402204e45e16932b8af514961a1d3a1a25fdf3f4f7732e9d624c6c61548ab5fb8cd410220181522ec8eca07de4860a4acdd12909d831cc56cbbac4622082221a8768d1d0901ffffffff0200ca9a3b00000000434104ae1a62fe09c5f51b13905f07f06b99a2f7159b2225f374cd378d71302fa28414e7aab37397f554a7df5f142c21c1b7303b8a0626f1baded5c72a704f7e6cd84cac00286bee0000000043410411db93e1dcdb8a016b49840f8c53bc1eb68a382e97b1482ecad7b148a6909a5cb2e0eaddfb84ccf9744464f82e160bfa9b8b64f9d4c03f999b8643f656b412a3ac00000000"# ----# TXID# ----# Note: Don't put the transaction data in to the hash function as a string.# Convert it from hexadecimal to raw bytes first.# convert hexadecimal string to byte sequencebytes = [data].pack("H*") # H = hex string (highest byte first), * = multiple bytes# SHA-256 (first round)hash1 = Digest::SHA256.digest(bytes)# SHA-256 (second round)hash2 = Digest::SHA256.digest(hash1)# convert from byte sequence back to hexadecimal stringtxid = hash2.unpack("H*")[0]# print result (natural byte order)puts txid #=> 169e1e83e930853391bc6f35f605c6754cfead57cf8387639d3b4096c54f18f4# print result (reverse byte order)puts txid.scan(/../).reverse.join #=> f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16

Remember that when working with segwit transactions you do not include the marker, flag, and witness as part of the transaction data that is being hashed.

Examples

What does a TXID look like?

1. Legacy Transaction

To create a TXID for a legacy transaction you HASH256 all of the transaction data:

0100000001c997a5e56e104102fa209c6a852dd90660a20b2d9c352423edce25857fcd3704000000004847304402204e45e16932b8af514961a1d3a1a25fdf3f4f7732e9d624c6c61548ab5fb8cd410220181522ec8eca07de4860a4acdd12909d831cc56cbbac4622082221a8768d1d0901ffffffff0200ca9a3b00000000434104ae1a62fe09c5f51b13905f07f06b99a2f7159b2225f374cd378d71302fa28414e7aab37397f554a7df5f142c21c1b7303b8a0626f1baded5c72a704f7e6cd84cac00286bee0000000043410411db93e1dcdb8a016b49840f8c53bc1eb68a382e97b1482ecad7b148a6909a5cb2e0eaddfb84ccf9744464f82e160bfa9b8b64f9d4c03f999b8643f656b412a3ac00000000

Note: The data that gets hashed to create the TXID is highlighted in green.

If you HASH256 all of this data you get 169e1e83e930853391bc6f35f605c6754cfead57cf8387639d3b4096c54f18f4, which is the TXID in natural byte order and is what's found inside raw transaction data.

Then, if you reverse the byte order you get the TXID f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16, which is the byte order used when searching for transactions in blockchain explorers.

2. Segwit Transaction

To create a TXID for a segwit transaction you HASH256 all of the transaction data except the marker, flag, and witness fields.

020000000001013a53de6e1fe821452674c5435e3989eecdf35cb1de1c8bafb674f543a55d658c3600000000fdffffff01599aea0400000000160014cfbd92a6337e8b6043552d6fc5c35c7e5062281e0247304402201250febbce0a5b333c2d715b869cb960f5abf1702192c7af6e112c6d6030be880220073c55f4814a064bf804d9ed16b57eaaeaafb536c4187e6260ef3fc61ca98a77012102e71911951e1f9799d5ccd05200ea0c18f786cb1bb45754d4a0799a06c2b80e8000000000

Note: The data that gets hashed to create the TXID is highlighted in green.

If you HASH256 the highlighted data you get 01cda497b58d876f207b74c1f0b741f397c376852b3c68b0b6db042a24ffd96c, then if you reverse the byte order you get the TXID 6cd9ff242a04dbb6b0683c2b8576c397f341b7f0c1747b206f878db597a4cd01.

When creating a TXID for a segwit transaction, you do not hash the fields that are new to segwit transactions. This avoids having any signature data forming part of the TXID (which are now in the witness instead) as signatures can be manipulated to change the TXID after a transaction has been sent in to the network (which is rare, but it makes TXIDs less dependable).

This was the primary reason for the segregated witness upgrade.

Try it yourself

You can check that the above data produces the correct TXIDs by manually hashing the same data using HASH256 directly:

Then don't forget to reverse the byte order:

Usage

How are TXIDs used in Bitcoin?

TXIDs play an important role in the way Bitcoin works. They are used in the following situations:

1. Searching for transactions

You typically use TXIDs to look up specific transactions on a blockchain explorer or from your own local node:

$ bitcoin-cli getrawtransaction f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e160100000001c997a5e56e104102fa209c6a852dd90660a20b2d9c352423edce25857fcd3704000000004847304402204e45e16932b8af514961a1d3a1a25fdf3f4f7732e9d624c6c61548ab5fb8cd410220181522ec8eca07de4860a4acdd12909d831cc56cbbac4622082221a8768d1d0901ffffffff0200ca9a3b00000000434104ae1a62fe09c5f51b13905f07f06b99a2f7159b2225f374cd378d71302fa28414e7aab37397f554a7df5f142c21c1b7303b8a0626f1baded5c72a704f7e6cd84cac00286bee0000000043410411db93e1dcdb8a016b49840f8c53bc1eb68a382e97b1482ecad7b148a6909a5cb2e0eaddfb84ccf9744464f82e160bfa9b8b64f9d4c03f999b8643f656b412a3ac00000000# Note: You need to set txindex=1 in bitcoin.conf to look up all the transactions in the blockchain.

This is useful when you want to check out the details of a transaction or to find out its location (i.e. if it has been mined in to the blockchain or if it's still in the mempool).

2. Referencing previous outputs for spending

You use TXIDs for referencing outputs from previous transactions for use as inputs when you create a bitcoin transaction.

TXIDs are unique, so you can use them in combination with a VOUT to reference any specific output in the blockchain for spending.

3. Creating a merkle root

TXIDs are used to create the merkle root for the block header:

A merkle root is created by basically hashing all of TXIDs in a block in a tree-like structure. This creates a unique fingerprint for all the transactions inside the block, which then gets placed inside the block header to prevent the contents of the block from being tampered with later on.

This is because any change to transaction data will change the TXID, and any change to a TXID will have a knock-on affect to the resulting merkle root.

TXID | Transaction ID (2024)

FAQs

TXID | Transaction ID? ›

A txid or Transaction ID is a string of letters and numbers that identifies a specific transaction on the blockchain. It can be used to look up a transaction on a node or block explorer.

How do I find my txid number? ›

Open a blockchain explorer like blockchain.com, etherscan.io, or solscan.io. (The explorer depends on the blockchain that you used – Ethereum, Bitcoin, Solana.) Connect your wallet to the explorer. Navigate to the completed transactions section where you will see all TXIDs displayed.

What is a txid? ›

The term "Transaction ID," often abbreviated as TXID, is an alphanumeric string that serves as a unique identifier for individual transactions on a blockchain, ensuring both transparency and traceability.

How to look up transaction ID? ›

If you're looking for a transaction ID associated with a bank transaction, check your bank statement. Transaction IDs might be reference numbers or unique identifiers assigned to each transaction by the bank. Look for the applicable transaction ID on your online or physical bank statement.

How do I track my Bitcoin transaction ID? ›

How to find a cryptocurrency transaction ID (TXID) in the Bitcoin.com Wallet app. From the app's home screen, tap on the "Funds" icon in the bottom toolbar. Select the blockchain of the transaction ID you are looking for. For example, if your transaction was on the Bitcoin blockchain, select Bitcoin.

Can I trace a transaction ID? ›

You can use transaction ID tracking to check the status of your UPI payment on mobile banking and digital payment apps. The transaction ID or UPI reference number is displayed on your phone's screen or sent to you through SMS, once a transaction is processed.

What does a txid look like? ›

How does the Transaction ID look like? Your Transaction ID consists of a combination of letters and numbers, displayed in the following format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. Each character in the Transaction ID is unique and contributes to its identification.

Is transaction ID same as TXID? ›

A txid or Transaction ID is a string of letters and numbers that identifies a specific transaction on the blockchain. It can be used to look up a transaction on a node or block explorer.

What is the TX ID of a wallet? ›

A TXID is a transaction ID (unique code/hash) that allows you to locate your transaction on the blockchain of a digital currency.

How to track crypto transactions? ›

Blockchain explorer

Each entry contains transaction details, such as the amount, timestamp and the sender and receiver's address. Blockchain explorers have an intuitive user interface (UI), allowing users to search for all transactions, blocks, wallet addresses and digital asset history.

How do I track a transaction ID on Google? ›

In the left side menu, click Subscriptions and Services. In the box Other purchase activity, click View Purchases. Select the purchase with the description Google Play. The transaction ID will appear on the right side information box.

What is a 12 digit transaction ID? ›

The UPI reference number is the identification number attached to UPI transactions, which ensures the reliability and transparency of UPI transactions. It is a unique 12-digit number that tags each UPI transaction, providing essential transaction details.

How to check if transaction ID is real or fake? ›

  1. A transaction receipt should have an amount mentioned that has been deducted.
  2. Now you need to check your bank account online for any such amount debited. ...
  3. Remember, don't call any phone number mentioned on the receipt as it wil be most probably be the phone number of those scammers who sent you the fake receipt.
Mar 20, 2023

Can I trace a Bitcoin transaction? ›

Yes, bitcoin transactions are traceable. Every transaction made on the Bitcoin network is recorded on a public ledger called the blockchain. While individual users can remain pseudonymous, their transaction history can still be traced through analysis of the blockchain.

How do I access Bitcoin transactions? ›

Searching by the transaction list
  1. From the Bitcoin.com Wallet app's home screen, tap on the "Funds" icon in the bottom toolbar.
  2. Select the blockchain of the transaction you are looking for. ...
  3. Choose the wallet of the transaction you are looking for (eg. ...
  4. Select the transaction.

How to tell if a Bitcoin is real? ›

The Casascius Bitcoins have a private key embedded in the coin and covered by a hologram that displays a honeycomb pattern if it is tampered with. The outside of each coin also contains the first 8 characters of the Bitcoin address associated with the coin.

Top Articles
About the RBA
Highest returns in six months
Gamevault Agent
Hocus Pocus Showtimes Near Harkins Theatres Yuma Palms 14
Free Atm For Emerald Card Near Me
Craigslist Mexico Cancun
Hendersonville (Tennessee) – Travel guide at Wikivoyage
Doby's Funeral Home Obituaries
Vardis Olive Garden (Georgioupolis, Kreta) ✈️ inkl. Flug buchen
Select Truck Greensboro
How To Cut Eelgrass Grounded
Craigslist In Flagstaff
Shasta County Most Wanted 2022
Energy Healing Conference Utah
Testberichte zu E-Bikes & Fahrrädern von PROPHETE.
Aaa Saugus Ma Appointment
Geometry Review Quiz 5 Answer Key
Walgreens Alma School And Dynamite
Bible Gateway passage: Revelation 3 - New Living Translation
Home
Shadbase Get Out Of Jail
Gina Wilson Angle Addition Postulate
Celina Powell Lil Meech Video: A Controversial Encounter Shakes Social Media - Video Reddit Trend
Walmart Pharmacy Near Me Open
Dmv In Anoka
A Christmas Horse - Alison Senxation
Ou Football Brainiacs
Access a Shared Resource | Computing for Arts + Sciences
Umn Biology
Obituaries, 2001 | El Paso County, TXGenWeb
Cvs Sport Physicals
Mercedes W204 Belt Diagram
Rogold Extension
'Conan Exiles' 3.0 Guide: How To Unlock Spells And Sorcery
Colin Donnell Lpsg
Teenbeautyfitness
Weekly Math Review Q4 3
Facebook Marketplace Marrero La
Nobodyhome.tv Reddit
Topos De Bolos Engraçados
Electric Toothbrush Feature Crossword
Gregory (Five Nights at Freddy's)
Grand Valley State University Library Hours
Holzer Athena Portal
Hampton In And Suites Near Me
Stoughton Commuter Rail Schedule
Bedbathandbeyond Flemington Nj
Free Carnival-themed Google Slides & PowerPoint templates
Otter Bustr
Used Curio Cabinets For Sale Near Me
San Pedro Sula To Miami Google Flights
Selly Medaline
Latest Posts
Article information

Author: Manual Maggio

Last Updated:

Views: 6180

Rating: 4.9 / 5 (69 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Manual Maggio

Birthday: 1998-01-20

Address: 359 Kelvin Stream, Lake Eldonview, MT 33517-1242

Phone: +577037762465

Job: Product Hospitality Supervisor

Hobby: Gardening, Web surfing, Video gaming, Amateur radio, Flag Football, Reading, Table tennis

Introduction: My name is Manual Maggio, I am a thankful, tender, adventurous, delightful, fantastic, proud, graceful person who loves writing and wants to share my knowledge and understanding with you.