源码方式搭建Sui全节点及交互

  • rzexin
  • 更新于 2023-12-27 22:04
  • 阅读 1331

源码方式搭建Sui全节点及交互

源码方式搭建Sui全节点及交互

1 环境准备

(1)下载源码

# fork https://github.com/MystenLabs/sui
$ git clone git@github.com:bityoume/sui.git bityoume_sui
$ cd bityoume_sui
$ git remote add upstream https://github.com/MystenLabs/sui
$ git fetch upstream

(2)编译节点

$ cargo build --release
$ cp target/release/sui-node ~/.cargo/bin/

(3)创建节点配置及数据目录

$ mkdir -p ~/sui-devnet/config
$ cp crates/sui-config/data/fullnode-template.yaml ~/sui-devnet/config/fullnode.yaml
$ cd ~/sui

(4)下载开发环境创世块

curl -fLJO https://github.com/MystenLabs/sui-genesis/raw/main/devnet/genesis.blob

(5)修改配置文件

fullnode.yaml

  • 修改前
db-path: "/opt/sui/db"
......
genesis:
  genesis-file-location: "/opt/sui/config/genesis.blob"
  • 修改后
db-path: "/root/sui-devnet/db"
......
genesis:
  genesis-file-location: "/root/sui-devnet/config/genesis.blob"

(6)启动节点

$ sui-node --config-path ./fullnode.yaml

(7)启动日志

image.png

(8)当前已经同步区块高度

curl --location --request POST 'http://127.0.0.1:9000/' --header 'Content-Type: application/json' --data-raw '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "sui_getTotalTransactionBlocks",
  "params": []
}'
{"jsonrpc":"2.0","result":"631041","id":1}

image.png

耐心等待区块同步完成。。。

2 交互测试

(1)添加本地网络

$ sui client new-env --alias localnet --rpc http://127.0.0.1:9000
Added new Sui env [localnet] to config.

$ sui client switch --env localnet
Active environment switched to [localnet]

==待区块同步完成后,再进行其他交互测试==

3 参考资料

https://docs.sui.io/guides/operator/sui-full-node

https://docs-zh.sui-book.com/guides/operator/sui-full-node

  • 原创
  • 学分: 20
  • 分类: Sui
  • 标签: Sui 
点赞 0
收藏 0
分享
本文参与登链社区写作激励计划 ,好文好收益,欢迎正在阅读的你也加入。

0 条评论

请先 登录 后评论
rzexin
rzexin
0x2Dc5...52c1
江湖只有他的大名,没有他的介绍。