v7.0.0-beta.0
Pre-release
Highlights
New Features
Breaking Changes
Fixes
Known Issues
Future Plans
This release is the first beta release of the new and improved Ganache v7.0.0. You'll definitely want to catch up on the previous changes, if you haven't already, before reading on!
Thanks to everyone who tried out our previous alpha releases and provided feedback! You have been immensely helpful!
And thanks again to contributors, mentors, and reviewers: @MicaiahReid, @gnidan, @cds-amal, and @haltman-at. And special thanks to our community members for reporting and commenting on issues fixed by this release: @domob1812, @NicsTr, @convexman, and @rainwater11!
Note: this is a beta release; even these 7.0.0 release notes are "beta" and the information here is likely incomplete. There may still be bugs and kinks to work out before we ship things off to rc
, then finally to latest
. You absolutely should use this beta release, please do try it out and let us know if breaks for you!
To install globally run:
npm uninstall ganache-cli --global
npm install ganache@beta --global
We've changed 70 files across 12 merged pull requests, tallying 2,616 additions and 65,747 deletions, since our last release. The high number of deletions is due to reverting our lock files back to v1, as we aren't yet confident in npm 7+'s stability.
This release fixes many bugs and adds some new features, but there is one that we are really excited about:
Free integrated archive data for Mainnet, Ropsten, Kovan, Rinkeby, and Görli!
You can now run your own fork of Ethereum's Mainnet with a simple command:
which will automatically connect to a Mainnet Node with full Archive Data, for free! 🤯
Full announcement is below.
Other than the big Infura + Ganache integration feature mentioned above, we've also added a couple of smaller features that we hope will improve the development experience.
- Integrate Infura into Ganache forking
- Add a
wallet.passphrase
Option - Add
evm_addAccount
/evm_removeAccount
RPC Methods - Add support for the "arrowGlacier" hardfork
Integrate Infura into Ganache forking (#1513)
This is a big deal! You now have free access to Infura²'s archive data for Ethereum's Mainnet, Ropsten, Kovan, Rinkeby, and Görli networks built right into Ganache itself!
The command ganache --fork
will fork Ethereum's Mainnet at the latest block number with access to full archive data.
We currently don't impose restrictions outside of the default limits provided by Infura, but will monitor usage closely in order to limit abuse so we can continue to provide this resource to you for free.
You can also fork from Ropsten, Kovan, Rinkeby, and Görli:
$ ganache --fork ropsten
$ ganache --fork kovan
$ ganache --fork rinkeby
$ ganache --fork görli
$ ganache --fork goerli
If you prefer using Ganache's option namespaces you can use:
$ ganache --fork.network mainnet
$ ganache --fork.network ropsten
$ ganache --fork.network kovan
$ ganache --fork.network rinkeby
$ ganache --fork.network görli
$ ganache --fork.network goerli
You can also use this feature programmatically:
import Ganache from "ganache";
const server = Ganache.server({
fork: {
network: "mainnet"
}
});
server.listen(8545, () => {
const liveOptions = provider.getOptions();
console.log("forked network: " + liveOptions.fork.network);
console.log("forked at block: " + liveOptions.fork.blockNumber.toString());
console.log("listening on 8545");
});
This feature is made possible by our close relationship with Infura.
Please let us know if you have problems, questions, or suggestions!
Add a wallet.passphrase
Option (#1513)
This feature allows you to specify a passphrase that will be used for personal namespace commands (personal_unlockAccount
, personal_sendTransaction
, etc.) on all startup accounts. Before this feature, ""
was the default (and only) password for startup accounts.
NOTE: Specifying the wallet.passphrase
parameter does not lock accounts by default. The wallet.lock
(previously wallet.secure
) parameter can be used to lock accounts by default. If wallet.passphrase
parameter is used without wallet.lock
, the passphrase will still be used when personal_lockAccount
is used.
Add evm_addAccount
/evm_removeAccount
RPC Methods (#1513)
The evm_addAccount
method can be used to add any address to the personal
namespace. Ganache will create a fake private key which will then used for all personal namespace commands sent using that added address. Here's an example of how to use this:
const address = "0x0000000000000000000000000000000000000000"; // let's send transactions from the zero address!
const transaction = {from: address};
const passphrase = "this is my passphrase";
// this will fail because we don't "know" the zero address
await assert.rejects(provider.send("personal_sendTransaction", [{ from: address }, passphrase] ));
const added = await provider.send("evm_addAccount", [address, passphrase] );
assert.equal(added, true) // but now we do!
// so now we can send transactions from the zero address!
const txHash = await provider.send("personal_sendTransaction", [{ from: address }, passphrase] ))
The evm_removeAccount
method can be used to do just the opposite — it will remove an account from the personal
namespace.
Add support for the "arrowGlacier" hardfork (#1524)
We updated ethereumjs-vm, and related packages, add added support for the "arrowGlacier" hardfork which is set to activate at block number 13,773,000 which is predicted to occur on December 8, 2021.
This hardfork introduces a single change: it pushes the difficulty bomb back several months. This doesn't affect Ganache, other than accepting the hardfork name in our options.
We've replaced some previous alpha features and errors (#1513)
In the ganache@v7.0.0-alpha.0
release, we introduced the evm_unlockUnknownAccount
and evm_lockUnknownAccount
RPC methods, and we since realized that these could be made simpler to use with a few tweaks. So, the breaking part of this change is that these methods have been removed. The good news is that they've been replaced with evm_addAccount
and evm_removeAccount
, which is explained in more detail in the features section of these notes.
We've also updated some error messaging to encourage the use of passphrases over passwords. So, the original error signer account is locked
error changed to authentication needed: password or unlock
in ganache@v7.0.0-alpha.0
and has (hopefully!) finally settled on authentication needed: passphrase or unlock
in the beta. We doubt this will actually break anything for our users, but we thought we'd mention it just in case.
We've got a handful of fixes in the release, some big (like making forking "chainId-aware"), some small. Thanks again to users who opened issued or provided feedback on these issues!
- Fix account locking/unlocking
- Make web3_sha encode data correctly
- Make the quiet flag actually work
- Make forking chainId aware
- Fix Blake2-256 calculation
- Remove bigint's n from cli output
- Return error for eth_call when call errors
Fix account locking/unlocking (#1513)
Starting up Ganache creates a set of accounts and saves their private/public keys to an encrypted¹ keyfile, or so we thought. It turns out that there were some cases where the keyfile wasn't properly initialized. So, when an account was locked via personal_lockAccount
, it was removed from our whitelist of "unlocked" accounts, never to be found again. When an attempt to unlock the account via personal_unlockAccount
would then be made, the private key for the account wouldn't be found and the unlock would fail.
Now, we properly store accounts in the keyfile, so all accounts in the personal namespace can be locked and unlocked.
Make web3_sha encode data correctly (#1593)
We were previously treating the data as utf-8 instead of hex.
Now we do things the right way.
Make the quiet flag actually work (#1587)
The command ganache --quite
wasn't making Ganache be quiet.
Now it does.
Make forking chainId aware (#1537)
Previous versions of Ganache applied the local hardfork rules to eth_call and debug_traceTransaction calls run in the context of a block that should be executed under different hardfork rules.
This bug may have caused results to be incorrect in cases where new opcodes were added, gas costs changed, or new transaction types added in hardforks.
This fix makes the assumption that the result of a call to eth_chainId
will accurately identify the chain (Mainnet = 1, Görli = 5, etc).
Fix Blake2-256 calculation (#1524)
There was a bug in @ethereumjs/vm package - blake2-256 precompile (see EIP-152) was implemented incorrectly. This was fixed in a newer version and we've upgraded the package in this release.
Remove bigint's n from cli output (#1591)
Startup display on Ganache 7.0.0-alpha.2 included an "n" after some numbers. This release properly prints the numbers without the n
suffix.
Return error for eth_call when call errors (#1589)
We incorrectly were requiring the use of our vmErrorsOnRPCResponse
flag in order to return eth_call
revert messages and errors.
eth_call
is not behaving as it should in alpha version (#1547)asyncRequestProcessing
doesn't default totrue
like it is supposed to (#1532)- Our TypeScript types aren't properly exported (#1412)
- We don't return a proper pending block (#772)
- Forking doesn't work in the browser
- Uncles aren't fully supported when forking
- Forking may fail in weird and unexpected ways. We need to "error better" here
- Node.js v12 outputs a µWS warning in the console
- Node.js v12 doesn't handle memory as well as 14+ and may crash computing very large
debug_traceTransaction
results - Our bundle size is larger than ideal
- Forking support for EVM compatible chains Arbitrum Rollup, Optimistic Ethereum, and Polygon PoS!
- Support for enabling eligible draft EIPs before they are finalized or considered for inclusion in a hardfork.
- New hardfork support well in advance of the hardfork launch.
- Add an
eth_createAccessList
method. - Track test performance metrics over time.
- Track real world Ganache usage (opt-in and anonymized) to better tune performance and drive bug fixes and feature development.
- Track test coverage.
- Document how to use Ganache in the browser, and what limits it has.
evm_mine
will return the new blocks instead of just0x0
.- We've laid the groundwork for additional performance improvements. We expect to see an additional 2-5x speed up for typical testing work loads in the near future.
- Add new
evm_setCode
andevm_setStorageAt
RPC methods. - Make
evm_snapshot
ids globally unique (unpredictable instead of a counter). - Support
eth_getRawTransactionByHash
RPC method. - Support
debug_accountAt
RPC method. - Allow "mining" to be disabled on start up.
- Set CLI options via config file, package.json, or ENV vars.
- "Flavor" Plugins: We're building support for Layer 2 plugins into Ganache so we can start up and manage other chains. e.g., The
ganache filecoin
command will look for the@ganache/filecoin
package and start up a Filecoin and IPFS server. - Multi-chain configurations: you'll be able to start up your project's entire blockchain "ecosystem" from a single Ganache command: e.g.,
ganache --flavor ethereum --flavor filecoin --flavor optimism
.- this is where defining your CLI options via JSON config will come in very handy!
- Create a CLI interactive/RELP mode.
- Enable a CLI daemon mode.
Open new issues (or join our team) to influence what we gets implemented and prioritized.
1. The keyfile isn't always encrypted on start up. If the user starts up Ganache with all accounts unlocked with the default passphrase ("") we will keep the unencrypted private keys in memory.
2. If you don't know already, Infura provides access to Ethereum networks.
💖 The Truffle Team