Hyperledger Fabric区块链浏览器搭建

最近在用Hyperledger Fabric平台做一个项目,要使用区块链浏览器。以下是我的基础环境的情况以及搭建过程。

版本
Ubuntu 22.04.1 LTS
运行内存 8.0 GiB
处理器 Intel® Core™ i7-8700 CPU @ 3.20GHz × 12
Hyperledger Fabric 2.2
golang 1.17.5
docker 20.10.12
docker-compose 1.29.2
nodejs v12.22.9
npm 8.5.1

在基础环境配好之后,就可以搭建区块链浏览器了。首先要在项目目录里面建立explorer文件夹,并需要进入explorer文件夹,以下为对应命令。

mkdir explorer
cd explorer

在建立好explorer文件夹之后,项目目录结构是这样的。

更具体的目录结构是这样的(这是搭建完成之后的),此处使用了tree -L 9命令。

.
├── chaincode
│   ├── go.mod
│   ├── go.sum
│   ├── med.go
│   └── vendor
│       ├── github.com
│       │   ├── golang
│       │   │   └── protobuf
│       │   │       ├── AUTHORS
│       │   │       ├── CONTRIBUTORS
│       │   │       ├── LICENSE
│       │   │       ├── proto
│       │   │       │   ├── clone.go
│       │   │       │   ├── decode.go
│       │   │       │   ├── deprecated.go
│       │   │       │   ├── discard.go
│       │   │       │   ├── encode.go
│       │   │       │   ├── equal.go
│       │   │       │   ├── extensions.go
│       │   │       │   ├── lib.go
│       │   │       │   ├── message_set.go
│       │   │       │   ├── pointer_reflect.go
│       │   │       │   ├── pointer_unsafe.go
│       │   │       │   ├── properties.go
│       │   │       │   ├── table_marshal.go
│       │   │       │   ├── table_merge.go
│       │   │       │   ├── table_unmarshal.go
│       │   │       │   ├── text.go
│       │   │       │   └── text_parser.go
│       │   │       └── ptypes
│       │   │           ├── any
│       │   │           │   ├── any.pb.go
│       │   │           │   └── any.proto
│       │   │           ├── any.go
│       │   │           ├── doc.go
│       │   │           ├── duration
│       │   │           │   ├── duration.pb.go
│       │   │           │   └── duration.proto
│       │   │           ├── duration.go
│       │   │           ├── empty
│       │   │           │   ├── empty.pb.go
│       │   │           │   └── empty.proto
│       │   │           ├── timestamp
│       │   │           │   ├── timestamp.pb.go
│       │   │           │   └── timestamp.proto
│       │   │           └── timestamp.go
│       │   └── hyperledger
│       │       ├── fabric-chaincode-go
│       │       │   ├── LICENSE
│       │       │   └── shim
│       │       │       ├── chaincodeserver.go
│       │       │       ├── handler.go
│       │       │       ├── interfaces.go
│       │       │       ├── internal
│       │       │       │   ├── client.go
│       │       │       │   ├── config.go
│       │       │       │   └── server.go
│       │       │       ├── response.go
│       │       │       ├── shim.go
│       │       │       └── stub.go
│       │       └── fabric-protos-go
│       │           ├── common
│       │           │   ├── collection.pb.go
│       │           │   ├── common.pb.go
│       │           │   ├── configtx.pb.go
│       │           │   ├── configuration.pb.go
│       │           │   ├── ledger.pb.go
│       │           │   └── policies.pb.go
│       │           ├── ledger
│       │           │   ├── queryresult
│       │           │   │   └── kv_query_result.pb.go
│       │           │   └── rwset
│       │           │       └── rwset.pb.go
│       │           ├── LICENSE
│       │           ├── msp
│       │           │   ├── identities.pb.go
│       │           │   ├── msp_config.pb.go
│       │           │   └── msp_principal.pb.go
│       │           └── peer
│       │               ├── chaincode_event.pb.go
│       │               ├── chaincode.pb.go
│       │               ├── chaincode_shim.pb.go
│       │               ├── collection.pb.go
│       │               ├── configuration.pb.go
│       │               ├── events.pb.go
│       │               ├── peer.pb.go
│       │               ├── policy.pb.go
│       │               ├── proposal.pb.go
│       │               ├── proposal_response.pb.go
│       │               ├── query.pb.go
│       │               ├── resources.pb.go
│       │               ├── signed_cc_dep_spec.pb.go
│       │               ├── snapshot.pb.go
│       │               └── transaction.pb.go
│       ├── golang.org
│       │   └── x
│       │       ├── net
│       │       │   ├── AUTHORS
│       │       │   ├── CONTRIBUTORS
│       │       │   ├── http
│       │       │   │   └── httpguts
│       │       │   │       ├── guts.go
│       │       │   │       └── httplex.go
│       │       │   ├── http2
│       │       │   │   ├── ciphers.go
│       │       │   │   ├── client_conn_pool.go
│       │       │   │   ├── databuffer.go
│       │       │   │   ├── Dockerfile
│       │       │   │   ├── errors.go
│       │       │   │   ├── flow.go
│       │       │   │   ├── frame.go
│       │       │   │   ├── go111.go
│       │       │   │   ├── gotrack.go
│       │       │   │   ├── headermap.go
│       │       │   │   ├── hpack
│       │       │   │   │   ├── encode.go
│       │       │   │   │   ├── hpack.go
│       │       │   │   │   ├── huffman.go
│       │       │   │   │   └── tables.go
│       │       │   │   ├── http2.go
│       │       │   │   ├── Makefile
│       │       │   │   ├── not_go111.go
│       │       │   │   ├── pipe.go
│       │       │   │   ├── README
│       │       │   │   ├── server.go
│       │       │   │   ├── transport.go
│       │       │   │   ├── write.go
│       │       │   │   ├── writesched.go
│       │       │   │   ├── writesched_priority.go
│       │       │   │   └── writesched_random.go
│       │       │   ├── idna
│       │       │   │   ├── idna10.0.0.go
│       │       │   │   ├── idna9.0.0.go
│       │       │   │   ├── punycode.go
│       │       │   │   ├── tables10.0.0.go
│       │       │   │   ├── tables11.0.0.go
│       │       │   │   ├── tables9.0.0.go
│       │       │   │   ├── trie.go
│       │       │   │   └── trieval.go
│       │       │   ├── internal
│       │       │   │   └── timeseries
│       │       │   │       └── timeseries.go
│       │       │   ├── LICENSE
│       │       │   ├── PATENTS
│       │       │   └── trace
│       │       │       ├── events.go
│       │       │       ├── histogram.go
│       │       │       └── trace.go
│       │       ├── sys
│       │       │   ├── AUTHORS
│       │       │   ├── CONTRIBUTORS
│       │       │   ├── LICENSE
│       │       │   ├── PATENTS
│       │       │   └── unix
│       │       │       ├── affinity_linux.go
│       │       │       ├── aliases.go
│       │       │       ├── asm_aix_ppc64.s
│       │       │       ├── asm_darwin_386.s
│       │       │       ├── asm_darwin_amd64.s
│       │       │       ├── asm_darwin_arm64.s
│       │       │       ├── asm_darwin_arm.s
│       │       │       ├── asm_dragonfly_amd64.s
│       │       │       ├── asm_freebsd_386.s
│       │       │       ├── asm_freebsd_amd64.s
│       │       │       ├── asm_freebsd_arm64.s
│       │       │       ├── asm_freebsd_arm.s
│       │       │       ├── asm_linux_386.s
│       │       │       ├── asm_linux_amd64.s
│       │       │       ├── asm_linux_arm64.s
│       │       │       ├── asm_linux_arm.s
│       │       │       ├── asm_linux_mips64x.s
│       │       │       ├── asm_linux_mipsx.s
│       │       │       ├── asm_linux_ppc64x.s
│       │       │       ├── asm_linux_riscv64.s
│       │       │       ├── asm_linux_s390x.s
│       │       │       ├── asm_netbsd_386.s
│       │       │       ├── asm_netbsd_amd64.s
│       │       │       ├── asm_netbsd_arm64.s
│       │       │       ├── asm_netbsd_arm.s
│       │       │       ├── asm_openbsd_386.s
│       │       │       ├── asm_openbsd_amd64.s
│       │       │       ├── asm_openbsd_arm64.s
│       │       │       ├── asm_openbsd_arm.s
│       │       │       ├── asm_solaris_amd64.s
│       │       │       ├── bluetooth_linux.go
│       │       │       ├── cap_freebsd.go
│       │       │       ├── constants.go
│       │       │       ├── dev_aix_ppc64.go
│       │       │       ├── dev_aix_ppc.go
│       │       │       ├── dev_darwin.go
│       │       │       ├── dev_dragonfly.go
│       │       │       ├── dev_freebsd.go
│       │       │       ├── dev_linux.go
│       │       │       ├── dev_netbsd.go
│       │       │       ├── dev_openbsd.go
│       │       │       ├── dirent.go
│       │       │       ├── endian_big.go
│       │       │       ├── endian_little.go
│       │       │       ├── env_unix.go
│       │       │       ├── errors_freebsd_386.go
│       │       │       ├── errors_freebsd_amd64.go
│       │       │       ├── errors_freebsd_arm.go
│       │       │       ├── fcntl_darwin.go
│       │       │       ├── fcntl.go
│       │       │       ├── fcntl_linux_32bit.go
│       │       │       ├── gccgo_c.c
│       │       │       ├── gccgo.go
│       │       │       ├── gccgo_linux_amd64.go
│       │       │       ├── ioctl.go
│       │       │       ├── mkall.sh
│       │       │       ├── mkerrors.sh
│       │       │       ├── pagesize_unix.go
│       │       │       ├── pledge_openbsd.go
│       │       │       ├── race0.go
│       │       │       ├── race.go
│       │       │       ├── readdirent_getdents.go
│       │       │       ├── readdirent_getdirentries.go
│       │       │       ├── README.md
│       │       │       ├── sockcmsg_linux.go
│       │       │       ├── sockcmsg_unix.go
│       │       │       ├── str.go
│       │       │       ├── syscall_aix.go
│       │       │       ├── syscall_aix_ppc64.go
│       │       │       ├── syscall_aix_ppc.go
│       │       │       ├── syscall_bsd.go
│       │       │       ├── syscall_darwin_386.go
│       │       │       ├── syscall_darwin_amd64.go
│       │       │       ├── syscall_darwin_arm64.go
│       │       │       ├── syscall_darwin_arm.go
│       │       │       ├── syscall_darwin.go
│       │       │       ├── syscall_darwin_libSystem.go
│       │       │       ├── syscall_dragonfly_amd64.go
│       │       │       ├── syscall_dragonfly.go
│       │       │       ├── syscall_freebsd_386.go
│       │       │       ├── syscall_freebsd_amd64.go
│       │       │       ├── syscall_freebsd_arm64.go
│       │       │       ├── syscall_freebsd_arm.go
│       │       │       ├── syscall_freebsd.go
│       │       │       ├── syscall.go
│       │       │       ├── syscall_linux_386.go
│       │       │       ├── syscall_linux_amd64_gc.go
│       │       │       ├── syscall_linux_amd64.go
│       │       │       ├── syscall_linux_arm64.go
│       │       │       ├── syscall_linux_arm.go
│       │       │       ├── syscall_linux_gc_386.go
│       │       │       ├── syscall_linux_gccgo_386.go
│       │       │       ├── syscall_linux_gccgo_arm.go
│       │       │       ├── syscall_linux_gc.go
│       │       │       ├── syscall_linux.go
│       │       │       ├── syscall_linux_mips64x.go
│       │       │       ├── syscall_linux_mipsx.go
│       │       │       ├── syscall_linux_ppc64x.go
│       │       │       ├── syscall_linux_riscv64.go
│       │       │       ├── syscall_linux_s390x.go
│       │       │       ├── syscall_linux_sparc64.go
│       │       │       ├── syscall_netbsd_386.go
│       │       │       ├── syscall_netbsd_amd64.go
│       │       │       ├── syscall_netbsd_arm64.go
│       │       │       ├── syscall_netbsd_arm.go
│       │       │       ├── syscall_netbsd.go
│       │       │       ├── syscall_openbsd_386.go
│       │       │       ├── syscall_openbsd_amd64.go
│       │       │       ├── syscall_openbsd_arm64.go
│       │       │       ├── syscall_openbsd_arm.go
│       │       │       ├── syscall_openbsd.go
│       │       │       ├── syscall_solaris_amd64.go
│       │       │       ├── syscall_solaris.go
│       │       │       ├── syscall_unix_gc.go
│       │       │       ├── syscall_unix_gc_ppc64x.go
│       │       │       ├── syscall_unix.go
│       │       │       ├── timestruct.go
│       │       │       ├── unveil_openbsd.go
│       │       │       ├── xattr_bsd.go
│       │       │       ├── zerrors_aix_ppc64.go
│       │       │       ├── zerrors_aix_ppc.go
│       │       │       ├── zerrors_darwin_386.go
│       │       │       ├── zerrors_darwin_amd64.go
│       │       │       ├── zerrors_darwin_arm64.go
│       │       │       ├── zerrors_darwin_arm.go
│       │       │       ├── zerrors_dragonfly_amd64.go
│       │       │       ├── zerrors_freebsd_386.go
│       │       │       ├── zerrors_freebsd_amd64.go
│       │       │       ├── zerrors_freebsd_arm64.go
│       │       │       ├── zerrors_freebsd_arm.go
│       │       │       ├── zerrors_linux_386.go
│       │       │       ├── zerrors_linux_amd64.go
│       │       │       ├── zerrors_linux_arm64.go
│       │       │       ├── zerrors_linux_arm.go
│       │       │       ├── zerrors_linux_mips64.go
│       │       │       ├── zerrors_linux_mips64le.go
│       │       │       ├── zerrors_linux_mips.go
│       │       │       ├── zerrors_linux_mipsle.go
│       │       │       ├── zerrors_linux_ppc64.go
│       │       │       ├── zerrors_linux_ppc64le.go
│       │       │       ├── zerrors_linux_riscv64.go
│       │       │       ├── zerrors_linux_s390x.go
│       │       │       ├── zerrors_linux_sparc64.go
│       │       │       ├── zerrors_netbsd_386.go
│       │       │       ├── zerrors_netbsd_amd64.go
│       │       │       ├── zerrors_netbsd_arm64.go
│       │       │       ├── zerrors_netbsd_arm.go
│       │       │       ├── zerrors_openbsd_386.go
│       │       │       ├── zerrors_openbsd_amd64.go
│       │       │       ├── zerrors_openbsd_arm64.go
│       │       │       ├── zerrors_openbsd_arm.go
│       │       │       ├── zerrors_solaris_amd64.go
│       │       │       ├── zptrace386_linux.go
│       │       │       ├── zptracearm_linux.go
│       │       │       ├── zptracemipsle_linux.go
│       │       │       ├── zptracemips_linux.go
│       │       │       ├── zsyscall_aix_ppc64_gccgo.go
│       │       │       ├── zsyscall_aix_ppc64_gc.go
│       │       │       ├── zsyscall_aix_ppc64.go
│       │       │       ├── zsyscall_aix_ppc.go
│       │       │       ├── zsyscall_darwin_386.1_11.go
│       │       │       ├── zsyscall_darwin_386.go
│       │       │       ├── zsyscall_darwin_386.s
│       │       │       ├── zsyscall_darwin_amd64.1_11.go
│       │       │       ├── zsyscall_darwin_amd64.go
│       │       │       ├── zsyscall_darwin_amd64.s
│       │       │       ├── zsyscall_darwin_arm.1_11.go
│       │       │       ├── zsyscall_darwin_arm64.1_11.go
│       │       │       ├── zsyscall_darwin_arm64.go
│       │       │       ├── zsyscall_darwin_arm64.s
│       │       │       ├── zsyscall_darwin_arm.go
│       │       │       ├── zsyscall_darwin_arm.s
│       │       │       ├── zsyscall_dragonfly_amd64.go
│       │       │       ├── zsyscall_freebsd_386.go
│       │       │       ├── zsyscall_freebsd_amd64.go
│       │       │       ├── zsyscall_freebsd_arm64.go
│       │       │       ├── zsyscall_freebsd_arm.go
│       │       │       ├── zsyscall_linux_386.go
│       │       │       ├── zsyscall_linux_amd64.go
│       │       │       ├── zsyscall_linux_arm64.go
│       │       │       ├── zsyscall_linux_arm.go
│       │       │       ├── zsyscall_linux_mips64.go
│       │       │       ├── zsyscall_linux_mips64le.go
│       │       │       ├── zsyscall_linux_mips.go
│       │       │       ├── zsyscall_linux_mipsle.go
│       │       │       ├── zsyscall_linux_ppc64.go
│       │       │       ├── zsyscall_linux_ppc64le.go
│       │       │       ├── zsyscall_linux_riscv64.go
│       │       │       ├── zsyscall_linux_s390x.go
│       │       │       ├── zsyscall_linux_sparc64.go
│       │       │       ├── zsyscall_netbsd_386.go
│       │       │       ├── zsyscall_netbsd_amd64.go
│       │       │       ├── zsyscall_netbsd_arm64.go
│       │       │       ├── zsyscall_netbsd_arm.go
│       │       │       ├── zsyscall_openbsd_386.go
│       │       │       ├── zsyscall_openbsd_amd64.go
│       │       │       ├── zsyscall_openbsd_arm64.go
│       │       │       ├── zsyscall_openbsd_arm.go
│       │       │       ├── zsyscall_solaris_amd64.go
│       │       │       ├── zsysctl_openbsd_386.go
│       │       │       ├── zsysctl_openbsd_amd64.go
│       │       │       ├── zsysctl_openbsd_arm64.go
│       │       │       ├── zsysctl_openbsd_arm.go
│       │       │       ├── zsysnum_darwin_386.go
│       │       │       ├── zsysnum_darwin_amd64.go
│       │       │       ├── zsysnum_darwin_arm64.go
│       │       │       ├── zsysnum_darwin_arm.go
│       │       │       ├── zsysnum_dragonfly_amd64.go
│       │       │       ├── zsysnum_freebsd_386.go
│       │       │       ├── zsysnum_freebsd_amd64.go
│       │       │       ├── zsysnum_freebsd_arm64.go
│       │       │       ├── zsysnum_freebsd_arm.go
│       │       │       ├── zsysnum_linux_386.go
│       │       │       ├── zsysnum_linux_amd64.go
│       │       │       ├── zsysnum_linux_arm64.go
│       │       │       ├── zsysnum_linux_arm.go
│       │       │       ├── zsysnum_linux_mips64.go
│       │       │       ├── zsysnum_linux_mips64le.go
│       │       │       ├── zsysnum_linux_mips.go
│       │       │       ├── zsysnum_linux_mipsle.go
│       │       │       ├── zsysnum_linux_ppc64.go
│       │       │       ├── zsysnum_linux_ppc64le.go
│       │       │       ├── zsysnum_linux_riscv64.go
│       │       │       ├── zsysnum_linux_s390x.go
│       │       │       ├── zsysnum_linux_sparc64.go
│       │       │       ├── zsysnum_netbsd_386.go
│       │       │       ├── zsysnum_netbsd_amd64.go
│       │       │       ├── zsysnum_netbsd_arm64.go
│       │       │       ├── zsysnum_netbsd_arm.go
│       │       │       ├── zsysnum_openbsd_386.go
│       │       │       ├── zsysnum_openbsd_amd64.go
│       │       │       ├── zsysnum_openbsd_arm64.go
│       │       │       ├── zsysnum_openbsd_arm.go
│       │       │       ├── ztypes_aix_ppc64.go
│       │       │       ├── ztypes_aix_ppc.go
│       │       │       ├── ztypes_darwin_386.go
│       │       │       ├── ztypes_darwin_amd64.go
│       │       │       ├── ztypes_darwin_arm64.go
│       │       │       ├── ztypes_darwin_arm.go
│       │       │       ├── ztypes_dragonfly_amd64.go
│       │       │       ├── ztypes_freebsd_386.go
│       │       │       ├── ztypes_freebsd_amd64.go
│       │       │       ├── ztypes_freebsd_arm64.go
│       │       │       ├── ztypes_freebsd_arm.go
│       │       │       ├── ztypes_linux_386.go
│       │       │       ├── ztypes_linux_amd64.go
│       │       │       ├── ztypes_linux_arm64.go
│       │       │       ├── ztypes_linux_arm.go
│       │       │       ├── ztypes_linux_mips64.go
│       │       │       ├── ztypes_linux_mips64le.go
│       │       │       ├── ztypes_linux_mips.go
│       │       │       ├── ztypes_linux_mipsle.go
│       │       │       ├── ztypes_linux_ppc64.go
│       │       │       ├── ztypes_linux_ppc64le.go
│       │       │       ├── ztypes_linux_riscv64.go
│       │       │       ├── ztypes_linux_s390x.go
│       │       │       ├── ztypes_linux_sparc64.go
│       │       │       ├── ztypes_netbsd_386.go
│       │       │       ├── ztypes_netbsd_amd64.go
│       │       │       ├── ztypes_netbsd_arm64.go
│       │       │       ├── ztypes_netbsd_arm.go
│       │       │       ├── ztypes_openbsd_386.go
│       │       │       ├── ztypes_openbsd_amd64.go
│       │       │       ├── ztypes_openbsd_arm64.go
│       │       │       ├── ztypes_openbsd_arm.go
│       │       │       └── ztypes_solaris_amd64.go
│       │       └── text
│       │           ├── AUTHORS
│       │           ├── CONTRIBUTORS
│       │           ├── LICENSE
│       │           ├── PATENTS
│       │           ├── secure
│       │           │   └── bidirule
│       │           │       ├── bidirule10.0.0.go
│       │           │       ├── bidirule9.0.0.go
│       │           │       └── bidirule.go
│       │           ├── transform
│       │           │   └── transform.go
│       │           └── unicode
│       │               ├── bidi
│       │               │   ├── bidi.go
│       │               │   ├── bracket.go
│       │               │   ├── core.go
│       │               │   ├── prop.go
│       │               │   ├── tables10.0.0.go
│       │               │   ├── tables9.0.0.go
│       │               │   └── trieval.go
│       │               └── norm
│       │                   ├── composition.go
│       │                   ├── forminfo.go
│       │                   ├── input.go
│       │                   ├── iter.go
│       │                   ├── normalize.go
│       │                   ├── readwriter.go
│       │                   ├── tables10.0.0.go
│       │                   ├── tables9.0.0.go
│       │                   ├── transform.go
│       │                   └── trie.go
│       ├── google.golang.org
│       │   ├── genproto
│       │   │   ├── googleapis
│       │   │   │   └── rpc
│       │   │   │       └── status
│       │   │   │           └── status.pb.go
│       │   │   └── LICENSE
│       │   └── grpc
│       │       ├── AUTHORS
│       │       ├── backoff.go
│       │       ├── balancer
│       │       │   ├── balancer.go
│       │       │   ├── base
│       │       │   │   ├── balancer.go
│       │       │   │   └── base.go
│       │       │   └── roundrobin
│       │       │       └── roundrobin.go
│       │       ├── balancer_conn_wrappers.go
│       │       ├── balancer.go
│       │       ├── balancer_v1_wrapper.go
│       │       ├── binarylog
│       │       │   └── grpc_binarylog_v1
│       │       │       └── binarylog.pb.go
│       │       ├── call.go
│       │       ├── clientconn.go
│       │       ├── codec.go
│       │       ├── codegen.sh
│       │       ├── codes
│       │       │   ├── codes.go
│       │       │   └── code_string.go
│       │       ├── connectivity
│       │       │   └── connectivity.go
│       │       ├── CONTRIBUTING.md
│       │       ├── credentials
│       │       │   ├── credentials.go
│       │       │   ├── internal
│       │       │   │   ├── syscallconn_appengine.go
│       │       │   │   └── syscallconn.go
│       │       │   └── tls13.go
│       │       ├── dialoptions.go
│       │       ├── doc.go
│       │       ├── encoding
│       │       │   ├── encoding.go
│       │       │   └── proto
│       │       │       └── proto.go
│       │       ├── go.mod
│       │       ├── go.sum
│       │       ├── grpclog
│       │       │   ├── grpclog.go
│       │       │   ├── logger.go
│       │       │   └── loggerv2.go
│       │       ├── install_gae.sh
│       │       ├── interceptor.go
│       │       ├── internal
│       │       │   ├── backoff
│       │       │   │   └── backoff.go
│       │       │   ├── balancerload
│       │       │   │   └── load.go
│       │       │   ├── binarylog
│       │       │   │   ├── binarylog.go
│       │       │   │   ├── binarylog_testutil.go
│       │       │   │   ├── env_config.go
│       │       │   │   ├── method_logger.go
│       │       │   │   ├── regenerate.sh
│       │       │   │   ├── sink.go
│       │       │   │   └── util.go
│       │       │   ├── channelz
│       │       │   │   ├── funcs.go
│       │       │   │   ├── types.go
│       │       │   │   ├── types_linux.go
│       │       │   │   ├── types_nonlinux.go
│       │       │   │   ├── util_linux.go
│       │       │   │   └── util_nonlinux.go
│       │       │   ├── envconfig
│       │       │   │   └── envconfig.go
│       │       │   ├── grpcrand
│       │       │   │   └── grpcrand.go
│       │       │   ├── grpcsync
│       │       │   │   └── event.go
│       │       │   ├── internal.go
│       │       │   ├── syscall
│       │       │   │   ├── syscall_linux.go
│       │       │   │   └── syscall_nonlinux.go
│       │       │   └── transport
│       │       │       ├── bdp_estimator.go
│       │       │       ├── controlbuf.go
│       │       │       ├── defaults.go
│       │       │       ├── flowcontrol.go
│       │       │       ├── handler_server.go
│       │       │       ├── http2_client.go
│       │       │       ├── http2_server.go
│       │       │       ├── http_util.go
│       │       │       ├── log.go
│       │       │       └── transport.go
│       │       ├── keepalive
│       │       │   └── keepalive.go
│       │       ├── LICENSE
│       │       ├── Makefile
│       │       ├── metadata
│       │       │   └── metadata.go
│       │       ├── naming
│       │       │   ├── dns_resolver.go
│       │       │   └── naming.go
│       │       ├── peer
│       │       │   └── peer.go
│       │       ├── picker_wrapper.go
│       │       ├── pickfirst.go
│       │       ├── preloader.go
│       │       ├── proxy.go
│       │       ├── README.md
│       │       ├── resolver
│       │       │   ├── dns
│       │       │   │   └── dns_resolver.go
│       │       │   ├── passthrough
│       │       │   │   └── passthrough.go
│       │       │   └── resolver.go
│       │       ├── resolver_conn_wrapper.go
│       │       ├── rpc_util.go
│       │       ├── server.go
│       │       ├── serviceconfig
│       │       │   └── serviceconfig.go
│       │       ├── service_config.go
│       │       ├── stats
│       │       │   ├── handlers.go
│       │       │   └── stats.go
│       │       ├── status
│       │       │   └── status.go
│       │       ├── stream.go
│       │       ├── tap
│       │       │   └── tap.go
│       │       ├── trace.go
│       │       ├── version.go
│       │       └── vet.sh
│       └── modules.txt
├── clean_docker.sh
├── config.yaml
├── explorer
│   ├── config.json
│   ├── connection-profile
│   │   └── org1-network.json
│   ├── docker-compose.yaml
│   └── organizations
│       ├── ordererOrganizations
│       │   └── example.com
│       │       ├── ca
│       │       │   ├── ca.example.com-cert.pem
│       │       │   └── priv_sk
│       │       ├── msp
│       │       │   ├── cacerts
│       │       │   │   └── ca.example.com-cert.pem
│       │       │   ├── config.yaml
│       │       │   └── tlscacerts
│       │       │       └── tlsca.example.com-cert.pem
│       │       ├── orderers
│       │       │   └── orderer.example.com
│       │       │       ├── msp
│       │       │       │   ├── cacerts
│       │       │       │   │   └── ca.example.com-cert.pem
│       │       │       │   ├── config.yaml
│       │       │       │   ├── keystore
│       │       │       │   │   └── priv_sk
│       │       │       │   ├── signcerts
│       │       │       │   │   └── orderer.example.com-cert.pem
│       │       │       │   └── tlscacerts
│       │       │       │       └── tlsca.example.com-cert.pem
│       │       │       └── tls
│       │       │           ├── ca.crt
│       │       │           ├── server.crt
│       │       │           └── server.key
│       │       ├── tlsca
│       │       │   ├── priv_sk
│       │       │   └── tlsca.example.com-cert.pem
│       │       └── users
│       │           └── [email protected]
│       │               ├── msp
│       │               │   ├── cacerts
│       │               │   │   └── ca.example.com-cert.pem
│       │               │   ├── config.yaml
│       │               │   ├── keystore
│       │               │   │   └── priv_sk
│       │               │   ├── signcerts
│       │               │   │   └── [email protected]
│       │               │   └── tlscacerts
│       │               │       └── tlsca.example.com-cert.pem
│       │               └── tls
│       │                   ├── ca.crt
│       │                   ├── client.crt
│       │                   └── client.key
│       └── peerOrganizations
│           └── org1.example.com
│               ├── ca
│               │   ├── ca.org1.example.com-cert.pem
│               │   └── priv_sk
│               ├── msp
│               │   ├── cacerts
│               │   │   └── ca.org1.example.com-cert.pem
│               │   ├── config.yaml
│               │   └── tlscacerts
│               │       └── tlsca.org1.example.com-cert.pem
│               ├── peers
│               │   ├── peer0.org1.example.com
│               │   │   ├── msp
│               │   │   │   ├── cacerts
│               │   │   │   │   └── ca.org1.example.com-cert.pem
│               │   │   │   ├── config.yaml
│               │   │   │   ├── keystore
│               │   │   │   │   └── priv_sk
│               │   │   │   ├── signcerts
│               │   │   │   │   └── peer0.org1.example.com-cert.pem
│               │   │   │   └── tlscacerts
│               │   │   │       └── tlsca.org1.example.com-cert.pem
│               │   │   └── tls
│               │   │       ├── ca.crt
│               │   │       ├── server.crt
│               │   │       └── server.key
│               │   └── peer1.org1.example.com
│               │       ├── msp
│               │       │   ├── cacerts
│               │       │   │   └── ca.org1.example.com-cert.pem
│               │       │   ├── config.yaml
│               │       │   ├── keystore
│               │       │   │   └── priv_sk
│               │       │   ├── signcerts
│               │       │   │   └── peer1.org1.example.com-cert.pem
│               │       │   └── tlscacerts
│               │       │       └── tlsca.org1.example.com-cert.pem
│               │       └── tls
│               │           ├── ca.crt
│               │           ├── server.crt
│               │           └── server.key
│               ├── tlsca
│               │   ├── priv_sk
│               │   └── tlsca.org1.example.com-cert.pem
│               └── users
│                   ├── [email protected]
│                   │   ├── msp
│                   │   │   ├── cacerts
│                   │   │   │   └── ca.org1.example.com-cert.pem
│                   │   │   ├── config.yaml
│                   │   │   ├── keystore
│                   │   │   │   └── priv_sk
│                   │   │   ├── signcerts
│                   │   │   │   └── [email protected]
│                   │   │   └── tlscacerts
│                   │   │       └── tlsca.org1.example.com-cert.pem
│                   │   └── tls
│                   │       ├── ca.crt
│                   │       ├── client.crt
│                   │       └── client.key
│                   └── [email protected]
│                       ├── msp
│                       │   ├── cacerts
│                       │   │   └── ca.org1.example.com-cert.pem
│                       │   ├── config.yaml
│                       │   ├── keystore
│                       │   │   └── priv_sk
│                       │   ├── signcerts
│                       │   │   └── [email protected]
│                       │   └── tlscacerts
│                       │       └── tlsca.org1.example.com-cert.pem
│                       └── tls
│                           ├── ca.crt
│                           ├── client.crt
│                           └── client.key
├── fixtures
│   ├── channel-artifacts
│   │   ├── channel.tx
│   │   ├── genesis.block
│   │   └── Org1MSPanchors.tx
│   ├── configtx.yaml
│   ├── crypto-config
│   │   ├── ordererOrganizations
│   │   │   └── example.com
│   │   │       ├── ca
│   │   │       │   ├── ca.example.com-cert.pem
│   │   │       │   └── priv_sk
│   │   │       ├── msp
│   │   │       │   ├── cacerts
│   │   │       │   │   └── ca.example.com-cert.pem
│   │   │       │   ├── config.yaml
│   │   │       │   └── tlscacerts
│   │   │       │       └── tlsca.example.com-cert.pem
│   │   │       ├── orderers
│   │   │       │   └── orderer.example.com
│   │   │       │       ├── msp
│   │   │       │       │   ├── cacerts
│   │   │       │       │   │   └── ca.example.com-cert.pem
│   │   │       │       │   ├── config.yaml
│   │   │       │       │   ├── keystore
│   │   │       │       │   │   └── priv_sk
│   │   │       │       │   ├── signcerts
│   │   │       │       │   │   └── orderer.example.com-cert.pem
│   │   │       │       │   └── tlscacerts
│   │   │       │       │       └── tlsca.example.com-cert.pem
│   │   │       │       └── tls
│   │   │       │           ├── ca.crt
│   │   │       │           ├── server.crt
│   │   │       │           └── server.key
│   │   │       ├── tlsca
│   │   │       │   ├── priv_sk
│   │   │       │   └── tlsca.example.com-cert.pem
│   │   │       └── users
│   │   │           └── [email protected]
│   │   │               ├── msp
│   │   │               │   ├── cacerts
│   │   │               │   │   └── ca.example.com-cert.pem
│   │   │               │   ├── config.yaml
│   │   │               │   ├── keystore
│   │   │               │   │   └── priv_sk
│   │   │               │   ├── signcerts
│   │   │               │   │   └── [email protected]
│   │   │               │   └── tlscacerts
│   │   │               │       └── tlsca.example.com-cert.pem
│   │   │               └── tls
│   │   │                   ├── ca.crt
│   │   │                   ├── client.crt
│   │   │                   └── client.key
│   │   └── peerOrganizations
│   │       └── org1.example.com
│   │           ├── ca
│   │           │   ├── ca.org1.example.com-cert.pem
│   │           │   └── priv_sk
│   │           ├── msp
│   │           │   ├── cacerts
│   │           │   │   └── ca.org1.example.com-cert.pem
│   │           │   ├── config.yaml
│   │           │   └── tlscacerts
│   │           │       └── tlsca.org1.example.com-cert.pem
│   │           ├── peers
│   │           │   ├── peer0.org1.example.com
│   │           │   │   ├── msp
│   │           │   │   │   ├── cacerts
│   │           │   │   │   │   └── ca.org1.example.com-cert.pem
│   │           │   │   │   ├── config.yaml
│   │           │   │   │   ├── keystore
│   │           │   │   │   │   └── priv_sk
│   │           │   │   │   ├── signcerts
│   │           │   │   │   │   └── peer0.org1.example.com-cert.pem
│   │           │   │   │   └── tlscacerts
│   │           │   │   │       └── tlsca.org1.example.com-cert.pem
│   │           │   │   └── tls
│   │           │   │       ├── ca.crt
│   │           │   │       ├── server.crt
│   │           │   │       └── server.key
│   │           │   └── peer1.org1.example.com
│   │           │       ├── msp
│   │           │       │   ├── cacerts
│   │           │       │   │   └── ca.org1.example.com-cert.pem
│   │           │       │   ├── config.yaml
│   │           │       │   ├── keystore
│   │           │       │   │   └── priv_sk
│   │           │       │   ├── signcerts
│   │           │       │   │   └── peer1.org1.example.com-cert.pem
│   │           │       │   └── tlscacerts
│   │           │       │       └── tlsca.org1.example.com-cert.pem
│   │           │       └── tls
│   │           │           ├── ca.crt
│   │           │           ├── server.crt
│   │           │           └── server.key
│   │           ├── tlsca
│   │           │   ├── priv_sk
│   │           │   └── tlsca.org1.example.com-cert.pem
│   │           └── users
│   │               ├── [email protected]
│   │               │   ├── msp
│   │               │   │   ├── cacerts
│   │               │   │   │   └── ca.org1.example.com-cert.pem
│   │               │   │   ├── config.yaml
│   │               │   │   ├── keystore
│   │               │   │   │   └── priv_sk
│   │               │   │   ├── signcerts
│   │               │   │   │   └── [email protected]
│   │               │   │   └── tlscacerts
│   │               │   │       └── tlsca.org1.example.com-cert.pem
│   │               │   └── tls
│   │               │       ├── ca.crt
│   │               │       ├── client.crt
│   │               │       └── client.key
│   │               └── [email protected]
│   │                   ├── msp
│   │                   │   ├── cacerts
│   │                   │   │   └── ca.org1.example.com-cert.pem
│   │                   │   ├── config.yaml
│   │                   │   ├── keystore
│   │                   │   │   └── priv_sk
│   │                   │   ├── signcerts
│   │                   │   │   └── [email protected]
│   │                   │   └── tlscacerts
│   │                   │       └── tlsca.org1.example.com-cert.pem
│   │                   └── tls
│   │                       ├── ca.crt
│   │                       ├── client.crt
│   │                       └── client.key
│   ├── crypto-config.yaml
│   └── docker-compose.yaml
├── go.mod
├── go.sum
├── LICENSE
├── main.go
├── medical
├── README.md
├── sdkInit
│   ├── integration.go
│   ├── sdkInfo.go
│   └── sdkSetting.go
├── service
│   ├── domain.go
│   └── medService.go
└── web
    ├── controller
    │   ├── controllerHandler.go
    │   ├── controllerResponse.go
    │   └── userInfo.go
    ├── static
    │   ├── css
    │   │   ├── bootstrap.min.css
    │   │   ├── help.css
    │   │   ├── index.css
    │   │   ├── login.css
    │   │   ├── process.css
    │   │   ├── query.css
    │   │   ├── queryResult.css
    │   │   └── reset.css
    │   ├── fonts
    │   │   ├── glyphicons-halflings-regular.eot
    │   │   ├── glyphicons-halflings-regular.svg
    │   │   ├── glyphicons-halflings-regular.ttf
    │   │   ├── glyphicons-halflings-regular.woff
    │   │   └── glyphicons-halflings-regular.woff2
    │   ├── images
    │   │   ├── head.jpg
    │   │   ├── icon_input.png
    │   │   ├── icon_list.png
    │   │   ├── logo.png
    │   │   └── vline.gif
    │   └── js
    │       ├── bootstrap.min.js
    │       └── jquery.min.js
    ├── tpl
    │   ├── accessMedHistory.html
    │   ├── accessMed.html
    │   ├── accessMedResult.html
    │   ├── auditAllRecords.html
    │   ├── auditByMedicalRecord.html
    │   ├── auditByOrganisation.html
    │   ├── auditByOriginalAuthor.html
    │   ├── auditByPatient.html
    │   ├── auditByUser.html
    │   ├── auditMed.html
    │   ├── auditReportByTimeRangeAndOrg.html
    │   ├── auditReportResult.html
    │   ├── auditResult.html
    │   ├── auditTimeRangeStartEnd.html
    │   ├── deleteMed.html
    │   ├── favicon.ico
    │   ├── index.html
    │   ├── login.html
    │   ├── operateMed.html
    │   ├── updateMed.html
    │   └── uploadMed.html
    └── webServer.go

217 directories, 696 files

进入explorer文件夹之后,需要执行以下命令。

wget https://raw.githubusercontent.com/hyperledger/blockchain-explorer/main/examples/net1/config.json
wget https://raw.githubusercontent.com/hyperledger/blockchain-explorer/main/examples/net1/connection-profile/test-network.json -P connection-profile
wget https://raw.githubusercontent.com/hyperledger/blockchain-explorer/main/docker-compose.yaml

以下为下载下来的配置文件的内容,如果下载不了可以复制下面三个文件的内容。

config.json

{
	"network-configs": {
		"test-network": {
			"name": "Test Network",
			"profile": "./connection-profile/test-network.json"
		}
	},
	"license": "Apache-2.0"
}

test-network.json

{
	"name": "test-network",
	"version": "1.0.0",
	"client": {
		"tlsEnable": true,
		"adminCredential": {
			"id": "exploreradmin",
			"password": "exploreradminpw"
		},
		"enableAuthentication": true,
		"organization": "Org1MSP",
		"connection": {
			"timeout": {
				"peer": {
					"endorser": "300"
				},
				"orderer": "300"
			}
		}
	},
	"channels": {
		"mychannel": {
			"peers": {
				"peer0.org1.example.com": {}
			}
		}
	},
	"organizations": {
		"Org1MSP": {
			"mspid": "Org1MSP",
			"adminPrivateKey": {
				"path": "/tmp/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp/keystore/priv_sk"
			},
			"peers": ["peer0.org1.example.com"],
			"signedCert": {
				"path": "/tmp/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp/signcerts/[email protected]"
			}
		}
	},
	"peers": {
		"peer0.org1.example.com": {
			"tlsCACerts": {
				"path": "/tmp/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt"
			},
			"url": "grpcs://peer0.org1.example.com:7051"
		}
	}
}

