Baidu XuperChain
### Content Overview
Content Overview
- 介绍
- 编译
- 文件结构介绍
- 基本操作
Introduction
XuperUnion is the first open-source project in the XuperChain ecosystem and the underlying solution for building super alliance networks.
-
Key features
-
High performance
- The original XuperModel genuinely enables concurrent execution and verification of smart contracts.
- The TDPOS algorithm ensures fast consensus across large-scale node networks.
- A WASM virtual machine accelerated with AOT lets contracts run at speeds approaching native programs.
-
Greater security
- An account system protected by multiple private keys.
- Authentication supports flexible strategies such as weighted accumulation and set operations.
-
Easy scalability
- A robust P2P network supporting very large-scale nodes over wide-area networks.
- The underlying ledger supports fork management and automatic consistency convergence, enabling truly global deployment.
- Develop smart contracts in multiple languages
- Pluggable multi-language virtual machines powered by the original XuperBridge technology.
-
High flexibility
- A pluggable, modular design lets users easily choose the solution that fits their business scenario.
-
Building
-
System requirements
- Operating system: Linux and Mac OS
- Language: Go 1.12.x or later
- Compiler: GCC 4.8.x or later
- Version control: Git
-
Get the code
git clone https://github.com/xuperchain/xuperunion
-
Build the executables
cd xuperunion
make
-
Build complete
- The artifacts are inside the output folder
File Structure
output
│
├── conf // 创始的共识采用tdpos模式,指定单一地址有权利出块
│ │
│ ├── plugins.conf // 插件的配置信息
│ │
│ ├── xchain.yaml. // xchain服务的配置信息
│ │
│ └── xchain.yaml.sample // 防止冲突,部署时根据需要修改端口号
│
│
├── contractCall.sh
│
├── createAccount.sh
│
├── data // 数据的存放目录,创世块信息,以及共识和合约的样例
│ │
│ ├── blockchain // 账本目录
│ │ │
│ │ └── xuper
│ │ ├── ledger
│ │ │ ├── 000001.log
│ │ │ │
│ │ │ ├── CURRENT
│ │ │ │
│ │ │ ├── LOCK
│ │ │ │
│ │ │ ├── LOG
│ │ │ │
│ │ │ └── MANIFEST-000000
│ │ │
│ │ ├── utxoVM
│ │ │ │
│ │ │ ├── 000001.log
│ │ │ │
│ │ │ ├── CURRENT
│ │ │ │
│ │ │ ├── LOCK
│ │ │ │
│ │ │ ├── LOG
│ │ │ │
│ │ │ └── MANIFEST-000000
│ │ │
│ │ └── xuper.json
│ │
│ ├── config // 创始的共识采用tdpos模式,指定单一地址有权利出块
│ │ │
│ │ ├── decay_demo.json
│ │ │
│ │ ├── pmroot.json
│ │ │
│ │ ├── pow.json
│ │ │
│ │ ├── root_demo.json
│ │ │
│ │ └── xuper.json
│ │
│ │
│ ├── keys // 此节点的地址,唯一性
│ │ │
│ │ ├── address
│ │ │
│ │ ├── private.key
│ │ │
│ │ └── public.key
│ │
│ └── netkeys // 此节点的网络标识ID,唯一性
│ │
│ └── net_private.key
│
│
├── deployContract.sh
│
│
├── dump_chain
│
│
├── logs // 程序日志目录
│ │
│ ├── pluginmgr.log
│ │
│ ├── pluginmgr.log.wf
│ │
│ ├── xchain.log
│ │
│ └── xchain.log.wf
│
│
├── plugins // so的存放目录
│ │
│ ├── consensus
│ │ │
│ │ ├── consensus-pow.so.1.0.0
│ │ │
│ │ ├── consensus-single.so.1.0.0
│ │ │
│ │ └── consensus-tdpos.so.1.0.0
│ │
│ ├── contract
│ │
│ ├── crypto
│ │ │
│ │ └── crypto-default.so.1.0.0
│ │
│ └── kv
│ │
│ ├── kv-badger.so.1.0.0
│ │
│ ├── kv-ldb-multi.so.1.0.0
│ │
│ └── kv-ldb-single.so.1.0.0
│
│
├── testnet.conf
│
├── transfer.sh
│
├── wasm2c // wasm工具
│
├── xchain // 服务的二进制文件
│
└── xchain-cli // 客户端工具
Chain Operations
-
Create a chain
./xchain-cli createChain
-
Start the service
nohup ./xchain &
-
Inspect blocks
./xchain-cli status -H 127.0.0.1:37101
-
Create an account
./xchain-cli account newkeys --output data/accounts/louis
-
Create a contract account
./xchain-cli account new --desc account.des The contract content is as follows:
{ "module_name": "xkernel", "method_name": "NewAccount", "args" : { "account_name": "1111111111111111", //Note: a string of 16 digits "acl": "{ "pm": {"rule": 1,"acceptValue": 0.6}, "aksWeight": {"AK1": 0.3,"AK2": 0.3}}" } }```