赞
踩
centos7
sudo yum install -y openssl openssl-devel
Ubuntu
sudo apt install -y openssl curl
- ## 创建操作目录
- cd ~ && mkdir -p fisco && cd fisco
-
- ## 下载脚本
- curl -#LO https://osp-1257653870.cos.ap-guangzhou.myqcloud.com/FISCO-BCOS/FISCO-BCOS/releases/v2.9.1/build_chain.sh && chmod u+x build_chain.sh
bash build_chain.sh -l 127.0.0.1:4 -p 30300,20200,8545
搭建成功截图如下
bash nodes/127.0.0.1/start_all.sh
启动成功截图如下
检查进程是否启动
ps -ef | grep -v grep | grep fisco-bcos
输出结果如下,如果进程数不为4,则进程没有启动(一般是端口被占用导致的)
查看节点node0链接的节点数
tail -f nodes/127.0.0.1/node0/log/log* | grep connected
输出结果如下,正常情况会不停地输出连接信息,从输出可以看出node0与另外3个节点有连接
检查是否在共识
tail -f nodes/127.0.0.1/node0/log/log* | grep +++
输出结果如下,正常情况会不停输出 ++++Generating seal
,表示共识正常
安装Java
- # ubuntu系统安装java
- sudo apt install -y default-jdk
-
- #centos系统安装java
- sudo yum install -y java java-devel
获取控制台并回到fisco目录
cd ~/fisco && curl -#LO https://gitee.com/FISCO-BCOS/console/raw/master-2.0/tools/download_console.sh && bash download_console.sh
拷贝控制台文件
- # 最新版本控制台使用如下命令拷贝配置文件
- cp -n console/conf/config-example.toml console/conf/config.toml
配置控制台证书
cp -r nodes/127.0.0.1/sdk/* console/conf/
启动
cd ~/fisco/console && bash start.sh
输出下述信息表明启动成功 否则请检查conf/config.toml中节点端口配置是否正确
用控制台获取信息
- # 获取客户端版本
- [group:1]> getNodeVersion
- ClientVersion{
- version='2.6.0',
- supportedVersion='2.6.0',
- chainId='1',
- buildTime='20200819 15:47:59',
- buildType='Darwin/appleclang/RelWithDebInfo',
- gitBranch='HEAD',
- gitCommitHash='e4a5ef2ef64d1943fccc4ebc61467a91779fb1c0'
- }
- # 获取节点信息
- [group:1]> getPeers
- [
- PeerInfo{
- nodeID='c1bd77e188cd0783256ee06838020f24a697f9af785438403d3620967a4a3612e3abc4bbe986d1e9dddf62d4236bff0b7d19a935a3cd44889f681409d5bf8692',
- ipAndPort='127.0.0.1:30302',
- agency='agency',
- topic=[
-
- ],
- node='node2'
- },
- PeerInfo{
- nodeID='7f27f5d67f104eacf689790f09313e4343e7887a1a7b79c31cd151be33c7c8dd57c895a66086c3c8e0b54d2fa493407e0d9646b2bd9fc29a94fd3663a5332e6a',
- ipAndPort='127.0.0.1:57266',
- agency='agency',
- topic=[
- _block_notify_1
- ],
- node='node1'
- },
- PeerInfo{
- nodeID='862f26d9681ed4c12681bf81a50d0b8c66dd5b6ee7b0b42a4af12bb37b1ad2442f7dcfe8dac4e737ce9fa46aa94d904e8c474659eabf575d6715995553245be5',
- ipAndPort='127.0.0.1:30303',
- agency='agency',
- topic=[
-
- ],
- node='node3'
- }
- ]
-
- [group:1]>
HelloWorld合约提供两个接口,分别是get()
和set()
,用于获取/设置合约变量name
。合约内容如下:
- pragma solidity ^0.4.24;
-
- contract HelloWorld {
- string name;
-
- function HelloWorld() {
- name = "Hello, World!";
- }
-
- function get()constant returns(string) {
- return name;
- }
-
- function set(string n) {
- name = n;
- }
- }
3.调用HelloWorld合约
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。