Skip to content

Instantly share code, notes, and snippets.

@samsondav
Last active May 20, 2020 07:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save samsondav/fa9d6e9070250479e310f591fc8a0c0f to your computer and use it in GitHub Desktop.
Save samsondav/fa9d6e9070250479e310f591fc8a0c0f to your computer and use it in GitHub Desktop.
0. (Optional but recommended) Make a dump/backup of your DB
1. STOP your node
2. Set env vars: ETH_GAS_BUMP_WEI=10000000000 and ETH_GAS_BUMP_THRESHOLD=1 and ETH_GAS_PRICE_DEFAULT=200000000000 on the node
3. Make sure your gas updater is updated to latest master from github and running with MAX_GAS_PRICE set high (suggest 500000000000 or more). Note that units are in GWei.
4. Get the keystore file from the node (found in the .env/tempkeys directory on the server). To extract the private key inside the container:
$ yum install python3
$ pip3 install eth-keyfile
$ python3 -c "import eth_keyfile; password = input('enter your password: '); print(eth_keyfile.extract_key_from_keyfile('.env/tempkeys/0xYOUR_KEY_FILE.json', password).hex())"
5. Get your highest pending nonce by:
```
curl -X POST --data ‘{“jsonrpc”:“2.0",“method”:“eth_getTransactionCount”,“params”:[“YOUR_NODE_PUBLIC_ADDRESS”,“pending”],“id”:1}’ -H “Content-Type: application/json” https://mainnet.infura.io/v3/865ab3c804cb47caa962010c897b40c5 | jq ‘.result’
```
6. Run the script here: https://github.com/peppersec/bump_nonce/blob/master/submit.js substituting the correct environment variables
- PRIVATE_KEY (MUST be the private key from the node)
- GAS_PRICE (suggest 200+)
- RPC_URL
- BUMP_NONCE_TO (from the command you ran in number 5)
(there is an alternative version in Python you can use - here: https://gist.github.com/samsondav/3e5fe8c48e954c1de6cbe4faa385b642)
7. (OPTIONAL: only do this if you are still getting stuck after multiple restarts. HIGHLY recommend taking a backup beforehand)
Clear your DB with:
```
TRUNCATE job_runs, task_runs;
TRUNCATE run_requests;
TRUNCATE run_results;
TRUNCATE tx_attempts;
```
8. Start your node again
@rstormsf
Copy link

BUMP_NONCE_TO - is actually what the future nonce value you want ( highest nonce)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment