Logo

Home

Tutorial 1Create Wallet

Tutorial 2Avatars and Smart Token

Tutorial 3Identifiable Token

Metaverse Tutorials

Step by step tutorials for the Metaverse Blockchain

This is a series of Metaverse tutorials. To begin, clone this repository

git clone https://github.com/mvs-org/MetaverseTutorials.git

Navigate to the tutorial directory

cd MetaverseTutorials

Update your repo to the latest version of mvs-blockchain-js

git submodule update --init --recursive

Install the metaverse npm package

npm install metaversejs --save

Install the mvs-blockchain-js npm package

cd mvs-blockchain-js && npm install

Each tutorial builds on the previous one, so it is recommended to do them in order.

Tutorial Information:

These tutorials are designed to:

  1. Integrate Metaverse wallet into your dApp with your DID
  2. Issue and transfer MST
  3. Issue and transfer MIT

For more information refer to the Metaverse Documentation. Also check out some working examples in the ./examples folder.

Please follow the “Environment Setup” instructions below before starting.

Environment Setup

Start by entering the playground directory. This is where you can build ALL your Metaverse apps during the tutorial.

cd tutorials/playground

Interact with metaverse libraries via nodejs

Create a testScript

touch testScript.js

To interact with Metaverse using javascript you can interact with mvs-blockchain-js and metaversejs.

For use in nodejs scripts, import mvs-blockchain from the mvs-blockchain folder, and require metaversjs.

Inside the testscript, add the following. You will be using the blockchain and Metaverse objects later in the other tutorials.

//import mvs-blockchain-js
let blockchain = require('../../mvs-blockchain-js')({
    url: "https://explorer-testnet.mvs.org/api/"
});


//import metaversjs
let Metaverse = require('metaversejs');

//make sure the libraries have been successfully imported

console.log(blockchain)
console.log("mvs-blockchain-js has been successfully imported!")
console.log(Metaverse)
console.log("Metaversjs has been successfully imported!")

Now run

node testScript.js

Interact with metaverse via web app

First create an html file

touch index.html

and add

<html>
  <head>
    <meta charset="utf-8">
    <title></title>
  </head>
  <body>

  </body>
</html>

To interact with web apps you must generate index.js from mvs-blockchain-js and metaverse.min.js from metaversejs. To generate these files you must clone each repository and simply run

grunt

This will generate javascript files into the /dist folder that you can import into your app. You don’t have to worry about this for now. We have generated these files and placed them in the playground folder. To include them in your web app, just add these script tags into your html page.

<script src = "metaverse.min.js"></script>
<script src = "index.min.js"></script>

Serve your webpage

python -m SimpleHTTPServer 4444

To test that the libraries have been successfully imported into your webpage, open the web console and enter

blockchain = await Blockchain({url: "https://explorer-testnet.mvs.org/api/"})

blockchain

Metaverse

You should see the “blockchain” (from mvs-blockchain-js) and “Metaverse” (from metaversjs) objects show up in the console.

You should now be fully set up and ready to begin tutorial 1.