Hypercore
API Docs | https://github.com/hypercore-protocol/hypercore |
Depends On | random-access-storage |
Used By | corestore, hyperbee, hyperdrive, hyperspace |
The centerpiece of our ecosystem is Hypercore, a secure append-only log data structure. One can think of a Hypercore as a “personal blockchain”, a self-owned list of binary blocks with an immutable history, secured by cryptographic proofs.
var hypercore = require('hypercore')
var feed = hypercore('./my-first-dataset', {valueEncoding: 'utf-8'})
feed.append('hello')
feed.append('world', function (err) {
if (err) throw err
feed.get(0, console.log) // prints hello
feed.get(1, console.log) // prints world
})
Having an immutable history means one can always “check out” the state of a Hypercore at any previous point in time (e.g. when it had a length of 15).
Hypercores can be stored in a variety of different storage backends, so long as they adhere to the random-access-storage pattern. There are random-access-* modules for local disk, memory-only, IndexedDB, S3, and more.