Skip to content

Instantly share code, notes, and snippets.

@riordant
Last active November 29, 2021 09:50
Show Gist options
  • Save riordant/5cf74993dfef479ce06f8a20ee6e58a5 to your computer and use it in GitHub Desktop.
Save riordant/5cf74993dfef479ce06f8a20ee6e58a5 to your computer and use it in GitHub Desktop.
Geth Gananche emulator - set up Geth like Ganache. Geth produces better debugging output for Remix and Truffle Debug.
# cd ~/.geth/
# Add following script here
# Create ~/.geth/keys, ~/geth/dev
# Add keys 0.txt,1.txt..N.txt, and passwords.txt, with each line in passwords.txt representing password for that account
# import into ~/geth/dev: geth account import --datadir ~/.geth/chain ~/.geth/dev/0.txt etc., enter same password
# full command: geth account import --datadir ~/.geth/chain ~/.geth/dev/0.txt && geth account import --datadir ~/.geth/chain ~/.geth/dev/1.txt && geth account import --datadir ~/.geth/chain ~/.geth/dev/2.txt && geth account import --datadir ~/.geth/chain ~/.geth/dev/3.txt && geth account import --datadir ~/.geth/chain ~/.geth/dev/4.txt && geth account import --datadir ~/.geth/chain ~/.geth/dev/5.txt && geth account import --datadir ~/.geth/chain ~/.geth/dev/6.txt && geth account import --datadir ~/.geth/chain ~/.geth/dev/7.txt && geth account import --datadir ~/.geth/chain ~/.geth/dev/8.txt && geth account import --datadir ~/.geth/chain ~/.geth/dev/9.txt
# by default the first account is unlocked with UINT_MAX eth. to fund the remaining accounts, in the internal console, paste this:
# for(var i = 1; i<10; i++){ eth.sendTransaction({from:eth.accounts[0], to:eth.accounts[i], value: web3.toWei(10000, "ether"), gas:100000}); }
# each line works as follows:
# remove old chain
# start geth
# datadir selection
# start RPC
# Remix Desktop 1.2.1 package
# RPC parameters
# Debug symbols
# Dev mode w/ console
# allow account unlock over RPC
# Unlock first 10 accounts
# passwords file (must be relative to current directory)
rm -rf ~/.geth/chain/geth && \
geth \
--datadir=~/.geth/chain \
--http \
--http.corsdomain="package://6fd22d6fe5549ad4c4d8fd3ca0b7816b.mod" \
--http.api web3,eth,debug,personal,net \
--vmdebug \
--dev console \
--allow-insecure-unlock \
--unlock "0,1,2,3,4,5,6,7,8,9" \
--password "keys/passwords.txt"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment