[blockchain-explorer] Fabric v1.4 네트워크에 blockchain-explorer v0.3.9.1 연동
기본 정보
버전 정보
-
Hyperledger Fabric: v1.4.0
-
blockchain-explorer: v0.3.9.1
-
node: v8.x
https://github.com/hyperledger/blockchain-explorer
hyperledger/blockchain-explorer
Read-only mirror of https://gerrit.hyperledger.org/r/#/admin/projects/blockchain-explorer - hyperledger/blockchain-explorer
github.com
소스 코드 복제
cd /opt/gopath/src/github.com/hyperledger git clone https://github.com/hyperledger/blockchain-explorer cd blockchain-explorer # node 버전 8.x 사용 nvm use v8
cd /opt/gopath/src/github.com/hyperledger
git clone https://github.com/hyperledger/blockchain-explorer
cd blockchain-explorer
# node 버전 8.x 사용
nvm use v8
실행
DB 설정
초기에 한 번만 실행하면 됨
# postgresql 설치
sudo apt-get install postgresql
# 권한 부여
cd app/persistence/fabric/postgreSQL/db
chmod -R 775 db/
# 데이터베이스 생성
./createdb.sh
※ createdb.sh 실행 시 다음과 같은 오류가 발생하는 경우가 있습니다. (hyper는 현재 접속한 우분투 사용자 계정명입니다.)
psql: FATAL: role "hyper" does not exist
-> 해결방법
sudo -u postgres ./createdb.sh
Fabric 네트워크 설정
자신의 네트워크에 맞게 config.json 파일 수정
# config.json 파일 수정
cd /opt/gopath/src/github.com/hyperledger/blockchain-explorer
vi app/platform/fabric/config.json
fabric-ca Server 환경에 맞게 config_ca.json 파일도 수정 필요함
-
enroll-id : blockchain-explorer를 관리하기 위해 CA Server에 register 및 enroll된 계정명
-
enroll-affiliation : CA Server의 affiliation
-
admin-username : CA Server에 새로운 사용자를 register하기 위한 관리자 계정명
-
admin-secret : CA Server에 새로운 사용자를 register하기 위한 관리자 계정 비밀번호
# config_ca.json 파일 수정
vi app/platform/fabric/config_ca.json
npm 모듈 설치
cd /opt/gopath/src/github.com/hyperledger/blockchain-explorer
npm install
cd /opt/gopath/src/github.com/hyperledger/blockchain-explorer/app/test
npm install
cd /opt/gopath/src/github.com/hyperledger/blockchain-explorer/client
npm install
npm run build
blockchain-explorer 실행
cd /opt/gopath/src/github.com/hyperledger/blockchain-explorer
./start.sh
./stop.sh
cd /opt/gopath/src/github.com/hyperledger/blockchain-explorer
./syncstart.sh
./syncstop.sh
설정 파일
-
app/explorerconfig.json : 데이터베이스 설정
-
app/platform/fabric/config.json : Fabric 네트워크 설정
-
app/platform/fabric/config_ca.json : Fabric-CA 서버 설정