-
Notifications
You must be signed in to change notification settings - Fork 8
add megaeth faq and quickstart #856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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}'; | ||
SahilAujla marked this conversation as resolved.
Show resolved
Hide resolved
SahilAujla marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| 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. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.