{"id":18679242,"url":"https://github.com/code-monad/ckb-tutorial-contract","last_synced_at":"2025-08-28T22:19:45.286Z","repository":{"id":242311936,"uuid":"809234388","full_name":"code-monad/ckb-tutorial-contract","owner":"code-monad","description":"a simple tutorial for how to write ckb contract using rust","archived":false,"fork":false,"pushed_at":"2024-06-02T06:38:30.000Z","size":27,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-18T15:12:06.400Z","etag":null,"topics":["ckb","contract","rust","template-project","tutorial"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/code-monad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-02T05:17:27.000Z","updated_at":"2024-06-02T11:49:36.000Z","dependencies_parsed_at":"2024-06-02T06:28:55.870Z","dependency_job_id":"7cab1a13-6379-4f61-bf6c-82f90ffc63c5","html_url":"https://github.com/code-monad/ckb-tutorial-contract","commit_stats":null,"previous_names":["code-monad/ckb-tutorial-contract"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/code-monad/ckb-tutorial-contract","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-monad%2Fckb-tutorial-contract","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-monad%2Fckb-tutorial-contract/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-monad%2Fckb-tutorial-contract/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-monad%2Fckb-tutorial-contract/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/code-monad","download_url":"https://codeload.github.com/code-monad/ckb-tutorial-contract/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-monad%2Fckb-tutorial-contract/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272566851,"owners_count":24956668,"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","status":"online","status_checked_at":"2025-08-28T02:00:10.768Z","response_time":74,"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":["ckb","contract","rust","template-project","tutorial"],"created_at":"2024-11-07T09:42:44.745Z","updated_at":"2025-08-28T22:19:45.270Z","avatar_url":"https://github.com/code-monad.png","language":"Rust","readme":"# tutorial-contract\n\n## How to generate/init a contract project\n\n### Prerequisite\n\nFollow https://github.com/cryptape/ckb-script-templates\n\n- `git`, `make`, `sed`, `bash`, `sha256sum` (you have these on most unix compatible systems)\n- `rust`, follow: https://rustup.rs/ , and do: `rustup target add riscv64imac-unknown-none-elf`\n- `llvm` \u003e 16\n- `cargo-generate`, `cargo install cargo-generate`\n\n### Generate a project\n\n```bash\ncargo generate gh:cryptape/ckb-script-templates workspace --name my-first-contract\ncd my-first-contract\n```\n\n### Generate a contract inside the project\n\nGenerate a contract with a given name\n\n```bash\nmake generate\n🤷   Project Name: my-contract\n🔧   Destination: ./my-first-contract/contracts/my-contract ...\n🔧   project-name: my-contract ...\n🔧   Generating template ...\n🔧   Moving generated files into: `./tutorial-contract/contracts/my-contract`...\n🔧   Initializing a fresh Git repository\n✨   Done! New project created ./tutorial-contract/contracts/my-contract\n```\n\n## Implement it!\n\nopen `./contracts/my-contract`, fill your logic in `src/main.rs`\n\n## Write your test in `tests/src/tests.rs` !\n\ntest cases goes into `tests/tests.rs`, you can also use your own project structure.\n\n## Build it, test it!\n\n1. run `make build MODE=debug` to build your contract\n2. run `make test` to test your contract\n\n## Distribute your contract!\n\n0. build your contract a release binary: `make build MODE=release`\n1. ensure you have installed ckb-cli: https://github.com/nervosnetwork/ckb-cli\n2. generate a deployment info: `ckb-cli --url https://testnet.ckb.dev/rpc deploy init-config --deployment-config deploy.yaml --output-format yaml`\n3. generate your deployment tx, and sign it: `mkdir -p ./migration \u0026\u0026 ckb-cli --url https://testnet.ckb.dev/rpc deploy gen-txs --info-file deploy.toml --migration-dir migration --from-address YOUR_ADDRESS --fee-rate 1000 --deployment-config deploy.yaml --sign-now`\n4. send your tx: `deploy apply-txs --info-file deploy.toml --migration-dir ./migration`\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode-monad%2Fckb-tutorial-contract","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcode-monad%2Fckb-tutorial-contract","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode-monad%2Fckb-tutorial-contract/lists"}