{"id":40669403,"url":"https://github.com/tea2x/ckb-xudt-extension-plugins","last_synced_at":"2026-01-21T09:19:13.670Z","repository":{"id":238673092,"uuid":"797196973","full_name":"tea2x/ckb-xudt-extension-plugins","owner":"tea2x","description":"A DLL extension that creates a total-supply effect on ckb xudt token standard","archived":false,"fork":false,"pushed_at":"2024-05-19T08:13:48.000Z","size":4308,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-19T09:25:31.757Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","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/tea2x.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-05-07T11:34:34.000Z","updated_at":"2024-05-19T08:13:51.000Z","dependencies_parsed_at":"2024-05-16T00:44:40.524Z","dependency_job_id":null,"html_url":"https://github.com/tea2x/ckb-xudt-extension-plugins","commit_stats":null,"previous_names":["tea2x/ckb-xudt-extension-plugins"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tea2x/ckb-xudt-extension-plugins","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tea2x%2Fckb-xudt-extension-plugins","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tea2x%2Fckb-xudt-extension-plugins/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tea2x%2Fckb-xudt-extension-plugins/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tea2x%2Fckb-xudt-extension-plugins/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tea2x","download_url":"https://codeload.github.com/tea2x/ckb-xudt-extension-plugins/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tea2x%2Fckb-xudt-extension-plugins/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28630946,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T04:47:28.174Z","status":"ssl_error","status_checked_at":"2026-01-21T04:47:22.943Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2026-01-21T09:19:13.478Z","updated_at":"2026-01-21T09:19:13.653Z","avatar_url":"https://github.com/tea2x.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Abstraction\nThere's a desire to create hard capped tokens but with [SUDT](https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0025-simple-udt/0025-simple-udt.md) it's not possible. Leveraging the modular design of [XUDT](https://talk.nervos.org/t/rfc-extensible-udt/5337), we can build an extension plugin that help create hard-capped tokens.\n\n### 1. Build\n\n`make all-via docker`\n\n### 2. The idea\nBy this design, the xudt tokens of this \"type\" (hard capped) will link to a \"remaining amount\" cell. In each creation transaction of this type, the \"remaining amount cell\" must be consumed/destroyed and created with a new remaining amount - effectively maintaining a number for \"the remaining amount\". Guides to create this remaining amount cell will be put below.\n\n### 3. Setting up\n#### 3.1. Executable binary cell deployment\n- [xudt_rce](https://github.com/nervosnetwork/ckb-production-scripts/blob/master/c/xudt_rce.c) binary cell\n- Hard_cap extension binary cell (hard_cap.so)\n- \"Remaining amount\" cell lock script binary (ramt_cell_lock)\n\n*Note*: The \"remaining amount cell\" must be protected by the lockScript ramt_cell_lock.c\n\n#### 3.2. Composing a remaining amount cell\nA remaining amount cell, just like any other cell, contains following major fields:\n```json\n{\n    lock: \u003cremaining-amount-cell-lock-script\u003e,\n    type: \u003ctypeid\u003e,\n    data: \u003cremaining-amount::4bytes\u003e\n}\n```\n- With remaining-amount-cell-lock-script:\n```json\n{\n    codeHash: \u003cremaining-amount-cell-binary-hash\u003e,\n    hashType: \"data1\",\n    args: \"0x\"\n}\n```\n- With typeId: to create a typeId, follow [this guide](https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0022-transaction-structure/0022-transaction-structure.md#type-id).\n- With remaining-amount: a 4 bit LE hexa number that holds the value of the remaining amount.\n\n#### 3.3. Composing our hard-capped token's cell\nA hard-capped XUDT token cell, just like any other cell, contains following major fields:\n\n```json\n{\n    lock: \u003cowner-lock\u003e,\n    type: \u003chard-capped-xudt-type-script\u003e,\n    data: \u003camount\u003e+ ...\n}\n```\n\nThe important part is the hard-capped-xudt-type-script which lables + marks our tokens:\n```json\n{\n    codeHash: \u003cxudt_rce code hash\u003e\n    hashType: \"data1\"\n    args: \u003cowner's lockscript hash\u003e + \u003cxudt flag\u003e + \u003cScriptVector\u003e\n}\n```\n\n- With Script vector contains 1 Script element:\n```json\n{\n    codeHash: \u003chard_cap code hash\u003e\n    hashType: \"data1\"\n    args: \u003cremaining amount cell's typeId hash\u003e\n}\n```\n\n### 4. Creating tokens\nIn three modes: creation, transfer, and burn. This extension only has effects on the 'creation' mode.\n\nToken creation is as simple as with SUDT but it is required to place the \"remaining amount\" cell in the inputs, and calculate another \"remaning supply\" in the outputs and inputs with the correct remaining-amount calculation. Otherwise token creation will fail\n\n\u003cimg width=\"462\" alt=\"Screenshot 2024-05-08 at 15 05 10\" src=\"https://github.com/tea2x/ckb-xudt-extension-plugins/assets/70423834/16a2d9aa-ddfb-485a-975a-55866f49bf98\"\u003e\n\n### 5. Note\nWhen you see `hashType: \"data1\",` present in a lockscript or a typescript in this doc, it means the lock or type are not upgradeable. This repo is a personal project and it might contain bugs and need some auditing work to be deploy on-chain forever with option \"data1\". Consider to use `hashType: \"type\",` and make it upgradeable when needed. For upgradeable scripts, follow https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0022-transaction-structure/0022-transaction-structure.md#upgradable-script for more information. \n\n### 6. Example code in lumos\nhttps://github.com/tea2x/developer-training-course/blob/master/Lab-XUDT/index.js\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftea2x%2Fckb-xudt-extension-plugins","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftea2x%2Fckb-xudt-extension-plugins","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftea2x%2Fckb-xudt-extension-plugins/lists"}