I'm using block.io and experimenting with a testnet accounts given to me by the site.

I can create addresses on the website and have thus far created 5 in total.

However, I only have one WIF, also given by block.io.

When I am building a transaction with bitcoinjs-lib, the WIF associated with the account decodes to a public address which does not match any of the 5 created addresses.

I'm still having trouble building a transaction and so am looking to understand how the WIF relates to the public addresses

I'm not really sure if this is a feature of block.io or if the address generation is a feature of bitcoin itself. It would be great if I can get an explanation of how these two are related.


1 Answer 1


tl:dr: The WIF is the master private key. The addresses are different things entirely but are derived from that.

[I] am looking to understand how the WIF relates to the public addresses


In Bitcoin, Wallet Import format (WIF) is a way of writing private keys. The numbers that give you power to spend money.

WIF is used to make backups of keys and when replacing one wallet program with another from a different developer.


However addresses are abstractions of locking scripts. These locking scripts are the parts of transactions in the blockchain that effectively specify who is allowed to spend a specific amount. For P2PKH outputs the address would be based on a hash of a public key.

Addresses are used to tell payers how they can construct an output in a transaction that will pay you money.


Note that WIF and addresses never appear in the Bitcoin blockchain.

Derivation of addresses from keys

There are other questions here about Bitcoin address generation that may be helpful however my rough understanding of the process is as follows

  1. When you create a wallet, a seed is created. This is a randomly generated number.
  2. From that seed we can use HMAC-SHA512 to generate
    • A master private key
    • A master public key
    • A master chain code
  3. From those, each time we want to receive a payment, we can use BIP-32 and a chosen derivation-path to create the next in a series of hierarchical deterministic (HD) private and public keys.
  4. from each of those public keys we can create an address suitable for use with one of the standard Bitcoin locking scripts.

for P2PKH locking scripts the process is

     | SHA256,RIPEMD160 (AKA HASH160)
Public key hash
     | Base58Check encode with 0x00 prefix
Bitcoin address

Example values

When you have a long string of numbers and letters and are wondering what sort of thing it is, this may help.

Prefix Example use Example value (DO NOT USE)
0 0x00 "1" Pubkey hash (P2PKH address) 17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhem
5 0x05 "3" Script hash (P2SH address) 3EktnHQD7RiAE6uzMj2ZifT9YgRrkSgzQX
128 0x80 "5" Private key (WIF, uncompressed pubkey) 5Hwgr3u458GLafKBgxtssHSPqJnYoGrSzgQsPwLFhLNYskDPyyA
128 0x80 "K"/"L" Private key (WIF, compressed pubkey) L1aW4aubDFB7yfras2S1mN3bqg9nwySY8nkoLmJebSLD5BWv3ENZ
4,136,178,30 0x0488B21E "xpub" BIP32 pubkey xpub661MyMwAqRbcEYS8w7XLSVeEsBXy79zSzH1J8vCdxAZningWLdN3 zgtU6LBpB85b3D2yc8sfvZU521AAwdZafEz7mnzBBsz4wKY5e4cp9LB
4,136,173,228 0x0488ADE4 "xprv" BIP32 private key xprv9s21ZrQH143K24Mfq5zL5MhWK9hUhhGbd45hLXo2Pq2oqzMMo63o StZzF93Y5wvzdUayhgkkFoicQZcP3y52uPPxFnfoLZB21Teqt1VvEHx
111 0x6F "m"/"n" Testnet pubkey hash mipcBbFg9gMiCh81Kj8tqqdgoZub1ZJRfn
196 0xC4 "2" Testnet script hash 2MzQwSSnBHWHqSAqtTVQ6v47XtaisrJa1Vc
239 0xEF "9" Testnet Private key (WIF, uncompressed pubkey) 92Pg46rUhgTT7romnV7iGW6W1gbGdeezqdbJCzShkCsYNzyyNcc
239 0xEF "c" Testnet Private key (WIF, compressed pubkey) cNJFgo1driFnPcBdBX8BrJrpxchBWXwXCvNH5SoSkdcF6JXXwHMm
4,53,135,207 0x043587CF "tpub" Testnet BIP32 pubkey tpubD6NzVbkrYhZ4WLczPJWReQycCJdd6YVWXubbVUFnJ5KgU5MDQrD9 98ZJLNGbhd2pq7ZtDiPYTfJ7iBenLVQpYgSQqPjUsQeJXH8VQ8xA67D
4,53,131,148 0x04358394 "tprv" Testnet BIP32 private key tprv8ZgxMBicQKsPcsbCVeqqF1KVdH7gwDJbxbzpCxDUsoXHdb6SnTPY xdwSAKDC6KKJzv7khnNWRAJQsRA8BBQyiSfYnRt6zuu4vZQGKjeW4YF
"bc1" Bech32 pubkey hash or script hash bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4
"tb1" Bech32 testnet pubkey hash or script hash tb1qw508d6qejxtdg4y5r3zarvary0c5xw7kxpjzsx

Prefixes are given as decimal, hex and resulting symbolic values.

See also

  • oh wow. thanks for the really comprehensive explanation.
    – zcaudate
    Sep 11, 2022 at 15:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.