RocksDB data storage documentation

pull/1/head
Martin Boehm 2018-01-28 00:30:55 +01:00
parent c7c85e51b5
commit 8226fae4dc
1 changed files with 16 additions and 8 deletions

View File

@ -47,13 +47,14 @@ $GOPATH/bin/blockbook --help
# Data storage in RocksDB
Blockbook stores data the following column families
Blockbook stores data the key-value store RocksDB.
The data are separated to different column families:
- **default**
at the moment not used, will store statistical data etc.
- **height** - mapping of *block height* to *block hash*
- **height** - maps *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
@ -66,19 +67,26 @@ Blockbook stores data the following column families
0x00000003 : 0x000000008B896E272758DA5297BCD98FDC6D97C9B765ECEC401E286DC1FDBE10
```
- **outputs** - mapping of *address+block height* to *array of outpoints*
- **outputs** - maps *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
*array of outpoints* stored as binary array of 32 bytes for transaction id + variable length outpoint index for each outpoint
Example - (all data hex encoded)
```
0x6FCB8DBDD6F207F559162EF3BBD4229911DA248C3000000029 : 0xC459D961CC607A12AFDC6A8A200E84F1AD8E2021C2745FE12E0231DD90CA46BE00
0x6FCF12C87234AF9C402246B1A5D5C3F937337E6ECC00000013 : 0x73A4988ADF462B6540CFA59097804174B298CFA439F73C1A072C2C6FBDBE57C700
0x6FD3F80654BDA100BB704FBAF49E759E6084AB10DD0000005D : 0xC12A5ACAE3EFD788F088FCFA6D267ED48681A1AE4D2F477BFA60C0500274B6BE00
0x6FD5D788B43528CF8AF3EFBB050060B1BE26A54B4600000033 : 0x67F41C86F443AC7E00F494DD6B5DB2E999AA64E77A537728096CE4AB32F3170D00
0xC43E3D6ABE282D92A28CB791697BA001D733CEFDC7AF1BCF05 : 0x7246e79f97b5f82e7f51e291d533964028ec90be0634af8a8ef7d5a903c7f6d301
```
- **inputs**
tbd
- **inputs** - maps *transaction outpoint* to *input transaction* that spends it
*Transaction outpoint* stored as binary array of 32 bytes for transaction id + variable length outpoint index
*Input transaction* stored as binary array of 32 bytes for transaction id + variable length input index
Example - (all data hex encoded)
```
0x7246e79f97b5f82e7f51e291d533964028ec90be0634af8a8ef7d5a903c7f6d300 : 0x0a7aa90ea0269c79f844c516805e4cac594adb8830e56fca894b66aab19136a428
0x7246e79f97b5f82e7f51e291d533964028ec90be0634af8a8ef7d5a903c7f6d301 : 0x4303a9fcfe6026b4d33ba488df6443c9a99bca7b7fcb7c6f6cd65cea24a749b700
```