fbpx
Crypto on Magicbit
MagicBlocks Project

Crypto on Magicbit

Make Magicbit display upto date Crypto currency status.

Introduction

In this lesson, we will use a Magicbit board to display the Cryptocurrency details. We will use an API service to obtain the latest news on Cryptocurrency. We have used API services before in previous lessons lesson.

Intended Learning Outcomes

  • You will learn how to handle Crypto API.
  • You will learn how to give a display output to the Magicbit.

What is CryptoCurrency?

A cryptocurrency, crypto-currency, or crypto is a digital currency designed to work as a medium of exchange through a computer network that is not reliant on any central authority, such as a government or bank, to uphold or maintain it.

The advantages of cryptocurrencies include cheaper and faster money transfers.

The disadvantages of cryptocurrencies include their price volatility, high energy consumption for mining activities, and use in criminal activities.

Setting up the Nodes

First, you need the below nodes.

       

Make the following arrangement.

Configuring the Inject Node.

Double click on it to access its settings. Make the below settings.

Now, let’s configure the HTTP request block.

  • Enter Method as GET.
  • Set the return field as “a parsed JSON object”
  • Paste the given link on the URL field:

https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest?CMC_PRO_API_KEY=e01f4a68-4ea6-4fba-83da-8cf1eef8ba2c

Function Node

Enter the given code in the Function.

var coinName = msg.payload.data[0].name;
var coinRank = msg.payload.data[0].cmc_rank;
var coinSymbol = msg.payload.data[0].symbol;
var coinVal = msg.payload.data[0].quote.USD.price;

msg.payload = "Coin Details...."+"\n"+"Name:     "+coinName + "\n" + "Rank:     "+coinRank+"\n" + "Symbol:   "+coinSymbol+"\n" + "Price:    "+Math.trunc(coinVal)+" $";
msg.topic = "";

return msg;

Template Node

Enter the below settings.

Display Node

Connect the Magicbit board with the Magicblocks platform.

Enter the Device(Board) ID. you can see your device ID in the devices tab.

Related Posts
Leave a Reply