{"id":22191957,"url":"https://github.com/cryptape/ckb-cli-light-client","last_synced_at":"2025-03-24T20:44:17.717Z","repository":{"id":62870654,"uuid":"544776012","full_name":"cryptape/ckb-cli-light-client","owner":"cryptape","description":"ckb-cli light client plugin","archived":false,"fork":false,"pushed_at":"2022-11-08T02:29:29.000Z","size":135,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-03T23:17:53.675Z","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/cryptape.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-10-03T07:50:51.000Z","updated_at":"2022-12-22T15:34:19.000Z","dependencies_parsed_at":"2022-11-08T07:15:58.357Z","dependency_job_id":null,"html_url":"https://github.com/cryptape/ckb-cli-light-client","commit_stats":null,"previous_names":["thewawar/ckb-cli-light-client"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cryptape%2Fckb-cli-light-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cryptape%2Fckb-cli-light-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cryptape%2Fckb-cli-light-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cryptape%2Fckb-cli-light-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cryptape","download_url":"https://codeload.github.com/cryptape/ckb-cli-light-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245351762,"owners_count":20601090,"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":[],"created_at":"2024-12-02T12:18:30.123Z","updated_at":"2025-03-24T20:44:17.686Z","avatar_url":"https://github.com/cryptape.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Light Client Command Line Tool\n\n## All sub-commands\n```\n$ ckb-cli-light-client --help\nUsage: ckb-cli-light-client [OPTIONS] \u003cCOMMAND\u003e\n\nCommands:\n  get-capacity        Get capacity of an address\n  transfer            Transfer some capacity from given address to a receiver address\n  dao                 Nervos DAO operations\n  example-search-key  Output the example `SearchKey` value\n  rpc                 Send jsonrpc call the ckb-light-client rpc server\n  help                Print this message or the help of the given subcommand(s)\n\nOptions:\n      --rpc \u003cURL\u003e  CKB light client rpc url [default: http://127.0.0.1:9000]\n      --debug      Debug mode, print more information\n```\n\n# Tutorial\n\n## Prepare for the tutorial\n\nFirstly, you need start a [ckb-light-client][ckb-light-client-repo] program. The default rpc address is `http://127.0.0.1:9000`.\n\nIf you want use a key from [ckb-cli][ckb-cli-repo], you can use follow command to create an account:\n```\n$ ckb-cli account new\nYour new account is locked with a password. Please give a password. Do not forget this password.\nPassword:\nRepeat password:\naddress:\n  mainnet: ckb1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqt48tu9kdhtu6qa3rxyvth38ttmyk7ds7cg3e9w7\n  testnet: ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqt48tu9kdhtu6qa3rxyvth38ttmyk7ds7cxrj2yx\naddress(deprecated):\n  mainnet: ckb1qyq82whctvmwhe5pmzxvgch0zwkhkfdumpasqdhlw4\n  testnet: ckt1qyq82whctvmwhe5pmzxvgch0zwkhkfdumpasagfqzf\nlock_arg: 0x753af85b36ebe681d88cc462ef13ad7b25bcd87b\nlock_hash: 0xb82e384482c41f010bc5decca782e8e8c6ad41bbcdac4187659fcb937526ab1e\n```\n\nAssume the ckb-light-client connected to CKB `testnet`, so the address `ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqt48tu9kdhtu6qa3rxyvth38ttmyk7ds7cxrj2yx` will be used. \n\nThen we need transfer some CKB to this address from other address, or get some CKB from [testnet faucet][testnet-faucet].\n\nAt last we install `ckb-cli-light-client` by `cargo install` (you may need install rust toolchain first).\n```\n$ cargo install --git https://github.com/TheWaWaR/ckb-cli-light-client.git --locked\n```\n\n## Transfer CKB capacity\n\nFirstly, we query the capacity of the address:\n```\n$ ckb-cli-light-client get-capacity --address ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqt48tu9kdhtu6qa3rxyvth38ttmyk7ds7cxrj2yx\nError: address not registered, you may use `rpc set-scripts` subcommand to register the address\n```\n\nIt says the address is not registered, we use `rpc set-scripts` to register it, so that ckb-light-client can index all the cells owner by this address:\n```\n$ ckb-cli-light-client rpc set-scripts --scripts ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqt48tu9kdhtu6qa3rxyvth38ttmyk7ds7cxrj2yx,1000\n```\n\nThen we query the capacity again:\n```\n$ ckb-cli-light-client get-capacity --address ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqt48tu9kdhtu6qa3rxyvth38ttmyk7ds7cxrj2yx\nsynchronized number: 7085789\ntip number: 7085789\ntip hash: 0x7777777777777777777777777777777777777777777777777777777777777777\ncapacity: 50000.0 CKB\n```\n\nThen, we better read the `transfer` sub-command help:\n```\n$ ckb-cli-light-client transfer --help\nTransfer some capacity from given address to a receiver address\n\nUsage: light-client transfer [OPTIONS] --to-address \u003cADDR\u003e --capacity \u003cCAPACITY\u003e \u003c--from-address \u003cADDR\u003e|--from-key \u003cPRIVKEY\u003e\u003e\n\nOptions:\n      --from-address \u003cADDR\u003e    The sender address (sighash only, also be used to match key in ckb-cli keystore)\n      --from-key \u003cPRIVKEY\u003e     The sender private key (hex string, also be used to generate sighash address)\n      --to-address \u003cADDR\u003e      The receiver address\n      --capacity \u003cCAPACITY\u003e    The capacity to transfer (unit: CKB, example: 102.43)\n      --skip-check-to-address  Skip check \u003cto-address\u003e (default only allow sighash/multisig address), be cautious to use this flag\n```\n\nTransfer some CKB from `ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqt48tu9kdhtu6qa3rxyvth38ttmyk7ds7cxrj2yx` to an address:\n```\n$ ckb-cli-light-client transfer \\\n    --from-address ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqt48tu9kdhtu6qa3rxyvth38ttmyk7ds7cxrj2yx \\\n    --to-address ckt1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqgaqanf \\\n    --capcity 200.0\n```\nIn above example, `ckb-cli-light-client` will search ckb-cli `keystore` directory by address (`ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqt48tu9kdhtu6qa3rxyvth38ttmyk7ds7cxrj2yx`) and use the key to sign the transaction. The `keystore` directory typically located in `~/.ckb-cli/keystore` or `$CKB_CLI_HOME/keystore` if you use the environment to specify the ckb-cli home directory.\n\nThen we query the capacity of the address:\n```\n$ ckb-cli-light-client get-capacity --address ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqt48tu9kdhtu6qa3rxyvth38ttmyk7ds7cxrj2yx\nsynchronized number: 7085789\ntip number: 7085789\ntip hash: 0x8888888888888888888888888888888888888888888888888888888888888888\ncapacity: 49799.99996544 CKB\n```\n\n[ckb-light-client-repo]: https://github.com/nervosnetwork/ckb-light-client\n[ckb-cli-repo]: https://github.com/nervosnetwork/ckb-cli\n[testnet-faucet]: https://faucet.nervos.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcryptape%2Fckb-cli-light-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcryptape%2Fckb-cli-light-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcryptape%2Fckb-cli-light-client/lists"}