Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions fern/api-reference/megaeth/megaeth-api-faq.mdx
Original file line number Diff line number Diff line change
@@ -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 [email protected] or open a ticket in the dashboard.
117 changes: 117 additions & 0 deletions fern/api-reference/megaeth/megaeth-api-quickstart.mdx
Original file line number Diff line number Diff line change
@@ -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.

<CodeGroup>
```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
```
</CodeGroup>

### 2. Set Up Your Project

Open your terminal and execute the following commands to create and initialize your project:

<CodeGroup>
```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
```
</CodeGroup>

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:

<CodeGroup>
```shell npm
npm install axios
```

```shell yarn
yarn add axios
```
</CodeGroup>

Create an `index.js` file in your project directory and paste the following code:

<CodeGroup>
```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);
});
```
</CodeGroup>

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:

<CodeGroup>
```shell shell
node index.js
```
</CodeGroup>

You should see the latest block information from MegaETH's network outputted to your console:

<CodeGroup>
```shell shell
Latest Block: 0x...
```
</CodeGroup>

## 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.
4 changes: 4 additions & 0 deletions fern/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading