infrablockchain-docs
en
en
  • InfraBlockchain
    • Learn
      • Architecture
        • Architecture
        • Network Participants
        • Parachain
          • System Parachains
      • Protocol
        • System Token
        • Transaction Fee
        • Proof of Transaction
      • Substrate
        • Learn
          • Basic
            • Cryptography
            • Blockchain Basics
            • Consensus
            • Networks and Nodes
            • Blockchain Transaction
            • Transaction Life Cycle
            • Offchain Operations
            • Light Client
            • Rust for Substrate
            • Introduction to Library
            • Architecture and Rust Libraries
            • File Architecture
            • Accounts, Addresses, and Keys
            • Transaction Format
            • Blockchain Randomness
          • FRAME
            • FRAME Pallets
            • FRAME Macros
            • Custom Pallets
            • Pallet Coupling
            • Origin
            • Events and Erros
            • Runtime Storage
            • State Transitions and Storage
            • SCALE Encoding
            • Weight and Fee
            • Runtime API
            • Runtime Development
          • Account
          • Address Format
          • Glossary
          • CLI
            • Archive
            • Memory Profiler
            • Node Template
            • sidecar
            • srtool
            • Subkey
            • subxt
            • try-runtime
            • tx-wrapper
          • Runtime Development
            • Basics
              • Configure Genesis State
              • Configure Runtime Constants
              • Customize a Chain Spec
              • Import a Pallet
              • Use Helper Function
            • Consensus Model
              • PoW
              • Create a Hybrid Node
            • Offchain Worker
              • Request Offchain HTTP
              • Offchain Indexing
              • Offchain Local Storage
            • Pallet Design
              • Create a Storage Structure
              • Implement Lockable Currency
              • Incorporate Randomness
              • Loose Coupling
              • Tight Coupling
            • Parachain Development
              • Add HRMP Channel
              • Add Paranodes
              • Connect to a Local Relay Chain
              • Convert a Solo Chain
              • Prepare to Launch
              • Select Collator
              • Upgrade a Parachain
            • Storage Migration
              • Basics
              • Trigger Migration
            • Test
              • Basics
              • Test a Transfer Transaction
            • Tools
              • Create a TxWrapper
              • Use Sidecar
              • try-runtime
              • Verify WASM
            • Weigths
              • Benchmark
              • Calculate Fees
              • Use Conditional Weights
              • Use Custom Weights
        • Build
          • Decide What to Build
          • Build Process
          • Determinisitc Runtime
          • Chain Spec
          • Genesis Configuration
          • Application Development
          • RPC
          • Troubleshoot Your Code
        • Tutorials
          • Install
            • Developer Tools
            • Linux
            • macOS
            • Rust Toolchain
            • Issues
            • Windows
          • Quick Start
            • Explore the Code
            • Modify Runtime
            • Start a Node
            • Substrate Basics
          • Build a Blockchain
            • Add Trusted Nodes
            • Authorize Specific Nodes
            • Build a Local Blockchain
            • Simulate Network
            • Upgrade a Running Network
          • Build Application Logic
            • Add a Pallet
            • Add Offchasin Workers
            • Publish Custom Pallets
            • Specify Origin for a Call
            • Use Macros in a Custom Pallet
          • Integrate with Tools
            • Access EVM Accounts
            • EVM Integration
            • Explore Sidecar Endpoints
            • Integrate a Light Client Node
          • Smart Contracts
            • Strategy
            • Build a Token Contract
            • Develop a Smart Contract
            • Prepare Your First Contract
            • Troubleshoot Smart Contracts
            • Use Maps for Storing Values
      • XCM
        • XCM
        • XCM Format
    • Service Chains
      • InfraDID
      • InfraEVM
      • URAuth(Universal Resource Auth)
    • DevOps
      • Build
      • Deploy
      • Monitoring
      • Runtime Upgrade
    • Tutorials
      • Basic
        • How to Interact with System Token
        • How To Pay Transaction Fee
        • How To Vote with TaaV
        • Hot to Get Validator Reward
      • Build
        • Build InfraRelayChain
        • Build Parachain
        • Open Message Passing Channels
        • Transfer Assets with XCM
      • Test
        • Benchmark
        • Check Runtime
        • Debug
        • Simulate Parachains
        • Unit Testing
      • Service Chains
        • Play with InfraDID
          • Build
          • Add Keys
          • Add Service Endpoint
          • Create InfraDID
        • Play with InfraEVM
          • Build
          • Deposit and Withdraw Token
          • Deploy ERC20 Contract
          • Deploy ERC721 Contract
          • Deploy ERC1155 Contract
  • Newnal Data Market
