This tutorial shows step by step how to use Remix and Metamask, which are tools that were originally built for Ethereum, to create and deploy a simple smart contract on Velas.
Get coins for testing - Airdrop instruction
Smart contract sample:
- Go to Remix
- In the home page choose environment "Solidity" ans create new file "Hello_World.sol"
- Insert contract code and compile
Connect Metamask to public bridge-rpc
To connect your metamask account to Velas public bridge-rpc:
- Open Metamask and go to networks
- Custom RPC
Connect Metamask to local node
To get info about running your node check "Bridge to EVM" section. By default bridge runs on port 8545.
To connect your metamask account to local bridge:
Open Metamask and go to networks
Custom RPCNetwork Name:Velas TestnetNew RPC URL:https://localhost:8545ChainID (optional):111
By default, node runs on 8545 port. Can be changed if node uses different port for bridge.
- Open Remix
- On the left side panel choose "Deploy and run transactions" section
- Choose environment "Injected Web3" to connect metamask account
- Choose "Hello_World.sol" contract in dropdown menu
- Press deploy button
- Confirm on Metamask popup window
Remix will add your contract instance on the same page for deploying. To test your code simply call "sayHello" method by pressing button in you new contract menu.