Blockchain layer of DIVA.EXCHANGE. Based on iroha/hyperledger.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
Konrad Bächler 9e67c8730a run scripts as regular user, sudo for docker ops, license updates 1 month ago
bin run scripts as regular user, sudo for docker ops, license updates 1 month ago
blockstore added can_get_peers permission, regenerated genesis block, 1 month ago
data added can_get_peers permission, regenerated genesis block, 1 month ago
data-genesis added can_get_peers permission, regenerated genesis block, 1 month ago
database security: giving access to read-only explorer only 2 months ago
network refactoring: using Iroha over I2P 2 months ago
.gitignore refactoring: using Iroha over I2P 2 months ago
Dockerfile run scripts as regular user, sudo for docker ops, license updates 1 month ago
Dockerfile-Genesis run scripts as regular user, sudo for docker ops, license updates 1 month ago
LICENSE run scripts as regular user, sudo for docker ops, license updates 1 month ago
README.md added can_get_peers permission, regenerated genesis block, 1 month ago
entrypoint-genesis.sh run scripts as regular user, sudo for docker ops, license updates 1 month ago
entrypoint.sh run scripts as regular user, sudo for docker ops, license updates 1 month ago
wait-for-it.sh Initial commit 1 year ago

README.md

Hyperledger/Iroha Blockchain

The blockchain backend of diva is based on Hyperledger/Iroha.

Important: these instructions are suitable for a testnet in a development environment (not production). This project contains well-known private keys (so they are not private anymore). To understand the cryptography related to Iroha, read the docs: https://iroha.readthedocs.io/en/master/

Get Started

DIVA.EXCHANGE offers preconfigured packages to start or join an Iroha testnet: https://codeberg.org/diva.exchange/diva-dockerized

For a beginner it’s probably easier to use the preconfigured package. The instructions below show how to sta

Docker

Pull the image using docker: docker pull divax/iroha:latest

Create a new bash/shell script (adapt the environment variables according to your needs):

#!/usr/bin/env bash

# -e  Exit immediately if a simple command exits with a non-zero status
set -e

PROJECT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"/../
cd ${PROJECT_PATH}

ID_INSTANCE=${ID_INSTANCE:-${1:-1}}
BLOCKCHAIN_NETWORK=${BLOCKCHAIN_NETWORK:-tn-`date -u +%s`-${RANDOM}}
NAME_KEY=${NAME_KEY:-${BLOCKCHAIN_NETWORK}-${RANDOM}}
NAME=iroha${ID_INSTANCE}

# bridge IP
IP_IROHA_NODE=`ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+'`
PORT_CONTROL=${PORT_CONTROL:-10002}
PORT_IROHA_PROXY=${PORT_IROHA_PROXY:-10001}

IP_PUBLISHED=${IP_PUBLISHED:-127.19.${ID_INSTANCE}.1}
PORT_EXPOSE_POSTGRES=${PORT_EXPOSE_POSTGRES:-10032}
PORT_EXPOSE_IROHA_INTERNAL=${PORT_EXPOSE_IROHA_INTERNAL:-10011}
PORT_EXPOSE_IROHA_TORII=${PORT_EXPOSE_IROHA_TORII:-10051}

# start the container
docker run \
  -d \
  -p ${IP_PUBLISHED}:${PORT_EXPOSE_POSTGRES}:5432 \
  -p ${IP_PUBLISHED}:${PORT_EXPOSE_IROHA_INTERNAL}:10001 \
  -p ${IP_PUBLISHED}:${PORT_EXPOSE_IROHA_TORII}:50051 \
  -v ${NAME}:/opt/iroha \
  --env BLOCKCHAIN_NETWORK=${BLOCKCHAIN_NETWORK} \
  --env NAME_KEY=${NAME_KEY} \
  --env IP_PUBLISHED=${IP_PUBLISHED} \
  --env IP_IROHA_NODE=${IP_IROHA_NODE} \
  --env PORT_CONTROL=${PORT_CONTROL} \
  --env PORT_IROHA_PROXY=${PORT_IROHA_PROXY} \
  --name ${NAME} \
  --network bridge \
  divax/iroha:latest

echo "Running ${NAME_KEY} on blockchain network ${BLOCKCHAIN_NETWORK}"

Execute the above shell script in your environment.

A new network and a new container will be created. Explore it using the docker tools, like docker ps -a or docker inspect some-name. To stop and remove the container and/or network, use the docker tools.

Source Code

Clone the code from git:

cd /home/me/my-stuff/
git clone -b master https://codeberg.org/diva.exchange/iroha.git
cd iroha

Now you can either start an Iroha container using the existing configuration (with the given keys) - or you can configure your own.

Start the Preconfigured Container

Make sure you are located in the iroha folder. To access Docker you need root rights. This will start a container:

sudo ./bin/start.sh

Now you have an Iroha Container up and running. Important: this uses preconfigured, well-known (publicly available) private keys. Use it for testing/development only.

Stop the Preconfigured Container

sudo ./bin/halt.sh

Build your Own

Within the folder data-genesis you can configure your own Genesis Block. Execute ./bin/genesis.sh to create your own Genesis Block. Take a close look at the script to understand how the private keys are handled!

Then, based on your own Genesis Block, build your own Docker Image: ./bin/build.sh.

After building, run your container using ./bin/start.sh.

Contact the Developers

On DIVA.EXCHANGE you’ll find various options to get in touch with the team.

Talk to us via Telegram https://t.me/diva_exchange_chat_de (English or German).

Donations

Your donation goes entirely to the project. Your donation makes the development of DIVA.EXCHANGE faster.

XMR: 42QLvHvkc9bahHadQfEzuJJx4ZHnGhQzBXa8C9H3c472diEvVRzevwpN7VAUpCPePCiDhehH4BAWh8kYicoSxpusMmhfwgx

BTC: 3Ebuzhsbs6DrUQuwvMu722LhD8cNfhG1gs

Awesome, thank you!