Renewable energy exchange

First, all of our Mantle Labs top-level applications are made by our newcomers in the dev team to play with the technology and also prove how easy it can be to work with blockchain technology when you have access to Mantle tech. The biggest challenge when developing a top-level app is not the Mantle interaction but just how you want your application.

Before we begin, this application is open source in our Mantle Labs, so feel free to use it and even improve it. Everything is in Reference at this end of the page.

What can I do with it?

So, you have access to Mantle Tracker, what can you do with it?

The following example is a simple application you can put on the top of it, let's do a renewable energy exchange!

So let's start by creating single assets that will be our basics renewable energy:

  • Wind power: WIN
  • Hydropower: HYD
  • Solar Energy: SOL
  • Geothermal Energy: GEO
  • BioEnergy: BIO

By using our API, simply do this call for every asset you want to create (see this page for more details):

curl -X POST \
  http://api.mantleblockchain.com/tracker/{{PRODUCT_ID}}/assets \
  -H 'Accept: text/plain, application/json, text/json' \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: {{API_KEY}}' \
  -d '{ "name": "Wind power" }'

You will need to be able to list all of your assets you just have created, and this can be done by this call (see this page for more details):

curl -X GET \
  http://api.mantleblockchain.com/tracker/{{PRODUCT_ID}}/assets \
  -H 'Accept: text/plain, application/json, text/json' \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: {{API_KEY}}'

When you have all of your assets ready, in our application we did generate a mock-up of random fluctuation prices on the value of these assets (this should be replaced later on by a real pricing market based on your selling product itself backed on resources such as gold for example). Let's take a look at how it's supposed to look:

1262

As you see, we can buy/sell the selected asset.

In order to buy/sell an amount of the asset, this will create an order ready to be matched with the opposite order of another user. A connected user can manually select an order to exchange with it or later on an AI could match the best orders by completing them or fractional them.

To issue the actual base amount of these assets in order to create the asset owner first sales, simply do this call to issue amount from an asset (see this page for more details):

curl -X POST \
  http://api.mantleblockchain.com/tracker/{{PRODUCT_ID}}/assets/{{ASSET_ID}}/issue \
  -H 'Accept: text/plain, application/json, text/json' \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: {{API_KEY}}' \
  -d '{ "recipientEmail": "{{RECIPIENT_EMAIL}}", "amount": {{AMOUNT_TO_ISSUE}} }'

Then, when users want to exchange their assets to other users, this call will transfer an amount from an asset to another user (see this page for details):

curl -X POST \
  http://api.mantleblockchain.com/tracker/{{PRODUCT_ID}}/assets/{{ASSET_ID}}/transfer \
  -H 'Accept: text/plain, application/json, text/json' \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: {{API_KEY}}' \
  -d '{ "recipientEmail": "{{RECIPIENT_EMAIL}", "amount": {{AMOUNT_TO_TRANSFER}} }'

And with these simple calls, here you are making your exchange blockchain enable. Enjoy!

References

https://github.com/mantle-labs/renewable-energy-credits
https://docs.mantleblockchain.com/docs/tracker-concepts