Giter Site home page Giter Site logo

dyne / fabchain Goto Github PK

View Code? Open in Web Editor NEW
8.0 4.0 4.0 568 KB

FABchain network based on geth + clique

Home Page: https://fabchain.net

License: GNU Affero General Public License v3.0

Makefile 14.47% Shell 14.19% Dockerfile 1.12% Lua 55.57% Solidity 4.40% Python 3.19% HTML 1.53% JavaScript 5.52%
dyne-ebsi blockchain ethereum

fabchain's Introduction

 _|_|_|_|    _|_|    _|_|_|      _|_|_|  _|    _|    _|_|    _|_|_|  _|      _|  
 _|        _|    _|  _|    _|  _|        _|    _|  _|    _|    _|    _|_|    _|  
 _|_|_|    _|_|_|_|  _|_|_|    _|        _|_|_|_|  _|_|_|_|    _|    _|  _|  _|  
 _|        _|    _|  _|    _|  _|        _|    _|  _|    _|    _|    _|    _|_|  
 _|        _|    _|  _|_|_|      _|_|_|  _|    _|  _|    _|  _|_|_|  _|      _|  

Dyne.org

Bloat-free toolbox to create and operate new blockchains based on ethereum technology using geth. Fabchain is fully cross-platform and facilitates operations on nodes using the command-line: one can use it to compile and deploy smart contracts as well easily build public web interfaces to contract operations using Zenroom.

Fabchain is optimized to run with bare-bone ethereum tools:

  • there is no javascript or nodejs involved
  • runs everywhere inside a minimal Alpine GNU/Linux docker
  • geth is natively compiled from its golang source
  • solc is natively compiled from its C++ source
  • interaction is designed via shell scripts and makefiles
  • deployement is orchestrated using ansible and makefiles
  • everything can be scripted and operated non-interactively
๐Ÿšฉ Table of Contents (click to expand)

๐Ÿ’พ Install

This application is made to work on Apple/OSX, Microsoft/WSL or GNU/Linux desktop systems. The host system needs the following dependencies installed:

  • Make, awk, bash, find, curl (found pretty much everywhere)
  • Docker - http://docker.com (from website, don't use distro packages)
  • upnpc - http://miniupnp.tuxfamily.org (optional, to automatically open port forwarding)
  • Python3, pip and web3 (optional, to extract private keys for other wallets)

๐Ÿ” back to top


๐ŸŽฎ Quick start

Fabchain is operated from a terminal inside its folder, all commands are issued by the Makefile and therefore prefixed by make.

Starting fabchain will result in a JSON-RPC API interface available on localhost:8545.

To run your own fabchain node just clone this repo, enter its directory and:

  1. Install Zenroom.org in your path
  2. Generate the configuration using make create-config
  3. Start the API node client using make run

It will start a light node connected to our testnet (Chain ID fabt).

To access the container running use make shell

To access the geth console running use make console.

To stop issue the command make stop.

A full overview of commands is shown simply typing make:

Server commands:
Usage:
  make <target>

General
  help             Display this help.

Server commands
  run              start the API node listening on HTTP port
  run-signer       start the SIGNER node networking on the P2P port
  status           see if server is running and print public addres
  logs             show the logs of the running server
  shell            open a shell inside running server (CMD=sh or custom)
  enr              Obtain the ENR node record (admin.nodeInfo.enr)
  console          open the geth console inside running server
  stop             stop running server

Network commands
  upnp-open        open UPNP port-forwarding on LAN router
  upnp-close       close UPNP port-forwarding on LAN router

Contract commands
  contract-deploy  deploy a web3 smart-contract in SOL=contracts/file.sol
  contract-info    obtain contract information about the TXID=hash

Account commands:
  account          create a new private account in data/keystore
  backup           print the private account content as JSON string
  backup-secret    print the wallet master secret key
  restore          ask for private account JSON to restore backup

Genesis commands
  genesis-create   Create data/genesis.json from scripts/params_genesis.json
  genesis-init     Initialize node to use the new chain in data/genesis.json

Development commands
  tag              compute the version tag for current build
  pull             pull the image from docker-hub online repo
  push             push the image to docker-hub online repo
  build            build the docker container
  debug            run a shell in a new interactive container (no daemons)

๐Ÿ” back to top


๐Ÿ API

