1.0.5 • Published 4 years ago

arweavedb v1.0.5

Weekly downloads
3
License
GPL-3.0
Repository
github
Last release
4 years ago

ArweaveDB

ArweaveDB is used to write and read the arweave blockchain database.

Arweave uses an unique way of storing it's data, and this package can be used on servers or any other application that interacts with the blockchain.

ArweaveDB uses fs to write files and fast-glob to find blocks by height or by ID.

Installation

npm install arweavedb --save

Initialisation

import { ArweaveDB } from 'arweavedb';

const arweaveDB = new ArweaveDB(__dirname);

Getting started

And enjoy

// Add a block
await arweaveDB.addBlock(myBlock);

// Add a transaction
await arweaveDB.addTransaction(myTx);

// Get a block by ID
const block = await arweaveDB.getBlockById(blockId);

// Get a block by height
const block = await arweaveDB.getBlockByHeight(height);