|
1 |
| -# Getting Started with Create React App |
| 1 | +# [REStake](https://restake.app) |
2 | 2 |
|
3 |
| -This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). |
| 3 | +REStake allows delegators to grant permission for a validator to compound their rewards, and provides a script validators can run to find their granted delegators and send the compounding transactions automatically. |
4 | 4 |
|
5 |
| -## Available Scripts |
| 5 | +REStake is also a convenient staking tool, allowing you to claim and compound your rewards individually or in bulk. This can save transaction fees and time, and many more features are planned. |
6 | 6 |
|
7 |
| -In the project directory, you can run: |
| 7 | +[](https://restake.app) |
8 | 8 |
|
9 |
| -### `npm start` |
| 9 | +Try it out at [restake.app](https://restake.app). |
10 | 10 |
|
11 |
| -Runs the app in the development mode.\ |
12 |
| -Open [http://localhost:3000](http://localhost:3000) to view it in your browser. |
| 11 | +## How it works / Authz |
13 | 12 |
|
14 |
| -The page will reload when you make changes.\ |
15 |
| -You may also see any lint errors in the console. |
| 13 | +Authz is a new feature for Tendermint chains which lets you grant permission to another wallet to carry out certain transactions for you. These transactions are sent by the grantee on behalf of the granter, meaning the validator will send and pay for the TX, but actions will affect your wallet (such as claiming rewards). |
16 | 14 |
|
17 |
| -### `npm test` |
| 15 | +REStake specifically lets you grant a validator permission to send `WithdrawDelegatorReward` and `Delegate` transactions for their validator only (note `WithdrawDelegatorReward` is technically not restricted to a single validator). The validator cannot send any other transaction types, and has no other access to your wallet. You authorise this using Keplr as normal. |
18 | 16 |
|
19 |
| -Launches the test runner in the interactive watch mode.\ |
20 |
| -See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. |
| 17 | +A script is also provided which allows a validator to automatically search their delegators, check each for the required grants, and if applicable carry out the claim and delegate transactions on their behalf in a single transaction. This script should be run daily, and the time you will run it can be specified when you [add your operator](#become-an-operator). |
21 | 18 |
|
22 |
| -### `npm run build` |
| 19 | +## Limitations |
23 | 20 |
|
24 |
| -Builds the app for production to the `build` folder.\ |
25 |
| -It correctly bundles React in production mode and optimizes the build for the best performance. |
| 21 | +- As of writing, Ledger is unable to send the necessary transactions to enable Authz. This is purely due to the way transactions are sent to a Ledger device and a workaround should be possible soon. |
| 22 | +- Authz is also not fully supported yet. Many chains are yet to update. The REStake UI will fall back to being a manual staking app with useful manual compounding features. |
| 23 | +- Currently REStake needs the browser extension version of Keplr, but WalletConnect and Keplr iOS functionality will be added ASAP. |
26 | 24 |
|
27 |
| -The build is minified and the filenames include the hashes.\ |
28 |
| -Your app is ready to be deployed! |
| 25 | +## Become an operator |
29 | 26 |
|
30 |
| -See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. |
| 27 | +Becoming an operator is extremely easy. You need to do three things: |
31 | 28 |
|
32 |
| -### `npm run eject` |
| 29 | +### Setup a bot wallet |
33 | 30 |
|
34 |
| -**Note: this is a one-way operation. Once you `eject`, you can't go back!** |
| 31 | +Generate a new hot wallet you will use to automatically carry out the staking transactions. The mnemonic will need to be provided to the script so **use a dedicated wallet and only keep enough funds for transaction fees**. |
35 | 32 |
|
36 |
| -If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. |
| 33 | +You only need a single mnemonic for multiple Cosmos chains, and the script will check each network in the [networks.json](./src/networks.json) file for a matching bot address. |
37 | 34 |
|
38 |
| -Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own. |
| 35 | +### Setup the autostaking script and run daily |
39 | 36 |
|
40 |
| -You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it. |
| 37 | +You can run the autostaking script using `docker-compose` or using `npm` directly. In both cases you will need to provide your mnemonic in a `MNEMONIC` environment variable. Instructions are provided for Docker Compose and will be expanded later. |
41 | 38 |
|
42 |
| -## Learn More |
| 39 | +Clone the repository and copy the sample `.env` file ready for your mnemonic. |
43 | 40 |
|
44 |
| -You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). |
| 41 | +``` |
| 42 | +git clone https://github.com/eco-stake/restake |
| 43 | +cd restake |
| 44 | +cp .env.sample .env |
| 45 | +``` |
45 | 46 |
|
46 |
| -To learn React, check out the [React documentation](https://reactjs.org/). |
| 47 | +**Populate your new .env file with your mnemonic.** |
47 | 48 |
|
48 |
| -### Code Splitting |
| 49 | +Running the autostake script manually is then simple: |
49 | 50 |
|
50 |
| -This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) |
| 51 | +``` |
| 52 | +docker-compose run app npm run autostake |
| 53 | +``` |
51 | 54 |
|
52 |
| -### Analyzing the Bundle Size |
| 55 | +Note you might need `sudo` depending on your docker install. |
53 | 56 |
|
54 |
| -This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) |
| 57 | +You should setup your script to run at the same time each day using `crontab` |
55 | 58 |
|
56 |
| -### Making a Progressive Web App |
| 59 | +``` |
| 60 | +crontab -e |
57 | 61 |
|
58 |
| -This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) |
| 62 | +0 21 * * * /bin/bash -c "cd restake && docker-compose run app npm run autostake" > ./restake.log 2>&1 |
| 63 | +``` |
59 | 64 |
|
60 |
| -### Advanced Configuration |
| 65 | +Use `git pull` to retrieve the latest version as required. The autostaking script can and will change in the near future. |
61 | 66 |
|
62 |
| -This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) |
| 67 | +### Setup and submit your REStake operator |
63 | 68 |
|
64 |
| -### Deployment |
| 69 | +You now need to update the [networks.json](./src/networks.json) file at `./src/networks.json` to add your operator to any networks you want to auto-compound for. Check the existing file for examples, but the operators array is simple: |
65 | 70 |
|
66 |
| -This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) |
| 71 | +``` |
| 72 | +"operators": [{ |
| 73 | + "address": "osmovaloper1u5v0m74mql5nzfx2yh43s2tke4mvzghr6m2n5t", |
| 74 | + "botAddress": "osmo1yxsmtnxdt6gxnaqrg0j0nudg7et2gqczed559y", |
| 75 | + "runTime": "21:00", |
| 76 | + "minimumReward": 1000 |
| 77 | +}, |
| 78 | +``` |
67 | 79 |
|
68 |
| -### `npm run build` fails to minify |
| 80 | +`address` is your validator's address, and `botAddress` is the address from your new hot wallet you generated earlier. Repeat this for all networks you want to REStake for. |
| 81 | + |
| 82 | +Note that the `botAddress` is the address which will be granted by the delegator to carry out their restaking transactions if it wasn't clear. |
| 83 | + |
| 84 | +#### Submit your operator |
| 85 | + |
| 86 | +You can now submit your `networks.json` update to the repository in a pull request which will be merged and deployed as soon as possible. |
| 87 | + |
| 88 | +## Running the UI |
| 89 | + |
| 90 | +Run the UI using docker with one line: |
| 91 | + |
| 92 | +``` |
| 93 | +docker run -p 80:80 -t ghcr.io/eco-stake/restake |
| 94 | +``` |
| 95 | + |
| 96 | +Alternative run from source using `docker-compose up` or `npm start`. |
| 97 | + |
| 98 | +## Ethos |
| 99 | + |
| 100 | +The REStake UI is both validator and network agnostic. Any validator can be added as an operator and run this tool to provide an auto-compounding service to their delegators, but they can also run their own UI if they choose and adjust the branding to suit themselves. |
| 101 | + |
| 102 | +For this to work, we need a common source of chain information, and a common source of 'operator' information. Currently this the [networks.json](./src/networks.json) file in this repository. A helper script is included to add a chain from the [Chain Registry](https://github.com/cosmos/chain-registry), and this integration will be taken further soon. |
| 103 | + |
| 104 | +If you fork this repository to provide your own UI, please keep up to date with the upstream to ensure you have the latest [networks.json](./src/networks.json) to include all operators. Some honesty is needed until we have a more decentralised solution. |
| 105 | + |
| 106 | +## Disclaimer |
| 107 | + |
| 108 | +The initial version of REStake was built quickly to take advantage of the new authz features. I'm personally not a React or Javascript developer, and this project leans extremely heavily on the [CosmJS project](https://github.com/cosmos/cosmjs) and other fantastic codebases like [Keplr Wallet](https://github.com/chainapsis/keplr-wallet) and [Osmosis Zone frontend](https://github.com/osmosis-labs/osmosis-frontend). It functions very well and any attack surface is very limited however. Any contributions, suggestions and ideas from the community are extremely welcome. |
| 109 | + |
| 110 | +## ECO Stake 🌱 |
| 111 | + |
| 112 | +ECO Stake is a climate positive validator, but we care about the Cosmos ecosystem too. We built REStake to make it easy for all validators to run an autocompounder with Authz, and it's one of many projects we work on in the ecosystem. [Delegate with us](https://ecostake.com) to support more projects like this. |
69 | 113 |
|
70 |
| -This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) |
|
0 commit comments