fisco:

yimumengke / 2023-04-28 / 原文

  1. 启动FISCO BCOS链
    启动所有节点
bash fisco/nodes/127.0.0.1/start_all.sh

  • 检查进程是否启动
ps -ef | grep -v grep | grep fisco-bcos

  • 第六步. 检查日志输出
    如下,查看节点node0链接的节点数
tail -f fisco/nodes/127.0.0.1/node0/log/log*  | grep connected

正常情况会不停地输出连接信息,从输出可以看出node0与另外3个节点有连接。

info|2019-01-21 17:30:58.316769| [P2P][Service] heartBeat,connected count=3
info|2019-01-21 17:31:08.316922| [P2P][Service] heartBeat,connected count=3
info|2019-01-21 17:31:18.317105| [P2P][Service] heartBeat,connected count=3

执行下面指令,检查是否在共识

tail -f fisco/nodes/127.0.0.1/node0/log/log*  | grep +++

正常情况会不停输出++++Generating seal,表示共识正常。

info|2020-12-22 17:24:43.729402|[g:1][CONSENSUS][SEALER]++++++++++++++++ Generating seal on,blkNum=1,tx=0,nodeIdx=1,hash=2e133146...
info|2020-12-22 17:24:47.740603|[g:1][CONSENSUS][SEALER]++++++++++++++++ Generating seal on,blkNum=1,tx=0,nodeIdx=1,hash=eb199760...
Copy to clipboard

  1. 启动控制台

bash fisco/console/start.sh

  1. 停止一键部署的所有服务

python3 deploy.py stopAll

  1. 启动一键部署的所有服务

python3 deploy.py startAll

  1. WeBASE:

http://localhost:5002/WeBASE-Front

一键部署

部署并启动所有服务 python3 deploy.py installAll
停止一键部署的所有服务 python3 deploy.py stopAll
启动一键部署的所有服务 python3 deploy.py startAll

各子服务启停

启动FISCO-BCOS节点: python3 deploy.py startNode
停止FISCO-BCOS节点: python3 deploy.py stopNode
启动WeBASE-Web: python3 deploy.py startWeb
停止WeBASE-Web: python3 deploy.py stopWeb
启动WeBASE-Node-Manager: python3 deploy.py startManager
停止WeBASE-Node-Manager: python3 deploy.py stopManager
启动WeBASE-Sign: python3 deploy.py startSign
停止WeBASE-Sign: python3 deploy.py stopSign
启动WeBASE-Front: python3 deploy.py startFront
停止WeBASE-Front: python3 deploy.py stopFront

可视化部署

部署并启动可视化部署的所有服务 python3 deploy.py installWeBASE
停止可视化部署的所有服务 python3 deploy.py stopWeBASE
启动可视化部署的所有服务 python3 deploy.py startWeBASE`

//部署合约 [group:1]> deploy KVTableTest //交易的hash值 transaction hash: 0xc18aeffad8e1b45a7cb944c49f733f45c540f1d20e4f9bdc4cf2a02db52649d2 //合约地址 contract address: 0x291ba326c748afe29d8c08f9e66632ba9a56b860 //合约账号 currentAccount: 0xca05676dc4a4502c7d04fd4d4c65507aab19e0c0

点击查看代码
//helloWorld.sol
pragma solidity>=0.4.24 <0.6.11;

contract HelloWorld {
    string name;

    constructor() public {
        name = "Hello, World!";
    }
//获取/设置合约变量name
    function get() public view returns (string memory) {
        return name;
    }

    function set(string memory n) public {
        name = n;
    }
}
点击查看代码
//调用合约
# 查看当前块高
[group:1]> getBlockNumber
1

# 调用get接口获取name变量 此处的合约地址是deploy指令返回的地址
[group:1]> call HelloWorld 0xb3c223fc0bf6646959f254ac4e4a7e355b50a344 get
---------------------------------------------------------------------------------------------
Return code: 0
description: transaction executed successfully
Return message: Success
---------------------------------------------------------------------------------------------
Return values:
[
    "Hello,World!"
]
---------------------------------------------------------------------------------------------

# 查看当前块高,块高不变,因为get接口不更改账本状态
[group:1]> getBlockNumber
1

# 调用set设置name
[group:1]> call HelloWorld 0xb3c223fc0bf6646959f254ac4e4a7e355b50a344 set "Hello, FISCO BCOS"
transaction hash: 0x7e742c44091e0d6e4e1df666d957d123116622ab90b718699ce50f54ed791f6e
---------------------------------------------------------------------------------------------
transaction status: 0x0
description: transaction executed successfully
---------------------------------------------------------------------------------------------
Output
Receipt message: Success
Return message: Success
---------------------------------------------------------------------------------------------
Event logs
Event: {}

# 再次查看当前块高,块高增加表示已出块,账本状态已更改
[group:1]> getBlockNumber
2

# 调用get接口获取name变量,检查设置是否生效
[group:1]> call HelloWorld 0xb3c223fc0bf6646959f254ac4e4a7e355b50a344 get
---------------------------------------------------------------------------------------------
Return code: 0
description: transaction executed successfully
Return message: Success
---------------------------------------------------------------------------------------------
Return values:
[
    "Hello,FISCO BCOS"
]
---------------------------------------------------------------------------------------------

# 退出控制台
[group:1]> quit


点击查看代码
[group:1]> call HelloWorld 0x244b605a4a50d6b9f6f6096c2be3b1dffa49133e get
---------------------------------------------------------------------------------------------
Return code: 0
description: transaction executed successfully
Return message: Success
---------------------------------------------------------------------------------------------
Return value size:1
Return types: (STRING)
Return values:(Hello, World!)
---------------------------------------------------------------------------------------------


点击查看代码
[group:1]> call HelloWorld 0x244b605a4a50d6b9f6f6096c2be3b1dffa49133e set "Hello, FISCO BCOS"
transaction hash: 0x936444676705cd2bc8cf642d1e316e855b3e4258591e5d17adc4023b7568d869
---------------------------------------------------------------------------------------------
transaction status: 0x0
description: transaction executed successfully
---------------------------------------------------------------------------------------------
Transaction inputs:
Input value size:1
Input types: (STRING)
Input values:(Hello, FISCO BCOS)
---------------------------------------------------------------------------------------------
Receipt message: Success
Return message: Success
Return values:[]
---------------------------------------------------------------------------------------------
Event logs
Event: {}

[group:1]>