{"id":13407275,"url":"https://github.com/kelsos/test-environment-scripts","last_synced_at":"2025-03-14T11:31:14.087Z","repository":{"id":71663679,"uuid":"161624835","full_name":"kelsos/test-environment-scripts","owner":"kelsos","description":"A collection of scripts used to bootstrap a test raiden envirnoment. (gist is harder to update)","archived":true,"fork":false,"pushed_at":"2019-06-14T09:01:46.000Z","size":76,"stargazers_count":1,"open_issues_count":2,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-07-31T20:27:09.913Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","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/kelsos.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":"2018-12-13T10:48:31.000Z","updated_at":"2023-01-28T12:16:49.000Z","dependencies_parsed_at":"2023-05-13T17:30:46.890Z","dependency_job_id":null,"html_url":"https://github.com/kelsos/test-environment-scripts","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kelsos%2Ftest-environment-scripts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kelsos%2Ftest-environment-scripts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kelsos%2Ftest-environment-scripts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kelsos%2Ftest-environment-scripts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kelsos","download_url":"https://codeload.github.com/kelsos/test-environment-scripts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243569449,"owners_count":20312427,"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-07-30T20:00:35.149Z","updated_at":"2025-03-14T11:31:12.979Z","avatar_url":"https://github.com/kelsos.png","language":"Python","funding_links":[],"categories":["Developer Resources","⚡ Developer Resources"],"sub_categories":["🛠️ Hacks and More Tools for Devs","Tools"],"readme":"# Collection of utilities to bootstrap a small raiden network\n\n## About the environment\n\nThe environment uses [virtualenvwrapper](https://virtualenvwrapper.readthedocs.io/en/latest/) to manage the python\nvirtual environments and most of the scripts and utilities are configured around that fact.\n\nTo [install](https://virtualenvwrapper.readthedocs.io/en/latest/install.html) virtualenvwrapper you can use pip\n\n```bash\npip install virtualenvwrapper\n```\n\nor\n\n```bash\nsudo pip install virtualenvwrapper\n```\n\nAlternatively you could use you system's package manager to install it globally.\n\nOn Arch Linux you need to [install](https://wiki.archlinux.org/index.php/Python/Virtual_environment#Installation_2) the package `python-virtualenvwrapper`.\n\n```bash\npacman -S python-virtualenvwrapper\n```\n\nThe virtualenvwrapper can be installed anywhere in the system but it has to be in the `PATH` for the script to use it.\n\n## Setting up the environment\n\nFor the virtual environment you have to run:\n\n```bash\nmkvirtualenv -p python3.7 test-scripts\n```\n\n(if `mkvirtualenv` is not found, follow [how to install mkvirtualenv](./how-to-install-mkvirtualenv.md).)\n\nActivating the environment can be done by\n\n```bash\nworkon test-scripts\n```\n\nThen as soon as you are in the virtual environment you can use `pip` to install the dependencies\nfor the scripts:\n\n```bash\npip install -r requirements.txt -e .\n```\n\nFor the private chain setup to work you need to have parity installed since the setup uses a [Parity Dev Chain](https://wiki.parity.io/Private-development-chain).  `parity` command should be in the `PATH`.\n\n## Preparing setup-environment.sh\n\nYou can start by copying the example setup and getting your setup ready.\n\n```bash\ncp setup-environment.example.sh setup-environment.sh\n```\n\nIn the `setup-environment.sh` script the accounts should be `:` separated\n\n```bash\nexport RT_ENV__TESTING_ACCOUNTS='account1:account2:account3'\n```\n\nThe passphrases should be stored in individual text files with filenames 'account1', 'account2' etc with the passphrase inside.\nThe account name should be prefixed with `0x` and the account should be in checksum format.\n\n### Loading setup-environment.sh\n\nThen source the `setup-environment.sh` to load the environment.\n\n```bash\nsource setup-environment.sh\n```\n\nThis provides an alias `raiden-up` that can be used to easily start raiden nodes.\nThis also provides the `dev-chain-reset` alias that is used to reset the development chain.\n\n## Using the script\n\nThen you can call the script:\n\n```bash\n➜ raiden-up -n rinkeby -a 0 -e production -l y\n```\n\n## Available flags\n\nThe following flags are available for the script.\n\n* -n: network (can be 'rinkeby', 'ropsten' or 'kovan')\n* -a: account (the index of the account in `RT_ENV__TESTING_ACCOUNTS` 0 is the first account)\n* -e: environment (production/development)\n* -l: local transport **y** (if the option is specified the *transport01.raiden.network* is used instead)\n* -b: path to the binary. (If not specified it will used raiden from the virtual enviroment else it will use the specified binary)\n* -p: private chain setup. (This will pass information to raiden to work with the private chain) *You might need to change the addresses dependending on the deployment on the parity dev chain)\n\n## Starting a the private chain\n\nThis is a small utility that starts a parity dev chain with RPC enabled.\nIt also funds the accounts that are in the `RT_ENV__TESTING_ACCOUNTS` environment variable and then\nsends a single transfer from the default account to the first account every `--block-time` seconds\nto simulate a stable block time.\n\n```bash\n./start_private_chain.py --block-time=1\n```\n\n## Deploying the raiden smart contracts\n\n## Before installing\n\nYou can run the `solidity.sh` script to install the proper version of `solc` in your virtual environment to be able to\ncompile the `raiden-contracts`. Currently the compilation process fails with solidity `0.5.0`.\n\n## Installation\n\nIn order for the private raiden network to work you need to deploy the smart contracts on your private chain.\n\n```bash\npython -m raiden_contracts.deploy raiden --rpc-provider http://127.0.0.1:8545 --private-key /home/kelsos/.ethereum/testnet/keystore/0x82641569b2062B545431cF6D7F0A418582865ba7 --gas-price 10 --gas-limit 6000000\n```\n\n## Deploying the test contract\n\n```bash\npython -m raiden_contracts.deploy token --rpc-provider http://127.0.0.1:8545 --private-key /home/kelsos/.ethereum/testnet/keystore/0x82641569b2062B545431cF6D7F0A418582865ba7 --gas-price 10 --token-supply 10000000 --token-name TestToken --token-decimals 18 --token-symbol TTT\n```\n\n## Registering the test token\n\n```bash\npython -m raiden_contracts.deploy register --rpc-provider http://127.0.0.1:8545 --private-key /home/kelsos/.ethereum/testnet/keystore/0x82641569b2062B545431cF6D7F0A418582865ba7 --gas-price 10 --token-address 0x28104EE15e1c70c421150865C3fb731c426929E6 --registry-address 0xA4e13D328308194c0AB4E10bB1f2B2e8d624d240\n\n```\n\nCurrently `raiden-contracts` doesn't support a single command deployment of all the contracts (raiden, token) along\nwith the registration. For this reason `scripts/deploy_testnet.py` is a script that is patched together from the\n[deploy script](https://github.com/raiden-network/raiden-contracts/blob/master/raiden_contracts/deploy/__main__.py)\nthat helps you deploy everything in a single command.\n\n### Using the deployment script\n\nThe purpose of this script is to help you easily deploy a test environment,\nwith one pre-registered token.\n\n\n#### Production Environment\n\nIf you want to setup a similar environment to the raiden `Red Eyes` release then you have to \njust run the `scripts/deploy_testnet.py` script.\n\nThis will install the `0.4.0` version of the `raiden-contracts` with the security limits and a\nsingle registered token.\n\n\n```\n./scripts/deploy_testnet.py --keystore-file /home/kelsos/.ethereum/testnet/keystore/0x82641569b2062B545431cF6D7F0A418582865ba7 --password 12345678\n```\n\nThen you have to start raiden in with the `production` environment flag.\n\n#### Development Environment\n\nIf you want to have a development environment you need to add the `--development` flag when calling \nthe deployment script.\n\n\n```bash\n./scripts/deploy_testnet.py --keystore-file /home/kelsos/.ethereum/testnet/keystore/0x82641569b2062B545431cF6D7F0A418582865ba7 --password 12345678 --development\n```\n\nIn order to use this contracts raiden should be started with the `development` environment flag.\n\n## Funding the accounts\n\nThe send tokens script is responsible for funding all the accounts with tokens.\n\n\u003e Please make sure to use the same keystore that you used to deploy the smart contracts.\n\u003e This account should contain some tokens.\n\nThe script will pick up the accounts on the `RT_ENV__TESTING_ACCOUNTS` environment variable and\nsend tokens for testing to all of them.\n\n```bash\n./send_tokens.py --keystore-file ~/.ethereum/testnet/keystore/0x82641569b2062B545431cF6D7F0A418582865ba7 --password 123 --token 0x28104EE15e1c70c421150865C3fb731c426929E6\n```\n\n## Using raiden-up to start a local node\n\nThis will start a raiden node that uses the private dev chain. The production environment will\nbe the same one with the `Red Eyes` contract version.\n\n```bash\nraiden-up -n local -a 3 -e production -p true\n```\n\n## Opening channels\n\nWhile you can always use the REST API or the WebUI for opening channels, there is also the `scripts/open_channels.py`.\nThe script will take a `yml` configuration and will open channels to other nodes.\n\nPlease make sure to include even nodes that will not open any channels, since the script automatically funds\nall the open channels to all directions.\n\n```bash\n./scripts/open_channels.py --token 0x28104EE15e1c70c421150865C3fb731c426929E6 --config config/channels.yml\n```\n\n## Running the transfers\n\nThe script for running transfers will take `yml` configuration specifying the targets of the transfers\nand the the total amount to be transferred.\n\n```bash\n./scripts/transfers.py --token 0x28104EE15e1c70c421150865C3fb731c426929E6 --config config/transfers.yml\n```\n\n## Running a local synapse (matrix server)\n\n\u003e Currently using a local synapse version is not working due to a crash on raiden client.\n\nRun `tools\\install_synapse.sh` from the [raiden repo](https://github.com/raiden-network/raiden/blob/master/tools/install_synapse.sh)\n\nAfter synapse is installed then you can go to run synapse by executing `run_synapse.sh` from the directory where synapse was installed in the previous script.\n\nAdd the url of the local matrix server to your hosts file:\n\n```bash\n# Static table lookup for hostnames.\n# See hosts(5) for details.\n127.0.0.1 matrix.local.raiden\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkelsos%2Ftest-environment-scripts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkelsos%2Ftest-environment-scripts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkelsos%2Ftest-environment-scripts/lists"}