Hyperledger Fabric Application built with Netflix DGS
·
Report Bug
·
Request Feature
Table of Contents
FabricQL is an example project of how to create a GraphQL Project over a Hyperledger Fabric network. The framework is based off of Netflix's DGS and creates a gateway accessing a ERC 20 Token contract already installed in the Hyperledger Network over kubernetes.
Much of the Fabric code is based off the rest-api-typescript example in the fabric-samples repo here but reconfigured to work with an ERC 20 Token Contract and written in Kotlin DGS.
A running Hyperledger Fabric network with a ERC 20 Token Contract installed is required to run the application.
- Hyperledger Fabric K8s Deployment
- Hyperledger Fabric ERC 20 Token
- Docker
- kubectl
- kind
- jq
- Gradle
- Java 11
A local test network also should work fine here, but I've found that it is much better to use the k8s deployment if you want a more production ready network.
TODO: Documentation on Packaging and Installing Token Contract on Blockchain Network
- Get the connection profiles
Run ./application_connection.sh This will build all the connection profiles, users, wallets, etc. needed for the app to run. All connection profiles are set to be saved under the extra/ folder
- Export Environment Variables
export ECERT_CA_SERVER="https://127.0.0.1:7054"
export CONFIG_FILE_PATH="/path/to/extra/app-fabric-org1-local-map.yaml"
export ORG1_CONNECTION_PROFILE_PATH="/path/to/extra/application/gateways/org1_ccp.json"
export ORG2_CONNECTION_PROFILE_PATH="/path/to/extra/application/gateways/org2_ccp.json"
export ORG1_IDENTITY_FILE_PATH="/path/to/extra/application/wallet/appuser_org1.id"
export ORG2_IDENTITY_FILE_PATH="/path/to/extra/application/wallet/appuser_org2.id"
export CA_CLIENT_CERT_PATH="/path/to/extra/msp/organizations/peerOrganizations/org1.example.com/msp/cacerts/org1-ecert-ca.pem"
export CA_TLS_CLIENT_CERT_PATH="/path/to/extra/msp/organizations/peerOrganizations/org1.example.com/msp/tlscacerts/org1-tls-ca.pem"- Expose the Hyperledger Fabric
Open connections to the org1-peer1 and the org1-ca
kubectl port-forward svc/org1-peer1 7051:7051
kubectl port-forward svc/org1-ca 7054:443Note! Make sure you have proper kube config
- Run the service
Build and run kotlin application at Main.kt
gradle build && gradle runOr just run via Intellij if you're using it.
Jib is a fantastic tool enabling one to run your container build/push deployment with a gradle task. An example of its usage is in ./build.gradle. It builds and pushes a docker image of the application to a local kind registry.
I've added kubernetes yaml files one can reference to deploy their own application service. The only requirements would be a kind or hosted kubernetes network and a command line interface to apply the files.
kubectl apply -f ./configmap.yaml
kubectl apply -f ./deployment.yaml
kubectl apply -f ./ingress.yaml
kubectl apply -f ./service.yaml
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE.md for more information.
Mike Shin - [email protected]
Project Link: https://github.com/skywall34/hyperledger-gql
- Documentation on Packaging and Installing Token Contract on Blockchain Network
- User Security implementation under UserClient.kt getUser()