dApps

Decentralized Applications (dApps)

In this first task, you will interact with a dApp.

This application is deployed on devnet, so you will need to Faucet tokens on devnet wallet

You will connect with your wallet and play a Ping Pong game. First you will press Ping button, which will call a `ping` endpoint and send 1 xEGLD. After 15 minutes, you will press Pong button and will receive your 1 xEGLD back:

  • Connect to you wallet
  • Press Ping
  • Wait 10 minutes
  • Press Pong to get your funds back
  • Go to explorer to inspect your transactions.

The dApp you are seeing is connected to erd1qqqqqqqqqqqqqpgqss6ch3dat9u9sm6487n9p7l9wna5zhj6jn2qh2nmjk Smart Conctract.

You can inspect the code here.

Prerequisites

sudo apt-get update

sudo apt install libncurses5 build-essential python3-pip nodejs npm python3.8-venv

Erdpy is now called mxpy, after rebranding to MultiversX

Erdpy - the Elrond command line tool, which is helpful for signing transactions, deploying smart contracts, managing wallets, accounts and validators:

wget -O mxpy-up.py https://raw.githubusercontent.com/multiversx/mx-sdk-py-cli/main/mxpy-up.py

python3 erdpy-up.py

Restart the session to active erdpy:

source ~/.profile

More about erdpy / mxpy installation at link

Command line wallet

In this task you will create a new wallet using a command line:

Use erdpy wallet [help] command to create a new wallet.

Create a pem file to login more easily.

Command line transactions

Use erdpy to make a transaction to the Ping Pong Smart Contract:

  • Call ping endpoint
  • There are some view functions in the contract. Call them (Ex: get_time_to_pong)
  • Call pong before 10 minutes
  • Call pong after 10 minutes to get your funds back
fob/laboratoare/02.txt · Last modified: 2023/01/23 12:01 by costin.carabas
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0