{"id":31745044,"url":"https://github.com/dotbithq/sub-account-custom-script","last_synced_at":"2026-06-21T01:31:26.978Z","repository":{"id":40613317,"uuid":"507739175","full_name":"dotbitHQ/sub-account-custom-script","owner":"dotbitHQ","description":"This is a basic sub-account custom script which allow user custom prices of sub-accounts when creating and renewing.","archived":false,"fork":false,"pushed_at":"2023-01-16T08:43:34.000Z","size":70,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-06-21T01:31:22.201Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/dotbitHQ.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}},"created_at":"2022-06-27T02:33:47.000Z","updated_at":"2022-06-28T07:15:11.000Z","dependencies_parsed_at":"2023-01-25T20:46:31.180Z","dependency_job_id":null,"html_url":"https://github.com/dotbitHQ/sub-account-custom-script","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dotbitHQ/sub-account-custom-script","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotbitHQ%2Fsub-account-custom-script","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotbitHQ%2Fsub-account-custom-script/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotbitHQ%2Fsub-account-custom-script/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotbitHQ%2Fsub-account-custom-script/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dotbitHQ","download_url":"https://codeload.github.com/dotbitHQ/sub-account-custom-script/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotbitHQ%2Fsub-account-custom-script/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34591166,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-20T02:00:06.407Z","response_time":98,"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":[],"created_at":"2025-10-09T12:28:30.537Z","updated_at":"2026-06-21T01:31:26.973Z","avatar_url":"https://github.com/dotbitHQ.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sub-account Custom Script\n\nThis is a contract for CKB network and also it is a custom script for [das-contracts](https://github.com/dotbitHQ/das-contracts).\nWith this custom script user can define the price of sub-accounts, and elevate the security to contact level.\n\n\n## Deployment Information\n\n### Mainnet\n\nTODO\n\n### Testnet\n\nType Script:\n\n```\n{\n    \"code_hash\": \"0x00000000000000000000000000000000000000000000000000545950455f4944\",\n    \"args\": \"0xf15f519ecb226cd763b2bcbcab093e63f89100c07ac0caebc032c788b187ec99\",\n    \"hash_type\": \"type\"\n}\n```\n\nCustom Script Config Value:\n\n```\n0x01f15f519ecb226cd763b2bcbcab093e63f89100c07ac0caebc032c788b187ec99\n```\n\nType ID:\n\n```\n0x4d224050b1de20454979d44c474e1e988e9eaa24cfd2319ab9bd4fdd439be4fe\n```\n\n\n## Configuration\n\nThis script depends on `SubAccountCell.data.script_args` to store a hash of real configuration which means you need to set the script_args \nin the transaction named `config_sub_account_custom_script action`. And transaction builder who want to create or renew sub-account needs \nput the configuration in `transaction.witnesses[]`.\n\nThe configuration consists of header, version and body：\n\n```\n[header][version][body]\n```\n\n- header, 10 bytes of fixed content `0x7363726970742D303031` which means `script-001`, custom script use the header to find the witness able to be parsed.\n- version, 4 bytes litter-endian u32 number, it indicates the version of the `body` field which allow developer upgrading the structure of the `body` field.\n- body, a [molecule structure](https://github.com/nervosnetwork/molecule) with variable length, the type is `table PriceConfigList` which come from [das-types](https://github.com/dotbitHQ/das-types/blob/master/schemas/cell.mol)；\n\n\n## Building\n\nFirst you need to install [capsule](https://github.com/nervosnetwork/capsule) and [Docker](https://www.docker.com/), capsule will use docker \nto compile binaries because the compiling environment is really complex. \n\nThen you may build the contract with targets in Makefile, for example:\n\n- `make` will build the developing version of contract;\n- `make release` will build the releasing version of contract;\n\n\u003e Because of the complexity and the limitation of function is hard to overcome for beginners, we do not implement any unit tests in this \nsample project. You may create a template project with capsule instantly and explore how to write unit tests yourself.\n\n\n## Deployment\n\nTo deploy the contract you need prepare a lot of things:\n\n- A CKB full node which will allow ckb-cli to build index for live cells, initializing a full node will cost you about two days;\n- A ckb-cli binary with fully synchronized index, this will also cost you about half day;\n- A CKB address with enough CKBytes;\n\nAfter all the above is ready, you need to edit the value of `--address` in the Makefile to your address. At the last you may safely run \n`make deploy-testnet` or `make deploy-mainnet`.\n\n\u003e DO NOT forget commit and push the json files generated in `migrations/` directory, without this information you will not be able to update\n\u003e the contract with capsule in the future. If that already happened, you need to construct the transaction of updating contract manually.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotbithq%2Fsub-account-custom-script","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdotbithq%2Fsub-account-custom-script","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotbithq%2Fsub-account-custom-script/lists"}