Skip to content

Latest commit

 

History

History
307 lines (186 loc) · 12.3 KB

test-swap.rst

File metadata and controls

307 lines (186 loc) · 12.3 KB

Test token swap

This test scenario walks you through the process of acquiring test INS tokens and swapping them to test XNS coins on Insolar TestNet.

Warning

Do not send real INS tokens from the main Ethereum network to Insolar MainNet during the testing period.

What you will need

You need to create two wallets:

  • Ethereum wallet that supports Ethereum test networks (Ropsten in particular) and custom tokens. This test scenario uses MetaMask as an example.
  • Insolar Wallet in which you can store XNS coins that are native for Insolar MainNet.

Additionally, you need to understand the following:

  • What coins and tokens are. Coin is a native cryptocurrency of any blockchain and token is a unit of value that may be built on top of it. Coins operate independently, while tokens have specific uses. On the Ethereum network, the coin is the ether (ETH) and the token standard (upon which the INS token is built) is ERC-20. Test tokens and coins are those that operate in test networks. For testing purposes, we are going to use the Ropsten test network.
  • What a crypto faucet is. The faucet is a quick and easy way of creating and distributing test coins and tokens on test networks.
  • What a token contract is. Essentially, a token contract is a smart contract that contains a map of account addresses and their balances. The unit of the balance is the token. When tokens are transferred from one account to another, the token contract updates balances of both accounts.

Test scenario overview

To grasp what you will be doing, take a look at the steps of the test scenario:

  1. Create a MetaMask wallet, switch to Ropsten test network inside it, and add the INS custom token.
  2. Get Ropsten test ETH coins.
  3. Swap the coins to test INS tokens using the INS token contract.
  4. Create a wallet in Insolar Wallet and, automatically, receive a migration address.
  5. Send the test INS tokens from the MetaMask wallet to the migration address. They will automatically swap to XNS native coins and appear in Insolar Wallet.

All the above steps are described in detail in subsequent sections.

Creating and setting up Ethereum wallet

To create and set up a MetaMask Ethereum wallet:

  1. Go to metamask.io and add its extension to your browser.

  2. Open the extension, click :guilabel:`Get Started`, :guilabel:`Create a Wallet`, and agree or disagree to help MetaMask improve itself.

  3. Create a new password, confirm it, and agree to the "Terms of Use".

  4. Reveal the backup phrase, copy it, and click :guilabel:`Next`.

  5. Click the words of the backup phrase in correct order and then click :guilabel:`Confirm`.

  6. Receive congratulations from MetaMask and click :guilabel:`All Done`. You will see the wallet's user interface.

  7. In the top right corner, select :guilabel:`Ropsten Test Network` from the drop-down list:

    imgs/mig-test/selecting-ropsten.png
  8. In the bottom left corner, click :guilabel:`Add Token`:

    imgs/mig-test/add-token.png
  9. On the Add Tokens screen, open the :guilabel:`Custom Token` tab:

    imgs/mig-test/custom-token.png
  10. Copy the INS token contract address -- click the copy icon copy-icon in the right corner of the following code block:

    0x7e94f2be613c6846c40325b0f2712269a0d61d10
    
  11. In the :guilabel:`Token Contract Address` field, paste the copied INS token contract address:

    imgs/mig-test/ins-token.png

    MetaMask will find the INS token symbol and decimals of precision for you. Click :guilabel:`Next`.

  12. On the next screen, click :guilabel:`Add Tokens`:

    imgs/mig-test/add-ins.png

    With that, the MetaMask wallet is set up to operate the test ETH coins and INS tokens:

    imgs/mig-test/wallet-setup.png

Acquiring test ETH coins and swapping them to test INS tokens

To acquire, first, test ETH, then swap them to test INS tokens:

  1. In the MetaMask wallet, first, click the :guilabel:`ETH` tab, then :guilabel:`Deposit`.

    imgs/mig-test/eth-deposit.png
  2. In the Deposit Ether window, click :guilabel:`Get Ether` next to Test Faucet:

    imgs/mig-test/get-eth-from-faucet.png

    This opens the MetaMask Ether Faucet page.

  3. On the opened page, click :guilabel:`request 1 ether from faucet`:

    imgs/mig-test/request-one-eth.png

    MetaMask will ask you to connect the request in the newly opened window. Click :guilabel:`Connect`:

    imgs/mig-test/connect-request.png

    Once connected, you can click :guilabel:`request 1 ether from faucet` several times more (maximum 6). The corresponding transaction entries will appear below:

    imgs/mig-test/test-eth-txes.png

    Wait several seconds to let the transactions be processed by the test network and return to the MetaMask wallet.

  4. In the MetaMask wallet's History, the confirmed transactions will appear and your balance will be updated. Click :guilabel:`Send`:

    imgs/mig-test/meta-balance.png
  5. Again, copy the INS token contract address—click the copy icon copy-icon in the right corner of the following code block:

    0x7e94f2be613c6846c40325b0f2712269a0d61d10
    
  6. On the Add Recipient screen, paste the copied address to the search field:

    imgs/mig-test/send-search-field.png

    The MetaMask wallet will recognize the INS token contract and display the transfer details:

    imgs/mig-test/meta-transfer-details.png
  7. On the Send ETH screen, you don't need to send actual ETH to the token contract but a small amount of ETH will be automatically subtracted to pay for transaction processing.

    However, setting the correct gas value is required. To set it, click :guilabel:`Advanced Options`:

    imgs/mig-test/advanced-options.png
  8. On the Customize Gas screen, set the :guilabel:`Gas Limit` to 80000 (eighty thousand) and click :guilabel:`Save`:

    imgs/mig-test/gas-limit.png

    Caution!

    If the gas limit value is lower than 80,000, the token contract will fail.

  9. Back on the Send ETH screen, click :guilabel:`Next`:

    imgs/mig-test/finally-send-eth.png

    And, on the next screen, click :guilabel:`Confirm`:

    imgs/mig-test/finally-confirm.png
  10. Repeat the procedure of sending ETH to INS token contract several more times to acquire enough test INS tokens.

    Once the corresponding transactions are confirmed, the MetaMask wallet is set up to operate test INS tokens:

    imgs/mig-test/meta-wallet-setup.png

