# Oracle redstone for developers

By [ssarra.eth](https://paragraph.com/@ssarra.eth) · 2024-01-30

---

Introduction:

RedStone is an oracle based on the Arweave blockchain that enables Dapps (decentralized applications) to access real-world data securely, reliably and cost-effectively. This tutorial will show you how to use RedStone Oracle for your Dapp using images and examples.

prerequisites:

Introduction to blockchain and Dapps

Familiarity with Solidity programming language

Familiarity with APIs

levels:

1\. Create a RedStone account:

Go to the RedStone website: https: / / [redstone.finance](http://redstone.finance) /

Click on "Sign Up".

Enter the required information in the registration form.

Click on "Create Account".

Figure 1: RedStone website and Sign Up button

2\. Create a data request:

In the RedStone dashboard, click on "Data Requests".

Click on "Create Request".

Select the type of data you want to get from the real world. For example, select "Price Data".

Figure 2: RedStone dashboard and Data Requests and Create Request buttons

3\. Selection of data source:

In the "Data Source" field, select the data source.For example, select "CoinMarketCap API".

Enter the API Key and other necessary information.

Figure 3: Selection of data source and API Key

4\. Request configuration:

Select the data update frequency. For example, select "5 minutes".

Choose how to pay for data. For example, select "Pay as you go".

5\. Send request:

Click on "Submit Request".

Your request will appear in the "Data Requests" list.

6\. Receiving data:

Your Dapp can access data from the real world through the RedStone API

**To get the price of Bitcoin, use the following code:**

`pragma solidity ^0.8.0;`

`import "@redstone.finance/contracts/RedStone.sol";`

`contract BitcoinPrice is RedStone {`

`function getBitcoinPrice() public view returns (uint256) {`

`// Get the latest data request`

`DataRequest request = getDataRequest(1);`

`// Check if the request is successful`

`require(request.status == RequestStatus.Success);`

`// Get the data from the response`

`uint256 price = abi.decode(request.response, (uint256));`

`return price;`

`}`

`}`

Example:

Let's say you want to create a Dapp to display the price of Bitcoin in USD. Follow the steps below:

Create a RedStone account.

Create a data request to get bitcoin price.

Select the data source as CoinMarketCap API.

Set data update frequency as 5 minutes.

Submit the request

Display data:

After receiving the data from RedStone Oracle, you can display it in your Dapp. For example, you can use the following code to display the price of Bitcoin in an HTML element with the identifier "price":

`<div id="price"></div>`

`<script>`

`const priceElement = document.getElementById("price");`

`const updatePrice = () => {`

`const bitcoinPrice = getBitcoinPrice();`

`priceElement.textContent = $${bitcoinPrice};`

`};`

`setInterval(updatePrice, 5000);`

`updatePrice();`

`</script>`

Result:

Using RedStone Oracle, you can easily build Dapps that access real-world data such as currency prices, weather data, sports data, and more. RedStone Oracle is a powerful tool for Dapp developers that allows them to build more powerful and efficient Dapps that fully meet the needs of users.

Hints:

RedStone uses a "Pay-as-you-go" payment model. You only pay for the data you use.

RedStone provides a complete API for developers that allows you to easily interact with RedStone Oracle.

For more information, see the RedStone documentation: https: / / [docs.redstone.finance](http://docs.redstone.finance)

---

*Originally published on [ssarra.eth](https://paragraph.com/@ssarra.eth/oracle-redstone-for-developers)*
