Once initial tests are running, its time to run a test using a browser against a local chain, running on ganache.

But when trying to run from a browser with your local ganahce, you often see an error message: signature mismatch

Metamask has a bug that confuses network-id and chain-id when handling the rpc call signTypedData(). Metamask can only work properly on networks with these are the same (which means it can't work with ganache or Ethereum Classic, or several other networks that passed a network fork)

Thankfully, Ganache just released (28-Sep-2020) a new version (v6.11.0) that fixes their bug. so now you can bring up ganache in a way that is compatible with Metamask.

Start ganache with this command line (good for Linux and Mac)

net=date "+%j%H%M%S" ganache-cli --networkId $net --chainId $net

This will keep the normal ganache property of new networkId on each restart, but also make sure the chainId is the same as networkId.

Alternately, you can start geth (but I didn't find a way to change its chainId which is fixed as 1337, only networkId)

e.g. use the following docker command:

docker run -ti --rm --name geth -p 8545:8545 ethereum/client-go:release-1.9 \\ --nousb --miner.gastarget 10000000 \\ --http --http.vhosts '*,localhost,host.docker.internal' \\ --http.corsdomain '*' --http.addr "0.0.0.0" \\ --dev --nodiscover --maxpeers 0 --mine --miner.threads 1 --verbosity 3 \\ --networkid 1337

This way, you can open a browser (or command-line tests) and use Metamask to connect to GSN.

Limitations: