{"id":13815828,"url":"https://github.com/disco-project/smart-sync","last_synced_at":"2025-05-15T09:34:05.783Z","repository":{"id":44432497,"uuid":"310559290","full_name":"disco-project/smart-sync","owner":"disco-project","description":"Smart Sync enables the creation of smart contract forks and verifiable synchronization across EVM-compatible blockchain networks.","archived":false,"fork":false,"pushed_at":"2023-01-06T17:21:14.000Z","size":3286,"stargazers_count":13,"open_issues_count":2,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-19T16:25:49.316Z","etag":null,"topics":["blockchain","blockchain-interoperability"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/disco-project.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}},"created_at":"2020-11-06T10:03:47.000Z","updated_at":"2025-03-10T11:58:15.000Z","dependencies_parsed_at":"2023-02-06T07:00:20.611Z","dependency_job_id":null,"html_url":"https://github.com/disco-project/smart-sync","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/disco-project%2Fsmart-sync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/disco-project%2Fsmart-sync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/disco-project%2Fsmart-sync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/disco-project%2Fsmart-sync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/disco-project","download_url":"https://codeload.github.com/disco-project/smart-sync/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254314202,"owners_count":22050190,"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":["blockchain","blockchain-interoperability"],"created_at":"2024-08-04T04:04:10.424Z","updated_at":"2025-05-15T09:34:05.756Z","avatar_url":"https://github.com/disco-project.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# Getting started\n\n## Installation CLI\n\nTo globally install the latest package of smart-sync cli, run:\n\n```\n$ npm i smart-sync -g\n```\n\nTo compile the project yourself and install it, see section [Getting started (Dev)](#getting-started-dev)\n\nUnder `{INSTALL_DIR}/config` you can find the default configuration for the cli. Adjust the fields according to your needs or pass them as options in the command line.\n\nTo execute tests, please refer to the [test](#tests) section.\n\n## Usage \n\n### Smart Contract Fork\n\n```bash \n$ smart-sync help fork\nUsage: smart-sync fork|f [options] \u003csrc_contract_address\u003e [relay_contract_address]\n\nMigrates a given contract address to a target chain and deploys a proxy contract. If no relay contract is provided, a relay contract will be deployed too.\n\nOptions:\n  -l, --log-level \u003clevel\u003e           verbose level of logging (choices: \"fatal\", \"error\", \"warn\", \"info\", \"debug\",\n                                    \"trace\", \"silly\", default: \"debug\")\n  -s, --src-chain-rpc-host \u003curl\u003e    url of src chain rpc\n  -t, --target-chain-rpc-url \u003curl\u003e  url of target chain rpc\n  -c, --config-file \u003cpath\u003e          path to the config file (default: \"./config/cli-config.json\")\n  --connection-timeout \u003ctimeout\u003e    connection timeout in ms\n  --src-blocknr \u003cnumber\u003e            block number of src chain to use\n  --diff-mode \u003cmode\u003e                Diff function to use (choices: \"storage\", \"srcTx\")\n  --gas-limit \u003climit\u003e               gas limit for tx on target chain\n  -h, --help                        display help for command\n```\nExample usage:\n```bash\n$ smart-sync fork 0x010A3d554c8d772aAC357e079B4D57B6dA28a43a\n```\n\n### Synchronizing a Smart Contract\n\n```bash\n$ smart-sync help synchronize\nUsage: smart-sync synchronize|s [options] \u003cproxy_contract_address\u003e\n\nSynchronizes the storage of a proxy contract with its source contracts storage up to an optionally provided block nr on the source chain.\n\nOptions:\n  -l, --log-level \u003clevel\u003e           verbose level of logging (choices: \"fatal\", \"error\", \"warn\", \"info\", \"debug\", \"trace\", \"silly\", default: \"debug\")\n  -s, --src-chain-rpc-host \u003curl\u003e    url of src chain rpc\n  -t, --target-chain-rpc-url \u003curl\u003e  url of target chain rpc\n  -c, --config-file \u003cpath\u003e          path to the config file (default: \"./config/cli-config.json\")\n  --connection-timeout \u003ctimeout\u003e    connection timeout in ms\n  --src-blocknr \u003cnumber\u003e            block number of src chain to use\n  --diff-mode \u003cmode\u003e                Diff function to use. When using storage, option --src-BlockNr equals block on srcChain and --target-BlockNr block on targetChain. When using srcTx\n                                    --src-BlockNr describes block from where to replay tx until --target-blockNr. (choices: \"storage\", \"srcTx\")\n  --target-blocknr \u003cnumber\u003e         see --diff-mode for further explanation\n  --gas-limit \u003climit\u003e               gas limit for tx on target chain\n  -h, --help                        display help for command\n```\n\nExample usage:\n```bash\n$ smart-sync s 0x010A3d554c8d772aAC357e079B4D57B6dA28a43a --target-blockNr 450\n```\n\n### Continuously synchronizing Smart Contracts\n```bash\n$ smart-sync continuous-synch --help\nUsage: smart-sync continuous-synch|c [options] \u003cproxy_contract_address\u003e \u003cperiod\u003e\n\nPeriodically synch state updates.\n\nArguments:\n  proxy_contract_address\n  period                            Define the updating period. Be sure to pass the period within \" (Example: \"*/2 * * * *\"). The crontab syntax is based on the GNU crontab syntax. For information visit https://www.npmjs.com/package/node-cron.\n\nOptions:\n  -l, --log-level \u003clevel\u003e           verbose level of logging (choices: \"fatal\", \"error\", \"warn\", \"info\", \"debug\", \"trace\", \"silly\", default: \"info\")\n  -s, --src-chain-rpc-host \u003curl\u003e    url of src chain rpc\n  -t, --target-chain-rpc-url \u003curl\u003e  url of target chain rpc\n  -c, --config-file \u003cpath\u003e          path to the config file (default: \"./config/cli-config.json\")\n  --connection-timeout \u003ctimeout\u003e    connection timeout in ms\n  --src-blocknr \u003cnumber\u003e            block number of src chain to use\n  --gas-limit \u003climit\u003e\n  --diff-mode \u003cmode\u003e                Diff function to use. When using storage, option --src-BlockNr equals block on srcChain and --target-BlockNr block on targetChain. When using srcTx --src-BlockNr describes block from where to replay tx until --target-blockNr. (choices: \"storage\",\n                                    \"srcTx\")\n  --target-blocknr \u003cnumber\u003e         see --diff-mode for further explanation\n  -h, --help                        display help for command\n```\n\nExample usage:\n```bash\n$ smart-sync c 0x010A3d554c8d772aAC357e079B4D57B6dA28a43a \"*/2 * * * *\"\n```\n\n### Retrieve migration status\n```bash\n$ smart-sync help migration-status\nUsage: smart-sync migration-status|status [options] \u003cproxy_contract_address\u003e\n\nChecks if the storage root of the proxy contract equals the current storage root of the source contract in the relay contract on the target chain.\n\nOptions:\n  -l, --log-level \u003clevel\u003e           verbose level of logging (choices: \"fatal\", \"error\", \"warn\", \"info\", \"debug\", \"trace\", \"silly\", default: \"debug\")\n  -s, --src-chain-rpc-host \u003curl\u003e    url of src chain rpc\n  -t, --target-chain-rpc-url \u003curl\u003e  url of target chain rpc\n  -c, --config-file \u003cpath\u003e          path to the config file (default: \"./config/cli-config.json\")\n  --connection-timeout \u003ctimeout\u003e    connection timeout in ms\n  --src-blocknr \u003cnumber\u003e            block number of src chain to use\n  -h, --help                        display help for command\n```\nExample usage:\n``` bash\n$ smart-sync status 0x010A3d554c8d772aAC357e079B4D57B6dA28a43a\n```\n### Get currrent block number\n```bash\n$ smart-sync help get-curr-blocknr\nUsage: smart-sync get-curr-blocknr|blocknr [options] \u003cproxy_contract_address\u003e\n\nGet the synched block number of src chain for the provided proxy contract.\n\nOptions:\n  -l, --log-level \u003clevel\u003e           verbose level of logging (choices: \"fatal\", \"error\", \"warn\", \"info\", \"debug\", \"trace\", \"silly\", default: \"debug\")\n  -s, --src-chain-rpc-host \u003curl\u003e    url of src chain rpc\n  -t, --target-chain-rpc-url \u003curl\u003e  url of target chain rpc\n  -c, --config-file \u003cpath\u003e          path to the config file (default: \"./config/cli-config.json\")\n  --connection-timeout \u003ctimeout\u003e    connection timeout in ms\n  --src-blocknr \u003cnumber\u003e            block number of src chain to use\n  -h, --help                        display help for command\n```\nExample usage:\n```bash\n$ smart-sync blocknr 0x20a508640B446990c781Cd541B9a2828ACA3a350\n```\n\n### Retrieve state diff\n```bash\n$ smart-sync help state-diff\nUsage: smart-sync state-diff|diff [options] \u003csource_contract_address\u003e [proxy_contract_address]\n\nShows the state diff between source contract and proxy contract on target chain. If diff-mode == storage, proxy_contract_address has to be provided.\n\nOptions:\n  -l, --log-level \u003clevel\u003e           verbose level of logging (choices: \"fatal\", \"error\", \"warn\", \"info\", \"debug\", \"trace\", \"silly\", default: \"debug\")\n  -s, --src-chain-rpc-host \u003curl\u003e    url of src chain rpc\n  -t, --target-chain-rpc-url \u003curl\u003e  url of target chain rpc\n  -c, --config-file \u003cpath\u003e          path to the config file (default: \"./config/cli-config.json\")\n  --connection-timeout \u003ctimeout\u003e    connection timeout in ms\n  --src-blocknr \u003cnumber\u003e            block number of src chain to use\n  --diff-mode \u003cmode\u003e                Diff function to use. When using storage, option --src-BlockNr equals block on srcChain and --target-BlockNr block on targetChain. When using srcTx\n                                    --src-BlockNr describes block from where to replay tx until --target-blockNr. If no blocks are given when using srcTx, then only the latest block\n                                    is examined. (choices: \"storage\", \"srcTx\")\n  --target-blocknr \u003cnumber\u003e         see --diff-mode for further explanation\n  -h, --help                        display help for command\n```\nExample usage:\n```bash\n$ smart-sync diff 0x20a508640B446990c781Cd541B9a2828ACA3a350 0xf8f22ab160e8a09fbf404a44139d9b5da936e3cb --diff-mode storage --src-blocknr 450\n```\n\n# Getting started (Dev)\n\nThis project uses [hardhat](https://hardhat.org/getting-started/) and [ethers](https://docs.ethers.io/v5/) among other things.\n\n### Install dev packages\n\n```bash\n$ npm i --development\n```\n\n### Compile project\nTo execute the compile-pipeline of this project run:\n\n```bash\n$ npx grunt compile-project\n```\n\nThis cleans the dist folder, compiles the contracts, lints the src files and executes tsc. If you want to execute those steps individually see `npx grunt --help` for all available individual commands:\n\nAvailable tasks:\nCommand | Description\n------------ | -------------\neslint | Validate files with ESLint *                        \nmochaTest | Run node unit tests with Mocha *                    \nclean | Clean files and folders. *                          \ndefault | Alias for \"eslint\" task.                            \nstart-chains | Startup chain                                       \nstop-chains | Stopping chain                                      \ncompile-project | Generate js-files                                   \ncompile-contracts | Generate contract type info                         \ntsc | Compile ts files                                    \ninstall | Install smart-sync locally                     \ninstall-global | Install smart-sync globally                    \npack | npm pack smart-sync                            \nnpm-pack | npm packaging command                               \nfull-pipeline-test | Testing precompiled *.ts project                    \nfull-pipeline-dist-test | Testing compiled *.js project inside dist folder    \nfull-pipeline-evaluation | Evaluating project                                  \nevaluate | Run evaluation                                      \ntest | Run tests\n\n### Install CLI\nTo compile and install the CLI run:\n```bash\n$ npx grunt install\n```\n## Chain\nGenerally, you don't need to start the chain individually since its already started if you execute the command:\n``` bash\n$ npm run test\n```\nSee [readme](chain/README.md) on how to start the test chains.\n\n## Linter\nWe use the code style from [airbnb](https://www.npmjs.com/package/eslint-config-airbnb-base).\nTo execute the linter just type:\n\n```bash\n$ npx grunt eslint\n```\n\n## Tests\nTo run all the tests run (requires a running ethereum node, see [hardhat.config.ts](./hardhat.config.ts) and [hardhat.org/config](https://hardhat.org/config/)):\n\n```bash\n$ npm run test\n```\n\n### Adjusting ports of the test chains\nIf you want to adjust the ports of the test chains, you just have to change them in the test-config file located at `test/config/test-cli-config.json`. Our scripts will then adjust the ports for the docker containers automatically when you run the command from above. \n\nAlternatively, you can adjust them over the optional parameter `test-chain-port` inside our Grunt task. With `test-config-path` you can even change the test config file path if you changed the location:\n\n```bash\n$ npx grunt full-pipeline-test --test-chain-port=9545 --test-config-path=./test/config/test-cli-config.json\n```\n\nIf you just want to adjust the ports without triggering the tests, execute the following:\n\n```bash\n$ npx grunt update-ports --test-chain-port=9545\n```\n\n### Running single tests\nYou can also run single tests (chains need to be started manually):\n\n```bash\n$ npx hardhat test test/list-storage-test.ts\n```\n\n## Evaluation\nTo run the evaluation run:\n\n```bash\n$ npm run evaluate\n```\n\nOr a specific evaluation (chain needs to be started manually):\n\n```bash\n$ npx hardhat test evaluation/update-multiple-values-with-map-sizes-1-1000.ts\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdisco-project%2Fsmart-sync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdisco-project%2Fsmart-sync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdisco-project%2Fsmart-sync/lists"}