部署超级账本fabric区块可视化浏览器

文件存放路径
在根目录中构建这样的目录结构

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

编写org1ProdNetworkConnection.json文件,注意自己的端口号和文件路径配置

{
  "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.json 配置文件


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

编写 docker-compose-explorer.yaml 文件

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.0.105"
            - "orderer0.example.com:192.168.0.105"
            - "orderer1.example.com:192.168.0.105"
            - "orderer2.example.com:192.168.0.105"
            - "peer0.org1.example.com:192.168.0.109"
            - "peer1.org1.example.com:192.168.0.109"
            - "peer0.org2.example.com:192.168.0.110"
            - "peer1.org2.example.com:192.168.0.110"
        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

启动 Hyperledger Explorer:
在 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://192.168.2.130:9090/
IP地址修改成为自己的即可完成
在这里插入图片描述

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
超级账本(Hyperledger)是一个由Linux基金会主持的开源区块链项目,旨在建立一个可扩展的、可靠的区块链平台,以满足企业级应用程序的需求。其中,Hyperledger Fabric是Hyperledger项目中最为成熟和广泛应用的一个区块链平台。 Hyperledger Fabric的特点: 1.灵活性:Hyperledger Fabric可以根据不同的业务需求进行配置,支持多种不同的共识算法和身份验证方式,可以根据实际情况进行设置。 2.私有性:Hyperledger Fabric支持私有部署,可以在企业内部搭建区块链网络,保障数据的私有性和安全性。 3.可扩展性:Hyperledger Fabric采用模块化架构,支持动态添加新的模块,可以根据需求进行扩展。 4.高效性:Hyperledger Fabric采用了分布式账本技术,可以实现高效的数据共享和传输,同时支持并发操作。 Hyperledger Fabric的架构: Hyperledger Fabric的架构可以分为四个主要部分:成员、通道、智能合约和账本。 1.成员:Hyperledger Fabric的成员可以是组织或个人,每个成员都有一个身份和相应的权限。成员可以通过身份验证和授权来访问网络中的资源。 2.通道:通道是Hyperledger Fabric中用于实现私有性的关键部分。通道可以将网络分成多个子网络,每个子网络中只有特定的成员可以访问,确保数据的私有性和安全性。 3.智能合约:智能合约是Hyperledger Fabric的核心部分,负责实现业务逻辑和数据交互。智能合约可以根据不同的业务需求进行编写,并在区块链上执行,确保数据的准确性和不可篡改性。 4.账本:Hyperledger Fabric采用了分布式账本技术,将数据存储在多个节点上,确保数据的可靠性和安全性。每个节点都有一个完整的账本副本,可以进行数据的读写操作。 Hyperledger Fabric的应用场景: Hyperledger Fabric适用于各种不同的企业级应用场景,如供应链管理、金融服务、物流管理、保险等。其中,供应链管理是Hyperledger Fabric最为广泛应用的场景之一,通过区块链技术可以实现供应链上下游的数据共享和透明化,提高供应链管理的效率和准确性。 总结: Hyperledger Fabric是一个功能强大、灵活性高、可扩展性强的区块链平台,可以满足各种企业级应用场景的需求。未来,Hyperledger Fabric有望成为企业级区块链的标准平台之一,推动区块链技术在企业应用中的广泛推广和应用。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

爱写代码的大狼

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值