LatestChain uses EVM for contract execution. See Solidity for details.
Remix
Remix IDE is an open-source web and desktop application. It fosters a fast development cycle and has a rich set of plugins with intuitive GUIs. Remix is used for the entire journey of contract development and is a playground for learning and teaching contract development.
Create a new file in File Explorer. Edit contact info on the right side.
Compile contract
Click the compiler button, switch the UI
Select the contract you want to compile
Set compile flags
Click compile button
Deploy contract to the blockchain via a wallet such as MetaMask.
Set network info in Metamask.
Back to Remix.
Switch environment
Select contract
click deploy button
The contract can be deployed on the chain through MetaMask
After initialization is complete, the following file structure is generated within the project.
|-- contracts //folder for contracts
|-- migrations //folder for deployment scripts
|-- test //folder for test scripts
|-- truffle-config.js //truffle config file
Config truffle info
const HDWalletProvider = require('@truffle/hdwallet-provider');
const fs = require('fs');
const mnemonic = fs.readFileSync(".secret").toString().trim();
module.exports = {
networks: {
testnet: {
provider: () => new HDWalletProvider(mnemonic, 'https://testnet-rpc.latestcoin.io'),
network_id: 6660
},
mainnet: {
provider: () => new HDWalletProvider(mnemonic, 'https://mainnet-rpc.latestcoin.io'),
network_id: 23924
}
},
// Set default mocha options here, use special reporters etc.
mocha: {
// timeout: 100000
},
// Configure your compilers
compilers: {
solc: {
// version: "0.5.1", // Fetch exact version from solc-bin (default: truffle's version)
// docker: true, // Use "0.5.1" you've installed locally with docker (default: false)
// settings: { // See the solidity docs for advice about optimization and evmVersion
// optimizer: {
// enabled: false,
// runs: 200
// },
// evmVersion: "byzantium"
// }
},
},
};
Create contract: Put custom contracts into folder contracts and modify deployment script in folder migrations.
Deploy contract
Run the deployment command.
truffle migrate --network testnet
The output as below.
2_example_migration.js
======================
Deploying 'ExampleToken'
------------------------
> transaction hash: 0x91e50594a63bc6f4c299f3f445868571678be306b835bddce6dff5c7a5ddf9dc
> Blocks: 2 Seconds: 4
> contract address: 0x54D2049715FC8De1361D7350de90eb05F0f6CA84
> block number: 375304
> block timestamp: 1608016637
> account: 0x03D32B774295D740ffEe43b20fcC0a53acC576e6
> balance: 878.909609236165318643
> gas used: 1056044 (0x101d2c)
> gas price: 20 gwei
> value sent: 0 ETH
> total cost: 0.02112088 ETH
> Saving migration to chain.
> Saving artifacts
-------------------------------------
> Total cost: 0.02112088 ETH
Summary
=======
> Total deployments: 1
> Final cost: 0.02112088 ETH