Powered by GitBook
On this page
  • Before you begin
  • Converting Addresses
  • Moving Assets from Substrate to EVM
  • Moving Assets from EVM to Substrate
  • Next Steps
  1. InfraBlockchain
  2. Tutorials
  3. Service Chains
  4. Play with InfraEVM

Deposit and Withdraw Token

This tutorial explains how to deposit and withdraw funds on the InfraEVM parachain.

PreviousBuildNextDeploy ERC20 Contract

Last updated 1 year ago

Before you begin

Before you begin, make sure to do the following:

Converting Addresses

InfraEVM Parachain uses two address systems:

  • SS58 address

  • H160 address

SS58 addresses are used in the Substrate layer, while H160 addresses are used in the EVM layer.

SS58 Address to H160 Address

Converting an SS58 address to an H160 address is done as shown in the image above.

It involves decoding the SS58 address and using the first 20 bytes of the resulting 32-byte buffer as the H160 address.

Here's how to convert SS58 addresses to H160 addresses:

  1. Open your computer's terminal shell.

  2. Clone InfraEVM Parachain repository by running the following command:

    git clone https://github.com/InfraBlockchain/infra-evm-parachain

    This command clones the master branch.

  3. Navigate to the root of the node template directory with the following command:

    cd infra-evm-substrate

    Create a new branch for your work:

    git switch -c my-learning-branch-yyyy-mm-dd

    Replace yyyy-mm-dd with your desired identification information. We recommend using a numeric year-month-day format. For example:

    git switch -c my-learning-branch-2023-03-01
  4. Execute the following command to perform the address conversion:

    node ./utils --evm-address {ss58-address}

H160 Address to SS58 Address

Converting an H160 address to an SS58 address is done as shown in the image above.

It involves combining a buffer composed of the string "evm:" and a buffer composed of the H160 address, then obtaining the hash value using the blake2 hash function and encoding the resulting hash value in SS58 format to obtain the SS58 address.

Here's how to convert H160 addresses to SS58 addresses:

  1. Open your computer's terminal shell.

  2. Clone InfraEVM Parachain repository by running the following command:

    git clone https://github.com/InfraBlockchain/infra-evm-parachain

    This command clones the master branch.

  3. Navigate to the root of the node template directory with the following command:

    cd infra-evm-substrate

    Create a new branch for your work:

    git switch -c my-learning-branch-yyyy-mm-dd

    Replace yyyy-mm-dd with your desired identification information. We recommend using a numeric year-month-day format. For example:

    git switch -c my-learning-branch-2023-03-01
  4. Execute the following command to perform the address conversion:

    node ./utils --ss58-address {evm-address}

Moving Assets from Substrate to EVM

  1. Use the method explained above to obtain the SS58 address mapped to the H160 address to be used in EVM.

    node ./utils --ss58-address {evm-address}
  2. Transfer assets to the obtained SS58 address.

    By default, InfraEVM Parachain is integrated to use asset 99 as the native token of the EVM.

  3. Verify that it reflects in EVM wallets like MetaMask.

Moving Assets from EVM to Substrate

  1. Use the method explained above to obtain the EVM address mapped to the SS58 address to be used in Substrate.

    node ./utils --evm-address {ss58-address}
  2. Transfer assets to the obtained EVM address.

  • Navigate to Developers - Extrinsics - evm palette and select the withdraw extrinsic.

    Configure it as shown below and dispatch the extrinsic:

    The SS58 account used for address conversion in step 1 should execute the extrinsic.

  1. Check the events to confirm that the assets were successfully deposited.

Next Steps

A JavaScript file that implements this conversion is included in the .

A JavaScript file that implements this conversion is included in the .

Access the and follow the steps below.

repository
repository
InfraBlockchain Explorer
Deploying an ERC20 Token Contract
InfraEVM
ss58-to-h160
h160-to-ss58
transfer-asset
metamask-balance
transfer-asset
withdraw
withdraw-success