You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+95-25
Original file line number
Diff line number
Diff line change
@@ -9,38 +9,68 @@ Official node for running stakers in Golang.
9
9
### Docker quick start
10
10
11
11
One of the quickest ways to get `razor-go` up and running on your machine is by using Docker:
12
+
12
13
```
13
14
docker run -d \
14
15
-it \
15
16
--name razor-go \
16
17
-v "$(echo $HOME)"/.razor:/root/.razor \
17
18
razornetwork/razor-go
18
19
```
20
+
19
21
Note that we are leveraging docker bind-mounts to mount `.razor` directory so that we have a shared mount of `.razor` directory between the host and the container. The `.razor` directory holds keys to the addresses that we use in `razor-go`, along with logs and config. We do this to persist data in the host machine, otherwise you would lose your keys once you delete the container.
20
22
21
23
You need to set a provider before you can operate razor-go cli on docker:
You can now execute razor-go cli commands by running:
28
30
29
31
```
30
32
docker exec -it razor-go <command>
31
33
```
34
+
35
+
### Setting up dev environment with docker-compose
36
+
37
+
You can build razor-go docker image by running:
38
+
39
+
```
40
+
docker-compose build
41
+
```
42
+
> **_NOTE:_** Add platform: linux/x86_64 for Silicon based MAC in docker-compose.yml.
43
+
44
+
45
+
46
+
Run razor-go locally with:
47
+
48
+
```
49
+
docker-compose up -d
50
+
```
51
+
52
+
You can intract with razor:
53
+
54
+
```
55
+
docker exec -it razor-go ...
56
+
```
57
+
32
58
### Prerequisites
33
-
* Golang 1.15 or later must be installed.
34
-
* Latest stable version of node is required.
35
-
* Silicon chip based Mac users must go for node 15.3.0+
36
-
*`geth` and `abigen` should be installed. (Skip this step if you don't want to fetch the bindings and build from scratch)
59
+
60
+
- Golang 1.15 or later must be installed.
61
+
- Latest stable version of node is required.
62
+
- Silicon chip based Mac users must go for node 15.3.0+
63
+
-`geth` and `abigen` should be installed. (Skip this step if you don't want to fetch the bindings and build from scratch)
64
+
-`solc` and `jq` must be installed.
37
65
38
66
### Building the source
67
+
39
68
1. Run `npm install` to install the node dependencies.
40
69
2. If you want to build from scratch i.e., by fetching the smart contract bindings as well, run `npm run build-all`.
41
70
42
71
_Note: To build from scratch, `geth` and `abigen` must be installed in your system._
43
-
3. If you already have the `pkg/bindings` you can run `npm run build` instead of `npm run build-all` to directly build the binary.
72
+
73
+
3. If you already have the `pkg/bindings` you can run `npm run build` instead of `npm run build-all` to directly build the binary.
44
74
4. If you want to build the binary without wanting to set the configurations use `npm run build-noargs`
45
75
5. While building the binary, supply the provider RPC url and the gas multiplier.
46
76
6. The binary will be generated at `build/bin`.
@@ -52,6 +82,7 @@ Go to the `build/bin` directory where the razor binary is generated.
52
82
`cd build/bin`
53
83
54
84
### Create Account
85
+
55
86
Create an account using the `create` command. You'll be asked to enter a password that'll be used to encrypt the keystore file.
56
87
57
88
```
@@ -62,10 +93,11 @@ Example:
62
93
63
94
```
64
95
$ ./razor create
65
-
Password:
96
+
Password:
66
97
```
67
98
68
99
### Import Account
100
+
69
101
If you already have an account created, and have it's private key, that account can be imported into the `razor-go` client.
70
102
To do that, you can use the `import` command. You'll be asked the private key first and then the password which you want to encrypt your keystore file with.
71
103
@@ -78,65 +110,77 @@ Example:
78
110
```
79
111
$ ./razor import
80
112
🔑 Private Key:
81
-
Password:
113
+
Password:
82
114
```
83
115
84
-
__Before staking on Razor Network, please ensure your account has eth and RAZOR. For testnet RAZOR, please contact us on Discord.
116
+
_Before staking on Razor Network, please ensure your account has eth and RAZOR. For testnet RAZOR, please contact us on Discord._
85
117
86
118
### Stake
87
119
88
120
If you have a minimum of 1000 razors in your account, you can stake those using the stake command.
$ ./razor transfer --value <value> --to <transfer_to_address> --from <transfer_from_address>
193
244
```
194
245
195
246
Example:
247
+
196
248
```
197
249
$ ./razor transfer --value 100 --to 0x91b1E6488307450f4c0442a1c35Bc314A505293e --from 0x5a0b54d5dc17e0aadc383d2db43b0a0d3e029c4c
198
250
```
199
251
200
252
### Set Config
253
+
201
254
There are a set of parameters that are configurable. These include:
202
255
203
-
* Provider: The RPC URL of the provider you are using to connect to the blockchain.
204
-
* Gas Multiplier: The value with which the gas price will be multiplied while sending every transaction.
205
-
* Buffer Size: Buffer size determines, out of all blocks in a state, in how many blocks the voting or any other operation can be performed.
206
-
* Wait Time: This is the number of blocks the system will wait while voting.
207
-
* Gas Price: The value of gas price if you want to set manually. If you don't provide any value or simply keep it to 0, the razor client will automatically calculate the optimum gas price and send it.
208
-
* Log Level: Normally debug logs are not logged into the log file. But if you want you can set `logLevel` to `debug` and fetch the debug logs.
209
-
* Gas Limit: The value with which the gas limit will be multiplied while sending every transaction.
256
+
- Provider: The RPC URL of the provider you are using to connect to the blockchain.
257
+
- Gas Multiplier: The value with which the gas price will be multiplied while sending every transaction.
258
+
- Buffer Size: Buffer size determines, out of all blocks in a state, in how many blocks the voting or any other operation can be performed.
259
+
- Wait Time: This is the number of blocks the system will wait while voting.
260
+
- Gas Price: The value of gas price if you want to set manually. If you don't provide any value or simply keep it to 0, the razor client will automatically calculate the optimum gas price and send it.
261
+
- Log Level: Normally debug logs are not logged into the log file. But if you want you can set `logLevel` to `debug` and fetch the debug logs.
262
+
- Gas Limit: The value with which the gas limit will be multiplied while sending every transaction.
210
263
211
264
The config is set while the build is generated, but if you need to change any of the above parameter, you can use the `setConfig` command.
Other than setting these parameters in the config, you can use different values of these parameters in different command. Just add the same flag to any command you want to use and the new config changes will appear for that command.
$ ./razor updateJob -a 0x5a0b54d5dc17e0aadc383d2db43b0a0d3e029c4c --jobId 1 -s last -u https://api.gemini.com/v1/pubticker/btcusd --power 2 --weight 10
369
+
$ ./razor updateJob -a 0x5a0b54d5dc17e0aadc383d2db43b0a0d3e029c4c --jobId 1 -s last -u https://api.gemini.com/v1/pubticker/btcusd --power 2 --weight 10
302
370
```
303
-
Note : *All the commands have an additional --password flag that you can provide with the file path from which password must be picked.*
304
371
305
-
### Contribute to razor-go
372
+
Note : _All the commands have an additional --password flag that you can provide with the file path from which password must be picked._
373
+
374
+
### Contribute to razor-go
375
+
306
376
We would really appreciate your contribution. To see our [contribution guideline](https://github.com/razor-network/razor-go/blob/main/.github/CONTRIBUTING.md)
0 commit comments