4. Deploy Using Ganache v7
Create a local blockchain environment through Ganache v7
- 1.Click on the terminal to open the Ganache mirror:

Start a local chain that can be accessed by clients other than terminal by entering ganache with the following parameters:
ganache -h 0.0.0.0
2. Next to port mapping, click on the port, select Ganache, port 8545, click add:

And copy ganache-cli's link:

Thus you have successfully started a ganache local blockchain. You can then connect to the chain via metamask, or deploy the contract via truffle, hardhat. Here is the usage in truffle.
3. Open truffle-config.js in the editor, delete the original content and use the following content:
module.exports = {
networks: {
development: {
host: "*******", // ****For the local link generated by the previous port mapping and remove the "https://"
port: 80, //80 is the http port
network_id: "*"
}
}
};
Replace ********** with the ganache-cli port mapping local link generated by yourself before, and remove the previous https://
Such as: sandboxbe8dd860b46bganache-cli-8545.gateway.chainide.com
4. Save the CTRL+S and close the configuration file.
5. Switch to the truffle mirror and enter the Metacoin directory

cd MetaCoin
6. Deployment
truffle migrate
You can use the console to interact with the contract
truffle console
- 1.
- 2.