Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/juzix-kelvin/bcos
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvin committed Aug 16, 2017
2 parents 0dd34fa + 91118bc commit 56598a9
Show file tree
Hide file tree
Showing 1,321 changed files with 469 additions and 36,691 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ BCOS平台是聚焦于企业级应用服务的区块链技术平台,已经在

## 技术白皮书

参见[BCOS平台白皮书——面向分布式商业的区块链基础设施](https://github.com/bcosorg/bcos/blob/master/doc/BCOS_Whitepaper.pdf)
(如无法在浏览器上直接浏览,请下载到本地打开)
参见[BCOS平台白皮书——面向分布式商业的区块链基础设施](https://github.com/bcosorg/whitepaper/blob/master/BCOS_Whitepaper.md)([PDF下载](https://raw.githubusercontent.com/bcosorg/bcos/master/doc/BCOS_Whitepaper.pdf))。

## License

Expand All @@ -30,6 +29,11 @@ BCOS的开源协议为GPL3.0,详情参见[LICENSE](https://github.com/bcosorg/
## 联系我们
邮箱:hi@bcos.org.cn

微信群:添加群管理员微信号BCOS_FANS,拉您入BCOS官方技术交流群。

群管理员微信二维码:

![](./doc/BCOS_FANS.jpeg)



Expand Down
31 changes: 31 additions & 0 deletions accounttool/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "accounttool",
"version": "1.0.0",
"description": "tools for nodejs \"",
"main": "deploy.js",
"scripts": {
"test": "test"
},
"keywords": [
"tools"
],
"author": "bcos",
"license": "GPL-3.0",
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-preset-es2017": "^6.24.1",
"bignumber": "^1.1.0",
"bignumber.js": "^2.3.0",
"bn.js":"^4.11.6",
"crypto-js": "^3.1.6",
"express": "^4.15.3",
"keccak": "^1.2.0",
"rlp": "^2.0.0",
"secp256k1": "^3.2.5",
"web3": "^0.17.0-alpha"
},
"engines": {
"node": ">=6.10.3",
"npm": ">=3.10.0"
}
}
1 change: 1 addition & 0 deletions accounttool/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm install
56 changes: 56 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#
# 一键安装脚本说明
#1 build.sh在centos和Ubuntu版本测试成功;
#2 所有Linux发行版本请确保yum和git已安装,并能正常使用;
#3 如遇到中途依赖库下载失败,一般和网络状况有关,请到https://github.com/bcosorg/lib找到相应的库,手动安装成功后,再执行此脚本
#

#!/bin/sh

#install nodejs
sudo yum install -y nodejs
sudo npm install -g cnpm --registry=https://registry.npm.taobao.org
sudo cnpm install -g babel-cli babel-preset-es2017
echo '{ "presets": ["es2017"] }' > ~/.babelrc


#install solc
wget https://github.com/ethereum/solidity/releases/download/v0.4.13/solc-static-linux
sudo cp solc-static-linux /usr/bin/solc
sudo chmod +x /usr/bin/solc

#install console
sudo cnpm install -g ethereum-console

#install deps
sudo yum -y install cmake3
sudo yum install -y openssl openssl-devel
chmod +x scripts/install_deps.sh
./scripts/install_deps.sh

#build bcos
mkdir -p build
cd build/
if grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
cmake -DEVMJIT=OFF -DTESTS=OFF -DMINIUPNPC=OFF ..
else
cmake3 -DEVMJIT=OFF -DTESTS=OFF -DMINIUPNPC=OFF ..
fi

make -j2

make install

cd ..
cd ./tool
cnpm install

cd ..
cd ./systemcontractv2
cnpm install

if [ ! -f "/usr/local/bin/bcoseth" ]; then
echo 'bcoseth build fail!'
else
echo 'bcoseth build succ! path: /usr/local/bin/bcoseth'
fi
78 changes: 39 additions & 39 deletions config.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
{
"sealEngine": "PBFT",
"systemproxyaddress":"0x0",
"systemproxyaddressDfsFile":"",
"systemproxyaddressDfsServer":"",
"listenip":"127.0.0.1",
"rpcport":"6801",
"p2pport":"30303",
"wallet":"keys.info",
"keystoredir":"keystore/",
"datadir":"",
"vm":"interpreter",
"networkid":"12345",
"logverbosity":"4",
"coverlog":"OFF",
"eventlog":"ON",
"logconf":"log.conf",
"dfsNode":"de0fa385816b505799433e54b88788e21cb42092a6ff5bcaa2285d7ace906e5e6ce8ef2b30134ff276a5834d58721291acc5864e07e6d52469b79b28e699dfde",
"dfsGroup":"group1",
"dfsStorage":"filestorage",
"params": {
"accountStartNonce": "0x0",
"maximumExtraDataSize": "0x0",
"tieBreakingGas": false,
"blockReward": "0x0",
"networkID" : "0x0"
},
"NodeextraInfo":[
{
"Nodeid":"de0fa385816b505799433e54b88788e21cb42092a6ff5bcaa2285d7ace906e5e6ce8ef2b30134ff276a5834d58721291acc5864e07e6d52469b79b28e699dfde",
"Nodedesc": "node1",
"Agencyinfo": "node1",
"Peerip": "127.0.0.1",
"Identitytype": 1,
"Port":30303,
"Idx":0
}
]
}
{
"sealEngine": "PBFT",
"systemproxyaddress":"0x0",
"systemproxyaddressDfsFile":"",
"systemproxyaddressDfsServer":"",
"listenip":"127.0.0.1",
"rpcport":"8545",
"p2pport":"30303",
"wallet":"/mydata/nodedata-1/keys.info",
"keystoredir":"/mydata/nodedata-1/keystore/",
"datadir":"/mydata/nodedata-1/data/",
"vm":"interpreter",
"networkid":"12345",
"logverbosity":"4",
"coverlog":"OFF",
"eventlog":"ON",
"logconf":"/mydata/nodedata-1/log.conf",
"dfsNode":"de0fa385816b505799433e54b88788e21cb42092a6ff5bcaa2285d7ace906e5e6ce8ef2b30134ff276a5834d58721291acc5864e07e6d52469b79b28e699dfde",
"dfsGroup":"group1",
"dfsStorage":"filestorage",
"params": {
"accountStartNonce": "0x0",
"maximumExtraDataSize": "0x0",
"tieBreakingGas": false,
"blockReward": "0x0",
"networkID" : "0x0"
},
"NodeextraInfo":[
{
"Nodeid":"de0fa385816b505799433e54b88788e21cb42092a6ff5bcaa2285d7ace906e5e6ce8ef2b30134ff276a5834d58721291acc5864e07e6d52469b79b28e699dfde",
"Nodedesc": "node1",
"Agencyinfo": "node1",
"Peerip": "127.0.0.1",
"Identitytype": 1,
"Port":30303,
"Idx":0
}
]
}
Binary file added doc/BCOS_FANS.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 33 additions & 21 deletions doc/manual/manual.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[toc]

# 前言

本文档是BCOS区块链开源平台的一部分。
BCOS区块链开源平台由深圳前海微众银行股份有限公司、万向区块链实验室和矩阵元Juzix共同发起
BCOS区块链开源平台由深圳前海微众银行股份有限公司、上海万向区块链股份公司、矩阵元技术(深圳)有限公司共同发起
本文档面向读者是了解区块链基本概念的区块链技术开发人员、测试人员、产品经理、区块链爱好者、金融行业从业者等等。

为了让大家更好的了解BCOS区块链开源平台的使用方法。本文档按照Step By Step的步骤详细介绍了BCOS区块链的构建、安装、启动,智能合约部署、调用等初阶用法,还包括多节点组网、系统合约等高阶内容的介绍。
Expand All @@ -22,22 +24,22 @@ BCOS区块链开源平台由深圳前海微众银行股份有限公司、万向
|操作系统| |Ubuntu(16.04 64位)/CentOS (7.2 64位)|


以下代码及操作命令以在Centos操作系统上为示例
以下代码及操作命令以在Centos7.2操作系统上为示例

## 1.2软件环境

① 安装nodejs(安装后版本nodejs版本大于6)、babel-node环境
```bash
sudo yum install nodejs
sudo npm config set registry https://registry.npm.taobao.org
sudo npm install -g babel-cli babel-preset-es2017
sudo yum install -y nodejs
sudo npm install -g cnpm --registry=https://registry.npm.taobao.org
sudo cnpm install -g babel-cli babel-preset-es2017
echo '{ "presets": ["es2017"] }' > ~/.babelrc
```

② 安装智能合约solidity编译器
方式一:直接下载solc二进制执行程序
```bash
wget https://github.com/ethereum/solidity/releases/download/v0.4.11/solc-static-linux
wget https://github.com/ethereum/solidity/releases/download/v0.4.13/solc-static-linux
sudo cp solc-static-linux /usr/bin/solc
sudo chmod +x /usr/bin/solc
```
Expand All @@ -47,8 +49,8 @@ sudo chmod +x /usr/bin/solc

③ 安装控制台
```bash
sudo yum install git
sudo npm install -g ethereum-console
sudo yum install -y git
sudo cnpm install -g ethereum-console
```

## 1.3源码编译
Expand Down Expand Up @@ -89,7 +91,7 @@ sudo yum -y install cmake3
② 安装依赖的开发库

```bash
sudo yum install openssl openssl-devel
sudo yum install -y openssl openssl-devel
chmod +x scripts/install_deps.sh
./scripts/install_deps.sh
```
Expand All @@ -98,11 +100,15 @@ chmod +x scripts/install_deps.sh
```bash
mkdir -p build
cd build/
cmake -DEVMJIT=OFF -DTESTS=OFF -DMINIUPNPC=OFF .. #注意命令末尾的..
cmake3 -DEVMJIT=OFF -DTESTS=OFF -DMINIUPNPC=OFF .. #注意命令末尾的..
make -j2
```

编译成功,eth/eth 即是区块链可执行程序。
编译成功,eth/bcoseth 即是区块链可执行程序。
执行安装
```
make install
```

# 第二章、启动创世节点

Expand Down Expand Up @@ -179,9 +185,13 @@ make -j2
## 2.4.生成节点身份NodeId
节点身份NodeId是一个公钥,代表节点的唯一身份标识。
```
./build/eth/eth --gennetworkrlp /mydata/nodedata-1/network.rlp
mkdir -p /mydata/nodedata-1/
mkdir -p /mydata/nodedata-1/data/
mkdir -p /mydata/nodedata-1/log/
mkdir -p /mydata/nodedata-1/keystore/
bcoseth --gennetworkrlp /mydata/nodedata-1/data/network.rlp
```
将在/mydata/nodedata-1/ 目录下生成两个文件 network.rlp 和 network.rlp.pub。
将在/mydata/nodedata-1/data/ 目录下生成两个文件 network.rlp 和 network.rlp.pub。
network.rlp是节点身份的私钥二进制文件。
network.rlp.pub是节点身份的NodeId文件。

Expand All @@ -192,6 +202,7 @@ network.rlp.pub是节点身份的NodeId文件。

```bash
cd tool
cnpm install
node accountManager.js
```

Expand Down Expand Up @@ -292,7 +303,7 @@ node accountManager.js
## 2.7.创世节点启动
命令行:区块链执行程序路径 --genesis 创世块文件 --config 配置文件

``` ./build/eth/eth --genesis ./genesis.json --config ./config.json & ```
``` bcoseth --genesis ./genesis.json --config ./config.json & ```

查看日志是否正常出块

Expand Down Expand Up @@ -770,6 +781,7 @@ contract HelloWorld{
工具目录下已有部署脚本。更新目录下config.js中的Ip(内网监听IP)和端口(RPC监听端口),及privKey(注意没有0x前缀)和account(注意有0x前缀) (生成方法参看生成公私钥对)后直接使用即可。
```bash
cd tool
cnpm install
vim config.js
babel-node deploy.js HelloWorld
```
Expand Down Expand Up @@ -849,7 +861,7 @@ web3.admin.getPeers(console.log)

本章详细介绍在一个创始节点已正常运行的前提下,如何一步步操作,加入新的区块链节 点, 组成区块链网络的操作流程。

系统合约是 OpenDL 区块链的重要设计思路之一,也是控制网络节点加入和退出的重要方式,
系统合约是 BCOS 区块链的重要设计思路之一,也是控制网络节点加入和退出的重要方式,

因此[部署系统合约](#7.1 部署系统合约)是多节点组网的前提条件。并且仅需执行一次。

Expand All @@ -859,11 +871,11 @@ web3.admin.getPeers(console.log)

执行以下命令:


```shell
cd systemcontractv2/output
tar xvf linux.tar
cd ..
vim config.js #更新内网监听Ip和RPC监听端口,及privKey和account(可复用第四章部署合约 中的或重新生成)
cd systemcontractv2
cnpm install
vim config.js #更新内网监听Ip和RPC监听端口,及privKey和account(可复用2.5.生成管理员公私钥对 中的或重新生成)
babel-node deploy.js
```

Expand Down Expand Up @@ -989,7 +1001,7 @@ vim node2.json
执行以下命令启动区块链节点进程:

```shell
./build/eth/eth --genesis /mydata/nodedata-2/genesis.json --config /mydata/nodedata-2/config.json
bcoseth --genesis /mydata/nodedata-2/genesis.json --config /mydata/nodedata-2/config.json
```

查看块高变化及连接节点信息:
Expand Down Expand Up @@ -1385,7 +1397,7 @@ console.log("配置项:"+key+","+value);
示例如下:

```
./build/eth/eth --genesis ./genesis.json --config ./config.json
bcoseth --genesis ./genesis.json --config ./config.json
--export-genesis ./genesis.file
```

Expand Down
Loading

0 comments on commit 56598a9

Please sign in to comment.