EVM in Velas

Velas native application model is aiming for high performance by splitting its modifiable state across multiple accounts. While this allows Velas to process transactions in parallel on a single shard, it also introduces complications for ordinary DApps developers. Additionally, most DApp infrastructures already rely on Solidity and targeting the Ethereum blockchain. These two reasons can significantly slow down the spread of the Solana ecosystem.

To make the life of DApps developers and integrators more easier, we at Velas introduced a full hybrid of Solana (eBPF) VM and Ethereum VM.

Here you can gain an overview on how to deploy an EVM dApp on Velas.

Metamask support

In our integration, we support Metamask. In order to use it, simply follow our metamask official instruction to add any public EVM Bridge as a custom network.

Network Details

chain_idNetwork Namerpcexplorer
106Velas Mainnethttps://mainnet.velas.com/rpchttps://evmexplorer.velas.com
111Velas Testnethttps://testnet.velas.com/rpchttps://evmexplorer.testnet.velas.com
5705Velas Devnethttps://devnet.velas.com/rpchttps://evmexplorer.devnet.velas.com

Transfer native token to EVM

In order to transfer native token into EVM, we can use velas binary. Note: EVM store tokens in nano lamports, so when you transfer for example, 5 lamports, your balance will be reported as 5*10^9

Usage:

> velas evm transfer-to-evm --help
velas-evm-transfer-to-evm
Transfer Native chain token to EVM world
USAGE:
velas evm transfer-to-evm [FLAGS] [OPTIONS] [ARGS]
FLAGS:
-h, --help Prints help information
--lamports Amount in lamports
ARGS:
<EVM_ADDRESS> Receiver address in EVM
<AMOUNT> Amount in VLX

Example:

> velas evm transfer-to-evm 0x9Edb9E0B88Dbf2a29aE121a657e1860aEceaA53D 5

Result after transaction processing:

[2020-12-26T15:03:01Z INFO evm_utils] Loading keypair from: /home/user/.config/solana/id.json
Transaction signature = 5d3eP741NYgemyM4CLmXuTEcP8f8w7QxfZ5vBxorqenEtNeSHWMFpkwtyi1meFKHVNXzDD3NbvFCExjZH79gEMKk

To make sure that balance was updated, you can request it using rpc:

curl -s -X POST --data '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0x9Edb9E0B88Dbf2a29aE121a657e1860aEceaA53D", "latest"],"id":1}' -H "Content-Type: application/json" http://127.0.0.1:8899
{"jsonrpc":"2.0","result":"0x12a05f200","id":1}

0x12a05f200 is a hex representation of 5*10^9

For more information about rpc checkout evm-rpc page.

Transfer token from EVM back to native

For transferring tokens back to native chain, we have a special precompiled contract, that deployed at address:

0x56454c41532D434841494e000000000053574150

With following interface:

pragma solidity ^0.6.0;
interface TransferToNative {
function transferToNative(bytes32 native_recipient) virtual external payable;
}

native_recipient is 32byte address of Velas Native account. To swap tokens, one should create a transaction on the address: 0x56454c41532D434841494e000000000053574150 with value specified in the transaction. This transaction then can be sent to EVM Bridge, that will wrap it to native transaction.