Wallet2: Integrating with MetaMask

Users who are familiar with decentralization prefer services with which they can use the private key and DApps by themselves to services such as Luniverse PKMS where their private key is managed by the server.

Luniverse Wallet Bridge Client enables the users to use DApps with MetaMask, which is most commonly used as a plug-in on the Chrome browser.

Integrating the DApp with MetaMask

This section describes how to transfer Luniverse Side Tokens through MetaMask.
*More information on the integration with Metamask can be found in MetaMask Support Center.

  • ##Installing and running MetaMask
  1. Access to MetaMask and click GET CHROME EXTENSION to install MetaMask.
  1. Launch the Chrome browser and click the MetaMask icon in the upper right corner to run MetaMask.

Integrating Luniverse Side Chain with MetaMask

  1. In [Console], click the icon of the Side Chain with which you wish to integrate MetaMask to go to the [Chain Overview] page.
  1. Select the name of the node you want to integrate with MetaMask to go to the page for the details of the node.
  1. Copy [RPC HTTP Endpoint] from the page for the details of the node.
  1. Run MetaMask on the Chrome browser.
  2. Click the [Network Settings] icon on the upper right corner of the MetaMask screen to go to the [Custom RPC] setting page.
  1. Enter the [RPC HTTP Endpoint] value (one that is copied in Step 3) into the [New Network] field and save the settings to complete the integration with the Luniverse Side Chain.

Integrating Side Tokens with EOA of MetaMask

  1. In [Console], click the icon of the ST with which you wish to integrate MetaMask to go to the [Side Token Overview] page.
  1. Copy [Contract Address] of the ST.
  1. Run MetaMask. Click the hamburger menu in the upper left corner to open the menu.
  1. Click [Add Token] at the bottom of the screen.
  1. Click the [Add Custom Token] tab.

  2. Paste the [Contract Address] of the ST you have copied from 2 into Token Contract Address.

  3. Click [Next].

  4. The ST is successfully integrated with MetaMask.

Sending Luniverse STs to EOA of MetaMask

  1. Run MetaMask. Click [Account] at the top to copy the EOA address.
  1. In [Console], click the ST that is integrated with the MetaMask and that you wish to transfer to MetaMask to go to the [Side Token Overview] page.
  1. Click [Side Token Transfer] on the left menu to go to the [Side Token Transfer] page.
  1. Click [Transfer Side Token] on the upper right corner to go to the [Transfer Side Token] page.
  1. Paste the MetaMask EOA address you have copied from 1 into Recipient.
  2. Enter the amount of the STs to transfer in Amount Sent.
  3. Enter the description of the transfer in Comment.
  4. Click [Transfer] to proceed with the transfer.
  1. A pop-up window that you can enter the private key to sign the transaction for transferring the tokens appears. Enter your private key or upload the keystore file and enter the passphrase to sign the transaction. When you sign the transaction successfully, the message "ST transfer confirmed (SIDE_TOKEN.TRANSFERS_RAW_TX_CONFIRM)" appears in a pop-up window. Click [OK] to proceed with transferring the tokens.
  1. Run MetaMask and check that the ST balance has changed.

Signing transactions of the end users using MetaMask as Wallet Bridge

  1. End users using MetaMask must obtain their MetaMask address in advance.

Process of signing transactions

  1. When the end user initiates a transaction in a DApp, the DApp calls the TX API to Luniverse.
curl -X POST 'https://stg-api.luniverse.io/tx/v1.0/transactions/transfer' \
--header 'Authorization: Bearer KcUSCE7iCZoJfud8iLdmBLdZBrRyVai4e5o6x8d9c4ZpYu2h5mwtmhEPm6285f23' \
--header 'Content-Type: application/json' \
--data '{   "from": "0xab9ccaBe5075273d0D422236176ffb28A15C470F",
     "inputs": { 
               "receiverAddress": "0x3b1f1faa2bb0b913f9c50723d014c1bccc9b8020",
               "valueAmount": "1000000000000000000" 
  1. Luniverse TX API checks if the wallet address was created from an external source, creates an unsigned transaction and returns it to the DApp.
{ result: true,
   { from: '0xab9ccaBe5075273d0D422236176ffb28A15C470F',
      { from: '0xab9ccaBe5075273d0D422236176ffb28A15C470F',
        to: '0x9f979Da4F511A3E689e5b837D065C0794e92b90E',
        nonce: '0x0',
        gasLimit: '0x989680',
        gasPrice: '0x1388' 
  1. The DApp calls web3.eth.sendTransaction and sends the unsigned transaction to MetaMask as described below.
  2. The user will be asked to sign the transaction using MetaMask.
if ( result != undefined && result.data != undefined && result.data.rawTx != undefined ) {
   if (typeof ethereum !== 'undefined') {
          const from = web3.eth.accounts[0];

          const rawTx = result.data.rawTx;
          console.log('sendTransaction to metamask',rawTx);

          web3.eth.sendTransaction(rawTx, function(err,result) {
            if ( err ) return console.error(err);
            console.log('SIGNED:' + result);
  1. When MetaMask receives the request for signing the transaction, it brings up a pop-up window for the end user to sign the transaction.
  1. The user then checks and signs the transaction on MetaMask. The signed transaction is executed on the Side Chain that has been set in MetaMask and recorded on the blockchain.