{"id":18301782,"url":"https://github.com/kfsoftware/hlf-cc-dev","last_synced_at":"2025-10-26T09:12:47.139Z","repository":{"id":44909830,"uuid":"448623551","full_name":"kfsoftware/hlf-cc-dev","owner":"kfsoftware","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-24T16:35:36.000Z","size":320,"stargazers_count":3,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-21T05:43:10.065Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kfsoftware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-16T17:24:12.000Z","updated_at":"2024-06-09T19:03:10.000Z","dependencies_parsed_at":"2023-02-18T22:46:06.527Z","dependency_job_id":null,"html_url":"https://github.com/kfsoftware/hlf-cc-dev","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kfsoftware%2Fhlf-cc-dev","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kfsoftware%2Fhlf-cc-dev/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kfsoftware%2Fhlf-cc-dev/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kfsoftware%2Fhlf-cc-dev/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kfsoftware","download_url":"https://codeload.github.com/kfsoftware/hlf-cc-dev/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247352531,"owners_count":20925284,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T15:16:58.633Z","updated_at":"2025-10-26T09:12:42.094Z","avatar_url":"https://github.com/kfsoftware.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## What's `hlf-cc-dev`?\n\n`hlf-cc-dev` is a tool to start developing a new chaincode from your development environment.\n\n### Why does this tool exist?\n\nWhen developing chaincodes, we need to have an HLF network deployed, usually in our development environment. It is hard for new developers to get started since they need to know how to deploy an HLF network.\n\nThis tool aims to ease the onboarding of new developers that are not familiar with the internals of the HLF network but are interested in developing chaincodes.\n\nThe only requirement is that the developer has access to a working HLF network. This network can be set up by Administrators that are used to perform these operations, so the developer doesn't need to.\n\nWith this tool, instead of installing the chaincode in the peers, approving the chaincode definition, and finally, committing the chaincode, the developer can have the chaincode started in its machine. With one command, it can install, approve and commit the chaincode in one go. SupposeThen, ifhe developer needs to modify the chaincode logic. In that case, all it needs to do is restart the chaincode program running in its machine, just like any other application the developer is used to developing.\n\n### What you'll need\n\n- A TLS/TCP tunnel to your local development environment (ngrok, getout, etc.)\n- Hyperledger Fabric peer with external chaincode builder enabled.\n- Network config with admin users for all of the organizations peers you will use.\n\n## General diagram\n\nThe following diagram explains the architecture of the final solution\n\n![Diagram](./static/img/diagram.png)\n\n## Steps to get started\n\nTo start the server, you need the network config with the admin users for each organization.\n\n```bash\nhlf-cc-dev serve --address \":8080\" --metrics-address \":8081\" --config \"\u003cPATH_TO_NETWORK_CONFIG\u003e\"\n```\n\n## Start development in your local environment\n\nYou need to have a chaincode that's able to be deployed as an external service; you can take a look at the following templates:\n\n- For Go (https://github.com/kfsoftware/hlf-cc-go-template)\n- For Node.JS (https://github.com/kfsoftware/hlf-cc-node-template)\n- **pending** For Java (https://github.com/kfsoftware/hlf-cc-java-template)\n\nWe recommend using the Go template since it's the easiest one to get started with.\n\nOnce you have the chaincode project set up on your local machine, you need to expose your server to the public; the easiest way to do this is to use a TLS/TCP tunnel, for example, [ngrok](https://ngrok.com/download).\n\n```bash\nngrok tcp 9999 --region=eu # region can be us, eu, au, ap, sa, jp, in\n```\nThe previous command will have this output:\n\n![ngrok](./static/img/ngrok-tunnel.png)\n\nCopy the Forwarding URL, but remove the `tcp://` part; for example, if you got `tcp://6.tcp.eu.ngrok.io:19922`, then you want to use `6.tcp.eu.ngrok.io:19922` for the following command(hlf-cc-dev).\n\nAfter having exposed your chaincode server to the public, you can run the following command to trigger:\n\n- Installation of the chaincode on the peers.\n- Approval of the chaincode definition.\n- Committing the chaincode definition.\n\n```bash\nCHAINCODE_NAME=template_go\nAPI_URL=\"http://localhost:8080/graphql\"\nSIGNATURE_POLICY=\"OR('Org1MSP.member', 'Org2MSP.member')\"\nCHAINCODE_ADDRESS_TUNNEL=\"4.tcp.eu.ngrok.io:13438\" # the forwarding URL you get from opening an ngrok tunnel\nhlf-cc-dev start --localChaincode=\"localhost:9999\" \\\n  --chaincodeAddress=\"${CHAINCODE_ADDRESS_TUNNEL}\" \\\n  --chaincode=\"${CHAINCODE_NAME}\" \\\n  --signaturePolicy=\"${SIGNATURE_POLICY}\" \\\n  --env-file=\"${PWD}/.env\" \\\n  --apiUrl=\"${API_URL}\"\n```\n\nAfter the successful execution of the previous command, you can follow the instructions on the README.md for each template.\n\nFor example, for Go, you would run the following command:\n\n```bash\nsource .env \u0026\u0026 go run ./main.go\n```\n\nThen you can go to http://localhost:8080/graphql and test the chaincode by running the following mutation:\n\n```graphql\nmutation invoke {\n  invokeChaincode(input:{\n    chaincodeName:\"template_go\"\n    function: \"InitLedger\"\n    args: []\n    transientMap: []\n  }){\n    response\n    transactionID\n    chaincodeStatus\n  }\n}\n\nmutation query {\n  queryChaincode(input:{\n    chaincodeName:\"template_go\"\n    function: \"GetAllAssets\"\n    args: []\n    transientMap: []\n  }){\n    response\n    chaincodeStatus\n  }\n}\n\n```\n\nIf there are any issues you run into with the previous mutations, this can be because:\n- The network config used to start the server is not correct.\n- The users set up in the network config are not admins.\n- The chaincode name is not valid.\n- The chaincode function is not valid.\n\nIf after checking the previous things you still get an error, please, [you can open an issue](https://github.com/kfsoftware/hlf-cc-dev/issues/new)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkfsoftware%2Fhlf-cc-dev","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkfsoftware%2Fhlf-cc-dev","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkfsoftware%2Fhlf-cc-dev/lists"}