From c7c85e51b5b9c958d7ebb84b49b935060eab388e Mon Sep 17 00:00:00 2001 From: Martin Boehm Date: Thu, 25 Jan 2018 18:04:35 +0100 Subject: [PATCH] description of data storage in RocksDB --- README.md | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b065c8a3..91a26c56 100644 --- a/README.md +++ b/README.md @@ -43,4 +43,42 @@ go get github.com/jpochyla/blockbook ``` $GOPATH/bin/blockbook --help -``` \ No newline at end of file +``` + +# Data storage in RocksDB + +Blockbook stores data the following column families + +- **default** + + at the moment not used, will store statistical data etc. + +- **height** - mapping of *block height* to *block hash* + + *Block heigh* stored as binary array of 4 bytes (big endian uint32) + *Block hash* stored as binary array of 32 bytes + + Example - the first four blocks (all data hex encoded) +``` +0x00000000 : 0x000000000933EA01AD0EE984209779BAAEC3CED90FA3F408719526F8D77F4943 +0x00000001 : 0x00000000B873E79784647A6C82962C70D228557D24A747EA4D1B8BBE878E1206 +0x00000002 : 0x000000006C02C8EA6E4FF69651F7FCDE348FB9D557A06E6957B65552002A7820 +0x00000003 : 0x000000008B896E272758DA5297BCD98FDC6D97C9B765ECEC401E286DC1FDBE10 +``` + +- **outputs** - mapping of *address+block height* to *array of outpoints* + + *Address+block height* stored as binary array 25 bytes total - 21 bytes address without checksum + 4 bytes (big endian uint32) block height + *array of outpoints* stored as binary array of 32 bytes for address + variable length outpoint number for each outpoint + + Example - (all data hex encoded) +``` +0x6FCB8DBDD6F207F559162EF3BBD4229911DA248C3000000029 : 0xC459D961CC607A12AFDC6A8A200E84F1AD8E2021C2745FE12E0231DD90CA46BE00 +0x6FCF12C87234AF9C402246B1A5D5C3F937337E6ECC00000013 : 0x73A4988ADF462B6540CFA59097804174B298CFA439F73C1A072C2C6FBDBE57C700 +0x6FD3F80654BDA100BB704FBAF49E759E6084AB10DD0000005D : 0xC12A5ACAE3EFD788F088FCFA6D267ED48681A1AE4D2F477BFA60C0500274B6BE00 +0x6FD5D788B43528CF8AF3EFBB050060B1BE26A54B4600000033 : 0x67F41C86F443AC7E00F494DD6B5DB2E999AA64E77A537728096CE4AB32F3170D00 +``` + +- **inputs** + + tbd \ No newline at end of file