{i,u}32 {signed,unsigned} 4-byte integer, little endian (N)-byte arbitrary bytes var_str (var_int(N)) + (N arbitrary bytes) var_int = (N) -> uint8(N) if N < 0xFD FD + uint16(N) if N <= 0xFFFF FE + uint32(N) if N <= 0xFFFFFFFF FF + uint64(N) if N <= 0xFFFFFFFFFFFFFFFF
version: version, start_height, ... verack ping To confirm that the TCP/IP connection is still valid No reply is expected
getaddr request addr message(s) addr: (timestamp, IP)-list alert: message, signature
type: TX, BLOCK, ERROR (error: ignore this item) (should probably only be heeded for not-yet-filled INV )
inv: (type, 4-byte hash)-list getdata: (type, 4-byte hash)-list getblocks: (hash_start, hash_stop, ...) tx: (TX, ...) block: (BLOCK...)
- Difficulty adjusted every 2016 blocks
uint256 hashTarget = f(difficulty) uint256 hash = sha256(sha256( headerData )) if (hash <= hashTarget) { // yay! }