Ledgerdata Refiner, proposed in Ledgerdata Refiner: A Powerful Ledger Data Query Platform for Hyperledger Fabric, is a ledger data query platform for Hyperledger Fabric. Its key component is ledger data analysis middleware, which extracts and synchronizes ledger data, and then parses the relationship among them. With this middleware, besides query blocks and transactions, we also provide enriched data view for end users, including schema overview and customized fine-grained query on ledger states.
The main features of Ledgerdata Refiner are as follows:
- More flexible block and transaction retrieval and detail display
- history tracking for all states
- multiple chaincodes support
- schema analysis for states in json format
- fine-grained search for values in json format of states
- A Dashboard to display system overview
Requirements | Notes |
---|---|
Go | 1.13 or higher |
Hyperledger Fabric | 1.4.x and 2.x |
PostgreSQL | 9.5 or higher |
go get github.com/FujitsuLaboratories/Ledger-Data-Refiner
See https://hyperledger-fabric.readthedocs.io/en/latest/test_network.html.
Modify config/config.ini
to update PostgreSQL database settings:
[database]
db_host = 127.0.0.1
db_port = 5432
db_user = refiner
db_password = 123456
db_name = ledgerdata_refiner
Modify config/connection-config.yaml
to define your fabric network connection profile:
client:
organization: org1
logging:
level: info
# Root of the MSP directories with keys and certs.
cryptoconfig:
path: ${FABRIC_PROJECT_PATH}/${CRYPTOCONFIG_PATH}
organizations:
org1:
users:
Admin:
cert:
path: ${FABRIC_PROJECT_PATH}/${CRYPTOCONFIG_PATH}/peerOrganizations/org1.example.com/users/[email protected]/msp/signcerts/cert.pem
User1:
cert:
path: ${FABRIC_PROJECT_PATH}/${CRYPTOCONFIG_PATH}/peerOrganizations/org1.example.com/users/[email protected]/msp/signcerts/cert.pem
orderers:
orderer.example.com:
tlsCACerts:
# Certificate location absolute path
path: ${FABRIC_PROJECT_PATH}/${CRYPTOCONFIG_PATH}/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem
..............
peers:
peer0.org1.example.com:
tlsCACerts:
# Certificate location absolute path
path: ${FABRIC_PROJECT_PATH}/${CRYPTOCONFIG_PATH}/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem
..............
ertificateAuthorities:
ca.org1.example.com:
url: https://ca.org1.example.com:7054
tlsCACerts:
# Comma-Separated list of paths
path: ${FABRIC_PROJECT_PATH}/${CRYPTOCONFIG_PATH}/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem
# Client key and cert for SSL handshake with Fabric CA
client:
key:
path: ${FABRIC_PROJECT_PATH}/${CRYPTOCONFIG_PATH}/peerOrganizations/tls.example.com/users/[email protected]/tls/client.key
cert:
path: ${FABRIC_PROJECT_PATH}/${CRYPTOCONFIG_PATH}/peerOrganizations/tls.example.com/users/[email protected]/tls/client.crt
............
Modify ${FABRIC_PROJECT_PATH}/${CRYPTOCONFIG_PATH}
to your path of keystore. For more information, please read config_e2e.yaml
If your database is deployed locally, run the following script to create user, database and tables:
$ cd DOCKER/postgreSQL/db
$ ./createdb.sh
Before running the script, you have to modify config.json
:
{
"postgreSQL": {
"database": "ledgerdata_refiner",
"username": "refiner",
"password": "123456"
}
}
if you want to run the database on the docker, run the following command:
$ make docker_refinerdb
NOTE: the ledgerdata refiner uses gorm to connect to the database, it will automatically create the data table when the application starts, so you can create only user and database without tables.
Use Makefile to build the application:
$ make build
or
$ go build -o ledgerdata-refiner main.go
To run the application locally, run:
$ ./ledgerdata-refiner
Then open http://localhost:30052 in the browser
-
Modify
config/config.ini
to update postgreSQL database settings:[database] # if using docker, db_host must be the same as the hostname in the docker-compose file db_host = refinerdb.network.com db_port = 5432 db_user = refiner db_password = 123456 db_name = ledgerdata_refiner
-
Modify
DOCKER/postgreSQL/db/config.json
to update postgreSQL database settings of docker image:{ "postgreSQL": { "database": "ledgerdata_refiner", "username": "refiner", "password": "123456" } }
-
Modify
docker-compose.yaml
to update volumes:.......... refinerdb.network.com: volumes: - /you path here:/var/lib/postgresql/data .......... refiner.network.com: volumes: - /the path of your keystore:/opt/organizations .............
-
Build docker images:
$ make docker_all
-
Run ledgerdata refiner:
$ docker-compose -f docker-compose.yaml up -d
Then open http://localhost:30052 in the browser
The ledgerdata refiner uses swagger to provide API document. Once starting the application, check http://localhost:30052/swagger/index.html.
Thank you for considering to help out with the source code! We welcome contributions from anyone on the internet, and are grateful for even the smallest of fixes! There are essentially 3 different scenarios for contributors.
If you are a Fujitsu employee or contractor, you essentially already signed a CLA as part of your on-boarding. Simply fill in the required details and indicate that you are associated with Fujitsu in the Corporate CLA (CCLA.txt) .
If you are contributing as an individual, simply fill in the required details and agree to the Individual CLA (ICLA.txt), then submit it to us.
If you are contributing as an employee of another company or organization, you need to simply fill in the required details and indicate the company you are associated with and that a Corporate CLA (CCLA.txt) has been signed and submitted to us.
This Ledgerdata Refiner is distributed under the Apache License Version 2.0 found in the LICENSE file.