How to Read Bitcoin Data
Table of Contents
- Most Bitcoin data will be represented in alphanumeric strings with identifying prefixes.
- Addresses begin with 1, 3, or bc1.
- Block hashes begin with many zeros.
- Transaction IDs are 64 characters long but have no identifying prefixes.
Bitcoin has a variety of data types, most of which are represented by alphanumeric strings. These strings may seem indistinguishable at first, but each Bitcoin data type has unique identifiers to help users distinguish between them.
Addresses are the most common Bitcoin data type for a user to see and interact with. Addresses are used to receive bitcoin, so they are often shared publicly and displayed on the blockchain. It is a best practice for users to generate and share a new address each time they wish to receive bitcoin. There are several types of Bitcoin addresses, each with a distinct beginning sequence:
“1…”: Addresses beginning in 1 are the most common. They are the most common address type, and they are meant for P2PKH transactions. This address is simply a hash of a public key, with the 1 digit added to the beginning as an identifier. P2PKH addresses use Base58 encoding, which is case sensitive.
“3…”: Addresses beginning with 3 are also common. They are used for P2SH transactions. These types of addresses may be (nested) SegWit addresses, but they might also be multisig addresses. Using this kind of address, if it is a SegWit address, will offer savings on transaction fees. P2SH addresses use Base58 encoding, which is case sensitive.
“bc1…” These addresses are (native) SegWit addresses. Sending to these addresses offers the greatest fee savings compared to the former two addresses. These transactions are often longer than the former two as well. Native SegWit addresses use Bech32 encoding, which only uses lowercase letters.
Addresses to watch out for:
- “2…” An address beginning with 2 is a testnet address, meant to receive test bitcoin (tBTC). Never send real bitcoin to these addresses.
Public keys are used less commonly by Bitcoin users nowadays. They have been mostly replaced by addresses as the way to receive bitcoin. However, you may occasionally see them. Public keys are much longer than addresses and also have specific beginning sequences:
“02…” or “03…” These are standard public keys encoded in SEC format. They can be hashed and turned into addresses for receiving as needed, used for creating multi-signature addresses, or used for verifying signatures. Very early Bitcoin transactions used public keys as part of P2PK transactions.
“xpub…”, “ypub…” or “zpub…” These are extended public keys or xpubs. They are keys used to derive many public keys as part of a Hierarchical Deterministic (HD) wallet. They should only be shared with parties you trust, even though they are public keys, as anyone with access to your xpub can track your entire past and future transaction history.
Blocks are large data structures, so you will rarely see the raw data of a block. However, every block can be identified by both its height and its hash.
Block Height. Each block is numbered in ascending order, starting at zero. So far, there are just over 650,000 blocks in existence, so most block heights you will encounter will be six digits.
Block Hash. A block hash is the SHA-256 hash of the block’s data, and is usually represented in hexadecimal format. A block hash can be interpreted as a very large number. In order to satisfy the Proof-of-Work requirement, a block hash must be below a certain threshold. Thus, all block hashes start with a series of zeros followed by an alphanumeric string. Some blocks have as many as twenty leading zeros, while earlier blocks have as few as eight. The number of zeros required roughly demonstrates the difficulty of mining at the time the block was published.
Transactions are usually around 250-400 bytes long, represented in hexadecimal format. However, transactions can be recognized by their txid, or the hash of the transaction. Thanks to SHA-256’s strong randomness, no two transactions should have the same ID. Transaction IDs are alphanumeric strings which are all 64 characters long. They have no defined beginning sequences, but their length, and the fact that, unlike block hashes, they don’t start with a string of zeros, should help you identify them.
You can use a block explorer to look up addresses, transactions, and blocks. Try out Blockstream’s block explorer here.
A Bitcoin signature using the ECDSA signature scheme is between 71-73 bytes long, and is represented using DER encoding. Bitcoin signatures will always start with the prefix ‘30’. Inside a signature, two ‘02’ prefixes will precede the R and S values which comprise a signature.