Ganache & Hardhat Setup
Video Tutorials on Setting Up Ganache and Hardhat and Connecting Them to Your Moralis Server.
Ganache
Setting Up Ganache and MetaMask
Connecting Ganache to Moralis
A note for Mac users, download frp_0.36.2_darwin_amd64.tar.gz
for the Ganache proxy server.
Hardhat
Connecting Hardhat to MetaMask - Ivan on Tech Explains
Connecting Hardhat to Moralis - Real-Time and Historical Transactions
Solidity Writing to Console (console.log) - Hardhat Introduction
Forking Mainnet (not supported)
Note, the "Mainnet Forking" feature in Ganache CLI and Hardhat is not yet supported. Transactions and contract events will not sync due to the block numbers starting at an unexpected value. We hope to have support for this in the future.
Changing chains
Note, Moralis doesn't support changing local dev chains. Once you've used a local dev chain on a Moralis Server - you have to keep using it. Changing chains may result in unexpected results like transactions not being synced at all or just partially synced. If you need to switch chains you will have to create another server. We hope to support changing chains on the same server in the near future!
Connect Through the moralis-admin-cli
You can connect your local dev chain to Moralis by making use of the moralis-admin-cli
.
To get started, you need to install it by running the following code in the terminal:
You also need to have frpc on your computer. You can get it here: https://github.com/fatedier/frp/releases.
After you've installed the moralis-admin-cli, you can head to the admin panel and open up the details on any of your servers.
You will need the CLI API Key and CLI API secret shortly.
You can now run the following command to start the process (Insert your own key, secret, and path):
To get more information you can write:
This will show you a more detailed description of the command and show how you can call the command without the need to specify the arguments each time.
Last updated