ccdb官网(Libra 测试环境搭建)

今天天秤座在线测试,之前说好的。写一个天秤座的测试环境。

ccdd官方网站

1、搭建前准备

1.要求系统:linux(红帽或Debian)或macOs系统。

2.git环境

3.linux系统需求:yum或者apt-get;;MacOs系统需要自制。

2、基础环境搭建

以下是基于参考https://developers.libra.org/docs/my-first-transaction并连接到测试网络的Libra环境。

1。下载Libra

吉特克隆·https://github.com/Libra/Libra.git 2。天秤座依赖软件安装

CD天秤座 。/scripts/dev _ setup.sh 这里主要涉及Rust、cmake、Golang、Protobuf的依赖环境的安装。

正确的安装如下所示:

安装CMake...... CMake已经安装 安装Go...... Go已经安装 安装Protobuf...... Protobuf已经安装 安装完所有依赖项。 您现在应该能够通过运行: source /root/来构建项目了。cargo/env cargo build 如果上述环境中的安装一步失败,可以自行下载安装,避免出错。

  • 安装golang环境:
  • 下载golang: wget https://study golang . com/dl/golang/go 1 . 12 . 5 . Linux-amd64 . tar . gz tar-xvfgo1.12.5.linux-amd64.tar.gz[Profile # Add exportgo root =/usr/go path export path = $ path:$ gorot/bin:$ gopath/bin 查看安装结果[/h]

    Curl https://sh。SSF | sh source $ home/。cargo/env Rust C-version 安装cmake

    在官网下载Cmake:https://Cmake . org/download/ tar-xvzf cmake-3.15.0-RC2.tar.gz CD Cmake-3 . 15 . 0-RC2/ 。/boot

    wget https://github . com/protocol buffers/proto buf/releases/tag/v 3 . 6 . 1 tar-xvf proto buf-all-3 . 8 . 0 . tar . gz CD proto buf-3 . 8 . 0/ 。/configure make make check sudo make install protocol-version 3依赖包下载和编译

    。这里会安装libra的/scripts/CLI/start _ CLI _ testnet . sh 依赖包,主要是从github下载的,所以下载会比较慢,要持续几个小时,最好让它半夜自己下载。

    并且下载成功显示如下,即连接到测试网络:

    运行“target/debug/client-host ac.testnet.libra.org-端口8000-s ./scripts/CLI/trusted _ peers . config . toml ` 连接到验证程序的178m 42s 中的开发[unoptimized + debuginfo]目标位于:AC . testnet . Libra . org:8000 用法:& ltcommand & gt& ltargs & gt 使用以下命令: Account | a Account operations Query | q Query operations transfer | transfer b | t | TB & lt;发件人帐户地址& gt| & ltsender _ account _ ref _ id & gt& lt接收者帐户地址& gt| & ltreceiver _ account _ ref _ id & gt& lt硬币数量& gt[燃气_单位_价格_ in _微_libras(默认= 0)][最大燃气_数量_ in _微_libras(默认10000)]后缀' b '用于阻止。 把硬币(天秤座)从一个账户转到另一个账户。 help | h 打印此帮助 退出| q! 退出这个客户端 请输入命令: Libra % Libra % Exit 未知命令:" exit" libra% q! 实际操作说明:

    target/debug/client-host AC . testnet . Libra . org-port 8000-s ./scripts/CLI/trusted _ peers . config . toml 3、测试运行1、帐户创建和帐户状态

    创建帐户Alice(帐户#0)和Bob(帐户#1)

    libra%帐户创建 & gt;& gt从钱包中创建/检索下一个帐户 创建/检索的帐户#0地址68 EAF 88 db 7a 25d 533066 b 363 ba 82 af 9 edda 19765 bb 2072051 FD 8 c 09 Fe 01 ccdb Libra % account create & gt;& gt从钱包中创建/检索下一个帐户 创建/检索的帐户# 1地址6 DCC 4079 a 3164975 AE 408608 b 7a 72 D5 a 382 C1 a7 a 857 dcce 6d 795 f 36 cf 44 AE 通过帐户列表查看内容:

    用户帐户索引:0,地址:68 EAF 88 db 7 a 25d 533066 b 363 ba 82 af 9 edda 19765 bb 2072051 FD 8c 09 Fe 01 ccdb,序列号:1,状态:持久化 用户帐户索引:1,地址:6 DCC 4079 a 3164975 AE 408608 b 72 a 72d 5 a 382 C1 a7 a 857 dcace 6d 7995 f 36 cf 4c 5 AE,序列号

    libra%帐户薄荷0 110 >& gt铸造硬币 铸币请求已提交 libra%帐户铸币1 52 & gt;& gtting coins mint request submitted 检查账户0和1的余额:

    Libra%查询余额0 余额is: 110.000000 Libra%查询余额1 余额is: 52.000000 查看账户顺序:

    libra%查询序列0 & gt;& gt获取当前序列号 序列号为:1 libra%查询序列号1 & gt;& gt获取当前序号 序号为:0 2,账户交易

    我们从Alice(账户#0)和Bob(账户#1)转账10英镑:

    传输0 1 10

    0是爱丽丝账户的索引(账户# 0)。

    1是Bob的帐户索引(帐户#1)。

    10是Libra从Alice账户转到Bob账户的金额。

    Libra % transfer 0 1 10 & gt;& gt将 事务提交给验证程序 以查询事务状态,运行:query txn _ ACC _ seq 01 & lt;fetch _ events = true | false & gt 3。查询交易信息

    我们可以查询每个账户、每个序列下的每笔交易。

    查询txn_acc_seq 0 0 true

  • 0是爱丽丝账户的索引(账户# 0)。
  • 0是Alice的第一个事务序列。
  • Libra % query txn _ ACC _ seq 0 0 true & gt;& gt按帐户和序号 获取提交的事务:signed transaction { raw _ txn:raw transaction { sender:68 EAF 88 db 7a 25d 533066 b 363 ba 82 af 9 edda 19765 bb 2072051 FD 8 c 09 Fe 01 ccdb, sequence_number: 0, payload: {, transaction:peer _ to _ peer _ transaction,[] 173 147 159 210 41 38 158 171 73 231 223 95 211 253 121 45 230 159 144 80 54 216 238 69 238 121 40 254 203 255 14], ),[/h 检查帐户状态

    查询帐户_状态0

  • 0是爱丽丝账户的索引(账户# 0)。
  • & gt& gt获取最新帐户状态 最新帐户状态为: Account:68 EAF 88 db 7a 25d 533066 b 363 ba 82 af 9 edda 19765 bb 2072051 FD 8 c 09 Fe 01 ccdb State:Some( accountstate blob { Raw:0x 01000000210000001217 da 6 c 6 b 3 e 19 f 1825 cf B2

    我们已经加入了libra的测试网络,我们也可以建立我们自己的本地区块链网络。

    切换到Libra核心存储库的根目录,运行libra_swarm,如下所示:

    以下是编译过程,占用大量机器资源,需要小心操作。

    CD ~/Libra cargo Run-libra_swarm-S -Libra _ Swarm使Cargo运行Libra _ Swarm包,该包启动由一个节点组成的本地区块链。

    -s启动本地客户端以连接到本地区块链。

    编译运行成功后,会提示CLI客户端菜单和libra%提示符。

    Libra资源[/s2/]

    天秤座官网:https://libra.org/zh-CN/

    天秤座白皮书:https://libra.org/zh-CN/white-paper/

    Libra技术白皮书:https://developers . Libra . org/docs/assets/papers/the-Libra-block chain . pdf

    Libra开发者技术文档:https://developers.libra.org/

    天秤座Github:https://github.com/libra/libra

    您可以还会对下面的文章感兴趣

    使用微信扫描二维码后

    点击右上角发送给好友