Setting Up Local Dev Chain

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 Historic 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.

Connect through the moralis-admin-cli

You can connect your local devchain 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:

npm install -g moralis-admin-cli

You also need to have frpc on you computer. You can get it here: https://github.com/fatedier/frp/releases

After you have installed the Moralis Admin CLI, you can head 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):

moralis-admin-cli connect-local-devchain --moralisApiKey FAM6pYzBKjcM
--moralisApiSecret 7thQGNKKqX8s --frpcPath "C:\Program Files\frpc\frpc.exe"

To get more information you can write:

moralis-admin-cli connect-local-devchain help

This will show you a more detailed description about the command as well as show you how you can call the command without needing to specify the arguments each time.