Bloqly: JavaScript Smart Contracts Engine + SQL database
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
resources use provided passphrase when creating a block, small cleanup Jul 30, 2018
scripts update test configuration according to refactoring Nov 14, 2018
LICENSE use caching properly (probably) Oct 4, 2018
build.gradle performance improvements Oct 5, 2018
settings.gradle cleanup Sep 18, 2018

JavaScript Smart Contracts Engine on a pBFT+PoA-inspired blockchain consensus algorithm

Build Status

This is a work in progress, API and implementation details can change.

Telegram Twitter Slack

What's this?

Bloqly is a written from the scratch smart contracts engine with JavaScript support.

First, small contract code sample:

const fractions = new Long('10').pow(8);
const maxSupply = new Long('1_000_000_000').multiply(fractions);

function main(context, orig, dest, amount) {

    let origBalance = getProperty(orig, 'balance', ZERO);
    let destBalance = getProperty(dest, 'balance', ZERO);

    let newOrigBalance = origBalance.safeSubtract(amount);
    let newDestBalance = destBalance.safeAdd(amount, maxSupply);

    return [
        { target: orig, balance: newOrigBalance },
        { target: dest, balance: newDestBalance },

function set(context, orig, dest, key, value) {

    return [ property(dest, key, value) ];

function setSigned(context, orig, dest, key, value, signature, publicKey) {

    let message = Crypto.sha256(value)

    if (!Crypto.verify(message, signature, publicKey)) {
        throw "Invalid signature"

    return [ property(dest, key + ":" + publicKey, value) ];


Install Bloqly

Download and unpack the latest binary distribution for your platform from

Note 1: right now MacOS and Linux are supported natively. For Windows please use Linux Bash Shell for Windows (it works great actually).

Note 2: Bloqly uses Java under the hood, but you don't need to download and install JVM in order to get it working, it is already packed up into the distribution archives.

Install Postgres

For Linux I find these instructions of installing Postgres very well written and easy to follow:

For MacOS just run brew install postgres

After Postgres is installed, lets create test databases and users:

sudo -su postgres

createdb bloqly_main
createdb bloqly_rhea
createdb bloqly_loge
createdb bloqly_ymir

createuser user_main
createuser user_rhea
createuser user_loge
createuser user_ymir

psql -d bloqly_main -c "alter user user_main with password 'password_main';"
psql -d bloqly_rhea -c "alter user user_rhea with password 'password_rhea';"
psql -d bloqly_loge -c "alter user user_loge with password 'password_loge';"
psql -d bloqly_ymir -c "alter user user_ymir with password 'password_ymir';"


Quick start

Bloqly consensus algoritm

Functional smart contracts with JavaScript