Skip to content

Commit edba7a0

Browse files
committed
Initial README and necessary fixes
1 parent 51bbced commit edba7a0

6 files changed

+85
-40
lines changed

.env.sample

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
MNEMONIC=some seed words here
1+
MNEMONIC=my hot wallet seed words here that has minimal funds

README.md

+81-38
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,113 @@
1-
# Getting Started with Create React App
1+
# [REStake](https://restake.app)
22

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.
44

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.
66

7-
In the project directory, you can run:
7+
[![](./docs/screenshot.png)](https://restake.app)
88

9-
### `npm start`
9+
Try it out at [restake.app](https://restake.app).
1010

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
1312

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).
1614

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.
1816

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).
2118

22-
### `npm run build`
19+
## Limitations
2320

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.
2624

27-
The build is minified and the filenames include the hashes.\
28-
Your app is ready to be deployed!
25+
## Become an operator
2926

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:
3128

32-
### `npm run eject`
29+
### Setup a bot wallet
3330

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**.
3532

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.
3734

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
3936

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.
4138

42-
## Learn More
39+
Clone the repository and copy the sample `.env` file ready for your mnemonic.
4340

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+
```
4546

46-
To learn React, check out the [React documentation](https://reactjs.org/).
47+
**Populate your new .env file with your mnemonic.**
4748

48-
### Code Splitting
49+
Running the autostake script manually is then simple:
4950

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+
```
5154

52-
### Analyzing the Bundle Size
55+
Note you might need `sudo` depending on your docker install.
5356

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`
5558

56-
### Making a Progressive Web App
59+
```
60+
crontab -e
5761
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+
```
5964

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.
6166

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
6368

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:
6570

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+
```
6779

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.
69113

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)

docker-compose.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "3.7"
1+
version: "3.3"
22

33
services:
44
app:

docs/screenshot.png

460 KB
Loading

package-lock.json

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6+
"@cosmjs/proto-signing": "^0.27.1",
67
"@cosmjs/stargate": "^0.27.1",
78
"@testing-library/jest-dom": "^5.16.2",
89
"@testing-library/react": "^12.1.3",

0 commit comments

Comments
 (0)