What are the different prefixes of Bitcoin addresses?

5

1

Until today, I thought all addresses must start with 1.

Well, behold 3M8XGFBKwkf7miBzpkU3x2DoWwAVrD1mhk, which is a multi-sig escrow address created to hold the bounty for the development of CoinJoin. This is both the first address I observed that doesn't start with 1, and the first multi-sig address that I've seen in the wild.

Are there other possible prefixes? What characterizes the different prefixes? (E.g. are all addresses that start with a 3 multisig addresses? Are there multisig addresses that do not start with a 3?)

ripper234

Posted 2013-09-07T16:20:52.177

Reputation: 25 192

Answers

9

According to the glossary the possible prefixes for bitcoin addresses are 1,3 or 5:

I'm quoting here:

Address

Bitcoin address is a Base58Check representation of a Hash160 of a public key with a version byte 0x00 which maps to a prefix "1". Typically represented as text (ex. 1CBtcGivXmHQ8ZqdPgeMfcpQNJrqTrSAcG) or as a QR code.

A variant of an address is P2SH address: a hash of a spending script with a version byte 0x05 which maps to a prefix "3" (ex. 3NukJ6fYZJ5Kk8bPjycAnruZkE5Q7UW7i8).

Another variant of an address is not a hash, but a raw private key representation (e.g. 5KQntKuhYWSRXNqp2yhdXzjekYAR7US3MT1715Mbv5CyUKV6hVe). It is rarely used, only for importing/exporting private keys or printing them on paper wallets.

Assaf Shomer

Posted 2013-09-07T16:20:52.177

Reputation: 523

4

1 and 3 are currently the only defined prefixes for an base58 encoded address.

1 is most common and denotes a simple "pay-to-PubKey" transaction. This transaction shows an actual recipient address.

3 indicates a "pay-to-script-hash" address that contains a hash (one way fingerprint) of a script that can be used for multiple things including address obfuscation and multi-signature requirements. This script is required to be a valid bitcoin transaction script, but the full script behind the scenes is not public, just the hash.

More information here: https://en.bitcoin.it/wiki/BIP_0016

More info on the base58 implementation used: https://en.bitcoin.it/wiki/Base58Check_encoding

CoinEnablers

Posted 2013-09-07T16:20:52.177

Reputation: 685

2

Here is a comprehensive list of key formats: https://en.bitcoin.it/wiki/List_of_address_prefixes. Technically, most of these are not addresses, but this seems to be in line with @Assaf Shomer's answer, which mentions raw private keys.

John Henry

Posted 2013-09-07T16:20:52.177

Reputation: 1 153

2

The odd prefix comes from a different magic byte used to generate this address. 05 in this case for a script address. Magic bytes are used for different purposes, like indicating the network. Bitcoins private key byte is 0x80, or 128. (testnet is 6F, litecoin has 48, giving L..)

You can find a list here: https://en.bitcoin.it/wiki/List_of_address_prefixes

Usually they're defined in the chainparams.cpp https://github.com/bitcoin/bitcoin/blob/2068f089c8b7b90eb4557d3f67ea0f0ed2059a23/src/chainparams.cpp#L129 for bitcoin and related networks, except in really old versions

karimkorun

Posted 2013-09-07T16:20:52.177

Reputation: 763

correction of a freudian slip: prefix character for P2SH is 05 not 03.karimkorun 2018-11-16T23:23:45.573