docker-compose.yaml

# SPDX-License-Identifier: Apache-2.0
version: '2.1'

volumes:
  pgdata:
  walletstore:

networks:
  mynetwork.com:
    name: fabric_test

services:

  explorerdb.mynetwork.com:
    image: hyperledger/explorer-db:latest
    container_name: explorerdb.mynetwork.com
    hostname: explorerdb.mynetwork.com
    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
    networks:
      - mynetwork.com

  explorer.mynetwork.com:
    image: hyperledger/explorer:latest
    container_name: explorer.mynetwork.com
    hostname: explorer.mynetwork.com
    environment:
      - DATABASE_HOST=explorerdb.mynetwork.com
      - DATABASE_DATABASE=fabricexplorer
      - DATABASE_USERNAME=hppoc
      - DATABASE_PASSWD=password
      - LOG_LEVEL_APP=info
      - LOG_LEVEL_DB=info
      - LOG_LEVEL_CONSOLE=debug
      - LOG_CONSOLE_STDOUT=true
      - DISCOVERY_AS_LOCALHOST=false
      - PORT=${PORT:-8080}
    volumes:
      - ${EXPLORER_CONFIG_FILE_PATH}:/opt/explorer/app/platform/fabric/config.json
      - ${EXPLORER_PROFILE_DIR_PATH}:/opt/explorer/app/platform/fabric/connection-profile
      - ${FABRIC_CRYPTO_PATH}:/tmp/crypto
      - walletstore:/opt/explorer/wallet
    ports:
      - ${PORT:-8080}:${PORT:-8080}
    depends_on:
      explorerdb.mynetwork.com:
        condition: service_healthy
    networks:
      - mynetwork.com