Fabchain uses the official ethereum go client to provide full access to the latest API specifications for the namespaces eth and web3 available on nodes connecting port 8545 via HTTP.

API documentation is maintained by the ethereum project:

๐Ÿ” back to top


๐ŸŒž GENESIS

This is something only people running a whole new blockchain based on fabchain need to know, or system administrators of the fabchain and its testnet.

To bootstrap a new blockchain one needs to create a genesis, which needs a new chainID which is an integer, easy to find using a string for instance fabt we do:

echo "print(BIG.new(O.from_string('fabt')):decimal())" | zenroom

And find 1717658228 as our 4 letter chain ID.

Then copy scripts/params-genesis.json.example to a new file scripts/params-genesis.json and configure it with the chain IDs, the current epoch and other base configurations as for instance the share of coins assigned to each signer, which is in fact the total amount of coins pre-mined.

Then install all the new signer nodes, create their accounts and note down their addressess, using our devops setup that is simply made with:

cd devops
make server-create    # creates 3 signers and 1 api server
make install          # instals all servers with fabchain
make create-accounts  # creates fabchain accounts
make list-addressess  # prints fabchain account addresses
cd -

Then fill the signer addressess in the scripts/params-genesis.json and run make genesis-create and the genesis will be found in data/genesis.json ready for your local node.

Then if using the devops tools to create the nodes:

cp data/genesis.json devops/
cd devops
make init-genesis
make init-bootnodes
cd -

Both genesis.json and bootnodes.csv need to be uploaded on each new node for the network to function.

๐Ÿ” back to top


๐Ÿ˜ Acknowledgements

software by Dyne.org

Fabchain is Copyright (C) 2022 by Dyne.org foundation

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses/.

๐Ÿ” back to top


๐Ÿ’ผ License

Fabchain - web3 framework for the fabcities

Copyleft (ษ”) 2022 Dyne.org foundation, Amsterdam

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

๐Ÿ” back to top

fabchain's People

Contributors

albertolerda avatar jaromil avatar mangronewmark avatar puria avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

fabchain's Issues

Fabchain testnet node not syncing

Trying the latest commit (2b3e5b0) and just running make run starts the node but it's not syncing.

$ make run

โ–‘โ–ˆโ–€โ–€โ–‘โ–ˆโ–€โ–ˆโ–‘โ–ˆโ–€โ–„โ–‘โ–‘โ–‘โ–ˆโ–€โ–€โ–‘โ–ˆโ–‘โ–ˆโ–‘โ–ˆโ–€โ–ˆโ–‘โ–€โ–ˆโ–€โ–‘โ–ˆโ–€โ–ˆ
โ–‘โ–ˆโ–€โ–€โ–‘โ–ˆโ–€โ–ˆโ–‘โ–ˆโ–€โ–„โ–‘โ–‘โ–‘โ–ˆโ–‘โ–‘โ–‘โ–ˆโ–€โ–ˆโ–‘โ–ˆโ–€โ–ˆโ–‘โ–‘โ–ˆโ–‘โ–‘โ–ˆโ–‘โ–ˆ
โ–‘โ–€โ–‘โ–‘โ–‘โ–€โ–‘โ–€โ–‘โ–€โ–€โ–‘โ–‘โ–‘โ–‘โ–€โ–€โ–€โ–‘โ–€โ–‘โ–€โ–‘โ–€โ–‘โ–€โ–‘โ–€โ–€โ–€โ–‘โ–€โ–‘โ–€

No account created
try: make account
UPNP client not found, unable to open P2P port forwarding
Using image: dyne/dyneth:0.8.0-5ae168ab95d9bf98a380d107f7ad8a4ce29f4e5c
Launching docker container for the HTTP API service:
P2P networking through port 30303
HTTP API available at http://127.0.0.1:8545
run 'make console' to attach the geth console
run 'make shell' to attach the running docker
docker  run --restart unless-stopped -d \
--mount "type=bind,source=/home/sargue/testnet/contracts,destination=/contracts" \
--mount "type=bind,source=/home/sargue/testnet/data,destination=/home/geth/.ethereum" \
-p 8545:8545 dyne/dyneth:0.8.0-5ae168ab95d9bf98a380d107f7ad8a4ce29f4e5c \
  bash /start-geth-api.sh "" "--syncmode snap --http.vhosts "*" --http.corsdomain "*""
