Skip to content

skywall34/hyperledger-gql

Repository files navigation

Forks Stargazers Issues MIT License LinkedIn


HFGQL

Hyperledger Fabric Application built with Netflix DGS
· Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Build
  4. Usage
  5. Contributing
  6. License
  7. Contact
  8. References
  9. Acknowledgments

About The Project

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.

(back to top)

Built With

(back to top)

Getting Started

Prerequisites

A running Hyperledger Fabric network with a ERC 20 Token Contract installed is required to run the application.

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

Getting Started Locally

  1. 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

  1. 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"
  1. 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:443

Note! Make sure you have proper kube config

  1. Run the service

Build and run kotlin application at Main.kt

gradle build && gradle run

Or just run via Intellij if you're using it.

(back to top)

Build

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.

Usage

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

(back to top)

Contributing

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!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.md for more information.

(back to top)

Contact

Mike Shin - [email protected]

Project Link: https://github.com/skywall34/hyperledger-gql

(back to top)

References

Acknowledgements

TODOS

  • Documentation on Packaging and Installing Token Contract on Blockchain Network
  • User Security implementation under UserClient.kt getUser()

(back to top)

About

Hyperledger Fabric Application with Kotlin/Graphql

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors