tokenspice / tokenspice

EVM agent-based token simulator 🐟🌪️

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't get ganache going

trentmc opened this issue · comments

I can't get Ganache going (1) automatically, or (2) running separately. Details:


  1. Ganache is supposed to auto-start from Brownie, if it isn't run before. The README expects it. Going through the README, I get to the following line:
pytest sol057/contracts/simpletoken/test/test_Simpletoken.py::test_transfer

And it returns

==================================================================== test session starts ====================================================================
platform linux -- Python 3.8.10, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /home/trentmc/code/tokenspice, configfile: pytest.ini
plugins: xdist-1.34.0, hypothesis-6.27.3, eth-brownie-1.18.2, web3-5.29.0, forked-1.4.0
collected 0 items / 1 error                                                                                                                                 

========================================================================== ERRORS ===========================================================================
__________________________________________ ERROR collecting sol057/contracts/simpletoken/test/test_Simpletoken.py ___________________________________________
sol057/contracts/simpletoken/test/test_Simpletoken.py:2: in <module>
    from util.constants import BROWNIE_PROJECT057
util/constants.py:24: in <module>
    brownie.network.connect("development")
venv/lib/python3.8/site-packages/brownie/network/main.py:50: in connect
    rpc.launch(active["cmd"], **active["cmd_settings"])
venv/lib/python3.8/site-packages/brownie/network/rpc/__init__.py:93: in launch
    raise RPCProcessError(cmd, uri)
E   brownie.exceptions.RPCProcessError: Unable to launch local RPC client.
E   Command: ganache-cli
E   URI: http://127.0.0.1:8545
---------------------------------------------------------------------- Captured stdout ----------------------------------------------------------------------

Launching 'ganache-cli --accounts 10 --hardfork istanbul --gasLimit 6721975 --mnemonic brownie --port 8545'...
================================================================== short test summary info ==================================================================
ERROR sol057/contracts/simpletoken/test/test_Simpletoken.py - brownie.exceptions.RPCProcessError: Unable to launch local RPC client.
===================================================================== 1 error in 4.03s ======================================================================
ERROR: not found: /home/trentmc/code/tokenspice/sol057/contracts/simpletoken/test/test_Simpletoken.py::test_transfer
(no name '/home/trentmc/code/tokenspice/sol057/contracts/simpletoken/test/test_Simpletoken.py::test_transfer' in any of [<Module test_Simpletoken.py>])

  1. I can't get Ganache by running it as its own process. Here's what happens
(venv) trentmc@trentmcLnv:~/code/tokenspice$ tsp ganache
Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:67:19)
    at Object.createHash (node:crypto:133:10)
    at p (/usr/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:55:527949)
    at b.set (/usr/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:55:528548)
    at Function.b.fromMasterSeed (/usr/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:55:530917)
    at Function.i.fromMasterSeed (/usr/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:55:526525)
    at new S (/usr/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:55:206543)
    at new p (/usr/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:55:195647)
    at new l (/usr/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:42:13485)
    at Object.create (/usr/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:94:92509)
    at Object.server (/usr/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:55:38637)
    at Object.<anonymous> (/usr/lib/node_modules/ganache-cli/cli.js:106:22)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:827:12)

Even ganache directly dies.

(venv) trentmc@trentmcLnv:~/code/tokenspice$ ganache-cli 
Error: error:0308010C:digital envelope routines::unsupported
...

I googled "Error: error:0308010C:digital envelope routines::unsupported"

It turns out that it's a node.js error. Details here

The solution is to downgrade from node.js v17 to v16, using node version manager (nvm):

nvm install 16.13.0

With this, I am now able to run ganache-cli and run tsp ganache (approach 2). However I still have the same error for auto-run (approach 1).

Digging around, I found that I have to also do:

nvm use 16.13.0

Now, it works too!

Final note: this issue was also discovered by eth-brownie community. Details.

Update: even better: use nvm 16.13.2, not 16.13.0.

I am also facing the same issue and it is not working even after using 16.13.0 or 16.13.2

I am on a new setup running ubuntu 22.04. I was able to go through the TokenSPICE README out of the box.

Some notes:

  • when I installed ganache (via sudo npm install ganache-cli --global) it warned me that ganache-cli is now just ganache. However that didn't seem to pose issues. The warning itself: "npm WARN deprecated ganache-cli@6.12.2: ganache-cli is now ganache; visit https://trfl.io/g7 for details"
  • I didn't bother trying to install a different version of nvm. In fact I don't even have nvm on my new setup right now, and there aren't issues.

I am also facing the same issue and it is not working even after using 16.13.0 or 16.13.2

Do you have more detailed error messages?