Bitcoin full node and query server

Sep 19, 2018

View in context in the libbitcoin Slack #general mirror.

M
Mlmikael12:06
i'd like to understand if the block_chain instance will let me access orphaned blocks, and what the indexes are optimized for
7 replies · evoskuil, Mlmikael · last Sep 20, 2018
evoskuil18:56
The “primitives” templates implement the entire database. Nothing is read or written if not through them. These implement just a small number of data structures. These rest on an abstract memory model, implemented in the “memory” types. In test cases we implement memory as a data chunk, in production we implement it using operating system file mapping. The “database” classes organize the templates and memory model into specific files each representing a complex data structure.
evoskuil19:02
The ADTs are: array, hash table, and linked list. These maintain data elements as record (fixed size) or slab (variable size). There are three arrays of records (candidate and confirmed indexes of heights and the tx index of tx offsets for a block), one record hash table (headers) one slab hash table (txs) and one record hash table of linked lists (addresses).
evoskuil19:03
Hash tables also use the linked list for maintaining the set of hash conflicts.
M
Mlmikael08:37
@evoskuil the "primitives templates" and "memory types" are classes, or are logical memory regions with their produce/retrieve logics implemented as classes (or both! ?), and the block_chain file is made up of a sequence of those primitive/memory structures only? (By "in test cases we implement memory as a data chunk" you mean your logics are operating on the memory addresses malloc:ed for the data chunk object, instead of on mmap():ed memory addresses.)
M
Mlmikael10:13
Cool! ADT here means Abstract Data Type yes? So block_chain is.. mostly append only? Just to expand what you said above: block_chain contains these six structures?: * the index of height of candidate blocks (type: array of record) * the index of height of confirmed blocks (type: array of record) * the tx index of tx offsets for a block * block headers hash table, i guess key = block hash and value = block header data * transactions slab hash table, i guess key = tx hash and value = raw tx data * address index: hash table of key = bitcoin address hash, value = linked list
evoskuil14:24
They are directories in the source code.
evoskuil14:25
The blockchain is append only.