substrate-node-new创建新项目

参考链接:
https://learnblockchain.cn/2019/08/06/substrate-toss/

https://github.com/paritytech/substrate-up

1- 安装Substrate

curl https://getsubstrate.io -sSf | bash -s -- —fast

2-更新 substrate-up 脚本,它提供了初始化节点、创建新模块等功能:

git clone https://github.com/paritytech/substrate-up

cd substrate-up

cp -a substrate-* ~/.cargo/bin

cp -a polkadot-* ~/.cargo/bin

3- 创建新的项目

substrate-node-new demo-node yourname

substrate-node-new substrate-parcel river

4- 测试启动

cd demo-node

./target/release/demo-node —dev

$ cd substrate-parcel

$ ./target/release/substrate-parcel —dev

2019-11-02 13:45:42 Substrate Node

2019-11-02 13:45:42 version 1.0.0-5d37443-x86_64-macos

2019-11-02 13:45:42 by river, 2017, 2018

2019-11-02 13:45:42 Chain specification: Development

2019-11-02 13:45:42 Node name: spurious-dirt-7607

2019-11-02 13:45:42 Roles: AUTHORITY

2019-11-02 13:45:42 Initializing Genesis block/state (state: 0xf719…b35d, header-hash: 0xcafe…1a7e)

2019-11-02 13:45:42 Loaded block-time = 10 seconds from genesis on first-launch

2019-11-02 13:45:42 Best block: #0

2019-11-02 13:45:42 Using default protocol ID "sup" because none is configured in the chain specs

2019-11-02 13:45:42 Local node identity is: Qme5iXkjdzcx1VtUE3e8zD1d9NpxqoZzdQVC9ZEqP1VD3Q

2019-11-02 13:45:42 Libp2p => Random Kademlia query has yielded empty results

2019-11-02 13:45:42 Listening for new connections on 127.0.0.1:9944.

2019-11-02 13:45:42 Using authority key 5FA9nQDVg267DEd8m1ZypXLBnvN7SFxYwV7ndqSYGiN9TTpu

2019-11-02 13:45:45 Libp2p => Random Kademlia query has yielded empty results

2019-11-02 13:45:47 Idle (0 peers), best: #0 (0xcafe…1a7e), finalized #0 (0xcafe…1a7e), ⬇ 0 ⬆ 0

2019-11-02 13:45:49 Libp2p => Random Kademlia query has yielded empty results

2019-11-02 13:45:50 Starting consensus session on top of parent 0xcafeb48f0086c88dac893f861d05989343a12089c5a9db2b194ac5edcfd71a7e

2019-11-02 13:45:50 Prepared block for proposing at 1 [hash: 0x174946a78a98f4d934d2d7ec143d58429ed6618be6657b0d826d8c8862a9fcf2; parent_hash: 0xcafe…1a7e; extrinsics: [0xb06c…a699]]

2019-11-02 13:45:50 Pre-sealed block for proposal at 1. Hash now 0xb50e21a095a30685b47e3b4d6d21e3df1ffa63a74a411f6912da6e5d808ee8c7, previously 0x174946a78a98f4d934d2d7ec143d58429ed6618be6657b0d826d8c8862a9fcf2.

2019-11-02 13:45:50 Imported #1 (0xb50e…e8c7)

2019-11-02 13:45:52 Idle (0 peers), best: #1 (0xb50e…e8c7), finalized #0 (0xcafe…1a7e), ⬇ 0 ⬆ 0

2019-11-02 13:45:57 Idle (0 peers), best: #1 (0xb50e…e8c7), finalized #0 (0xcafe…1a7e), ⬇ 0 ⬆ 0

2019-11-02 13:45:57 Libp2p => Random Kademlia query has yielded empty results

2019-11-02 13:46:00 Starting consensus session on top of parent 0xb50e21a095a30685b47e3b4d6d21e3df1ffa63a74a411f6912da6e5d808ee8c7

2019-11-02 13:46:00 Prepared block for proposing at 2 [hash: 0x91582d83242ed16f1706090b138b399ad059a73656b4966b835875848e690c62; parent_hash: 0xb50e…e8c7; extrinsics: [0x1744…b4da]]

2019-11-02 13:46:00 Pre-sealed block for proposal at 2. Hash now 0xa754117099fc2a3c9d9a18f60aa98b616460bea0101682828a8509a45f396dad, previously 0x91582d83242ed16f1706090b138b399ad059a73656b4966b835875848e690c62.

2019-11-02 13:46:00 Imported #2 (0xa754…6dad)

项目目录结构

$ ls -l

total 576

-rw-r--r-- 1 zhouhe staff 274728 Nov 2 13:33 Cargo.lock

-rw-r--r-- 1 zhouhe staff 2218 Nov 2 13:29 Cargo.toml

-rw-r--r-- 1 zhouhe staff 1210 Nov 2 13:29 LICENSE

-rw-r--r-- 1 zhouhe staff 2100 Nov 2 13:29 README.md

-rw-r--r-- 1 zhouhe staff 238 Nov 2 13:29 build.rs

drwxr-xr-x 5 zhouhe staff 160 Sep 2 17:27 runtime

drwxr-xr-x 4 zhouhe staff 128 Sep 2 17:27 scripts

drwxr-xr-x 7 zhouhe staff 224 Sep 2 17:27 src

drwxr-xr-x 4 zhouhe staff 128 Nov 2 13:43 target

$ ls -l

-rw-r--r-- 1 zhouhe staff 4041 Nov 2 13:29 Cargo.toml

drwxr-xr-x 4 zhouhe staff 128 Sep 2 17:27 src

drwxr-xr-x 7 zhouhe staff 224 Nov 2 13:30 wasm

substrate-parcel/runtime/src $ ls -l

-rw-r--r-- 1 zhouhe staff 9719 Nov 2 13:29 lib.rs

-rw-r--r-- 1 zhouhe staff 4053 Nov 2 13:29 template.rs

image.png

- 编译异常,坑死我了_

你可能感兴趣的:(substrate-node-new创建新项目)