之后,将fixtures文件夹下的crypto-config文件夹复制到explorer文件夹,并将explorer文件夹中的crypto-config文件夹重命名为organizations。此时的目录结构应该是这样的。

docker-compose.yaml
config.json
connection-profile/test-network.json
organizations/ordererOrganizations/
organizations/peerOrganizations/

 

此处需要修改配置文件的内容,需要和区块链网络匹配,这样才能在启动的时候打开区块链浏览器,具体如下所示。

将test-network.json重命名为org1-network.json,并修改为以下内容。此处需要重点注意几个path字段是否能跟organizations文件夹里面的对应文件对上。此外,adminCredential字段指定了区块链浏览器的登录用户名和密码。

{
	"name": "org1-network",
	"version": "1.0.0",
	"client": {
		"tlsEnable": true,
		"adminCredential": {
			"id": "exploreradmin",
			"password": "exploreradminpw"
		},
		"enableAuthentication": true,
		"organization": "Org1MSP",
		"connection": {
			"timeout": {
				"peer": {
					"endorser": "300"
				},
				"orderer": "300"
			}
		}
	},
	"channels": {
		"mychannel": {
			"peers": {
				"peer0.org1.example.com": {}
			},
			"connection": {
				"timeout": {
					"peer": {
						"endorser": "6000",
						"eventHub": "6000",
						"eventReg": "6000"
					}
				}
			}
		}
	},
	"organizations": {
		"Org1MSP": {
			"mspid": "Org1MSP",
			"adminPrivateKey": {
				"path": "/tmp/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp/keystore/priv_sk"
			},
			"peers": ["peer0.org1.example.com"],
			"signedCert": {
				"path": "/tmp/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp/signcerts/[email protected]"
			}
		}

	},

	"peers": {
		"peer0.org1.example.com": {
			"tlsCACerts": {
				"path": "/tmp/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt"
			},
			"url": "grpcs://peer0.org1.example.com:7051"
		}
	}
}

