forked from cuijinfeng68/L0
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e40d5a2
Showing
2,731 changed files
with
786,093 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
build/bin/* | ||
build/bin2/* | ||
build/bin3/* | ||
build/datadir/* | ||
.idea/ | ||
.vscode/ | ||
debug | ||
*.exe | ||
|
||
cmd/lcnd/lcnd | ||
tests/tests | ||
.DS_Store | ||
nodekey | ||
L0.iml | ||
tests/docker/l0/lcnd | ||
tests/docker/msgnet/msg-net | ||
tests/Transaction/* | ||
!/tests/transaction/crossLayer_3/ | ||
*.swp | ||
debug.test |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
## L0 | ||
#### 概述 | ||
L0是北京博晨技术有限公司推出的的具有自主知识产权的分布式账本系统。L0使用了树型分层的分布式账本架构,它是多个链>的有机组合,通过创新的跨链共识和分层交易机制,以及对账户和交易的全新分类,突破了传统单链结构的性能及存储瓶颈,理论上可支持任意规模的网络和任意级别的并发,同时为现实场景中热点账户性能瓶颈的解决提供了内生的支持。 | ||
|
||
#### 结构示例 | ||
![L0三层结构示例](http://bocheninc.com/static/images/jiegou.jpg) | ||
|
||
#### 整体架构 | ||
L0整体架构分为三层:核心层、服务层、应用层。 | ||
|
||
**核心层**由区块链节点和消息网络组成,提供账本的交易广播、共识计算、合约执行、身份认证、数据存储等功能。核心层 | ||
可以通过弹性平滑扩展提升交易处理能力。企业可以快速部署自有的核心层,也可以接入基础平台供应商的核心层。 | ||
|
||
**服务层**可以承接分布式账本的各种业务场景,企业可以通过服务层构建相关的具体业务,包括在服务层构建和提交自己的 | ||
智能合约,构建自己的资产体系,维护自己的业务数据、用户数据等。 | ||
|
||
**应用层**向终端用户提供基于分布式账本的应用服务,如各类型数字资产的钱包、交易应用等。用户通过应用层来管理资产 | ||
或者进行交易。 | ||
|
||
更多关于L0的介绍请查看[L0白皮书](http://bocheninc.com/l0.pdf) | ||
|
||
## 安装 | ||
``` | ||
cd $GOPATH/src/github.com/bocheninc/L0/build | ||
make | ||
./lcnd | ||
``` | ||
|
||
## License | ||
L0 is distributed under the terms of the GPLv3 License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
net: | ||
maxPeers: 8 | ||
bootstrapNodes: [] | ||
listenAddr: "127.0.0.1:20166" | ||
privatekey: "111c2857d4598e37fb9647507e47a309d6133539bf21a8b9cb6df88fd5232032" | ||
|
||
msgnet: | ||
routeAddress: ["127.0.0.1:10001"] | ||
|
||
log: | ||
level: "debug" | ||
|
||
jrpc: | ||
enabled: true | ||
port: "8881" | ||
|
||
blockchain: | ||
id: "00" | ||
datadir: "datadir/1" | ||
|
||
issueaddr: | ||
addr: ["6ce1bb0858e71b50d603ebe4bec95b11d8833e6d"] | ||
|
||
#consensus | ||
consensus: | ||
plugin: "lbft" | ||
|
||
noops: | ||
blockSize: 100 | ||
blockInterval: 10s | ||
|
||
lbft: | ||
id: "ID0001" | ||
"N": 28 | ||
Q: 25 | ||
K: 100 | ||
blockSize: 10000000 | ||
blockTimeout: 8s | ||
blockInterval: 10s | ||
blockDelay: 10s | ||
viewChange: 5s | ||
resendViewChange: 5s | ||
viewChangePeriod: 0s | ||
nullRequest: 5s | ||
bufferSize: 100 | ||
maxConcurrentNum: 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
net: | ||
maxPeers: 4 | ||
bootstrapNodes: ["encode://0459db9f954749751ec6cc0d6e05f4dc33c4ccbb150b1f80270e39371140d772dbbb3910bba7003b874031a468a1de697228af357b4a93420e54e21f03f3c87a67@127.0.0.1:20166"] | ||
listenAddr: "127.0.0.1:20167" | ||
privatekey: "222c2857d4598e37fb9647507e47a309d6133539bf21a8b9cb6df88fd5232032" | ||
|
||
msgnet: | ||
routeAddress: ["127.0.0.1:10001"] | ||
|
||
log: | ||
level: "info" | ||
|
||
jrpc: | ||
enabled: true | ||
port: "8882" | ||
|
||
blockchain: | ||
id: "00" | ||
datadir: "datadir/2" | ||
|
||
issueaddr: | ||
addr: ["6ce1bb0858e71b50d603ebe4bec95b11d8833e6d"] | ||
|
||
#consensus | ||
consensus: | ||
plugin: "lbft" | ||
|
||
noops: | ||
blockSize: 100 | ||
blockInterval: 10s | ||
|
||
lbft: | ||
id: "ID0002" | ||
"N": 4 | ||
Q: 3 | ||
K: 100 | ||
blockSize: 10000000 | ||
blockTimeout: 8s | ||
blockInterval: 10s | ||
blockDelay: 10s | ||
viewChange: 5s | ||
resendViewChange: 5s | ||
viewChangePeriod: 0s | ||
nullRequest: 5s | ||
bufferSize: 100 | ||
maxConcurrentNum: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
net: | ||
maxPeers: 8 | ||
bootstrapNodes: ["encode://0459db9f954749751ec6cc0d6e05f4dc33c4ccbb150b1f80270e39371140d772dbbb3910bba7003b874031a468a1de697228af357b4a93420e54e21f03f3c87a67@127.0.0.1:20166"] | ||
listenAddr: "127.0.0.1:20168" | ||
privatekey: "333c2857d4598e37fb9647507e47a309d6133539bf21a8b9cb6df88fd5232032" | ||
|
||
msgnet: | ||
routeAddress: ["127.0.0.1:10001"] | ||
|
||
log: | ||
level: "info" | ||
|
||
jrpc: | ||
enabled: true | ||
port: "8883" | ||
|
||
blockchain: | ||
id: "00" | ||
datadir: "datadir/3" | ||
|
||
issueaddr: | ||
addr: ["6ce1bb0858e71b50d603ebe4bec95b11d8833e6d"] | ||
|
||
#consensus | ||
consensus: | ||
plugin: "lbft" | ||
|
||
noops: | ||
blockSize: 100 | ||
blockInterval: 10s | ||
|
||
lbft: | ||
id: "ID0003" | ||
"N": 4 | ||
Q: 3 | ||
K: 100 | ||
blockSize: 10000000 | ||
blockTimeout: 8s | ||
blockInterval: 10s | ||
blockDelay: 10s | ||
viewChange: 5s | ||
resendViewChange: 5s | ||
viewChangePeriod: 0s | ||
nullRequest: 5s | ||
bufferSize: 100 | ||
maxConcurrentNum: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
net: | ||
maxPeers: 8 | ||
bootstrapNodes: ["encode://0459db9f954749751ec6cc0d6e05f4dc33c4ccbb150b1f80270e39371140d772dbbb3910bba7003b874031a468a1de697228af357b4a93420e54e21f03f3c87a67@127.0.0.1:20166"] | ||
listenAddr: "127.0.0.1:20169" | ||
privatekey: "444c2857d4598e37fb9647507e47a309d6133539bf21a8b9cb6df88fd5232032" | ||
|
||
msgnet: | ||
routeAddress: ["127.0.0.1:10001"] | ||
|
||
log: | ||
level: "info" | ||
|
||
jrpc: | ||
enabled: true | ||
port: "8884" | ||
|
||
blockchain: | ||
id: "00" | ||
datadir: "datadir/4" | ||
|
||
issueaddr: | ||
addr: ["6ce1bb0858e71b50d603ebe4bec95b11d8833e6d"] | ||
|
||
#consensus | ||
consensus: | ||
plugin: "lbft" | ||
|
||
noops: | ||
blockSize: 100 | ||
blockInterval: 10s | ||
|
||
lbft: | ||
id: "ID0004" | ||
"N": 4 | ||
Q: 3 | ||
K: 100 | ||
blockSize: 10000000 | ||
blockTimeout: 8s | ||
blockInterval: 10s | ||
blockDelay: 10s | ||
viewChange: 5s | ||
resendViewChange: 5s | ||
viewChangePeriod: 0s | ||
nullRequest: 5s | ||
bufferSize: 100 | ||
maxConcurrentNum: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM golang:latest | ||
RUN go get -u github.com/kardianos/govendor \ | ||
&& mkdir -p $GOPATH/src/github.com/bocheninc/ \ | ||
&& cd $GOPATH/src/github.com/bocheninc/ \ | ||
&& wget https://github.com/bocheninc/L0/archive/master.zip \ | ||
&& mv L0-master L0 \ | ||
&& go install -tags=embed ./cmd/lcnd/... | ||
CMD ["lcnd"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Build path | ||
BUILD_BIN_PATH=../../../../../bin | ||
|
||
# Binary | ||
LCND=${BUILD_BIN_PATH}/lcnd | ||
GOBIN_LCND=${GOBIN}/lcnd | ||
|
||
#CLI=${BUILD_BIN_PATH}/cli | ||
#GOBIN_CLI=${GOBIN}/cli | ||
|
||
TESTS=${BUILD_BIN_PATH}/tests | ||
|
||
# Install path | ||
INSTALL_DIR=./bin/ | ||
|
||
all: | ||
go install -tags=embed ../cmd/... | ||
@mkdir -p bin | ||
|
||
@if test -f ${LCND}; then \ | ||
mv ${LCND} ${CLI} ${INSTALL_DIR} ; \ | ||
echo "make done, mv the lcnd cli to ${INSTALL_DIR}"; \ | ||
elif test -f ${GOBIN_LCND}; then \ | ||
mv ${GOBIN_LCND} ${GOBIN_CLI} ${INSTALL_DIR} ; \ | ||
echo "make done, mv the ${GOBIN_LCND} to ${INSTALL_DIR}"; \ | ||
else \ | ||
echo "make fail, not mv lcnd to ${INSTALL_DIR}";\ | ||
fi | ||
|
||
tests: | ||
go install -tags=embed ../tests/... | ||
mv ${TESTS} ${INSTALL_DIR} | ||
|
||
.PHONY:all tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#/bin/bash | ||
killall lcnd | ||
for i in 1 2 3 4 | ||
do | ||
./bin/lcnd --config=$i.yaml & | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
VM: | ||
RegistrySize: 1024 | ||
|
||
CallStackSize: 1024 | ||
|
||
# vm maximum memory size (MB) | ||
MaxMem: 2 | ||
|
||
ExecLimit: | ||
# max allow exec opcode num | ||
MaxOpcodeCount: 10000 | ||
|
||
# the contract max run time (millisecond) | ||
MaxRunTime: 10000 | ||
|
||
# contract script(lua source code) max byte | ||
MaxScriptSize: 1024 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Copyright (C) 2017, Beijing Bochen Technology Co.,Ltd. All rights reserved. | ||
// | ||
// This file is part of L0 | ||
// | ||
// The L0 is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// The L0 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 General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
package commands | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
"github.com/bocheninc/L0/lcnd" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var ( | ||
cfgFile string | ||
msgNet bool | ||
) | ||
|
||
// RootCmd represents the base command when called without any subcommands | ||
var RootCmd = &cobra.Command{ | ||
Use: "lcnd", | ||
Short: "lcnd is a layered cross-chain network", | ||
Long: `lcnd is a layered cross-chain network, a distributed ledger`, | ||
// Uncomment the following line if your bare application | ||
// has an action associated with it: | ||
Run: func(cmd *cobra.Command, args []string) { | ||
l := lcnd.NewLcnd(cfgFile) | ||
// l.SetFlags() | ||
l.Start() | ||
}, | ||
} | ||
|
||
// Execute adds all child commands to the root command sets flags appropriately. | ||
// This is called by main.main(). It only needs to happen once to the rootCmd. | ||
func Execute() { | ||
if err := RootCmd.Execute(); err != nil { | ||
fmt.Println(err) | ||
os.Exit(-1) | ||
} | ||
} | ||
|
||
func init() { | ||
RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/lcnd.yaml)") | ||
RootCmd.PersistentFlags().BoolVar(&msgNet, "msgnet", false, "use msgnet") | ||
} |
Oops, something went wrong.