{"id":13651945,"url":"https://github.com/maxsam4/fork-off-substrate","last_synced_at":"2026-06-13T04:04:57.590Z","repository":{"id":37891697,"uuid":"280818534","full_name":"maxsam4/fork-off-substrate","owner":"maxsam4","description":"This script allows bootstrapping a new substrate chain with the current state of a live chain","archived":false,"fork":false,"pushed_at":"2024-04-18T08:19:00.000Z","size":89,"stargazers_count":111,"open_issues_count":9,"forks_count":65,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-23T02:37:21.453Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maxsam4.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}},"created_at":"2020-07-19T07:52:28.000Z","updated_at":"2025-04-10T13:04:04.000Z","dependencies_parsed_at":"2024-01-03T05:14:39.358Z","dependency_job_id":"a7efe9fd-e98c-4e96-8fbb-2cc67f65efee","html_url":"https://github.com/maxsam4/fork-off-substrate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/maxsam4/fork-off-substrate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxsam4%2Ffork-off-substrate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxsam4%2Ffork-off-substrate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxsam4%2Ffork-off-substrate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxsam4%2Ffork-off-substrate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maxsam4","download_url":"https://codeload.github.com/maxsam4/fork-off-substrate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxsam4%2Ffork-off-substrate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34271512,"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-13T02:00:06.617Z","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":"2024-08-02T02:00:53.645Z","updated_at":"2026-06-13T04:04:57.575Z","avatar_url":"https://github.com/maxsam4.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Tools"],"sub_categories":[],"readme":"# Fork off substrate\n\nThis script allows bootstrapping a new substrate chain with the current state of a live chain. Using this, you can create a fork of Polkadot, Kusama and other substrate chain for development purposes.\n\n## Usage\n\n1. Clone this repository and install dependencies\n\n    ```bash\n    git clone https://github.com/maxsam4/fork-off-substrate.git\n    cd fork-off-substrate\n    npm i\n    ```\n\n2. Create a folder called `data` inside the top folder (`fork-off-substrate`).\n\n    ```bash\n    mkdir data\n    ```\n\n3. Copy the executable/binary of your substrate based node inside the data folder and rename it to `binary`.\n\n4. Copy the runtime WASM blob of your substrate based blockchain to the data folder and rename it to `runtime.wasm`. To get the WASM blob, compile your blockchain and look for `./target/release/wbuild/runtime/runtime.compact.wasm`. If you are forking Polkadot/Kusama/Westend, you can download the WASM blobs from [Polkadot's release page](https://github.com/paritytech/polkadot/releases).\n\n5. If your substrate chain uses additional custom types than what are available in polkadot.js, define them in a JSON file of format `{ \"types\": { \u003cYOUR_TYPES\u003e } }`. Copy the file to the `data` folder and rename it to `schema.json`.\n\n6. Either run a full node for your blockchain locally(Recommended) or have an external endpoint handy.\n\n7. Run the script\n    * If using a local node, simply run the script using\n\n        ```bash\n        npm start\n        ```\n\n    * If you are using an external/non-default endpoint, you need to provide it to the script via the `HTTP_RPC_ENDPOINT` environment variable\n\n        ```bash\n        HTTP_RPC_ENDPOINT=https://example.com npm start\n        ```\n\n8. You should have the genesis file for the forked chain inside the `data` folder. It will be called `fork.json`.\n\n9. You can now run a new chain using this genesis file\n\n    ```bash\n    ./binary --chain fork.json --alice\n    ```\n\n## Configuration\n\nThe script can be tweaked and configured using various environment variables -\n\n| Environment Variable | Effects | Default value |\n| --- | --- | --- |\n| HTTP_RPC_ENDPOINT | HTTP RPC endpoint that should be used to query state | http://localhost:9933 |\n| FORK_CHUNKS_LEVEL | Determines how many chunks to split the RPC download in. Effect is exponential, recommended value for most is 1. You can try 0 for small chains and 2 for large chains for potential speed improvements | 1 |\n| ORIG_CHAIN | Chain to use as the original chain.  | `$default_of_the_binary` |\n| FORK_CHAIN | Chain to use as base for the forked chain.  | `dev` |\n| ALICE | If set, the script will replace the chain's sudo account with `//Alice` | `NULL` |\n| QUICK_MODE | If set, it parallelizes the data download from the RPC endpoint | `NULL` | \n\n## Read more\n\nIf you would like to understand how this script works, please read this [blog post](https://mudit.blog/fork-substrate-blockchain/)\n\n## Using Docker\n\n### Build the image\n\n    docker build -t fork-off-substrate .\n\n### Run\n\n    BINARY=/full/path/to/your/linux/binary\n    HTTP_RPC_ENDPOINT=http://localhost:9933\n    docker run --rm -it \\\n        -e HTTP_RPC_ENDPOINT=$HTTP_RPC_ENDPOINT \\\n        -v \"$BINARY\":/data/binary\n        fork-off-substrate\n\n## Credits\n\nThis script is based on [a script shared in the substrate riot channel](https://hackmd.io/mGgNZX0VT4S0UTaq89-_SQ)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxsam4%2Ffork-off-substrate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxsam4%2Ffork-off-substrate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxsam4%2Ffork-off-substrate/lists"}