CLV Documentations
CLV DOC
CLV DOC
  • Intro to CLV
    • About CLV ๐Ÿ€
    • Clover Finance Rebrands to CLV
    • What is CLV Chain?
    • What is CLV Wallet?
    • What is $CLV Token?
    • ๐Ÿ“ฃ CLV Official Channels
    • ๐Ÿ˜ CLV Community Channels
  • Use CLV Chain
    • ๐Ÿ“š Beginnerโ€™s Guide
      • Setup CLV Wallet
      • Setup Metamask Wallet
      • How to Get $CLV
      • Bridge Other Assets to CLV P-Chain (Parachain)
    • ๐ŸŒ Network Details
    • ๐Ÿฆ Economics
      • Tokenomics
      • Inflation Design
    • ๐Ÿ—ณ๏ธGovernance
    • ๐Ÿ™‹๐Ÿป CLV Chain FAQ
    • CLV P-Chain EVM Explorer
    • $CLV Cross-Chain Explorer
    • $CLV Cross-Chain Transfer
  • CLV Validator & Staking
    • What are Nominator & Validator?
    • Stake as a Nominator
    • Running a Validator or RPC Node
    • Staking FAQ
  • Use CLV Wallet
    • ๐Ÿ’ฐ Download CLV Wallet
      • Browser Extension (Google Chrome & Brave)
      • Apple iOS (Mobile)
      • Android (Mobile)
      • Web Wallet (Universal)
    • ๐Ÿ“ฑ CLV Mobile Wallet
    • ๐Ÿ–ฅ CLV Extension Wallet
    • ๐Ÿ•ธ๏ธ CLV Web Wallet
  • CLV Chain Developer Guide
    • Getting Started
    • Using Local Node
      • Using MetaMask
      • Using Remix
      • Using Web3.js
    • Using Testnet
      • Create an account
      • Faucet
      • Run a Testnet Node
      • Connect to Testnet
    • dApp Example
      • Setup dApp project
      • Setup truffle
      • The Counter Contract
      • Deploy Contract
      • Counter Webapp
    • Test Cases
    • Technical Documentations
      • CLV EVM
      • Developers Incentive
      • CLV Accounts Binding
      • Virtual Ethereum Address Binding
      • Query Balance
      • Transaction Finality
      • Web3 Compatibility
        • eth_protocolVersion
        • eth_syncing
        • eth_hashrate
        • eth_coinbase
        • eth_mining
        • eth_chainId
        • eth_gasPrice
        • eth_accounts
        • eth_blockNumber
        • eth_getBalance
        • eth_getStorageAt
        • eth_getBlock
        • eth_getTransactionCount
        • eth_getBlockTransactionCount
        • eth_getBlockUncleCount
        • eth_getCode
        • eth_sendTransaction
        • eth_sendSignedTransaction
        • eth_call
        • eth_estimateGas
        • eth_getTransaction
        • eth_getTransactionByBlockHashAndIndex
        • eth_getTransactionByBlockNumberAndIndex
        • eth_getTransactionReceipt
        • eth_getUncle
        • eth_getLogs
        • eth_getWork
        • eth_submitWork
        • eth_submitHashrate
        • eth_subscribe
        • eth_unsubscribe
        • net_version
        • net_peerCount
        • net_listening
        • web3_clientVersion
        • web3_sha3
      • CLV P-Chain Integration
  • CLV Wallet Developer Guide
    • EVM dApp Integration
    • Substrate dApp Integration
    • Solana dApp Integration
    • Kadena dApp Integration
    • Aptos dApp Integration
    • Web Wallet dApp Integration
    • dApp Interaction Protocol
    • Wallet Integration QA
  • CLV Ecosystem
    • ๐Ÿž๏ธ Ecosystem Partners
      • CLV Chain
      • CLV Wallet
    • ๐ŸŒฑ Incentive Programs
      • CLV Ecosystem Grant
      • CLV Wallet Integration Grant
      • CLV Bug Bounty Program
    • Whitelist Assets on Clover P-Chain
    • Bridge assets into CLV P-Chain
  • Assets
    • ๐Ÿ”ค Glossary
      • Blockchain (in General)
      • Polkadot
      • Wallet
    • ๐ŸŽŸ๏ธ CLV - Polkadot Parachain Auction 2021
      • Parachain Auction Rule Announcement
      • Parachain Winning Reward Announcement
    • ๐Ÿ›๏ธ Brand Pack
    • ๐Ÿ“„ Whitepaper
Powered by GitBook
On this page
  • Why need Account Binding
  • How to Bind the Account
  1. CLV Chain Developer Guide
  2. Technical Documentations

CLV Accounts Binding

PreviousDevelopers IncentiveNextVirtual Ethereum Address Binding

Last updated 3 years ago

Why need Account Binding

As explained in this , CLV Parachain is a dual blockchain which support both EVM transactions as well as Polkadot like transactions.

Account binding only happens on CLV Parachain, you can bind your CLV address to a CLV EVM address. Once you bind the accounts, you can use one account to interact with both EVM-based dApps as well as Substrate-based dApps.

Here are the features of CLV accounts binding (suppose you have done the accounts binding, for example bind your CLV address: 5DyCG7icXFuq8WtLd7iLi3umczKf84SAvp7w7Rw44RFEU8Yf with EVM address: 0xe6206C7f064c7d77C6d8e3eD8601c9AA435419cE)

  1. The above addresses will have the same balance. Other people can send CLV to any of the above account, and you can receive the CLV. At the same time, you can send CLV to other people using any of the above account.

  2. If you only have CLV in 0xe6206C7f064c7d77C6d8e3eD8601c9AA435419cE, you can't deploy or interact with CLV smart contract. Once you bind the account with a EVM address, you are able to deploy and interact with CLV smart contract.

How to Bind the Account

  1. Using CLV Wallet, the version should be above 1.0.3

  2. Using the following sample code๏ผš

const API = require("@polkadot/api")
const Web3 = require("web3")
const web3 = new Web3("https://rpc-2.clover.finance")
const cloverTypes = require('@clover-network/node-types')

const PUB_KEY = "0xe6206C7f064c7d77C6d8e3eD8601c9AA435419cE"
const PRIV_KEY = "0xa504b64992e478a6846670237a68ad89b6e42e90de0490273e28e74f084c03c8"
const CLOVER_SEEDS = "your 12 seed words"

async function run() {
    const wsProvider = new API.WsProvider('wss://api-2.clover.finance');
    const api = await API.ApiPromise.create({
        provider: wsProvider,
        types: cloverTypes
    });
    const keyring = new API.Keyring({ type: 'sr25519' });
    const alice = keyring.addFromUri(CLOVER_SEEDS);
    let nonce = await api.rpc.system.accountNextIndex(alice.address);
    web3.eth.accounts.wallet.add(PRIV_KEY);
    let signature = await web3.eth.sign(`clover evm:${web3.utils.bytesToHex(alice.publicKey).slice(2)}`, PUB_KEY);

    await api.tx.evmAccounts
        .claimAccount(PUB_KEY, web3.utils.hexToBytes(signature))
        .signAndSend(alice, {
            nonce,
        }, ({ events = [], status }) => {
            if (status.isFinalized) {
                console.log(`${alice.address} has bound with EVM address: ${PUB_KEY}`)
            }
        });
}

run()

section