hsd
Version:
Cryptocurrency bike-shed
63 lines (56 loc) • 1.49 kB
JavaScript
/*!
* layout.js - blockchain data layout for hsd
* Copyright (c) 2017-2018, Christopher Jeffrey (MIT License).
* https://github.com/handshake-org/hsd
*/
;
const bdb = require('bdb');
/*
* Database Layout:
* V -> db version
* O -> chain options
* R -> chain state (contains tip)
* D -> versionbits deployments
* e[hash] -> entry
* h[hash] -> height
* H[height] -> hash
* n[hash] -> next hash
* p[hash] -> tip index
* b[hash] -> block (deprecated)
* t[hash] -> extended tx
* c[hash] -> coins
* u[hash] -> undo coins (deprecated)
* v[bit][hash] -> versionbits state
* T[addr-hash][hash] -> dummy (tx by address)
* C[addr-hash][hash][index] -> dummy (coin by address)
* w[height] -> name undo
* s -> tree state
* f -> bit field
* M -> migration state
*/
const layout = {
V: bdb.key('V'),
O: bdb.key('O'),
R: bdb.key('R'),
D: bdb.key('D'),
e: bdb.key('e', ['hash256']),
h: bdb.key('h', ['hash256']),
H: bdb.key('H', ['uint32']),
n: bdb.key('n', ['hash256']),
p: bdb.key('p', ['hash256']),
b: bdb.key('b', ['hash256']),
t: bdb.key('t', ['hash256']),
c: bdb.key('c', ['hash256', 'uint32']),
u: bdb.key('u', ['hash256']),
v: bdb.key('v', ['uint8', 'hash256']),
T: bdb.key('T', ['hash', 'hash256']),
C: bdb.key('C', ['hash', 'hash256', 'uint32']),
w: bdb.key('w', ['uint32']),
s: bdb.key('s'),
f: bdb.key('f'),
M: bdb.key('M')
};
/*
* Expose
*/
module.exports = layout;