b420ea0c392f1e12103d6402f33194f650fb36962b9aa597a6c25a6db0c2f789
$ make logs

โ–‘โ–ˆโ–€โ–€โ–‘โ–ˆโ–€โ–ˆโ–‘โ–ˆโ–€โ–„โ–‘โ–‘โ–‘โ–ˆโ–€โ–€โ–‘โ–ˆโ–‘โ–ˆโ–‘โ–ˆโ–€โ–ˆโ–‘โ–€โ–ˆโ–€โ–‘โ–ˆโ–€โ–ˆ
โ–‘โ–ˆโ–€โ–€โ–‘โ–ˆโ–€โ–ˆโ–‘โ–ˆโ–€โ–„โ–‘โ–‘โ–‘โ–ˆโ–‘โ–‘โ–‘โ–ˆโ–€โ–ˆโ–‘โ–ˆโ–€โ–ˆโ–‘โ–‘โ–ˆโ–‘โ–‘โ–ˆโ–‘โ–ˆ
โ–‘โ–€โ–‘โ–‘โ–‘โ–€โ–‘โ–€โ–‘โ–€โ–€โ–‘โ–‘โ–‘โ–‘โ–€โ–€โ–€โ–‘โ–€โ–‘โ–€โ–‘โ–€โ–‘โ–€โ–‘โ–€โ–€โ–€โ–‘โ–€โ–‘โ–€

No account created
try: make account
Container running: b420ea0c392f
docker logs b420ea0c392f -f
Public address:
Bootnodes: enr:-KO4QCI4-nPHAzSi07K9XaTUkKGd9yeNUeFl_z0nRF5CbR7iE-OMqF9zQzwHZUkv6uN9xV-RIjxEcyW7TbM9FtnmYjGGAX8jtfSkg2V0aMfGhCO-XOSAgmlkgnY0gmlwhJ9F0KSJc2VjcDI1NmsxoQJiITeT_7ThS6_nqM53Z5gvfr29ztrgZ0GWx1H5jOeVyIRzbmFwwIN0Y3CCdl-DdWRwgnZf,enr:-KO4QMmx9c5KEs7AfmVg_l_pFpK6AJlu5HhI_iXVXVS5cJFlYGzUPYjpXUVwzA__RkUfHsChX2s3xDmY5_sqI6zP21SGAX8jtfZXg2V0aMfGhCO-XOSAgmlkgnY0gmlwhDEMT9uJc2VjcDI1NmsxoQPOPkps-dyuNkMeeFGg16lR7Qr42UqGmutHd26a_ccZ_oRzbmFwwIN0Y3CCdl-DdWRwgnZf,enr:-KO4QBiz8RzvPTKbP6t1Sdc0FPcxP7JPRfY5xtbRktM5ydPVROVYtGwOeikdg2P7TtqdW1sgistCZ9cjaJFJONc1qrWGAX8jtfcWg2V0aMfGhCO-XOSAgmlkgnY0gmlwhEEV8IaJc2VjcDI1NmsxoQNBS_Lb98z-J00sCnmjw47lJFEOpOeqBudo9nys00E9UYRzbmFwwIN0Y3CCdl-DdWRwgnZf
Public IP: [redacted]
[*] Zenroom v2.0.0 - secure crypto language VM
 .  Zenroom is Copyright (C) 2017-2021 by the Dyne.org foundation
 .  For the original source code and documentation go to https://zenroom.org
 .  Zenroom is free software: you can redistribute it and/or modify
 .  it under the terms of the GNU Affero General Public License as
 .  published by the Free Software Foundation, either version 3 of the
 .  License, or (at your option) any later version.
 .  Zenroom is distributed in the hope that it will be useful,
 .  but WITHOUT ANY WARRANTY; without even the implied warranty of
 .  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 .  GNU Affero General Public License for more details.
 .  You should have received a copy of the GNU Affero General Public License
 .  along with this program.  If not, see http://www.gnu.org/licenses/
 .  using default configuration
 .  Release version: 2.0.0
 .  Build commit hash: 01deffee
 .  ECDH curve is SECP256K1
 .  ECP curve is BLS381
 .  Memory in use: 489 KB
 .  reading Zencode from stdin
 .  loaded file (55 bytes)
