From f5e0f23d9c3cfc769505958e2a114bd437ca86b7 Mon Sep 17 00:00:00 2001 From: AryamanXlighthouse <138587874+AryamanXlighthouse@users.noreply.github.com> Date: Thu, 26 Oct 2023 19:08:56 +0530 Subject: [PATCH 1/3] Lighthouse docs added (#464) * Lighthouse docs added * Update mint-nfts-lighthouse.md * add titles; remove from xcm section --------- Co-authored-by: Gregory Luneau Co-authored-by: Megan Skye Phoenix <58894568+meganskye@users.noreply.github.com> --- docs/build/EVM/precompiles/xcm/xcm.md | 2 +- .../lighthouse-encryption.md | 214 ++++++++++++++++++ .../leverage_parachains/mint-nfts-crust.md | 4 + .../mint-nfts-lighthouse.md | 133 +++++++++++ 4 files changed, 352 insertions(+), 1 deletion(-) create mode 100644 docs/build/builder-guides/leverage_parachains/lighthouse-encryption.md create mode 100644 docs/build/builder-guides/leverage_parachains/mint-nfts-lighthouse.md diff --git a/docs/build/EVM/precompiles/xcm/xcm.md b/docs/build/EVM/precompiles/xcm/xcm.md index 413d752cd3d..300b0c6dd69 100644 --- a/docs/build/EVM/precompiles/xcm/xcm.md +++ b/docs/build/EVM/precompiles/xcm/xcm.md @@ -241,7 +241,7 @@ XCM.Multilocation memory asset = XCM.Multilocation({ #### Builder Guides -Three builder guides on the subject of EVM XCM are available in Builder section: +Three builder guides on the subject of EVM XCM are available in the Builder section: - [How to create and interact with a mintable XC20 asset via Solidity smart contract](../../../builder-guides/leverage_parachains/interact_with_xc20.md) - [Harnessing Crust Network for NFT Minting: A Developer's Guide](../../../builder-guides/leverage_parachains/mint-nfts-crust.md) diff --git a/docs/build/builder-guides/leverage_parachains/lighthouse-encryption.md b/docs/build/builder-guides/leverage_parachains/lighthouse-encryption.md new file mode 100644 index 00000000000..ae4d2dc6508 --- /dev/null +++ b/docs/build/builder-guides/leverage_parachains/lighthouse-encryption.md @@ -0,0 +1,214 @@ +--- +title: Lighthouse Encryption +--- + +# Utilizing Lighthouse Encryption on Astar for Enhanced Security: A Developer's Guide + +The realm of digital data has grown immensely, both in terms of volume and significance. As the usage of digital assets like NFTs increases, there's a compelling need to ensure that these assets are stored securely and accessibly. This guide introduces a new dimension of security, detailing how to encrypt data using Lighthouse Storage and then store and retrieve it on the Astar Network EVM. The focus is on leveraging Lighthouse Encryption in tandem with the blockchain capabilities of Astar Network. + +## Introduction + +#### Lighthouse Encryption +With an increasing volume of sensitive and important data being stored online, data encryption has become crucial. Lighthouse offers a robust encryption service, ensuring data remains confidential and secure. Their encryption approach goes beyond traditional methods, making data access seamless yet guarded. + +#### Why Lighthouse Encryption? +* **Guarded Yet Accessible**: Lighthouse encryption ensures that while data is securely encrypted, it remains accessible to those with the right credentials. +* **Immutable and Distributed**: Leveraging the decentralization principles of blockchain, Lighthouse ensures that encrypted data remains tamper-proof and spread across a wide network. +* **Developer-Friendly**: Like its storage counterpart, Lighthouse Encryption comes with a suite of developer tools, including SDKs in various languages and a CLI for streamlined operations. + +#### Getting Started with Lighthouse Encryption +* Website: https://lighthouse.storage +* Sign into [Files Dapp](https://files.lighthouse.storage/) with your wallet or your GitHub account to start uploading files to Lighthouse. +* Optionally: + * Get [Lighthouse CLI](https://lighthouse-1.gitbook.io/lighthouse-1/cli-tool/overview) + * Get [Lighthouse Javascript SDK](https://lighthouse-1.gitbook.io/lighthouse-1/lighthouse-sdk/overview) + * Get [Python SDK](https://pypi.org/project/lighthouseweb3/) + +For this tutorial, we will employ the Lighthouse Javascript SDK to encrypt and decrypt data using Lighthouse. + + +## Encrypting Data with Lighthouse + +Lighthouse provides a simple yet robust solution for encrypting data on the IPFS network. + +**Step 1:** **Install the required dependencies:** + +```shell +npm install dotenv ethers @lighthouse-web3/sdk +``` + +**Step 2:** **Use lighthouse-SDK to upload encrypted data on the IPFS and get the Hash:** + +*Note: In this example, we are using ES6 so we have to save the file as filename.mjs or define "type": "module", in the package.json file.* + +```javascript +import * as dotenv from 'dotenv'; +dotenv.config(); +import { ethers } from "ethers"; +import lighthouse from '@lighthouse-web3/sdk'; + +const signAuthMessage = async (publicKey, privateKey) => { + const provider = new ethers.JsonRpcProvider(); + const signer = new ethers.Wallet(privateKey, provider); + const messageRequested = (await lighthouse.getAuthMessage(publicKey)).data.message; + const signedMessage = await signer.signMessage(messageRequested); + return signedMessage; +} + +const deployEncrypted = async () => { + const path = "/mnt/c/Users/ravis/Pictures/Screenshots/flow1.png"; // Provide the absolute path to the file + const apiKey = process.env.API_KEY; + const publicKey = "0xa3c960b3ba29367ecbcaf1430452c6cd7516f588"; + const privateKey = process.env.PRIVATE_KEY; + const signedMessage = await signAuthMessage(publicKey, privateKey); + + const response = await lighthouse.uploadEncrypted( + path, + apiKey, + publicKey, + signedMessage + ); + + // Display response + console.log(response); +} +deployEncrypted(); +``` + +**Expected Response:** + +```bash +{ + data: [{ + Name: 'flow1.png', + Hash: 'QmQqfuFH77vsau5xpVHUfJ6mJQgiG8kDmR62rF98iSPRes', + Size: '31735' + }] +} +``` + +**Step 3:** **Customize the code:** + +* Update the `path` variable with the actual absolute path to the file you want to upload. +* Replace `0xa3c960b3ba29367ecbcaf1430452c6cd7516f588` with your own public key. +* Ensure you have the corresponding private key stored in the `PRIVATE_KEY` environment variable. + +**Step 4:** **Configure the API key and the Private Key:** + +* Create a .env file in your project's root directory. +* Add the following content to the .env file: + +```makefile +API_KEY=YOUR_API_KEY +PRIVATE_KEY=YOUR_PRIVATE_KEY +``` + +* Replace `YOUR_API_KEY` with your actual API key obtained from [Lighthouse API Key Node Application](https://docs.lighthouse.storage/lighthouse-1/lighthouse-sdk/code-examples/nodejs-backend/api-key) or using the [Lighthouse CLI command](https://docs.lighthouse.storage/lighthouse-1/cli-tool/cli-commands/api-key) `lighthouse-web3 api-key --new`. +* Replace `YOUR_PRIVATE_KEY` with your own private key corresponding to the public key used in the code (Can be obtained from the wallet.json file made while [creating a wallet](https://docs.lighthouse.storage/lighthouse-1/cli-tool/cli-commands/create-wallet)). + +**Step 5:** **Run the Node.js application to upload the file:** + +* In the terminal, while in the `lighthouse-encryption-app` directory, run the following command: + +```shell +node app.js +``` + +## Storing Encrypted Data on Astar Network + +Once encrypted, this data can now be stored safely on the Astar Network. + +```javascript +async function storeOnAstar(key, encryptedHash) { + // Assuming you have a contract with a setData function to store data + const txResponse = await yourContract.setData(key, encryptedHash); + const txReceipt = await txResponse.wait(); + + console.log("Data stored successfully on Astar Network!"); +} +``` + +## Retrieving and Decrypting Data + +To read back your encrypted data from the Astar Network and decrypt it: + +**Step 1: Retrieve data from the Astar Chain:** +```javascript +async function getFromAstar(key) { + // Assuming you have a contract with a setData function to store data + const txResponse = await yourContract.getData(key); + + console.log("Data retrieved successfully from Astar Network: ", txResponse); +} +``` + +**Step 2: Retrieve and Decrypt data from the Lighthouse Storage:** + +```javascript + +const signAuthMessage = async (publicKey, privateKey) => { + const provider = new ethers.JsonRpcProvider(); + const signer = new ethers.Wallet(privateKey, provider); + const messageRequested = (await lighthouse.getAuthMessage(publicKey)).data.message; + const signedMessage = await signer.signMessage(messageRequested); + return signedMessage; +} + +const decrypt = async () => { + const cid = txResponse; //Example: 'QmbGN1YcBM25s6Ry9V2iMMsBpDEAPzWRiYQQwCTx7PPXRZ' + const publicKey = "YOUR_PUBLIC_KEY"; //Example: '0xa3c960b3ba29367ecbcaf1430452c6cd7516f588' + const privateKey = process.env.PRIVATE_KEY; + + // Get file encryption key + const signedMessage = await signAuthMessage(publicKey, privateKey); + const fileEncryptionKey = await lighthouse.fetchEncryptionKey( + cid, + publicKey, + signedMessage + ); + + // Decrypt File + const decrypted = await lighthouse.decryptFile( + cid, + fileEncryptionKey.data.key + ); + + // Save File + fs.createWriteStream("fileName.txt").write(Buffer.from(decrypted)); +} + +decrypt(); +``` +--- +## Advanced Features of Lighthouse SDK: Access Control & File Sharing + +* **Access Control:** +Lighthouse SDK doesn't just stop at encryption. It also provides a range of advanced features, allowing developers to implement various access control mechanisms. Here's a quick look at some of the types of access control conditions supported: + + **Types of Access Control conditions:** + + 1. **NFTs and Tokens** + * **ERC20**: Standard for fungible tokens, allowing a seamless integration for token-based access control. + * **ERC721**: Often used for NFTs, granting unique asset-based access. + * **ERC1155**: A multi-token standard, allowing for both fungible and non-fungible tokens. + + 2. **Custom Contracts Deployed**: Integration with your custom smart contracts, granting or restricting access based on specific contract conditions. + + 3. **Native Chain Token (like ETH)**: Implement access control based on native blockchain assets. + + 4. **Time-based Access**: Grant or restrict access based on specific time constraints, allowing for temporary permissions. + +* **Sharing Files Using Lighthouse Node**: + The Lighthouse SDK also provides the ability to share encrypted files with other users. This feature can be especially useful when you want to provide access to a specific piece of data without revealing your encryption keys or compromising security. + +**For more in-depth information on implementaion and practical examples, Lighthouse's official documentation is a treasure trove:** + +* [Access Control](https://docs.lighthouse.storage/lighthouse-1/lighthouse-sdk/code-examples/nodejs-backend/access-control-node) +* [Access Control Conditions](https://docs.lighthouse.storage/lighthouse-1/lighthouse-sdk/code-examples/access-conditions) +* [Sharing File](https://docs.lighthouse.storage/lighthouse-1/lighthouse-sdk/code-examples/nodejs-backend/share-file-nodejs) + +## Conclusion + +By harnessing the power of Lighthouse Encryption combined with the Astar Network's decentralized capabilities, developers can ensure that data remains both accessible and confidential. As we move into an era where data is the new gold, tools and practices like these will become fundamental in the evolving digital landscape. + +--- diff --git a/docs/build/builder-guides/leverage_parachains/mint-nfts-crust.md b/docs/build/builder-guides/leverage_parachains/mint-nfts-crust.md index 3551777b934..0d32b93921c 100644 --- a/docs/build/builder-guides/leverage_parachains/mint-nfts-crust.md +++ b/docs/build/builder-guides/leverage_parachains/mint-nfts-crust.md @@ -1,3 +1,7 @@ +--- +title: Mint NFTs with Crust +--- + # Harnessing Crust Network for NFT Minting: A Developer's Guide ![](https://hackmd.io/_uploads/r12FVSxHn.jpg) diff --git a/docs/build/builder-guides/leverage_parachains/mint-nfts-lighthouse.md b/docs/build/builder-guides/leverage_parachains/mint-nfts-lighthouse.md new file mode 100644 index 00000000000..4972bb7e91c --- /dev/null +++ b/docs/build/builder-guides/leverage_parachains/mint-nfts-lighthouse.md @@ -0,0 +1,133 @@ +--- +title: Mint NFTs with Lighthouse +--- + +# NFT Minting Simplified: A Developer’s Guide to Lighthouse and Astar Network + +The world of Non-Fungible Tokens (NFTs) has revolutionized the digital realm, offering unique opportunities for creators and enthusiasts. Entering this domain can be challenging, especially when integrating with blockchain technology. This guide simplifies the process, detailing how to create and manage NFTs using the Astar Network EVM and Lighthouse Storage while leveraging the XCM protocol communication. + +## Introduction +#### Lighthouse Storage +In an era defined by digital data, a reliable and enduring file storage solution is of paramount importance. Lighthouse emerges as a front-runner in this domain, offering a storage model designed for the long haul. It uses the miner network and storage capacity of the Filecoin network and the IPFS content-addressing system. Lighthouse's reliance on IPFS ensures widespread file replications across a myriad of Filecoin miners, effectively bolstering data reliability and simplifying the nuances of sustainable, long-term, and perpetual storage. + +#### Understanding Lighthouse +Before diving deep into the steps, let's get a clear picture of Lighthouse: + +* **Sustainable Storage**: With an eye on the future, Lighthouse's storage model emphasizes longevity and resilience. +* **Encrypted Data**: Developers benefit from storing encrypted data on Lighthouse, paving the way to craft token-gated applications. +* **Developer-Centric**: Lighthouse not only values data security but also ensures ease of integration by offering a variety of SDKs in various languages and a dedicated CLI. + +#### Setting Up Lighthouse +* Website: https://lighthouse.storage +* Sign into [Files Dapp](https://files.lighthouse.storage/) with your wallet or your GitHub account to start uploading files to Lighthouse. +* Optionally: + * Get [Lighthouse CLI](https://lighthouse-1.gitbook.io/lighthouse-1/cli-tool/overview) + * Get [Lighthouse Javascript SDK](https://lighthouse-1.gitbook.io/lighthouse-1/lighthouse-sdk/overview) + * Get [Python SDK](https://pypi.org/project/lighthouseweb3/) + +In this tutorial we will be using the Lighthouse Javascript SDK to upload a file using Lighthouse. + + + +## Step 1: Setting Up an EVM Wallet +Before crafting your NFT, ensure you have a Web3 wallet ready. This wallet bridges traditional web browsers with the Ethereum blockchain, a renowned platform for NFTs. Popular choices include Metamask, Talisman, and Subwallet. +- Start by connecting your Web3 wallet. + +```javascript +async connect() { + const connect = await this.onboard.connectWallet(); + this.wallet = await this.onboard.connectedWallet; + + if (this.wallet) { + this.provider = new ethers.providers.Web3Provider(this.wallet.provider); + this.signer = this.provider.getSigner(); + this.address = await this.signer.getAddress(); + this.set(); + } + + return { connect }; +} +``` + +For a comprehensive understanding of the onboard wallet provider, refer to [this article](https://astar.network/blog/one-small-piece-of-code-one-giant-leap-for-web3-37760/). + +## Step 2: Digital Signatures +With a connection established, you'll need to sign a message. This signature is crucial for Lighthouse's API to authenticate your EVM address. Consider it your digital stamp, verifying your blockchain identity. +- Click the "Sign" button to authenticate. + +```javascript +async sign() { + this.sig = await this.signer.signMessage(this.address); +} +``` + +## Step 3: Uploading to Lighthouse - Your First Major Move +With your signature ready, it's time to upload your image and metadata to the Lighthouse network. This decentralized platform ensures your data's safety and accessibility. +- Click the "Upload" button to begin. + +```javascript +import * as dotenv from 'dotenv'; +dotenv.config(); +import lighthouse from '@lighthouse-web3/sdk'; + +const uploadFile = async () => { + const path = "path/to/your/file"; // Provide the path to the file + const apiKey = process.env.API_KEY; + // Generate the API key from https://files.lighthouse.storage/ + //or using CLI (lighthouse-web3 api-key --new) + + // Both files and folders are supported by the upload function + const response = await lighthouse.upload(path, apiKey); + + console.log(response); + console.log("Visit at: https://gateway.lighthouse.storage/ipfs/" + response.data.Hash); + return `https://gateway.lighthouse.storage/ipfs/${response.data.Hash}` +} + +let tokenURI = uploadFile(); + +``` + +## Step 4: Minting Your NFT +With your data pinned, you're set to mint your NFT. This step transforms your digital asset into a unique, blockchain-certified NFT. +- Click the "Mint" button to finalize. + +```javascript +import * as dotenv from 'dotenv'; +dotenv.config(); + +const abi = [....] //your contract ABI + +const contractAddress = process.env.CONTRACT_ADDRESS; +const privateKey = process.env.PRIVATE_KEY; + +async mint() { + // Get signer and provider + const provider = new ethers.JsonRpcProvider(); + const signer = new ethers.Wallet(privateKey, provider); + + const contract = new ethers.Contract( + contractAddress, + abi, //write a smart contract to handle minting of NFT + signer + ); + + // Mint the NFT + const txResponse = await contract.mintNFT(this.tokenURI); + const txReceipt = await txResponse.wait(); + const [transferEvent] = txReceipt.events; + const { tokenId } = transferEvent.args; + console.log("NFT minted successfully!"); + console.log(`NFT tokenId: ${tokenId}`); + + const tokenURIonchain = await contract.tokenURI(tokenId); + console.log("tokenURI", tokenURIonchain); +} +``` + +Congratulations on minting your NFT! + +## Conclusion +This guide offers a step-by-step introduction to NFT creation and management using the Astar Network EVM and Lighthouse Network. As you familiarize yourself with these steps, you'll be better equipped to delve deeper into the dynamic world of NFTs. Welcome to the digital frontier! + +--- From 803ad10b2a1f3c21e5d46a52f68105e8091378ff Mon Sep 17 00:00:00 2001 From: "Mar.io" <34627453+Maar-io@users.noreply.github.com> Date: Thu, 26 Oct 2023 16:16:15 +0200 Subject: [PATCH 2/3] restructure gas fee information (#489) --- docs/build/zkEVM/fee.md | 65 ++++++++++++++++++++++++++- docs/build/zkEVM/zkevm-gas-station.md | 13 +++--- 2 files changed, 71 insertions(+), 7 deletions(-) diff --git a/docs/build/zkEVM/fee.md b/docs/build/zkEVM/fee.md index 8440f449a44..e92fa08480e 100644 --- a/docs/build/zkEVM/fee.md +++ b/docs/build/zkEVM/fee.md @@ -3,6 +3,8 @@ sidebar_position: 7 title: Astar zkEVM Fee Calculation sidebar_label: Fee Calculation --- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; ## How do network fees on Astar zkEVM work? In Astar zkEVM the gas fee is calculated by applying a fixed factor over L1 gas fee. That price factor is a fixed value and doesn't change often and it's value is based the rollup's cost to publish tx to L1. To Simply put, gas prices in L2 will linearly follow gas prices in L1. @@ -13,4 +15,65 @@ $$ The L1 fee will vary depending on the amount of transactions on the L1. If the timing of your transaction is flexible, you can save costs by submitting transactions during periods of lower gas on the L1 (for example, over the weekend) -The support for congestion mechanism based EIP-1559 [here](https://eips.ethereum.org/EIPS/eip-1559) is planned for future and will make the L2 gas fee dynamic. \ No newline at end of file +The support for congestion mechanism based EIP-1559 [here](https://eips.ethereum.org/EIPS/eip-1559) is planned for future and will make the L2 gas fee dynamic. + +## Fetch gas price from RPC node +The gas price can be fetched from the Astar zkEVM Sequencer using the following RPC call: + +```bash +curl https://rpc.zkatana.gelato.digital/ \ + -X POST \ + -H "Content-Type: application/json" \ + --data '{"method":"eth_gasPrice","params":[],"id":1,"jsonrpc":"2.0"}' + ``` + + The result is the hex value of the gas price in wei. + +## Use Blockscout Price Oracle +Blockscout Price Oracle calculates the gas price from the average of previous blocks. It doesn't call `eth_gasPrice`. + + + +Send a GET request to the [Blockscout Price Oracle endpoint](https://zkatana.blockscout.com/api/v1/gas-price-oracle) to get a gas price recommendation from this oracle. + +#### cURL + +```bash +curl https://zkatana.blockscout.com/api/v1/gas-price-oracle +``` + +#### JavaScript + +```javascript +fetch('https://zkatana.blockscout.com/api/v1/gas-price-oracle') + .then(response => response.json()) + .then(json => console.log(json)) +``` + +#### Python + +```python +import requests +requests.get('https://zkatana.blockscout.com/api/v1/gas-price-oracle').json() +``` + + + +coming soon... + + + + +### The Price Oracle Response + +An example JSON response will look like this. + +```json +{ + "average":0.02, + "fast":0.02, + "slow":0.02, +} +``` + +- {`average`, `fast`, `slow`} are gas prices in Gwei, you can use these prices before sending the transaction off to Astar zkEVM. \ No newline at end of file diff --git a/docs/build/zkEVM/zkevm-gas-station.md b/docs/build/zkEVM/zkevm-gas-station.md index 5bf10a35549..cd0517136ad 100644 --- a/docs/build/zkEVM/zkevm-gas-station.md +++ b/docs/build/zkEVM/zkevm-gas-station.md @@ -1,20 +1,21 @@ --- sidebar_position: 6 -title: Astar zkEVM Gas Station -sidebar_label: zkEVM Gas Station +title: Blockscout zkEVM Gas Oracle +sidebar_label: zkEVM Gas Oracle --- import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -The goal of **Astar zkEVM Gas Station** is to provide dApp developers with gas pricing suggestions so they can use them before sending transactions to the **Astar zkEVM** network. +## Overview +The **Blockscout Price Oracle** provides gas pricing suggestions which can be used by dApp developers before sending transactions to the **Astar zkEVM** network. ## Usage - +Blockscout Price Oracle takes the values from the average of previous blocks. It does't call `eth_gasPrice`. -Send a GET request to the [zKatana Gas Station endpoint](https://zkatana.blockscout.com/api/v1/gas-price-oracle) to get a gas price recommendation from this oracle. +Send a GET request to the [Blockscout Price Oracle endpoint](https://zkatana.blockscout.com/api/v1/gas-price-oracle) to get a gas price recommendation from this oracle. #### cURL @@ -56,4 +57,4 @@ An example JSON response will look like this. } ``` -- {`average`, `fast`, `slow`} are gas prices in Gwei, you can use these prices before sending the transaction off to Astar zkEVM, depending upon your needs \ No newline at end of file +- {`average`, `fast`, `slow`} are gas prices in Gwei, you can use these prices before sending the transaction off to Astar zkEVM. \ No newline at end of file From 86784eaf23a0319613f4594df8900f0650494e93 Mon Sep 17 00:00:00 2001 From: "Mar.io" <34627453+Maar-io@users.noreply.github.com> Date: Thu, 26 Oct 2023 16:30:22 +0200 Subject: [PATCH 3/3] remove gas station chapter (#491) --- docs/build/zkEVM/fee.md | 2 +- docs/build/zkEVM/zkevm-gas-station.md | 60 --------------------------- 2 files changed, 1 insertion(+), 61 deletions(-) delete mode 100644 docs/build/zkEVM/zkevm-gas-station.md diff --git a/docs/build/zkEVM/fee.md b/docs/build/zkEVM/fee.md index e92fa08480e..be580e6ed0b 100644 --- a/docs/build/zkEVM/fee.md +++ b/docs/build/zkEVM/fee.md @@ -66,7 +66,7 @@ coming soon... ### The Price Oracle Response -An example JSON response will look like this. +An example JSON response from Blockscout Price Oracle will look like this: ```json { diff --git a/docs/build/zkEVM/zkevm-gas-station.md b/docs/build/zkEVM/zkevm-gas-station.md deleted file mode 100644 index cd0517136ad..00000000000 --- a/docs/build/zkEVM/zkevm-gas-station.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -sidebar_position: 6 -title: Blockscout zkEVM Gas Oracle -sidebar_label: zkEVM Gas Oracle ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -## Overview -The **Blockscout Price Oracle** provides gas pricing suggestions which can be used by dApp developers before sending transactions to the **Astar zkEVM** network. - -## Usage -Blockscout Price Oracle takes the values from the average of previous blocks. It does't call `eth_gasPrice`. - - - -Send a GET request to the [Blockscout Price Oracle endpoint](https://zkatana.blockscout.com/api/v1/gas-price-oracle) to get a gas price recommendation from this oracle. - -#### cURL - -```bash -curl https://zkatana.blockscout.com/api/v1/gas-price-oracle -``` - -#### JavaScript - -```javascript -fetch('https://zkatana.blockscout.com/api/v1/gas-price-oracle') - .then(response => response.json()) - .then(json => console.log(json)) -``` - -#### Python - -```python -import requests -requests.get('https://zkatana.blockscout.com/api/v1/gas-price-oracle').json() -``` - - - -coming soon... - - - - -## Interpretation - -An example JSON response will look like this. - -```json -{ - "average":0.02, - "fast":0.02, - "slow":0.02, -} -``` - -- {`average`, `fast`, `slow`} are gas prices in Gwei, you can use these prices before sending the transaction off to Astar zkEVM. \ No newline at end of file