First of all, building a blockchain environment requires a private or public chain. Here, Ganache’s quickstart is used to create a blockchain instance. As shown in the figure below: the red circle represents the port, which will be used to configure truffle-config.js.
Step 2: When using the truffle init command to create a project, the file directory that generally appears is as follows:
.
├── contracts
│ └── Migrations.sol
├── migrations
│ └── 1_initial_migration.js
├── test
├── truffle-config.js
└── truffle.js
The third step is to configure truffle-config.js. Add the following information, remember to change the port, corresponding to the port created by ganache above
module.exports = {
networks: {
development: {
host: “127.0.0.1”, // Localhost (default: none)
port: 7545, // Standard Ethereum port (default: none)
network_id: “*” // Any network (default: none)
}
}
}
At this time, run the **truffle migrate** command directly, and if the following figure appears, the deployment is successful.
If there is an ExtendableError: Could not find suitable configuration file.