These are the steps for deploying a smart contract to Ethereum blockchain with Truffle:
- Write a migration script: To deploy your smart contract, you need to write a migration file. Create a new file named migrations/2_deploy_donation.js. Then, we fill this file with the following script:
var Donation = artifacts.require("./Donation.sol");
module.exports = function(deployer) {
deployer.deploy(Donation);
};
As for the migrations/1_initial_migration.js and contracts/Migrations.sol files, we leave these as they are for now. Truffle needs these files in order to deploy a smart contract.
- Launch Ganache (the blockchain for Ethereum development): Now you need to launch Ganache. Assuming you have been given proper permission, run the following command line to execute the file:
./ganache-1.2.3-x86_64.AppImage
As you can see...