将config.json修改为以下内容,要与connection-profile文件夹对应。

{
	"network-configs": {
		"org1-network": {
			"name": "org1-network",
			"profile": "./connection-profile/org1-network.json"
		}
	},
	"license": "Apache-2.0"
}

将docker-compose.yaml文件的内容修改为如下所示。此处需要指定网络名称与区块链网络的名称相同(我的为fixtures_test),并指定端口号。此外需要指定DISCOVERY_AS_LOCALHOST=false,以便禁止将主机名映射为localhost。


# SPDX-License-Identifier: Apache-2.0
version: '2.1'

volumes:
  pgdata:
  walletstore:

networks:
  mynetwork.com:
    external:
      name: fixtures_test

services:

  explorerdb.mynetwork.com:
    image: hyperledger/explorer-db:latest
    container_name: explorerdb.mynetwork.com
    hostname: explorerdb.mynetwork.com
    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
    networks:
      - mynetwork.com

  explorer.mynetwork.com:
    image: hyperledger/explorer:latest
    container_name: explorer.mynetwork.com
    hostname: explorer.mynetwork.com
    environment:
      - DATABASE_HOST=explorerdb.mynetwork.com
      - DATABASE_DATABASE=fabricexplorer
      - DATABASE_USERNAME=hppoc
      - DATABASE_PASSWD=password
      - LOG_LEVEL_APP=debug
      - LOG_LEVEL_DB=debug
      - 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
      - ./organizations:/tmp/crypto
      - walletstore:/opt/explorer/wallet
    ports:
      - 8080:8080
    depends_on:
      explorerdb.mynetwork.com:
        condition: service_healthy
    networks:
      - mynetwork.com

