Skip to content

Repository files navigation

npm version npm lerna MIT license

Activeledger

Activeledger is a distributed ledger technology. A network of permissioned nodes gossips transactions to each other, votes on them, and commits the ones that reach consensus — each node reaching its own conclusion by watching the same traffic, rather than waiting on a single leader. Application logic lives in smart contracts (TypeScript, sandboxed), and consensus is tracked per-stream rather than globally, so unrelated transactions can be voted on and committed concurrently.

Requirements

Node.js 24.x (the current LTS line) is the recommended and actively-tested version. The native HTTP/consensus transport (uWebSockets.js) ships prebuilt bindings for a specific set of Node majors at any given time — 22.x also works today, but if you hit an error like This version of uWS.js (...) supports only Node.js versions ... on a Node version you'd expect to work, check that node_modules/uWebSockets.js itself is up to date (npm i again) before assuming the version genuinely isn't supported.

Installation

Please see our documentation for detailed instructions. We currently have 2 languages available.

Language
English documentation
Chinese 说明文档

Quickstart Guide

Use NPM to install Activeledger. @activeledger/activerestore is recommended alongside it (heals a node that falls behind or comes up empty); @activeledger/activecore's REST API is optional and off by default (autostart.core: false) — install it too only if you specifically want it, see the documentation above.

npm i -g @activeledger/activeledger @activeledger/activerestore
Creating a local Activeledger testnet

Run the following command to create a 3 node local testnet.

activeledger --testnet

Activeledger Create Testnet

When the testnet has been created you can run all of them at once but running

node testnet

Alternatively you can run each instance of Activeledger independantly by navigating into the instance-x folders which have been created and running

activeledger

Activeledger Launch Testnet

Installing from GitHub Packages

As of v4.0.0, packages are published to the GitHub Packages npm registry rather than npmjs.com. GitHub Packages requires authentication for install even on public repositories, so add an .npmrc alongside your package.json (do not commit a real token):

@activeledger:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}

Then set NODE_AUTH_TOKEN to a GitHub personal access token with read:packages scope (a fine-grained token scoped to this org is fine) and install as normal:

export NODE_AUTH_TOKEN=<your github token>
npm i -g @activeledger/activeledger @activeledger/activerestore

For a Docker build, pass the token in as a build secret (e.g. --secret id=npmrc,src=.npmrc with a RUN --mount=type=secret,id=npmrc,target=/root/.npmrc npm i -g ... step) rather than baking it into an image layer.

Developer Tools

We have created an IDE for developers to create and manage Activeledger smart contracts across multiple networks. This IDE helps manage the private keys for developers to sign their contracts with and the namespaces their contracts will be stored under in each specific network. This tool is currently in beta but is available for Linux, Windows and OSX.

IDE User Guide | 用户指南

Activeledger IDE

IDE Download

Visit Release section

Building from source

Prerequisites

We use lerna to manage this monorepo. Make sure you have lerna installed. If you use a package manager, install lerna with that. Otherwise:

npm install --global lerna

Building

npm i
npm run build

npm run setup is also available for a full clean rebuild (lerna clean + bootstrap + build) if your node_modules are in a bad state — slower, and rarely needed for everyday work.

Testing

Two separate test suites, deliberately decoupled so the fast one stays fast:

npm test              # fast unit tests (tests/*.ts, Mocha) - in-process, no real nodes
npm run test:network  # live 4-node network integration test - boots real nodes on the local machine

npm test runs in well under a second and is safe to run constantly during development.

npm run test:network (tests/network/) boots a real 4-node bare-host network, runs 100+ real transactions spread across every node as origin, deploys custom contracts and verifies returnToRemote(), verifies live event delivery over SSE, and verifies the network's Stream-Position-Incorrect self-healing by directly desyncing one node's local copy of a stream and confirming a transaction still succeeds whether that node is the transaction's origin or not. It prints live progress and a pass/fail summary, and takes well under a minute. Deliberately bare-host rather than Docker, so it doesn't add any requirements beyond what building the repo already needs.

License

MIT

About

Activeledger is a powerful distributed ledger technology.

Topics

Resources

Contributing

Stars

20 stars

Watchers

8 watching

Forks

Releases

Packages

Used by

Contributors

Languages