{"id":15012755,"url":"https://github.com/microsoft/ccf-app-template","last_synced_at":"2025-07-06T00:37:12.818Z","repository":{"id":38192193,"uuid":"496290904","full_name":"microsoft/ccf-app-template","owner":"microsoft","description":"Template repository for CCF apps","archived":false,"fork":false,"pushed_at":"2025-01-15T14:13:48.000Z","size":55,"stargazers_count":14,"open_issues_count":2,"forks_count":18,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-07-05T00:13:11.811Z","etag":null,"topics":["confidential-computing","ledger","multiparty","trusted-execution-environment"],"latest_commit_sha":null,"homepage":"https://microsoft.github.io/CCF/main/build_apps","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/microsoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-25T15:34:32.000Z","updated_at":"2025-04-04T02:01:06.000Z","dependencies_parsed_at":"2024-07-29T10:56:24.279Z","dependency_job_id":"963757e0-a780-42aa-a253-0ca6c7e1b5d0","html_url":"https://github.com/microsoft/ccf-app-template","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/microsoft/ccf-app-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fccf-app-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fccf-app-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fccf-app-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fccf-app-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/microsoft","download_url":"https://codeload.github.com/microsoft/ccf-app-template/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fccf-app-template/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263832484,"owners_count":23517350,"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":["confidential-computing","ledger","multiparty","trusted-execution-environment"],"created_at":"2024-09-24T19:43:10.707Z","updated_at":"2025-07-06T00:37:12.777Z","avatar_url":"https://github.com/microsoft.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CCF App Template [![Open in VSCode](https://img.shields.io/static/v1?label=Open+in\u0026message=VSCode\u0026logo=visualstudiocode\u0026color=007ACC\u0026logoColor=007ACC\u0026labelColor=2C2C32)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/microsoft/ccf-app-template)\n\n[![CCF App Template CI](https://github.com/microsoft/ccf-app-template/actions/workflows/ci.yml/badge.svg)](https://github.com/microsoft/ccf-app-template/actions/workflows/ci.yml)\n\nTemplate repository for JavaScript and C++ CCF applications.\n\nNote: For complete sample apps, see https://github.com/microsoft/ccf-app-samples.\n\n## Quickstart\n\nThe quickest way to build and run this sample CCF app is to checkout this repository locally in its development container by clicking:\n[![Open in VSCode](https://img.shields.io/static/v1?label=Open+in\u0026message=VSCode\u0026logo=visualstudiocode\u0026color=007ACC\u0026logoColor=007ACC\u0026labelColor=2C2C32)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/microsoft/ccf-app-template)\n\nAll dependencies will be automatically installed (takes ~2 mins on first checkout).\n\nAlternatively, you can checkout this repository in a Github codespace: [![Open in Github codespace](https://img.shields.io/static/v1?label=Open+in\u0026message=GitHub+codespace\u0026logo=github\u0026color=2F363D\u0026logoColor=white\u0026labelColor=2C2C32)](https://github.com/codespaces/new?hide_repo_select=true\u0026ref=main\u0026repo=496290904\u0026machine=basicLinux32gb\u0026devcontainer_path=.devcontainer.json\u0026location=WestEurope)\n\n## \u003cimg src=\"https://user-images.githubusercontent.com/42961061/191275583-88e00f94-73aa-4d66-9786-047987eb9fa9.png\" height=50px\u003e \u003c/img\u003e JavaScript\n\nCCF apps can be written in JavaScript/TypeScript. This is the quickest way to develop new apps as this does not require any compilation step and the app can be updated on the fly, via [a governance proposal](https://microsoft.github.io/CCF/main/build_apps/js_app_bundle.html#deployment).\n\nThe JavaScript sample bundle is located in the [`js/`](js/) directory.\n\n### Run JS app\n\n```bash\n$ npm --prefix ./js install\n$ npm --prefix ./js run build\n$ /opt/ccf_virtual/bin/sandbox.sh --js-app-bundle ./js/dist/\n[12:00:00.000] Virtual mode enabled\n[12:00:00.000] Starting 1 CCF node...\n[12:00:00.000] Started CCF network with the following nodes:\n[12:00:00.000]   Node [0] = https://127.0.0.1:8000\n[12:00:00.000] You can now issue business transactions to the libjs_generic application\n[12:00:00.000] Loaded JS application: ./js/dist/\n[12:00:00.000] Keys and certificates have been copied to the common folder: /workspaces/ccf-app-template/workspace/sandbox_common\n[12:00:00.000] See https://microsoft.github.io/CCF/main/use_apps/issue_commands.html for more information\n[12:00:00.000] Press Ctrl+C to shutdown the network\n```\n\nIn another terminal:\n\n```bash\n$ curl -X POST \"https://127.0.0.1:8000/app/log?id=1\" --cacert ./workspace/sandbox_common/service_cert.pem -H \"Content-Type: application/json\" --data '{\"msg\": \"hello world\"}'\n$ curl \"https://127.0.0.1:8000/app/log?id=1\" --cacert ./workspace/sandbox_common/service_cert.pem\nhello world\n```\n\n### Docker\n\nIt is possible to build a runtime image of the JavaScript application via docker:\n\n```bash\n$ docker build -t ccf-app-template:js-enclave -f docker/ccf_app_js.enclave .\n$ docker run --device /dev/sgx_enclave:/dev/sgx_enclave --device /dev/sgx_provision:/dev/sgx_provision -v /dev/sgx:/dev/sgx ccf-app-template:js-enclave\n...\n2022-01-01T12:00:00.000000Z -0.000 0   [info ] ../src/node/node_state.h:1790        | Network TLS connections now accepted\n\n# Now the CCF service is started and member governance is needed to allow trusted users to interact with the deployed application\n```\n\nOr, for the non-SGX (a.k.a. virtual) variant:\n\n```bash\n$ docker build -t ccf-app-template:js-virtual -f docker/ccf_app_js.virtual .\n$ docker run ccf-app-template:js-virtual\n```\n\n#### Network governance\n\nThe CCF network is started with one node and one member, you need to execute the following governance steps to initialize the network\n\n- [Activate the network existing member to start a network governance](https://microsoft.github.io/CCF/main/governance/adding_member.html#activating-a-new-member)\n- Build the application and [create a deployment proposal](https://microsoft.github.io/CCF/main/build_apps/js_app_bundle.html#deployment)\n- Deploy the application proposal, [using governance calls](https://microsoft.github.io/CCF/main/governance/proposals.html#submitting-a-new-proposal)\n- Create and submit [an add users proposal](https://microsoft.github.io/CCF/main/governance/open_network.html#adding-users)\n- Open the network for users ([using proposal](https://microsoft.github.io/CCF/main/governance/open_network.html#opening-the-network))\n\n### Bare VM\n\nThe application can be tested using `cchost` on Linux environment.\nTo start a test CCF network on a Linux environment, it requires [CCF to be intalled](https://microsoft.github.io/CCF/main/build_apps/install_bin.html) or you can create a CCF-enabled VM using [Creating a Virtual Machine in Azure to run CCF](https://github.com/microsoft/CCF/blob/main/getting_started/azure_vm/README.md)\n\n```bash\n# Start the CCF network using the cchost in\n\n# Enclave mode\n /opt/ccf_sgx/bin/cchost --config ./config/cchost_config_enclave_js.json\n\n# Or Virtual mode\n/opt/ccf_virtual/bin/cchost --config ./config/cchost_config_virtual_js.json\n...\n\n # Now the CCF network is started and further initialization needed before the interaction with the service\n```\n\nThe CCF network is started with one node and one member, please follow the [same governance steps as Docker](#network-governance) to initialize the network and check [CCF node config file documentation](https://microsoft.github.io/CCF/main/operations/configuration.html)\n\n### Managed CCF\n\nThe application can be tested using [Azure Managed CCF](https://techcommunity.microsoft.com/t5/azure-confidential-computing/microsoft-introduces-preview-of-azure-managed-confidential/ba-p/3648986) `(Pre-release phase)`, you can create Azure Managed CCF service on your subscription, that will give you a ready CCF network\n\n- First, create the network's initial member certificate, please check [Certificates generation](https://microsoft.github.io/CCF/main/governance/adding_member.html)\n- Create a new Azure Managed CCF service (the initial member certificate required as input)\n- Build the application and [create a deployment proposal](https://microsoft.github.io/CCF/main/build_apps/js_app_bundle.html#deployment)\n- Deploy the application proposal, [using governance calls](https://microsoft.github.io/CCF/main/governance/proposals.html#creating-a-proposal)\n- Create and submit [an add users proposal](https://microsoft.github.io/CCF/main/governance/proposals.html#creating-a-proposal)\n\n## \u003cimg src=\"https://user-images.githubusercontent.com/42961061/191275172-24269bf0-bb9c-402d-8900-2d589582a781.png\" height=50px\u003e\u003c/img\u003e C++\n\nCCF apps can also be written in C++. This offers better performance than JavaScript apps but requires a compilation step and a restart of the CCF node for deployment.\n\nThe C++ sample app is located in the [`cpp/`](cpp/) directory.\n\nAlso check out the [code tour](#code-tour) to get an overview of the C++ app.\n\n### Build C++ app\n\nIn the checkout of this repository:\n\n```bash\n$ cd cpp/\n$ mkdir build \u0026\u0026 cd build\n$ CC=\"clang-11\" CXX=\"clang++-11\" cmake -GNinja ..\n$ ninja\n$ ls\nlibccf_app.enclave.so.signed # SGX-enabled application\nlibccf_app.virtual.so # Virtual application (i.e. insecure!)\n```\n\nSee [docs](https://microsoft.github.io/CCF/main/build_apps) for complete instructions on how to build a CCF app.\n\n### Run C++ app\n\n```bash\n$ /opt/ccf_virtual/bin/sandbox.sh -p ./libccf_app.virtual.so\nSetting up Python environment...\nPython environment successfully setup\n[12:00:00.000] Virtual mode enabled\n[12:00:00.000] Starting 1 CCF node...\n[12:00:00.000] Started CCF network with the following nodes:\n[12:00:00.000]   Node [0] = https://127.0.0.1:8000\n[12:00:00.000] You can now issue business transactions to the ./libccf_app.virtual.so application\n[12:00:00.000] Keys and certificates have been copied to the common folder: .../ccf-app-template/build/workspace/sandbox_common\n[12:00:00.000] See https://microsoft.github.io/CCF/main/use_apps/issue_commands.html for more information\n[12:00:00.000] Press Ctrl+C to shutdown the network\n```\n\nOr, for an SGX-enabled application (unavailable in development container): `$ /opt/ccf_sgx/bin/sandbox.sh -p ./libccf_app.enclave.so.signed -e release`\n\n### Docker\n\nIt is possible to build a runtime image of the C++ application via docker:\n\n```bash\n$ docker build -t ccf-app-template:cpp-enclave -f docker/ccf_app_cpp.enclave .\n$ docker run --device /dev/sgx_enclave:/dev/sgx_enclave --device /dev/sgx_provision:/dev/sgx_provision -v /dev/sgx:/dev/sgx ccf-app-template:cpp-enclave\n...\n2022-01-01T12:00:00.000000Z -0.000 0   [info ] ../src/node/node_state.h:1790        | Network TLS connections now accepted\n# It is then possible to interact with the service\n```\n\nOr, for the non-SGX (a.k.a. virtual) variant:\n\n```bash\n$ docker build -t ccf-app-template:cpp-virtual -f docker/ccf_app_cpp.virtual .\n$ docker run ccf-app-template:cpp-virtual\n```\n\n---\n\n## Dependencies\n\nIf this repository is checked out on a bare VM (e.g. [for SGX deployments](https://docs.microsoft.com/en-us/azure/confidential-computing/quick-create-portal)), the dependencies required to build and run the C++ app can be installed as follows:\n\n```bash\n$ wget https://github.com/microsoft/CCF/releases/download/ccf-5.0.0/ccf_sgx_5.0.0_amd64.deb\n$ sudo dpkg -i ccf_sgx_5.0.0_amd64.deb # Install CCF under /opt/ccf_sgx\n$ cat /opt/ccf_sgx/share/VERSION_LONG\nccf-5.0.0\n$ /opt/ccf_sgx/getting_started/setup_vm/run.sh /opt/ccf_sgx/getting_started/setup_vm/app-dev.yml # Install dependencies\n```\n\nFor a non-SGX VM, replace `ccf_sgx` in all the commands above with `ccf_virtual`.\n\nSee the [CCF official docs](https://microsoft.github.io/CCF/main/build_apps/install_bin.html#install-ccf) for more info and [Modern JavaScript application development](https://microsoft.github.io/CCF/main/build_apps/js_app_bundle.html).\n\n## Code Tour\n\nIn VSCode, a [code tour](https://marketplace.visualstudio.com/items?itemName=vsls-contrib.codetour) of the C++ app can be started with: Ctrl + P, `\u003e CodeTour: Start Tour`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoft%2Fccf-app-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicrosoft%2Fccf-app-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoft%2Fccf-app-template/lists"}