Introduction 🌐:

  • The content below contains instructions on how to interact with the application. The logic behind the web application restricts the calling of functions to certain addresses only, respecting the implemented business logic. Also included here are instructions on how to interact with the graphql server and the server manager of each of the Cartesi machines.

User Stories 📖:

  • Here we are going to list all the user stories that the frontend covers, and then instruct on how to execute them:

    1st "I, as an agent of Lilium, want to tokenize a forest carbon credit compensation project to have a monetary award for the service."

    2nd "I, as an agent of a tokenized forest reserve, want to include a new IoT device in its area to check the state of my forest and ensure that the tokens I am selling have a real backing."

    3rd "I, as an agent of the forest reserve that hired Lilium's services, need to inform the contract that represents my reserve on the blockchain, what are the addresses of my Cartesi DApps to be able to check the state of the real world and sell my carbon credit tokens issued via auction."

    4th "I, as a hardware/IoT device installed in the forest region, need to collect data and send them to be verified and compared with previous analyses carried out in that type of region by the computer vision and classification model that are within the Cartesi DApp (Verifier)."

    5th "I, as an agent of the forest reserve, want to stake carbon credit tokens in the forest reserve contract to be able to start an auction to sell these tokens in the future."

    6th "I, as an agent of the forest reserve, who already have tokens in stake, want to start an auction to sell these tokens in a way that my final profit is as high as possible. This will interact with the Cartesi DApp (Auction)."

    7th "I, as a company or individual who emitted or will emit carbon, want to bid in a carbon credit auction, passing the amount of tokens I am interested in and the value I wish to pay for each token to be able to acquire carbon credits."

    8th "I, as interested in the auction result and that its time has already ended, want to perform the operation to finalize it."

    - This operation generates vouchers for both winners and losers.
    

    9th "I, as an agent of the forest reserve, want to withdraw the carbon credit tokens in stake from my contract."

    10th "I, as a person who holds carbon credits, want to transfer them to another entity."

    11th "I, as an entity that wishes to offset my carbon emission, want to retire them."

    - In a future version, when retiring, the function caller earns a certificate [NFT].
    

Setup ⚙️:

Step 1: Import the system entities 🗃️

  • To interact with the application, it is necessary to import specific wallets ( The contracts that this application is using are configured to restrict function calls to these wallets ):
{
   PRIVATE_KEY_LILIUM_AGENT_TESTNET="87e4fedadb3031e64671c25c5342a07f003cf56e47072df3fd5ef5c8ee8e3184"
   
   PRIVATE_KEY_FOREST_AGENT_TESTNET="ee0df441f3dfac55cd861928ce69255507aed863ec2122d0e256a748f56402ee"
   
   PRIVATE_KEY_DEVICE_TESTNET="92aeae239988b3a66a924c651230e57e73dd7c3599d3a88716651623b1d9ba34"
}

Tip 1: When importing these wallets, change their name in Metamask to the name of the entity they represent.

Tip 2: Make sure that all wallets, after importation, have the necessary funds to perform interactions with the blockchain.

Step 2: Build and deploy DApps 🛠️

To build and deploy the DApps, follow the information contained in the links below:

Interactions 🔄:

  • Below are the instructions on how to interact with each section of the application, which user story that section fulfills, and some metadata of the performed operation.

New Forest Section 🌲:

  • User story number 1
  • Required past interactions: No past interactions.
  • Step 1: Connect the Metamask to Lilium Agent Wallet.
  • Step 2: Fill in the fields with the same types as the placeholders indicate and do not use commas for the numbers.
  • Step 3: Click to perform the transaction.
  • INFO:

New Device Section 📲:

  • User story number 2
  • Required past interactions: No past interactions.
  • Step 1: Connect the Metamask to Forest Agent Wallet.
  • Step 2: Pass here an address that will represent the new device (this address will be able to call the "verifyRealWorldState" function shown further ahead).
  • Step 3: Click to perform the transaction.
  • INFO:

Rollup DApp Addresses Section 🔄

⚠️ To perform this operation, you first need to have completed the setup

Hardware Simulation Section 💻:

⚠️ To perform this operation, you first need to have completed the setup

  • User story number 4
  • Required past interactions: New Device Section, Rollup DApp Addresses Section.
  • Step 1: Download any photo from this folder hosted on IPFS (It contains images that the computer vision model will detect trees).
  • Step 2: Run a node with your Cartesi DApp, following the instructions contained in the verifier repository.
  • Step 3: Connect the Metamask to Hardware Device Wallet.
  • Step 4: Fill in the fields with the same types as the placeholders indicate and do not use commas for the numbers. Also, input one of the images contained in the zip downloaded previously.
  • Step 5: Click to perform the transaction.
  • INFO:

IoT Simulation Outputs Section 📊

⚠️ To perform this operation, you first need to have completed the setup

  • Required past interactions: Hardware Simulation Section.

  • Step 1: Run a node with your Cartesi DApp, following the instructions contained in the verifier repository.

  • Step 2: Install Ngrok

  • Step 3: Create a tunnel with ngrok, allowing you to access your graphql server through a public URL:

    $ ngrok http http://localhost:4000
  • Step 4: Insert the https URL generated by ngrok into the Image output field ( Ex:. https://15c0-177-92-77-170.ngrok-free.app ).

  • Step 5: Click the button to make the request.

  • Step 6: Create a tunnel with ngrok, allowing you to access your server manager through a public URL:

    $ ngrok http http://localhost:5005
  • Step 7: Insert the https URL generated by ngrok into the Verifier State field ( Ex:. https://15c0-177-92-77-170.ngrok-free.app ).

  • Step 8: Click the button to make the request.

Stake Carbon Credits Section 💰

  • User story number 5
  • Step 1: Connect the Metamask to Forest Agent Wallet.
  • Step 2: Insert the amount of tokens you wish to stake and do not use commas for the numbers.
  • Step 3: Click to perform the transaction.
  • INFO:

Create New Auction Section 🛍️

⚠️ To perform this operation, you first need to have completed the setup.

  • User story number 6
  • Required past interactions: Rollup DApp Addresses Section.
  • Step 1: Run a node with your Cartesi DApp, following the instructions contained in the auction repository.
  • Step 2: Connect the Metamask to Forest Agent Wallet.
  • Step 3: Fill in the fields with the same types as the placeholders indicate and do not use commas for the numbers.
  • Step 4: Click to perform the transaction.
  • INFO:

New bid Section 💸

⚠️ To perform this operation, you first need to have completed the setup

  • User story number 7
  • Required past interactions: Create New Auction Section.
  • Step 1: Run a node with your Cartesi DApp, following the instructions contained in the auction repository.
  • Step 2: Connect the Metamask to Forest Agent Wallet.
  • Step 3: Fill in the fields with the same types as the placeholders indicate and do not use commas for the numbers ( Make sure you have enough tokens to send as the bid value: Amount x Price per token ).
  • Step 4: Click to perform the transaction.
  • INFO:

Finish Auction Section 🏁

⚠️ To perform this operation, you first need to have completed the setup

  • User story number 8
  • Required past interactions: Rollup DApp Addresses Section.
  • Step 1: Run a node with your Cartesi DApp, following the instructions contained in the auction repository.
  • Step 2: Connect to any wallet ( This operation will only be executed on the Cartesi machine if the determined time for the auction has already passed ).
  • Step 3: Click to perform the transaction.
  • INFO:

Auction Outputs Section 📤

⚠️ To perform this operation, you first need to have completed the setup

  • Required past interactions: Create New Auction Section or Create New Auction Section + New bid Section or Create New Auction Section + New bid Section + Finish Auction Section.

  • Step 1: Run a node with your Cartesi DApp, following the instructions contained in the auction repository.

  • Step 2: Install Ngrok

  • Step 3: Create a tunnel with ngrok, allowing you to access your server manager through a public URL:

    $ ngrok http http://localhost:5005
  • Step 4: Insert the https URL generated by ngrok into the Verifier State field ( Ex:. https://15c0-177-92-77-170.ngrok-free.app )

  • Step 5: Click the button to make the request

Withdraw Section 🏦

  • User story number 9
  • Required past interactions: Stake Carbon Credits Section.
  • Step 1: Connect the Metamask to Forest Agent Wallet.
  • Step 2: Insert the amount of tokens you wish to withdraw and do not use commas in the number.
  • Step 3: Click to perform the transaction.
  • INFO:

Transfer Tokens Section 🔄:

  • User story number 10
  • Step 1: Connect your MetaMask to a wallet that has carbon credits.
  • Step 2: Fill in the fields with the same types as the placeholders indicate and do not use commas for the numbers.
  • Step 3: Click to perform the transaction.
  • INFO:

Retire Tokens Section 🔄:

  • User story number 11
  • Step 1: Connect your MetaMask to a wallet that has carbon credits.
  • Step 2: Fill in the fields with the same types as the placeholders indicate and do not use commas for the numbers.
  • Step 3: Click to perform the transaction.
  • INFO: