(Fabric学习八)部署区块链浏览器Hyperledger explorer

这篇具有很好参考价值的文章主要介绍了(Fabric学习八)部署区块链浏览器Hyperledger explorer。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

区块链浏览器Hyperledger explorer:

区块链浏览器:官方网站https://github.com/hyperledger-labs/blockchain-explorer

(Fabric学习八)部署区块链浏览器Hyperledger explorer

可以看到他需要以下几个文件 :

  1. docker-compose.yaml
  2. test-network.json
  3. config.json

一、docker容器配置文件docker-compose-explorer.yaml

注意:如果从来没有设置过postgreSQL,那最好使用默认的账号hppoc和密码password,不然会报role '你自己的定义的账号' does not exist的错误导致explorer容器打开后秒挂,无法访问。

文件中要确保各项端口、IP对应,同时volumes中挂载的文件位置要正确。 


version: '2.0'


volumes:
    pgdata:
    walletstore:

services:

    explorerdb.mynetwork.com:
        image: hyperledger/explorer-db:latest
        container_name: explorerdb.mynetwork.com
        hostname: explorerdb.mynetwork.com
        ports:
            - 5432:5432
        environment:
            - DATABASE_DATABASE=fabricexplorer
            - DATABASE_USERNAME=hppoc
            - DATABASE_PASSWORD=password
        healthcheck:
            test: "pg_isready -h localhost -p 5432 -q -U postgres"
            interval: 30s
            timeout: 10s
            retries: 5
        volumes:
            - pgdata:/var/lib/postgresql/data


    explorer.mynetwork.com:
        image: hyperledger/explorer:latest
        container_name: explorer.mynetwork.com
        hostname: explorer.mynetwork.com
        ports:
            - 9090:8080
        extra_hosts:
            - "explorerdb.mynetwork.com:192.168.235.129"
            - "orderer0.example.com:192.168.235.129"
            - "orderer1.example.com:192.168.235.129"
            - "orderer2.example.com:192.168.235.129"
            - "peer0.org1.example.com:192.168.235.129"
            - "peer1.org1.example.com:192.168.235.129"
            - "peer0.org2.example.com:192.168.235.129"
            - "peer1.org2.example.com:192.168.235.129"
        environment:
            - DATABASE_HOST=explorerdb.mynetwork.com
            - DATABASE_DATABASE=fabricexplorer
            - DATABASE_USERNAME=hppoc
            - DATABASE_PASSWD=password
            - LOG_LEVEL_APP=debug
            - LOG_LEVEL_DB=info
            - LOG_LEVEL_CONSOLE=debug
            - LOG_CONSOLE_STDOUT=true
            - DISCOVERY_AS_LOCALHOST=false
        volumes:
            - ./config.json:/opt/explorer/app/platform/fabric/config.json
            - ./connection-profile:/opt/explorer/app/platform/fabric/connection-profile
            - ../crypto-config:/tmp/crypto
            - walletstore:/opt/explorer/wallet
        depends_on:
            explorerdb.mynetwork.com:
                condition: service_healthy

二、编写网络配置文件test-network.json

我这里将网络配置文件取名为:org1ProdNetworkConnection.json

注意:这里adminCredential下面的id和password随你定,不必和上面的一样,之后访问浏览器使用的是这里的id和password 

{
  "name": "prod-network",
  "version": "1.0.0",
  "client": {
    "tlsEnable": true,
    "adminCredential": {
      "id": "exploreradmin",
      "password": "exploreradminpw"
    },
    "enableAuthentication": true,
    "organization": "Org1",
    "connection": {
      "timeout": {
        "peer": {
          "endorser": "300"
        },
        "orderer": "300"
      }
    }
  },
  "channels": {
    "businesschannel": {
      "peers": {
        "peer0.org1.example.com": {
          "endorsingPeer": true,
          "chaincodeQuery": true,
          "ledgerQuery": true,
          "eventSource": true
        },
        "peer1.org1.example.com": {
          "endorsingPeer": true,
          "chaincodeQuery": true,
          "ledgerQuery": true,
          "eventSource": true
        },
        "peer0.org2.example.com": {
          "endorsingPeer": true,
          "chaincodeQuery": true,
          "ledgerQuery": true,
          "eventSource": true
        },
        "peer1.org2.example.com": {
          "endorsingPeer": true,
          "chaincodeQuery": true,
          "ledgerQuery": true,
          "eventSource": true
        }
      }
    }
  },
  "organizations": {
    "Org1": {
      "mspid": "Org1MSP",
      "peers": [
        "peer0.org1.example.com",
        "peer1.org1.example.com"
      ],
      "adminPrivateKey": {
        "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/priv_sk"
      },
      "signedCert": {
        "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem"
      }
    },
    "Org2": {
      "mspid": "Org2MSP",
      "peers": [
        "peer0.org2.example.com",
        "peer1.org2.example.com"
      ],
      "adminPrivateKey": {
        "path": "/tmp/crypto/prod-network/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/keystore/priv_sk"
      },
      "signedCert": {
        "path": "/tmp/crypto/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/signcerts/User1@org2.example.com-cert.pem"
      }
    }
  },
  "peers": {
    "peer0.org1.example.com": {
      "url": "grpcs://peer0.org1.example.com:7051",
      "grpcOptions": {
        "ssl-target-name-override": "peer0.org1.example.com",
        "hostnameOverride": "peer0.org1.example.com",
        "request-timeout": 120001
      },
      "tlsCACerts": {
        "path": "/tmp/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt"
      }
    },
    "peer1.org1.example.com": {
      "url": "grpcs://peer1.org1.example.com:8051",
      "grpcOptions": {
        "ssl-target-name-override": "peer1.org1.example.com",
        "hostnameOverride": "peer1.org1.example.com",
        "request-timeout": 120001
      },
      "tlsCACerts": {
        "path": "/tmp/crypto/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt"
      }
    },
    "peer0.org2.example.com": {
      "url": "grpcs://peer0.org2.example.com:9051",
      "grpcOptions": {
        "ssl-target-name-override": "peer0.org2.example.com",
        "hostnameOverride": "peer0.org2.example.com",
        "request-timeout": 120001
      },
      "tlsCACerts": {
        "path": "/tmp/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt"
      }
    },
    "peer1.org2.example.com": {
      "url": "grpcs://peer1.org2.example.com:10051",
      "grpcOptions": {
        "ssl-target-name-override": "peer1.org2.example.com",
        "hostnameOverride": "peer1.org2.example.com",
        "request-timeout": 120001
      },
      "tlsCACerts": {
        "path": "/tmp/crypto/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/ca.crt"
      }
    }
  }
}

三、编写配置文件config.tx

{
        "network-configs": {
                "prod-network": {
                        "name": "Prod Network",
                        "profile": "./connection-profile/org1ProdNetworkConnection.json"
                }
        },
        "license": "Apache-2.0"
}

四、文件目录

文件准备好后,都要放在一个目录下,且保证目录的格式为:

./
├── config.json
├── connection-profile
│   └── org1ProdNetworkConnection.json
└── docker-compose-explorer.yaml

五、启动容器

启动 Hyperledger Explorer:

docker-compose -f docker-compose-explorer.yaml up -d

清理(不删除持久性数据):

docker-compose -f docker-compose-explorer.yaml down

彻底清理:

docker-compose -f docker-compose-explorer.yaml down -v

启动后访问 http://localhost:9090/:

这里的用户名和密码:要使用org1ProdNetworkConnection.json中的密码即可登录。

 (Fabric学习八)部署区块链浏览器Hyperledger explorer

 文章来源地址https://www.toymoban.com/news/detail-484468.html

到了这里,关于(Fabric学习八)部署区块链浏览器Hyperledger explorer的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • hyperledger fabric2.4.0基础搭建到区块链浏览器搭建

    基础环境借鉴  如下博客地址安装成功Ubuntu20.04下安装fabric2.4环境 从零开始超详细步骤【亲测有效】及Hyperledger Explorer安装_小草cys的博客-CSDN博客_ubuntu安装fabricq 区块链浏览器借鉴如下博客配置成功 2021-05-02-fabric浏览器搭建_Soulmate_666的博客-CSDN博客_搭建fabric浏览器 config.json

    2024年02月11日
    浏览(26)
  • hyperledger fabric explorer 超级账本区块链浏览器搭建-docker的方式

    hyperledger fabric explorer 超级账本区块链浏览器搭建-使用docker的方式快速搭建一个超级账本区块链浏览器 区块链浏览器可以让用户更加直观地查看当前超级账本网络的情况,来观察整个区块链上的块数,节点数,通道,链码等; 官方推荐的搭建区块链浏览器有两种方法,一种是

    2023年04月08日
    浏览(26)
  • 部署超级账本fabric区块可视化浏览器

    文件存放路径 在根目录中构建这样的目录结构 编写org1ProdNetworkConnection.json文件,注意自己的端口号和文件路径配置 编写 config.json 配置文件 编写 docker-compose-explorer.yaml 文件 启动 Hyperledger Explorer: 在 Hyperledger Explorer中启动 清理(不删除持久性数据): 彻底清理: 启动后访问

    2024年02月12日
    浏览(38)
  • 【区块链】HyperLedger Besu Alethio区块浏览器

    上一节我们已经完成了整个Besu区块链网络的搭建,本章将介绍通过Alethio区块链浏览器对上链数据进行查看和校验。同时,由于Besu区块链是可以通过EthSigner来实现带权限(token)访问的,那么在权限访问下还需要添加explorer-besu-plugin来实现,这个也会在本节中一并叙述。 Alet

    2024年03月19日
    浏览(23)
  • Fabric区块链浏览器(2)

    本文是区块链浏览器系列的第四篇。 在上一篇文章介绍如何解析区块数据时,使用 session 对客户端上传的pb文件进行区分,到期后自动删除。 在这片文章中,会着重介绍下认证系统的实现,主要分为三部分: 添加数据库,存储用户信息 实现用户认证中间件 修改路由 我这里

    2024年02月12日
    浏览(34)
  • Fabric区块链浏览器(3)

    本文是区块链浏览器系列的第五篇,项目完整代码在这里。 在上一篇文章中给浏览器增加了简单的用户认证,至此浏览器的基本功能就已经大致完成了。 在这片文章中,我将使用kratos对区块链浏览器器进行重构,使之同时支持http和gRPC。 项目结构如下: api 定义接口 block.p

    2024年02月11日
    浏览(32)
  • Fabric区块链浏览器搭建

    书接这一回 Fabric二进制建链,在建好链之后,将为这条链部署一个区块链浏览器。 Hyperledger Fabric区块链浏览器地址:https://github.com/hyperledger-labs/blockchain-explorer 内容如下: 创建配置文件 config.json : 内容如下: 继续配置节点证书相关 fabric_dev.json : 内容如下: 最终的目录:

    2024年02月04日
    浏览(39)
  • 【FISCO BCOS】十九、区块链浏览器部署

    目录 一、环境依赖 检查环境  1.检查java  二、拉取安装脚本 获取部署安装包 ​编辑 解压安装包 进入目录 三、修改配置  四、部署服务 五、状态检查 检查前后端进程 1.检查后端server进程 2.检查前端的nginx进程 检查进程端口 六、使用区块链浏览器 1.配置群组 2.添加节点 

    2024年02月04日
    浏览(39)
  • 区块链hyperledger fabric部署

      新建目录、下载、解压 配置环境   将指定版本的 Hyperledger Fabric 平台特定二进制文件和配置文件安装到 fabric-samples 下的  /bin 和  /config  目录中,下载指定版本的 Hyperledger Fabric docker 镜像 2.2.1 配置镜像源 注:以上curl主要是为了获得一个 bootstrap.sh 的脚本文件并执行,可能

    2024年02月11日
    浏览(26)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包