P2P dApp Guide

Nimbus Platform
13 min readJul 30, 2021

Program description

P2P Exchange dApp provides the user with the opportunity to buy or sell cryptocurrency at a lucrative rate without the involvement of intermediaries. The service acts as a crypto-asset exchange with a mechanism that ensures all transactions are carried out directly between two parties involved in the exchange (the general view of the interface is shown in Figure 1).

Figure 1

Terminology

  • Offer — is an intention to buy/sell tokens. It is not controlled by a smart contract (only the user is responsible for creating it). The offer is not a final decision, but only a statement of intent by the user.
  • Seller — a user who creates an offer on their own terms;
  • Buyer — a user who has the intention of exchanging their tokens based on the terms of the seller;
  • Deal — is an act of exchanging tokens (buy/sell) that takes place between a buyer and a seller.

How P2P Exchange dApp works

If user A has a certain amount of tokens that he wants to exchange for other tokens on their own terms, they need to create an offer. This offer will be automatically added to the general offer board (section “All Listing”). User B responds to this offer and creates a deal with user A. After creating a deal, user’s B tokens that they indicated for exchange (when creating a deal from the wallet connected to the Platform) will be automatically withdrawn. These tokens will be deposited into the underlying smart contract of the transaction.

User A will see this trade in the “My Trades” section in the “Open” subsection. If they intend to make a deal, then they must confirm it. In this case, their tokens will be automatically withdrawn from the wallet connected to the Platform, and the tokens of user B will be credited to their wallet. The deal will be considered closed and will occur in the “Closed” subsection. At the same time, User A’s tokens will be credited to User B’s wallet, and the transaction will be considered closed.

If user A does not want to confirm the transaction, they can either ignore it, wait until the end of the specified period, or cancel. User B can cancel the deal at any time and withdraw their tokens from the smart contract if user A failed to confirm it or the deal has expired.

Important! Before executing the steps mentioned in this section (and any other sections of the Platform), the user needs to make sure that his/her wallet is connected to the Platform. In this guide, MetaMask will be used as an example.

Using P2P Exchange dApp

Getting started with P2P Exchange dApp

In order to buy or sell cryptocurrency at a favorable rate without intermediaries, the user needs to go to the “dApps” section of the Platform (Figure 2).

Figure 2

In this section, the user can see 3 different dApps:

  • Borrow;
  • Lend;
  • P2P Exchange.

This document will cover the use of only the third dApp — P2P Exchange.

To start working with the P2P Exchange dApp, click on the Open button (Figure 3).

Figure 3

A window of the wallet connected to the Platform will pop up, here the user need to confirm the action by clicking on the Sign button (Figure 4).

Figure 4

After confirming the action, the P2P Exchange dApp interface will be displayed and the user are ready to use the dApp (Figure 5)…

Figure 5

On the P2P Exchange dApp interface the user can see the following sections:

  • All Listing — all offers within the Platform that are currently available;
  • My Listing — offers created by the user;
  • My Trades ​​ — transactions of the user (open and closed);
  • My Chats — chats that allow users to interact with each other (contractors);
  • Create Listing — a section where the user can create a new offer.

Each section will be discussed in more detail below.

How to see the list of all active offers

Figure 6

When the user click on the All Listing button, a list of active offers will appear (Figure 6), the information which is arranged in the following order:

  1. — the serial number of the proposal;
  2. Trader — the name specified by the seller, or their wallet address (if the name was not specified);
  3. Asset swap — the token offered by the seller;
  4. Exchange asset — a token that the seller wants to receive in return;
  5. Rate — the current exchange rate (by clicking on the cross-shaped arrow (🔁), the user can see the reverse rate at the moment);
  6. Limits — the minimum and maximum amount of token specified by the seller in their offer;
  7. Actions — available actions within the offer

When choosing an offer, the user can start a correspondence with the seller (the Chat button in the far right column) or start making a deal (the Acquire button in the far right column). Each step will be covered in more detail in other sections.

To view other available offers, the user needs to navigate between the pages (in the lower right corner of the interface — Figure 6).

For convenience, the user can sort offers (in the upper right corner of the interface — Figure 7) by the following parameters:

  • Asset for sale — a token offered by the seller;
  • Exchange asset — a token that the seller wants to receive in return.
Figure 7

How to create/change username

In order to see the username instead of the wallet address in the offer (in the Trader column — Figure 8), the user must click on the purple ⚙️ button (upper right corner of the interface — Figures 6–7).

Figure 8

After a line for entering a username will appear (Figure 9).

The user can choose any name not occupied by another user (Figure 10) and containing any letters, numbers, or symbols “-” and “_”.

Figure 9
Figure 10

To save the entered username, the user needs to click on the Confirm button.

The username can be changed at any time. To do this, press the purple ⚙️ button again (upper right corner of the interface — Figures 6–7). Then the user needs to save changes, and the updated username will automatically appear in all offers.

How to create a new offer

When the user click on the Create Listing button, a window will appear in which the user can create a new offer (Figure 11).

Figure 11

To create an offer, the user must enter the data in the appropriate lines:

  1. What do you swap? — in this line, the user must specify the token that they wish to sell. By clicking on the drop-down list, the user can see a list of tokens available for selection (Figure 12). When selected, the address of the corresponding token will be displayed under the line (Figure 13).
Figure 12
Figure 13

If the user selects My token, a new line will appear for entering the token address (ERC-20 or BEP-20 — depending on the network (Figure 14).

Figure 14

2) What do you want to receive? — in this line, the user must specify the token that they want to receive in return. The selection of the token is carried out by analogy with the previous line.

3) Min amount / Max amount — in these lines, the seller must specify the minimum and maximum amount of tokens that they want to sell. The selected range will be indicated in the Limits column (Figure 15). It is important to note that this range is not a condition of the transaction and is only for informational purposes (the number of tokens for exchange can be negotiated by the user additionally when interacting with the counterparty).

Figure 15

4) Define your offer — in this line, the user must specify the price for the token that he/she wants to sell. For example, if a user wants to give NBU tokens and receive GNBU in return, they can put “5” in this line, and then the price will be determined as 1 GNBU for 5 NBU. It is important to note that this range is not a condition of the transaction and is for informational purposes only.

5) Cross offer — the price of the token that the user wants to receive in return is calculated automatically (reverse rate).

There are two buttons at the bottom of the window (Figure 16):

  1. The Cancel button allows the user to cancel the action. In this case, the entered data will not be saved.
  2. The Create Advert button allows the user to create an offer or save the changes made to the old one.
Figure 16

How the user can see the list of their offers

When clicking on the My Listing button, a list of offers created by the current user will appear (Figure 17).

Figure 17

The information in this list is arranged in the same order as in the “All Listing” section (except for the buttons in the last column):

  1. — the serial number of the proposal;
  2. Trader — the name specified by the seller, or their wallet address (if the name was not specified);
  3. Asset swap — the token offered by the seller;
  4. Exchange asset — a token that the seller wants to receive in return;
  5. Rate — the current exchange rate (by clicking on the cross-shaped arrow (🔄), users can see the reverse rate at the moment);
  6. Limits — the minimum and maximum amount of token specified by the seller in their offer;
  7. Actions — available actions within the offer.

The Actions column contains three buttons:

  1. The Create trade button allows the user to create a trade (after reaching an agreement with the counterparty), which will then be reflected in the “My Trades” section;
  2. The Edit button allows the user to make changes to this offer (editing is done by analogy with creating a deal);
  3. The Delete button allows the user to delete this offer.

If the user has a lot of created offers, then to view all of them it is necessary to navigate between the pages (in the lower right corner of the interface).

How to create a new deal

Figure 18

When clicking on the Create trade (Figure 17) or Acquire (Figure 6) button, a window will appear (Figure 18), in which the user can create a new trade.

To create a deal, the user must enter the data in the appropriate lines:

  1. What do you send? — this line is filled in automatically based on the conditions specified in the offer.
  2. What do you want to receive? — this line is filled in automatically based on the conditions specified in the offer.
  3. Send amount — in this line, the user must enter the number of tokens that they want to sell (there are no restrictions on input).
  4. Receive amount — in this line, the user must enter the number of tokens that they want to receive in return (there are no restrictions on input).
  5. Exchange rates — in this line, the exchange rate is calculated automatically when the two previous indicators are entered.
  6. Deadline — the deadline for the execution of the transaction (if the obligations are not fulfilled on time, the transaction is canceled).
  7. Notify user — the name of the counterparty user. This line is filled in automatically if the initiator of the transaction did not create this offer themself.

If all the lines are filled in correctly, the user needs to click on the Create trade button. After that, the created deal will be reflected in the “My Trades” section in the “Open” subsection (Figure 19) for both counterparties.

