hexresearch / hschain

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HSchain

Build Status

HSchain is a collection of packages for blockchain development. Currently only PBFT-based consensus algorithms is implemented. PoW development is under way. Following packages could be conidered relatively stable:

  • hschain-crypto — wrappers for cryptography which work both on GHC and GHCJS.

  • hschain-merkle — data structures for Merkle trees.

  • hschain-control — various utilities for control flow and concurrency.

  • hschain-types — data types for hschain. It's split into separate package to make possible to reuse data type in GHCJS.

  • hschain — implementation of PBFT-based consensus engine.

  • hschain-examples — examples and tests for hschain.

Rest of packages in repository are highly experimental.

Development

Nix

Standard way of working on hschain is to use Nix to set up development environment. To use this method one need to install Nix unless it's not already done. After that one only need to type

$ nix-shell

in project root. After new-style cabal should be used. For example:

$ cabal new-build all

Note that if project directory contains .ghc.environment.* files created by new-style cabal commands build will fail.

Cabal

It's possible to use cabal without nix but one'll have to install required C libraries manually (some configurations require libsodium)

Stack

It's also possible to use stack for development

stack build

Build with docker

Docker image https://github.com/phadej/docker-ghc can be used to build project.

Executables are compatable with Ubuntu 18.04.

Steps to build:

  • Download docker image: docker pull phadej/ghc:8.6.5-bionic
  • Login into: docker run -it --rm --mount type=bind,src=$PWD,target=/project --workdir /project phadej/ghc:8.6.5-bionic /bin/bash --login
  • Now in image:
    • Update cabal db: cabal new-update
    • Build exe: cabal new-build hschain-dioxane-node --flags="-libsodium". Note turned off flag libsodium, so it is not need to install libsodium library in image.
    • Last output of cabal will contain path to built executable.

Build docker image

cd nix
build-docker.sh

All info about building docker images by nix I found here.

When that command is finished you will have result simlink that refers to the docker image in tar archive format.

build-docker.sh loads this archive into local docker image.

About

License:Other


Languages

Language:C 75.3%Language:Haskell 9.4%Language:JavaScript 6.9%Language:Shell 6.2%Language:Makefile 0.8%Language:Dhall 0.3%Language:Jupyter Notebook 0.3%Language:Python 0.2%Language:Nix 0.2%Language:NSIS 0.1%Language:Cuda 0.1%Language:C++ 0.1%Language:Tcl 0.1%Language:PHP 0.0%Language:TLA 0.0%Language:CSS 0.0%Language:HTML 0.0%