diff --git a/args.js b/args.js index a0f479f..eeb4930 100644 --- a/args.js +++ b/args.js @@ -146,6 +146,13 @@ module.exports = exports = function(yargs, version, isDocker) { defaultDescription: "System time at process start or Network ID of forked blockchain if configured.", demandOption: false }) + .option('chainId', { + group: 'Chain:', + type: 'number', + describe: "The Chain ID ganache-cli will use for `eth_chainId` RPC and the `CHAINID` opcode.", + defaultDescription: "For legacy reasons, the default is currently `1337` for `eth_chainId` RPC and `1` for the `CHAINID` opcode. This will be fixed in the next major version of ganache-cli and ganache-core!", + demandOption: false + }) .option('g', { group: 'Chain:', alias: 'gasPrice', diff --git a/cli.js b/cli.js index 8b1f878..4118734 100755 --- a/cli.js +++ b/cli.js @@ -97,7 +97,10 @@ var options = { logger: logger, allowUnlimitedContractSize: argv.allowUnlimitedContractSize, time: argv.t, - keepAliveTimeout: argv.keepAliveTimeout + keepAliveTimeout: argv.keepAliveTimeout, + _chainId: argv.chainId, + // gross! + _chainIdRpc: argv.chainId } var server = ganache.server(options);