diff --git a/fern/api-reference/megaeth/megaeth-api-faq.mdx b/fern/api-reference/megaeth/megaeth-api-faq.mdx new file mode 100644 index 000000000..bb4ba02f9 --- /dev/null +++ b/fern/api-reference/megaeth/megaeth-api-faq.mdx @@ -0,0 +1,33 @@ +--- +title: MegaETH API FAQ +description: Frequently asked questions about the MegaETH API +subtitle: Frequently asked questions about the MegaETH API +slug: reference/megaeth-api-faq +--- + +## What is MegaETH? +MegaETH is a high-performance Ethereum Layer 2 blockchain designed to achieve real-time transaction processing with sub-millisecond latency and extremely high throughput. + +## How do I get started with MegaETH? +Check out our [MegaETH API Quickstart guide](./megaeth-api-quickstart) to get started building on MegaETH. + +## What is the MegaETH API? +The MegaETH API allows developers to interface with the MegaETH mainnet. With this API, developers can execute transactions, query on-chain data, and interact with the MegaETH network, relying on a JSON-RPC standard. + +## Is MegaETH EVM compatible? +Yes, MegaETH is EVM compatible. + +## What API does MegaETH use? +MegaETH uses the JSON-RPC API standard. This API is crucial for any blockchain interaction on the MegaETH network, allowing users to read block/transaction data, query chain information, execute smart contracts, and store data on-chain. + +## What methods are supported on MegaETH? +MegaETH supports standard Ethereum JSON-RPC methods. Some chain-specific methods may vary. Please check the MegaETH API endpoints documentation for a complete list. + +## What is a MegaETH API key? +When accessing the MegaETH network via a node provider like Alchemy, MegaETH developers use an API key to send transactions and retrieve data from the network. For the best development experience, we recommend that you [sign up for a free API key](https://dashboard.alchemy.com/signup)! + +## Which libraries support MegaETH? +Common Ethereum libraries like [ethers.js](https://docs.ethers.org/v5/) should be compatible with MegaETH, given its EVM nature. + +## My question isn’t here, where can I get help? +If you have any questions or feedback, please contact us at support@alchemy.com or open a ticket in the dashboard. diff --git a/fern/api-reference/megaeth/megaeth-api-quickstart.mdx b/fern/api-reference/megaeth/megaeth-api-quickstart.mdx new file mode 100644 index 000000000..ead879261 --- /dev/null +++ b/fern/api-reference/megaeth/megaeth-api-quickstart.mdx @@ -0,0 +1,117 @@ +--- +title: MegaETH API Quickstart +description: How to get started building on MegaETH and using the JSON-RPC API +subtitle: How to get started building on MegaETH and using the JSON-RPC API +slug: reference/megaeth-api-quickstart +--- + +*To use the MegaETH API you'll need to [create a free Alchemy account](https://dashboard.alchemy.com/signup) first!* + +## Introduction + +MegaETH is a high-performance Ethereum Layer 2 blockchain designed to achieve real-time transaction processing with sub-millisecond latency and extremely high throughput. + +## What is the MegaETH API? + +The MegaETH API allows interaction with the MegaETH network through a set of JSON-RPC methods. Its design is familiar to developers who have worked with Ethereum's JSON-RPC APIs, making it intuitive and straightforward to use. + +## Getting Started Instructions + +### 1. Choose a Package Manager (npm or yarn) + +Select a package manager to manage your project's dependencies. Choose between `npm` and `yarn` based on your preference or project requirements. + + + ```shell npm + # Begin with npm by following the npm documentation + # https://docs.npmjs.com/downloading-and-installing-node-js-and-npm + ``` + + ```shell yarn + # For yarn, refer to yarn's installation guide + # https://classic.yarnpkg.com/lang/en/docs/install + ``` + + +### 2. Set Up Your Project + +Open your terminal and execute the following commands to create and initialize your project: + + + ```shell npm + mkdir megaeth-api-quickstart + cd megaeth-api-quickstart + npm init --yes + ``` + + ```shell yarn + mkdir megaeth-api-quickstart + cd megaeth-api-quickstart + yarn init --yes + ``` + + +This creates a new directory named `megaeth-api-quickstart` and initializes a Node.js project within it. + +### 3. Make Your First Request + +Install Axios, a popular HTTP client, to make API requests: + + + ```shell npm + npm install axios + ``` + + ```shell yarn + yarn add axios + ``` + + +Create an `index.js` file in your project directory and paste the following code: + + + ```javascript index.js + const axios = require('axios'); + + const url = 'https://megaeth-mainnet.g.alchemy.com/v2/${your-api-key}'; + + const payload = { + jsonrpc: '2.0', + id: 1, + method: 'eth_blockNumber', + params: [] + }; + + axios.post(url, payload) + .then(response => { + console.log('Latest Block:', response.data.result); + }) + .catch(error => { + console.error(error); + }); + ``` + + +Remember to replace `your-api-key` with your actual Alchemy API key that you can get from your [Alchemy dashboard](https://dashboard.alchemy.com/signup). + +### 4. Run Your Script + +Execute your script to make a request to the MegaETH network: + + + ```shell shell + node index.js + ``` + + +You should see the latest block information from MegaETH's network outputted to your console: + + + ```shell shell + Latest Block: 0x... + ``` + + +## Next Steps + +Congratulations! You've made your first request to the MegaETH network. You can now explore the various JSON-RPC methods available on MegaETH and start building your dApps on this innovative platform. diff --git a/fern/docs.yml b/fern/docs.yml index 7c51f3e2f..ee7e7c5a9 100644 --- a/fern/docs.yml +++ b/fern/docs.yml @@ -1713,6 +1713,10 @@ navigation: slug: arc - section: MegaETH contents: + - page: MegaETH API Quickstart + path: api-reference/megaeth/megaeth-api-quickstart.mdx + - page: MegaETH API FAQ + path: api-reference/megaeth/megaeth-api-faq.mdx - api: MegaETH API Endpoints api-name: megaeth slug: megaeth