Giter Club home page Giter Club logo

bloqly's Introduction

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


The project currently is under global refactoring, sources will be available later.

Telegram Twitter

What's this?

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

Small contract code example:

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) ];
}

Documentation

bloqly's People

Contributors

slavasn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bloqly's Issues

Create a script to flood network with transactions

Transaction example:

curl -X POST \
-H 'Content-Type: application/json' \
-d '
{
    "origin": "58BF325AF01CCC78265EB715C1EB10EEA455905D4B50C2AC6541950D97DF8607",
    "passphrase": "root password",
    "destination": "5CA1EEF9AA50625F3B7AC637D35655174CAA2C4FAB559B294D6E7C924C9AA6D4",
    "args": [
        {
            "type": "BIGINT",
            "value": "1"
        }
    ]
}
' http://localhost:9901/api/v1/data/transactions 

Would be really nice to have a way to pass parameters with number of threads and interval between transactions

Implement "Validator Key" transaction type

Storing validators private key in database is not the best idea. Instead, would be nice to have a new type of transaction which allows validators to announce their "Validator Key". With this key it is possible to do only voting. Such a key can be changed with a new "Validator Key" transaction.

Implement proof of work anti-spam

Remote API invocations should supply proof of work nonce in request attributes.

Algorithm should be, if it's possible, using memory hard asymmetric PoW function so that it is easy to check but hard to generate.

Candidates: Cuckoo Cycle, Momentum (though it's believed to be broken), Equihash (looks quite complex to implement), others?

Implement dynamic attributes

For example, the 'system' attribute power depends on user's balance and it would be better to calculate it dynamically:

function getPower(target) {
    return getProperty(target, 'balance', zero);
}

Create initial project for wallet

Wallet (client) is thought to be a one-page PWA application, probably using Vue.js or React + JS or TypeScript. I personally like Elm, but having some doubts if it'll be possible to find developers for it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.