An oracle for the real world, with a taste of innovation
Project Redstone: An oracle for the real world, with a taste of innovationIntroduction:As a blockchain-based oracle, Redstone plays a key role in con...
Oracle redstone from another perspective
Redstone: Oracle for the real worldRedstone is a blockchain-based oracle that provides real-world data to decentralized applications (dApps) and smar...
Oracle Redstone: Gateway to the Real World in Blockchain and Web 3
Oracle Redstone: Gateway to the Real World in Blockchain and Web 3Introduction:Oracle Redstone is an advanced Oracle platform that provides blockchai...
An oracle for the real world, with a taste of innovation
Project Redstone: An oracle for the real world, with a taste of innovationIntroduction:As a blockchain-based oracle, Redstone plays a key role in con...
Oracle redstone from another perspective
Redstone: Oracle for the real worldRedstone is a blockchain-based oracle that provides real-world data to decentralized applications (dApps) and smar...
Oracle Redstone: Gateway to the Real World in Blockchain and Web 3
Oracle Redstone: Gateway to the Real World in Blockchain and Web 3Introduction:Oracle Redstone is an advanced Oracle platform that provides blockchai...
Share Dialog
Share Dialog
Subscribe to ssarra.eth
Subscribe to ssarra.eth
<100 subscribers
<100 subscribers
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 /
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
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 /
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
No activity yet