package
Cryptographically provable database
npm install urkelGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
An optimized and cryptographically provable key-value store.
The urkel tree was created for the Handshake protocol, and is implemented as a base-2 merkelized trie. It was created as an alternative to Ethereum's base-16 trie (which was the initial choice for Handshake name proofs).
Urkel stores nodes in a series of append-only files for snapshotting and crash consistency capabilities. Due to these presence of these features, Urkel has the ability to expose a fully transactional database.
The primary advantages in using an urkel tree over something like Ethereum's trie are:
The final benefit was the primary focus of the Handshake protocol. As name resolutions are a frequently requested operation, Handshake required proof sizes less than 1kb even after hundreds of millions of leaves are present in the tree.
History independence and non-destruction are also inherent properties of the urkel tree, just the same as the Ethereum trie. Note that urkel should only be used with uniformally distributed keys (i.e. hashed).
Compaction, while available, is currently inefficient and requires user intervention. This will be optimized in a future C implementation of the urkel tree. In the meantime, we don't see this as a problem as long as frequent commissions are avoided in consensus applications of the tree (i.e. avoid committing the tree on every block).
A more in-depth description is available in the Handshake Whitepaper.
There used to be three different backends:
urkel/trie - A simple base-2 merkelized trie whose design shares
similarities with earlier work done by Bram Cohen.urkel/radix - A base-2 merkelized radix tree, similar
to Amaury Séchet's Merklix tree.urkel/optimized - A memory and storage optimized version of the simplified
trie.These can all still be found in the
old-variants
branch of this repository.
Only the radix variant is currently maintained by The Handshake Developers.
const bcrypto = require('bcrypto');
const urkel = require('urkel');
const {BLAKE2b, randomBytes} = bcrypto;
const {Tree, Proof} = urkel;
// Create a tree using blake2b-256
// and a depth/key-size of 256 bits.
const tree = new Tree({
hash: BLAKE2b,
bits: 256,
prefix: '/path/to/my/db'
});
await tree.open();
let key;
const txn = tree.transaction();
for (
If you contribute code to this project, you are implicitly allowing your code
to be distributed under the MIT license. You are also implicitly verifying that
all code is your original work. </legalese>
See LICENSE for more info.
nodweber
nodar.chkuaselidze@gmail.com