[*] Script successfully executed
[*] Zenroom teardown.
 .  Memory used: 491 KB
 .  Time used: 9398
Starting geth for chainID: fabt (1717658228)

It just sits there. There seems to be not connecting to any node:

$ make console

โ–‘โ–ˆโ–€โ–€โ–‘โ–ˆโ–€โ–ˆโ–‘โ–ˆโ–€โ–„โ–‘โ–‘โ–‘โ–ˆโ–€โ–€โ–‘โ–ˆโ–‘โ–ˆโ–‘โ–ˆโ–€โ–ˆโ–‘โ–€โ–ˆโ–€โ–‘โ–ˆโ–€โ–ˆ
โ–‘โ–ˆโ–€โ–€โ–‘โ–ˆโ–€โ–ˆโ–‘โ–ˆโ–€โ–„โ–‘โ–‘โ–‘โ–ˆโ–‘โ–‘โ–‘โ–ˆโ–€โ–ˆโ–‘โ–ˆโ–€โ–ˆโ–‘โ–‘โ–ˆโ–‘โ–‘โ–ˆโ–‘โ–ˆ
โ–‘โ–€โ–‘โ–‘โ–‘โ–€โ–‘โ–€โ–‘โ–€โ–€โ–‘โ–‘โ–‘โ–‘โ–€โ–€โ–€โ–‘โ–€โ–‘โ–€โ–‘โ–€โ–‘โ–€โ–‘โ–€โ–€โ–€โ–‘โ–€โ–‘โ–€

No account created
try: make account
Console starting
docker exec -it --user geth b420ea0c392f geth attach
Welcome to the Geth JavaScript console!

instance: Geth/v1.10.16-stable/linux-amd64/go1.17.6
at block: 0 (Thu Jan 01 1970 00:00:00 GMT+0000 (UTC))
 datadir: /home/geth/.ethereum
 modules: admin:1.0 debug:1.0 eth:1.0 ethash:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

To exit, press ctrl-d or type exit
> eth.blockNumber
0
> net.peerCount
0
>eth.syncing
false

Is the testnet network working right now? The website seems to be down (https://fabchain.net/).

Zenroom and other tools are required for some operations

Example:

$ make genesis-create
/bin/sh: 1: zenroom: not found
/bin/sh: 1: jq: not found

###########################
now RUN: make genesis-init
###########################

Those tools are probably inside the docker image so instead of trying to run directly on the host perhaps a solution is to run it inside a docker instance mounting the proper paths.

Make block explorer url compatible with metamask

Metamask links to an executed transaction once done using a url that is slightly incompatible with our explorer:

/tx/ -> /#/transaction/

the /tx/ part of the address should be translated to /#/transaction/

Docker image not found when running `make run`

Running make run tries to pull a docker image using a tag built from a hash and a version string. They appear to be out of sync currently as the version says 0.7.0 and the hash 516fe1f1f82d1114ffb03fd9cd8d4a14100b64de which points to an unpublished version.

Unable to find image 'dyne/dyneth:0.7.0-516fe1f1f82d1114ffb03fd9cd8d4a14100b64de' locally
docker: Error response from daemon: manifest for dyne/dyneth:0.7.0-516fe1f1f82d1114ffb03fd9cd8d4a14100b64de not found: manifest unknown: manifest unknown.

Reverting the version string to 0.6.0 allows the script to run.

Naming of eth and ERC20: "FAB" -> "FAB-GAS" and "ERC20" -> "FAB"

We are introducing an ERC20 (token) used to trade goods and services, next to the eth (coin, currently named "FAB"), needed to pay transactions.
This ERC20 will be initially (maybe forever) not exchangable with the eth. In order to keep things simple and stick to Ethereum standard name, we should use a naming policy like:

  • ERC20 = "FAB"
  • Eth = "FAB-GAS"

Currently this requires only a change in this line

Cannot start under Microsoft/WSL

According to the README this application is compatible with WSL.

This application is made to work on Apple/OSX, Microsoft/WSL or GNU/Linux desktop systems.

But currently running make run on a Windows 10 + WSL2 + Docker 4.5.1 refuses to start the geth daemon inside the container.

Fatal: Error starting protocol stack: listen unix /home/geth/.ethereum/geth.ipc: bind: operation not supported

Bug, documentation issue or am I doing something wrong?

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.