How the user can see a list of his/her open and closed deals

The “My Trades” section consists of two subsections (Figure 19):

  1. Open (open trades);
  2. Closed (closed deals).
Figure 19

Each subsection will be discussed in more detail below.

  1. The “Open” subsection contains all unfinished (open) transactions of the current user (Figure 20). In this case, it does not matter at all who created the deal (the user themself or the counterparty), since the information about the deal will be identical for both users.
Figure 20

The information in the list of open trades is arranged in the following order:

  1. Trade id — serial number of the offer;
  2. Your counterparty — counterparty username;
  3. You send — the number of tokens that the current user must send;
  4. Your status — payment status of the current user (sent/expected);
  5. You receive — the number of tokens that the current user must receive (must be sent by the counterparty);
  6. Counterparty status — payment status of the counterparty user (sent / expected);
  7. Rate — the exchange rate (set by the user themself or the counterparty) with the ability to display the reverse rate;
  8. Deadline — the deadline for the execution of the deal (if the obligations are not fulfilled on time, the deal is canceled);
  9. Trade creator is the initiator of the trade.

The last column contains buttons that change according to the status of the deal (Figure 19):

  • Cancel and withdraw button — if the user wants to cancel the deal, but the tokens have already been deposited, click on the button and the tokens will be withdrawn from the deal.
  • Cancel button — if the deal has not yet been executed, then it can be canceled by clicking on this button. After that, the deal will move from the “Open” subsection to the “Closed” subsection.
  • Approve button — if the deal has not yet been executed, then to complete it, the user needs to give the smart contract permission to transfer tokens (the permission size is the amount of the deal) by clicking on this button. This button is absent/doesn’t exist if the current user intends to send ETH.
  • Support button — allows the user to add tokens to the smart-contract (appears instead of the Approve button after providing the smart contract with the permission to transfer tokens).

If none of the counterparties has added tokens to the deal within the specified period or any of the counterparties have canceled the deal, then it is considered closed (it moves from the “Open” subsection to the “Closed” subsection).

If one of the counterparties has added/deposited tokens to the deal, and then the deal expires, then it goes to the “Closed” subsection for the counterparty who did not have time to deposit tokens within the specified time period, and remains in the “Open” subsection for the counterparty who contributed tokens. For this user, the Cancel and withdraw button appears so that they can withdraw his tokens from the transaction.

2. The “Closed” subsection contains all completed (closed) deals of the current user (Figure 21). The information in the list of closed deals is almost identical to that in the list of open deals: the Actions column is replaced by the Status column.

Figure 21

Possible status scenarios and meanings:

  • Succeeded — contained when both counterparties have deposited tokens and the deal is considered executed;
  • Canceled — contains when at least one of the counterparties canceled the deal or did not deposit tokens within the specified period.

How the user interacts with counterparties

To interact with counterparties the user should go to the “My Chats” section (Figure 22).

Figure 22

This section has three filters (Figure 23):

  1. All ads — all chats of the current user are displayed;
  2. My ads — display chats for offers created by the current user (other users write to the current user based on the offers they made);
  3. Other ads — displays chats for proposals created by other users (the current user writes to them according to their proposals).
Figure 23

The information in the chats list (Figure 24) is arranged in the appropriate order:

Figure 24
  1. — serial number of the chat;
  2. Your counterparty — counterparty username;
  3. Advert — brief information about the offer: tokens, exchange rate, and range;
  4. Last message preview — preview of the last message in the chat;
  5. Last date — date and time of the last message;
  6. Actions — available actions within the chat and offers.

The Actions column contains two buttons:

  1. The Answer button allows the user to answer another user (counterparty) in the chat;
  2. The Create trade button allows the user to create a trade (see the section “How to create a new trade”).

When the user clicks the Answer button, they are moved/transferred to the chat window (Figure 25).

Figure 25

The chat with the user contains the following information:

  • Ad — offer details;
  • Ad creator — the creator of the offer (both username and wallet address can be displayed);
  • Counterparty messages on the left highlighted in green (with the date and time of the message);
  • Messages of the current user on the right highlighted in gray (with the date and time of the message);
  • The line for entering a message and sending it later.

--

--

Nimbus Platform

DAO-governed platform that offers 16 earning strategies for users boosted by multiple layers of risk-management. https://link.nimbusplatform.io/medium