{"id":24054643,"url":"https://github.com/cardinal-cryptography/fork-off","last_synced_at":"2025-07-26T02:33:29.075Z","repository":{"id":216109326,"uuid":"740479864","full_name":"Cardinal-Cryptography/fork-off","owner":"Cardinal-Cryptography","description":null,"archived":false,"fork":false,"pushed_at":"2024-01-11T11:40:07.000Z","size":61,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-07-03T18:11:06.319Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Cardinal-Cryptography.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-01-08T12:37:47.000Z","updated_at":"2024-01-11T11:40:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"27fec714-a810-48ee-ad39-fcebb94c0d68","html_url":"https://github.com/Cardinal-Cryptography/fork-off","commit_stats":null,"previous_names":["cardinal-cryptography/fork-off"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Cardinal-Cryptography/fork-off","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cardinal-Cryptography%2Ffork-off","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cardinal-Cryptography%2Ffork-off/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cardinal-Cryptography%2Ffork-off/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cardinal-Cryptography%2Ffork-off/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Cardinal-Cryptography","download_url":"https://codeload.github.com/Cardinal-Cryptography/fork-off/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cardinal-Cryptography%2Ffork-off/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267107637,"owners_count":24037296,"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-07-26T02:00:08.937Z","response_time":62,"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-01-09T03:49:13.566Z","updated_at":"2025-07-26T02:33:29.022Z","avatar_url":"https://github.com/Cardinal-Cryptography.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Aleph Fork-Off tool\n\nThis has been moved from repo `aleph-node` in [PR](https://github.com/Cardinal-Cryptography/aleph-node/pull/1565).\n\nCommand-line tool for creating snapshots of a running aleph-bft chains. Given a (raw) chainspec of\nthe target chain and an url to a node of the said chain to query it will create a raw chainspec,\nwith the genesis block equal to the current state of the target chain.\n\nIn addition, there is a possibility of tweaking initial balances for specified accounts.\n\nYou can then spawn a forked-off chain using this chainspec as a starting point.\n\n## Using instructions\n\nBuild the binary (this command will use rust toolchain version specified in the `rust-toolchain`\nfile located in this repository's top-level directory):\n\n```bash\ncargo build --release\n```\n\nCreate a chainspec for the fork, it will serve as a basis with a known sudo account, known set of\nvalidators, known session keys etc:\n\n```bash\naleph-node bootstrap-chain --raw --base-path /data --chain-id a0fnet1 --account-ids \u003cid1,id2,...\u003e  --sudo-account-id \u003csudo_id\u003e \u003e chainspec.json\n```\n\nAlternatively, if you have a chainspec in a human-readable format, you can convert it into the \"raw\"\nformat using the `convert-chainspec-to-raw` command:\n\n```bash\naleph-node convert-chainspec-to-raw --chain docker/data/chainspec.json\n```\n\nThe tool will perform the following actions, in this order:\n\n1. Download the whole state (key-value pairs) of the chain via the provided rpc\n   endpoint `ws-rpc-endpoint`. More specifically it will first query the best block and then\n   download the state at this block.\n2. Dump the state to a json file. You can provide a path via `--snapshot-path`.\n3. Read the state from the snapshot json file. This is because steps 1. and 2. can be omitted by\n   running with `--use-snapshot-file` -- see example below.\n4. Read the chainspec provided via `--initial-spec-path` you should pass here the one generated\n   via `the bootstrap-chain` command, so `--initial-spec-path=chainspec.json` if it is in the same\n   directory.\n5. Replace the genesis state in the chainspec by the one from the snapshot WITH THE EXCEPTION of\n   states of paths provided via a comma separated list using `--storage_keep_state`. The default\n   setting is `--storage_keep_state=Aura,Aleph,Sudo,Staking,Session,Elections` and it's likely you\n   don't want to change it.\n6. If you have passed `--accounts_path` pointing to a file with a configuration for some accounts,\n   then it will be written into chainspec (`System.Account` map). For an example\n   see `AccountInfo-Template.json` file.\n7. Alternatively to `--accounts_path` you can just pass `--balances` flag with which you can specify\n   initial free balances for some accounts. Similarly, it will be saved to `System.Account` map.\n8. The final, new chainspec is saved to the path provided via `--combined-spec-path`.\n\nNote: `fork-off` expects address as an SS58 public key. For Alice it would\nbe `5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY`.\n\nSo for instance to generate a new spec keeping the storage of testnet (note that in that case you\nshould use the same binary as running on testnet to `bootstrap-chain`) we would run:\n\n```bash\ntarget/release/fork-off --ws-rpc-endpoint=wss://ws.test.azero.dev --initial-spec-path=chainspec.json --combined-spec-path=combined.json --balances 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY=1000000000000000\n```\n\nThis will also create a `snapshot.json` file containing the state downloaded from testnet. In case\nthe state downloaded correctly (easy to see from logs) but something went wrong when combining the\nspecs (e.g. you want to use a different set of paths) then you can rerun without the need of\ndownloading the state again (it might be time consuming):\n\n```bash\ntarget/release/fork-off --ws-rpc-endpoint=wss://ws.test.azero.dev --initial-spec-path=chainspec.json --combined-spec-path=combined.json --use-snapshot-file\n```\n\nFinally, there is also an optional parameter `--max-requests` with a default value of `1000` which\nyou can tweak to allow more/less concurrent in-flight requests while the state is downloading. Note\nthat this might influence the risk of being banned for too many RPC requests, so use with caution.\nThe default value seems to be safe.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcardinal-cryptography%2Ffork-off","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcardinal-cryptography%2Ffork-off","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcardinal-cryptography%2Ffork-off/lists"}