43 Technical Facts about Bitcoin

Harsha Goli
BitCraft
Published in
4 min readApr 28, 2018

--

Got an interview coming up for a crypto interview? Here’s a short list of facts and explanations I’ve come up with while preparing for my series of interviews.

This article is a constant work in progress, and additions will be made as time progresses or as proposed.

Bitcoin Transactions

  1. Can be comprised of many inputs and outputs
  2. The inputs are the previous transaction hash and the index of the previous transaction output which you want to spend
  3. Each output are values assigned to an address
  4. In general, a transaction is expected to have 2 outputs, the destination address and the change address
  5. The change address is used to send the remainder of the funds back to the sender (like when you pay for a 5 dollar coffee with 20 dollars and get 15 dollars back. The 15 dollars goes to the change address
  6. Transaction fee = aggregate input value − aggregate output value
  7. ^ The transaction fee is just what’s left over in a transaction
  8. A coinbase transaction is a transaction is with zero usable inputs
Coinbase transaction visual

9. A coinbase transaction has a single input. This is input is not used, and it contains 32 bytes zeros as the previous transaction

//Example getrawtransaction on coinbase tx> getrawtransaction d1c6b8140246950475735394b0ac68f9ada60d313d2b5308afbc569c84f7fd08
< 01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff53038349040d00456c69676975730052d8f72ffabe6d6dd991088decd13e658bbecc0b2b4c87306f637828917838c02a5d95d0e1bdff9b0400000000000000002f73733331312f00906b570400000000e4050000ffffffff01bf208795000000001976a9145399c3093d31e4b0af4be1215d59b857b861ad5d88ac00000000
01000000 - version
01 - input count
0000000000000000000000000000000000000000000000000000000000000000 - prev tx
ffffffff - prev out n
53 - length of coinbase script
038349040d00456c69676975730052d8f72ffabe6d6dd991088decd13e658bbecc0b2b4c87306f637828917838c02a5d95d0e1bdff9b0400000000000000002f73733331312f00906b570400000000e4050000 - coinbase script
ffffffff - sequence
01 - output count
bf20879500000000 - 2508660927, satoshi count, or 25.08660927 BTC
19 - script length
76a9145399c3093d31e4b0af4be1215d59b857b861ad5d88ac - script
00000000 - locktime

10. The absolute smallest transaction you’d see would be 60 bytes, use an input where the script does not require and signatures, and the output scriptpubkey is empty

02000000
01
0000000000000000000000000000000000000000000000000000000000000000
00000000
00
fdffffff
01
0100000000000000
00
00000000

11. Coinbase transactions must have 100 confirmations to be spendable

12. The genesis output is not spendable

13. Pay-to-PubKey (P2PK): A transaction that is paid directly to the public key (not in the formal address format that is acquired after hashing twice)

14. Pay-to-Script-Hash (P2SH): moves responsibility for supplying conditions to redeem a transaction from the sender to the redeemer. Used for multi-sig

15. Script Hash addresses that start with 3, specified in BIP 13

16. m-of-n: term used to describe the number of keys needed out of the number of keys available to sign a multi-sig transaction. Ex: 2 of 3, 10 of 20, etc

17. Fun fact: the largest n can be regarding above is 20, but standardization rules dictate 3

18. Pay-to-Witness-Script-Hash (P2WSH):

19. Witness in Segregated Witness refers to the scriptSig in inputs

20. Dust transactions are transactions with value too small to be considered by many clients, and can be rejected by custom node software (although they are completely valid by the protocol)

21. Sweeping is a transaction that has a lot of dust transactions. Because you’re sweeping the dust into a single transaction

22. Bitcoin is divisible by 8 decimal places, the smallest unit is known as a satoshi

Bitcoin Wallets

23. Wallets are private key and public key management systems

24. BIP 32: HD wallets allow for multiple addresses to be generated from the same mnemonic

25. BIP 32 defines how to construct an HD wallet

26. BIP 39: Mnemonic is just entropy (random bits of data) in a human readable form

27. BIP 44: Proposes a specific hierarchy for constructing HD wallets

28. In Bitcoin this path is

m / purpose' / coin_type' / account' / change / address_index

29. Apostrophe in the path indicates that BIP32 hardened derivation is used.

30. For HD wallets, the private key is not used for signing transactions, but for regenerating the entire wallet path tree

31. purpose' refers to the path format you’re following. The above follows BIP 44

32. This satoshi labs commit is the most comprehensive list of different coin types to serve in the coin_type field. Bitcoin is 0, Ethereum is 60, etc

33. account is a relatively unused feature in bitcoin, designed to be able to have different accounts all in the same tree

34.change either 0 or 1

35. 0 represents external key pairs

36. 1 represents internal key pairs like change addresses

37. BIP 47 and BIP 75 are two competing solutions to make payments easier while maintaining privacy

38. A BIP 70 payment request contains destination address, an amount, and an HTTPS payment URL

39. When “Send” is clicked in bitcoind, the transaction is signed, but rather than being broadcast on the p2p network immediately, a message is POSTed to the payment URL, containing the signed transactions and also a refund address.

40. The requester must broadcast the transaction after checking that it matches the request

41. SPV: Simplified Payment Verification — an independent way for a client to verify transactions

42. Simply explained, SPV implements transaction verification by downloading the block headers from the network and running the data through a specially constructed bloom filter to identify which transactions belong to the wallet and which do not

43. SPV compliant nodes are very vulnerable to DDoS attacks

How’d you like this article? If you liked it or learned something, please leave a clap! BitCraft is a crypto development group and we’re always taking on new clients. Also — WE’RE HIRING!! If you’re a great developer and you’re familiar with remote work, we’re interested in you! Reach out to us at hello@bitcraft.io or visit our website at bitcraft.io!

Some other articles and resources of note:

HD Wallets Explained

So You Want To Build an Ethereum HD Wallet?

So You Want To Build a Bitcoin HD Wallet?

Mnemonic Code Converter

Gobittest

43 Technical Facts About Bitcoin

--

--