Skip to content

Commit

Permalink
Merge pull request hyperledger-iroha#104 from hyperledger/master
Browse files Browse the repository at this point in the history
master->dev
  • Loading branch information
takemiyamakoto authored Dec 25, 2016
2 parents 035f305 + 67f41af commit 333315f
Show file tree
Hide file tree
Showing 8 changed files with 273 additions and 40 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
config/*.py
config/__pycahe__
**/__pycache__/*
__pycache__/*
Expand Down
63 changes: 29 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
# Pull Requests
Please include a developer certificate with pull requests: https://www.clahub.com/agreements/hyperledger/iroha

# How to build
[how_to_build](https://github.com/hyperledger/iroha/blob/master/docs/how_to_build.rst)


# Architecture (Draft)

### Directory tree
Expand Down Expand Up @@ -89,39 +93,30 @@ It contains main.
We adopt a **Domain-Driven Development structure** as much as possible.

```
+--------------+
| web rest api |
+--------------+
|
+--------------+
| controller |--------+-----------------------------------------+
+--------------+ | |
| +-------------+ +----------------+ +----------------------+
| | repository | | domain model | | service |
| | (interface) |--| | |+---------++---------+|
| +-------------+ |+--------------+| || crypto ||validate ||
| | || transaction || || base64 |+---------+|
| | |+--------------+| || hash | |
| | || asset || |+---------+ |
| | |+--------------+| +----------------------+
| | |+--------------+|
| | ||smart contract||
+--------------+ | |+--------------+|
| consensus |--------+ +----------------+
| |
|+------------+|
|| messaging ||
|+------------+|
+--------------+
+----------------------------------------------------------------------------+
|infrastructure |
| |
|+------------++--------------++-------------++----------------++---------+ |
|| messaging || web rest api || repository || smart contract || crypto | |
||(use aeron )|| (use crow) ||(use leveldb)|| (use java vm) || ed25519 | |
|+------------++--------------++-------------++----------------++---------+ |
+----------------------------------------------------------------------------+
front API
|(1)
┌-------------┐
+ Cappuccino +------------------------
└--+----------┘
|
|
┌--┼----------┐ ┌---------------┐
| V sumeragi |(3) | Command exec |
| ----------+> |
└--|-------A--┘ └----+----------┘
|(2) | valdation |
| └-----------------┼------┐
| | |
|consensus building |(4) |
┌------------┐ ┌-V------+------┐ ┌-------┐
| connection | | repository |------ model |
└------------┘ └---------------┘ └-------┘
| |
Infra=|=============================|===========
|implement |implement
┌------┐ ┌-----┐
| grpc | | D B |
└------┘ └-----┘
```

Expand Down Expand Up @@ -223,7 +218,7 @@ protoc --cpp_out=core/infra/connection core/infra/connection/connection.proto
protoc --grpc_out=core/infra/connection --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` core/infra/connection/connection.proto
```
## Authors
## Authors
[MakotoTakemiya](https://github.com/takemiyamakoto)
[MizukiSonoko](https://github.com/MizukiSonoko)
Expand Down
13 changes: 13 additions & 0 deletions config/fabric.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

from collections import namedtuple
GitHub = namedtuple("name", "email")
github = GitHub( "", "")


myhosts = [""]
port = "22"
user = "mizuki"
password = ""
repo_name = "https://github.com/hyperledger/iroha"
deploy_hosts = [""]

30 changes: 30 additions & 0 deletions config/sumeragi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"me":{
"ip":"172.17.0.6",
"name":"kabohara",
"publicKey":"Sht5opDIxbyK+oNuEnXUs5rLbrvVgb2GjSPfqIYGFdU=",
"privateKey":"aGIuSZRhnGfFyeoKNm/NbTylnAvRfMu3KumOEfyT2HPf36jSF22m2JXWrdCmKiDoshVqjFtZPX3WXaNuo9L8WA=="
},
"group":[
{
"ip":"172.17.0.3",
"name":"mizuki",
"publicKey":"jDQTiJ1dnTSdGH+yuOaPPZIepUj1Xt3hYOvLQTME3V0="
},
{
"ip":"172.17.0.4",
"name":"natori",
"publicKey":"Q5PaQEBPQLALfzYmZyz9P4LmCNfgM5MdN1fOuesw3HY="
},
{
"ip":"172.17.0.5",
"name":"kabohara",
"publicKey":"f5MWZUZK9Ga8XywDia68pH1HLY/Ts0TWBHsxiFDR0ig="
},
{
"ip":"172.17.0.6",
"name":"samari",
"publicKey":"Sht5opDIxbyK+oNuEnXUs5rLbrvVgb2GjSPfqIYGFdU="
}
]
}
2 changes: 1 addition & 1 deletion core/consensus/sumeragi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ namespace sumeragi {
namespace detail{

unsigned int getNumValidSignatures(const Event::ConsensusEvent& event){
int sum = 0;
unsigned int sum = 0;
for(auto&& esig: event.eventsignatures()){
if(signature::verify( esig.signature(), event.transaction().hash(), esig.publickey())){
sum++;
Expand Down
189 changes: 189 additions & 0 deletions docs/how_to_build.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
いろは構築手順 / Iroha build method
===================================

環境 / Environment
==================

今回は"sudo"を書きたくないのでrootで行いましたが普通のユーザーの方がいいと思います。よしなにお願いします

I could not write "sudo" in this time and I executed as root, but I
think normal user is better, Do as you think best.

OS
--

::

root@mizuki # lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.1 LTS
Release: 16.04
Codename: xenial

Compiler & Maketool
-------------------

基本的にC++14がコンパイルできる物が必要

I need C++14 compilable compiler

::

root@mizuki # g++ -v
gcc version 5.4.1 20160904 (Ubuntu 5.4.1-2ubuntu1~16.04)

::

root@mizuki # cmake -version
cmake version 2.8.0

依存ライブラリのインストール / install dependics library
========================================================

xsltprocのインストール / Install xsltproc
-----------------------------------------

KeccakCodePackageのbuildで使用

used by building KeccakCodePackage

::

# apt -y install xsltproc

libsnappy-dev等のインストール / Install libsnappy-dev and so on
---------------------------------------------------------------

LevelDBのbuildで使用

used by building LevelDB

::

# apt -y install libhdf5-serial-dev libsnappy-dev liblmdb-dev

基本的なもののインストール / Install basic library  
-----------------------------------------------------

基本的な物、Dockerとかだとたまに無い

Basically library

::

# apt -y install autoconf automake libtool unzip

protobuf のインストール / Install protobuf
------------------------------------------

buildは時間かかる あと\ **バージョンは3.0.0でなければいけない**

**Version should be 3.0.0!!**

::

# cd /tmp; git clone -b v3.0.0 https://github.com/google/protobuf.git
# cd /tmp/protobuf;(git cherry-pick 1760feb621a913189b90fe8595fffb74bce84598; echo Force continue)
# cd /tmp/protobuf; ./autogen.sh; ./configure --prefix=/usr;
# make -j 16;
# make install
# protoc --version

::

root@mizuki # protoc --version
libprotoc 3.0.0

grpc のインストール / Install grpc
----------------------------------

buildに時間かかるのでBinaryがほしい

::

cd /tmp; git clone -b $(curl -L http://grpc.io/release) https://github.com/grpc/grpc
cd /tmp/grpc; git submodule update --init; make -j 14; make install

::

root@mizuki # which grpc_cpp_plugin
/usr/local/bin/grpc_cpp_plugin

Iroha本体のclone / Clone iroha
==============================

いろはを構築したい場所をよしなに決めてください

Could you decide place you will install iroha as you think best.

::

~ # git clone --recursive https://github.com/hyperledger/iroha.git
~ # ls -l
total 4
drwxr-xr-x 8 root root 4096 Dec 8 17:15 iroha

IROHA\_HOMEの設定 / set IROHA\_HOME
-----------------------------------

::

~ # cd iroha
~/iroha # export IROHA_HOME=$(pwd)
~/iroha # echo $IROHA_HOME
/root/iroha

依存ライブラリのBuild / Build dependics library
-----------------------------------------------

LevelDB
~~~~~~~

::

# cd $IROHA_HOME/core/vendor/leveldb; make -j 14

ed25519
~~~~~~~

::

# cd $IROHA_HOME/core/vendor/ed25519; make -j 14

libkeccak
~~~~~~~~~

::

# cd $IROHA_HOME/core/vendor/KeccakCodePackage; make; make generic64/libkeccak.a

libhash
~~~~~~~~~

何故かCMakeが正しく動かないので自分でBuildします

I should make libhash, because cmake doesn't running correctly.

::

# cd $IROHA_HOME/core/infra/crypto/; make



Iroha本体のbuild / build iroha
==============================

::

~/iroha # mkdir build
~/iroha # cd build/
~/iroha/build # cmake ..
.
.
.
[ 98%] Built target sumeragi_test
[100%] Built target iroha-main
root@mizuki ~/iroha/build#

完成! Complate!
Binary file added docs/iroha_merkle_tree.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 11 additions & 4 deletions docs/iroha_whitepaper.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,15 @@ Consensus events, when received from the event queue, are processed in the follo
2. Events ordered by the leader
3. New events that need ordering, to be processed by the current leader

### 2.7. Data storage

### 2.7. Consensus
#### Merkle tree structure

Transactions are stored in a Merkle tree with each transaction being a leaf of the tree. After a pre-defined depth of the leafs to the Merkle root, the current Merkle root becomes a leaf in a new tree. This acts to group a set of transactions together into a block. This is shown in the following figure.

![alt tag](iroha_merkle_tree.png)

### 2.8. Consensus

Byzantine fault tolerant systems are engineered to tolerate *f* numbers of Byzantine faulty nodes in a network. Iroha introduces a Byzantine Fault Tolerant consensus algorithm called Sumeragi. It is heavily inspired by the B-Chain algorithm:

Expand Down Expand Up @@ -133,15 +140,15 @@ Consensus in Sumeragi is performed on individual transactions and on the global

When syncing nodes with each other, valid parts of the Merkel tree are shared until the roots match.

### 2.8. Data synchronization and retrieval
### 2.9. Data synchronization and retrieval

The state with the Merkle root that has the most transactions in the Merkle tree and has 2*f*+1 signatures of validating servers is the most advanced state.

### Data permissions

## Hijiri: Trust system
### 2.10. Hijiri: Peer reputation system

The trust system is based on rounds. At each round, validating peers that are registered with the membership service perform the following tasks to establish trust (reliability) ratings for the peers:
The hijiri reputation system is based on rounds. At each round, validating peers that are registered with the membership service perform the following tasks to establish trust (reliability) ratings for the peers:

* ping test
* version test
Expand Down

0 comments on commit 333315f

Please sign in to comment.