Next, migrate test INS token to the Insolar network. The migration will automatically swap the test INS tokens to test XNS coins.

Migrating test INS tokens and swapping them to test XNS coins

To migrate the test INS tokens and swap them to XNS coins:

  1. Open the Insolar Wallet website and make sure to select :guilabel:`TESTNET` from the drop-down list.

    imgs/mig-test/select-testnet.png
  2. Click :guilabel:`CREATE A NEW WALLET`:

    imgs/mig-test/create-test-ins-wlt.png

    This opens a Wallet creation tutorial. Read through it attentively.

    Upon creation, your wallet takes care of security for you:

    1. Generates a secret backup phrase and private key using randomization. They are synonymous in function.
    2. Encrypts the key with your password and puts it in a keystore file. You can use this file to access your wallet and authorize operations.
    3. Ensures that you make a record of the secret backup phrase. Using this phrase, you can restore access to your wallet in case you lose the private key or the keystore file and your password.

    Caution!

    You are solely responsible for keeping your funds as no one else can restore access to your wallet. Insolar does not store your credentials, encrypted or otherwise.

  3. On the Create a new wallet page:

    imgs/mig-test/ins-wallet-password.png
    1. Enter a new password. It should be at least 8 characters long and contain a mix of numbers, uppercase, and lowercase letters.
    2. Re-enter the password to confirm it.
    3. Agree to the "Term of Use".
    4. Allow anonymous data collection if you want to help us improve the service.
    5. Click :guilabel:`NEXT`.
  4. On the next screen, click :guilabel:`REVEAL TEXT` to see the backup phrase:

    imgs/mig-test/ins-reveal-phrase.png

    The secret backup phrase is a series of words that store all the information needed to recover Insolar Wallet. The secret backup phrase and private key are synonymous in function.

    Warning

    Never disclose your secret backup phrase (or private key).

    Tip

    Security tips:

    • Store the phrase in a password manager.
    • Write the phrase down on several pieces of paper and store them in different places.
    • Memorize the phrase.

    Once you have secured the backup phrase, click :guilabel:`NEXT`.

  5. On the next screen, enter the requested words in the correct order and click :guilabel:`OPEN MY WALLET`:

    imgs/mig-test/ins-word-order.png
  6. Wait for the wallet validation to complete and all features to become available:

    imgs/mig-test/one-more-thing.png
  7. Once the wallet is created, receive congratulations from Insolar:

    imgs/mig-test/ins-congrats.png

    And save the keystore file in one of the following ways:

    • Click :guilabel:`SAVE TO BROWSER` to save it to your browser local storage. Keeping the file locally allows easier access from the browser on the device you are using.
    • Click :guilabel:`DOWNLOAD` to save it to your device. In this case, you can later move it to another device via, for example, a USB drive.

    Later, you can log in using one of the following:

    • (Recommended) Your password and the keystore file saved to your browser.
    • Your password and the keystore file saved to your device.
    • Hardware wallet (such as Ledger Nano X or S).
    • (Weakest safety level) Unencrypted private key.

    Either way, Insolar Wallet does not store your private key. Instead, it uses the private key provided every time to authorize login and operations. While logged in, you can copy your unencrypted private key, but keep in mind, this is its most vulnerable form.

  8. In Insolar Wallet, open the :guilabel:`SWAP` tab and copy your migration address.

    imgs/mig-test/wlt-test-open-swap-tab.png

    On the :guilabel:`SWAP` tab, click :guilabel:`Copy migration address`.

    After that, return to the MetaMask wallet.

  9. In the MetaMask wallet, open the :guilabel:`INS` tab and click :guilabel:`Send`:

    imgs/mig-test/meta-send-ins.png
  10. On the Add Recipient screen, paste the copied migration address to the search field:

    imgs/mig-test/send-search-field.png
  11. On the Send Tokens screen, first, click :guilabel:`Max`, then :guilabel:`Next`:

    imgs/mig-test/send-ins-to-mig-addr.png

    And :guilabel:`Confirm` the transaction:

    imgs/mig-test/confirm-send-to-mig-addr.png

    The migration process may take some time.

  12. Once the transaction is processed by the Ropsten test network, your test XNS coins will appear in Insolar Wallet:

    imgs/mig-test/ins-tokens-hold.png

This concludes the migration test.