此时的目录结构如下所示。

具体的目录结构如下所示,此处使用tree -L 8命令。

.
├── config.json
├── connection-profile
│   └── org1-network.json
├── docker-compose.yaml
└── organizations
    ├── ordererOrganizations
    │   └── example.com
    │       ├── ca
    │       │   ├── ca.example.com-cert.pem
    │       │   └── priv_sk
    │       ├── msp
    │       │   ├── cacerts
    │       │   │   └── ca.example.com-cert.pem
    │       │   ├── config.yaml
    │       │   └── tlscacerts
    │       │       └── tlsca.example.com-cert.pem
    │       ├── orderers
    │       │   └── orderer.example.com
    │       │       ├── msp
    │       │       │   ├── cacerts
    │       │       │   │   └── ca.example.com-cert.pem
    │       │       │   ├── config.yaml
    │       │       │   ├── keystore
    │       │       │   │   └── priv_sk
    │       │       │   ├── signcerts
    │       │       │   │   └── orderer.example.com-cert.pem
    │       │       │   └── tlscacerts
    │       │       │       └── tlsca.example.com-cert.pem
    │       │       └── tls
    │       │           ├── ca.crt
    │       │           ├── server.crt
    │       │           └── server.key
    │       ├── tlsca
    │       │   ├── priv_sk
    │       │   └── tlsca.example.com-cert.pem
    │       └── users
    │           └── [email protected]
    │               ├── msp
    │               │   ├── cacerts
    │               │   │   └── ca.example.com-cert.pem
    │               │   ├── config.yaml
    │               │   ├── keystore
    │               │   │   └── priv_sk
    │               │   ├── signcerts
    │               │   │   └── [email protected]
    │               │   └── tlscacerts
    │               │       └── tlsca.example.com-cert.pem
    │               └── tls
    │                   ├── ca.crt
    │                   ├── client.crt
    │                   └── client.key
    └── peerOrganizations
        └── org1.example.com
            ├── ca
            │   ├── ca.org1.example.com-cert.pem
            │   └── priv_sk
            ├── msp
            │   ├── cacerts
            │   │   └── ca.org1.example.com-cert.pem
            │   ├── config.yaml
            │   └── tlscacerts
            │       └── tlsca.org1.example.com-cert.pem
            ├── peers
            │   ├── peer0.org1.example.com
            │   │   ├── msp
            │   │   │   ├── cacerts
            │   │   │   │   └── ca.org1.example.com-cert.pem
            │   │   │   ├── config.yaml
            │   │   │   ├── keystore
            │   │   │   │   └── priv_sk
            │   │   │   ├── signcerts
            │   │   │   │   └── peer0.org1.example.com-cert.pem
            │   │   │   └── tlscacerts
            │   │   │       └── tlsca.org1.example.com-cert.pem
            │   │   └── tls
            │   │       ├── ca.crt
            │   │       ├── server.crt
            │   │       └── server.key
            │   └── peer1.org1.example.com
            │       ├── msp
            │       │   ├── cacerts
            │       │   │   └── ca.org1.example.com-cert.pem
            │       │   ├── config.yaml
            │       │   ├── keystore
            │       │   │   └── priv_sk
            │       │   ├── signcerts
            │       │   │   └── peer1.org1.example.com-cert.pem
            │       │   └── tlscacerts
            │       │       └── tlsca.org1.example.com-cert.pem
            │       └── tls
            │           ├── ca.crt
            │           ├── server.crt
            │           └── server.key
            ├── tlsca
            │   ├── priv_sk
            │   └── tlsca.org1.example.com-cert.pem
            └── users
                ├── [email protected]
                │   ├── msp
                │   │   ├── cacerts
                │   │   │   └── ca.org1.example.com-cert.pem
                │   │   ├── config.yaml
                │   │   ├── keystore
                │   │   │   └── priv_sk
                │   │   ├── signcerts
                │   │   │   └── [email protected]
                │   │   └── tlscacerts
                │   │       └── tlsca.org1.example.com-cert.pem
                │   └── tls
                │       ├── ca.crt
                │       ├── client.crt
                │       └── client.key
                └── [email protected]
                    ├── msp
                    │   ├── cacerts
                    │   │   └── ca.org1.example.com-cert.pem
                    │   ├── config.yaml
                    │   ├── keystore
                    │   │   └── priv_sk
                    │   ├── signcerts
                    │   │   └── [email protected]
                    │   └── tlscacerts
                    │       └── tlsca.org1.example.com-cert.pem
                    └── tls
                        ├── ca.crt
                        ├── client.crt
                        └── client.key

62 directories, 65 files

在编写完配置文件之后,就可以启动区块链浏览器了。首先需要启动区块链网络,然后需要进入explorer文件夹,输入docker-compose up -d命令。

 

输入docker ps -a命令,可以看到已经启动的docker容器情况。如果hyperledger/explorer:latest容器出现Exited(1)的情况,则输入docker logs [对应的容器ID],查看错误情况(此处一般是配置文件没有和区块链网络对应)。

区块链浏览器启动后在浏览器输入localhost:8080,单击回车。此处,登录用户名为exploreradmin,密码为exploreradminpw。

登录之后可以查看区块链网络、区块和交易等信息。

若要关闭区块链浏览器,则还需要进入explorer文件夹,输入docker-compose down -v(此处-v不能去掉,因为删除持久化数据才能在下一次启动区块链浏览器时启动成功)命令。

猜你喜欢

转载自blog.csdn.net/weixin_58267277/article/details/127506960