{"id":49850067,"url":"https://github.com/midnightntwrk/example-hello-world","last_synced_at":"2026-05-14T15:04:27.232Z","repository":{"id":345754046,"uuid":"1170929636","full_name":"midnightntwrk/example-hello-world","owner":"midnightntwrk","description":"An Example Hello World DApp","archived":false,"fork":false,"pushed_at":"2026-04-29T17:18:56.000Z","size":166,"stargazers_count":4,"open_issues_count":1,"forks_count":2,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-29T19:19:13.135Z","etag":null,"topics":["compact","midnightntwrk"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/midnightntwrk.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-02T17:24:01.000Z","updated_at":"2026-04-29T17:18:58.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/midnightntwrk/example-hello-world","commit_stats":null,"previous_names":["midnightntwrk/example-hello-world"],"tags_count":0,"template":false,"template_full_name":"midnightntwrk/midnight-template-repo","purl":"pkg:github/midnightntwrk/example-hello-world","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/midnightntwrk%2Fexample-hello-world","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/midnightntwrk%2Fexample-hello-world/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/midnightntwrk%2Fexample-hello-world/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/midnightntwrk%2Fexample-hello-world/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/midnightntwrk","download_url":"https://codeload.github.com/midnightntwrk/example-hello-world/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/midnightntwrk%2Fexample-hello-world/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33030380,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-14T02:00:06.663Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["compact","midnightntwrk"],"created_at":"2026-05-14T15:04:25.279Z","updated_at":"2026-05-14T15:04:27.219Z","avatar_url":"https://github.com/midnightntwrk.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hello World Example\n\nThe repository is intended as part of the tutorial flow for the hello-world example in the [Midnight documentation](https://docs.midnight.network/getting-started/hello-world). It does not operate as a complete repository without the accompanying documentation.\n\nThe below documentation will be provided here to \"finish\" this example.\n\n## Set up project\n\n```bash\ngit clone git@github.com:midnightntwrk/example-hello-world.git\n```\n\nInstall dependencies:\n\n```bash\nyarn install\n```\n\n## Create the contract file\n\nCreate a new file named `hello-world.compact` in the `contracts` directory:\n\n```bash\ntouch contracts/hello-world.compact\n```\n\nOpen this file in VS Code:\n```bash\ncode .\n```\n\n## Create the Compact Smart Contract\n\n```compact\npragma language_version \u003e= 0.23;\n\nexport ledger message: Opaque\u003c\"string\"\u003e;\n\nexport circuit storeMessage(newMessage: Opaque\u003c\"string\"\u003e): [] {\n  message = disclose(newMessage);\n}\n```\n- `pragma language_version` specifies which version of Compact your contract uses.\n- `ledger message` creates a state variable named `message` that stores a string value in the on-chain state. On-chain state is public and persistent on the blockchain.\n- `circuit storeMessage` is a Compact circuit (function) that defines the logic to modify on-chain state.\n- `newMessage: Opaque\u003c\"string\"\u003e` is the input parameter. *Circuit parameters are always private by default.* The `disclose()` function marks the private value as safe to store publicly. Without it, trying to assign `newMessage` directly to the ledger returns a compiler error.\n\n## Compile the contract\n\nCompiling transforms your Compact code into zero-knowledge circuits, generates cryptographic keys, \nand creates TypeScript APIs and a JavaScript implementation for the contract to be used by DApps. \n\nRun the compiler from the contracts folder:\n\n```bash\ncompact compile hello-world.compact managed/hello-world\n```\n\nYou should see the following output:\n\n```\nCompiling 1 circuits:\n  circuit \"storeMessage\" (k=6, rows=26)\n```\n\nThe compilation process will:\n1. Parse and validate your Compact code.\n2. Generate zero-knowledge circuits from your logic.\n3. Create proving and verifying keys for the circuits.\n4. Generate the TypeScript API and JavaScript implementation for the contract.\n\nWhen compilation completes, you'll see a new directory structure:\n\n```\ncontracts/\n├── managed/\n|   └── hello-world/\n|        ├── compiler/\n|        ├── contract/\n|        ├── keys/\n|        └── zkir/\n└── hello-world.compact\n└── index.ts\n```\n\nHere's what each directory contains:\n\n- **contract/**: The compiled contract artifacts, which includes the JavaScript implementation and type definitions.\n- **keys/**: Cryptographic proving and verifying keys that enable zero-knowledge proofs.\n- **zkir/**: Zero-Knowledge Intermediate Representation—the bridge between Compact and the ZK backend.\n- **compiler/**: Compiler-generated JSON output that other tools can use to understand the contract structure.\n\n## Deploy Contract to Local Devnet\nNow that your contract is compiled, it needs to be deployed to the blockchain so that you can interact with it.\n\nBe sure the Docker engine is running and in a *separate terminal* start the proof server from the project root:\n```bash\nyarn env:up\n```\n\nLeave the proof server running for the following steps.\n\nTo deploy the contract, you'll need a wallet. The local devnet package comes with 3 pre-funded wallets.\n\n\nRun the deployment script:\n```bash\nyarn test:local\n```\n\nThe test script will begin to show output from your local devnet and will progress the contract deployment and interaction programatically:\n\n```\n[12:46:12.694] INFO (22064): Wallet sync complete after 23 emissions\n[12:46:12.703] INFO (22064): Providers initialized. Ready to test\n[12:46:12.707] INFO (22064): Creating private state...\n[12:46:32.347] INFO (22064): Setting the contract address...\n[12:46:32.347] INFO (22064): Contract deployed at: bba6579743ae23b44301d4a9f8df30dbd5244d63a59d8fbc2c9fc7ea521a04f8\n ✓ src/test/hw.test.ts (2 tests) 39112ms\n   ✓ Hello World Contract \u003e Deploys the contract  19649ms\n   ✓ Hello World Contract \u003e Stores Hello World!   18184ms\n```\n\nHello World! You are now ready to explore [Tutorials](https://docs.midnight.network/category/tutorials) for more detailed instructions on building DApps on Midnight!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmidnightntwrk%2Fexample-hello-world","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmidnightntwrk%2Fexample-hello-world","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmidnightntwrk%2Fexample-hello-world/lists"}