-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
21 changed files
with
3,211 additions
and
23 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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,74 @@ | ||
--- | ||
title: Overview | ||
description: Explore the comprehensive guide to the zkSync Era JSON-RPC API, offering seamless Ethereum integration and advanced Layer 2 functionalities for developers. | ||
--- | ||
|
||
Welcome to the zkSync Era API reference documentation! This page provides you with a high-level overview of our API capabilities and essential information. | ||
|
||
zkSync Era seamlessly integrates with the Ethereum ecosystem. To achieve this integration, | ||
we support not only the standard <a href="https://ethereum.org/en/developers/docs/apis/json-rpc/" target="_blank">Ethereum JSON-RPC API</a> | ||
but also introduce L2-specific features that enhance functionality. | ||
|
||
<!-- TODO: make icon larger --> | ||
::callout{icon="i-heroicons-information-circle" color="amber"} | ||
To ensure a seamless experience, we impose rate limits on both HTTPS and WebSocket APIs. | ||
Generally, these limits are ample, ranging from 10 to 100 requests per second (RPS) per client. | ||
:: | ||
|
||
## Mainnet | ||
|
||
- **Network Name**: zkSync Era Mainnet | ||
- **RPC URL**: https://mainnet.era.zksync.io | ||
- **WebSocket URL**: wss://mainnet.era.zksync.io/ws | ||
- **Chain ID**: 324 | ||
- **Currency Symbol**: ETH | ||
- **Block Explorer URL**: https://explorer.zksync.io/ | ||
|
||
## Testnet | ||
|
||
- **Network Name**: zkSync Era Testnet | ||
- **RPC URL**: https://testnet.era.zksync.dev | ||
- **WebSocket URL**: wss://testnet.era.zksync.dev/ws | ||
- **Chain ID**: 280 | ||
- **Currency Symbol**: ETH | ||
- **Block Explorer URL**: https://sepolia.explorer.zksync.io/ | ||
|
||
## API Collections | ||
|
||
Explore our curated collections of API endpoints tailored for every need, from seamless Ethereum integrations to advanced debugging tools. | ||
Embrace the full potential of zkSync Era and elevate your dApps to new heights. Discover, integrate, and innovate with our robust API offerings. | ||
|
||
::card-group | ||
::card | ||
--- | ||
title: Ethereum JSON-RPC API | ||
icon: i-simple-icons-ethereum | ||
to: /api-reference/ethereum-rpc | ||
--- | ||
Integrate effortlessly with full compatibility for the Ethereum JSON-RPC API. | ||
:: | ||
::card | ||
--- | ||
title: zkSync JSON-RPC API | ||
icon: i-zksync-zksync-logo | ||
to: /api-reference/zks-rpc | ||
--- | ||
Unlock Layer 2 capabilities with our dedicated zkSync JSON-RPC API. | ||
:: | ||
::card | ||
--- | ||
title: Debugging JSON-RPC API | ||
icon: i-heroicons-code-bracket-16-solid | ||
to: /api-reference/debug-rpc | ||
--- | ||
Simplify your development process with powerful debugging tools. | ||
:: | ||
::card | ||
--- | ||
title: PubSub JSON-RPC | ||
icon: i-heroicons-signal-solid | ||
to: /api-reference/pub-sub-rpc | ||
--- | ||
Stay informed with real-time event subscriptions. | ||
:: | ||
:: |
This file contains 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,57 @@ | ||
--- | ||
title: Conventions | ||
description: Formatting conventions and references for use with zkSync Era API docs. | ||
--- | ||
|
||
## Hex value encoding | ||
|
||
Two key data types get passed over JSON: unformatted byte arrays and quantities. | ||
Both are passed with a hex encoding but with different requirements for formatting. | ||
|
||
### Quantities | ||
|
||
When encoding quantities (integers, numbers): encode as hex, prefix with "0x", | ||
the most compact representation (slight exception: zero should be represented as "0x0"). | ||
|
||
Here are some examples: | ||
|
||
- 0x41 (65 in decimal) | ||
- 0x400 (1024 in decimal) | ||
- WRONG: 0x (should always have at least one digit - zero is "0x0") | ||
- WRONG: 0x0400 (no leading zeroes allowed) | ||
- WRONG: ff (must be prefixed 0x) | ||
|
||
### Unformatted data | ||
When encoding unformatted data (byte arrays, account addresses, hashes, bytecode arrays): | ||
encode as hex, prefix with "0x", two hex digits per byte. | ||
|
||
Here are some examples: | ||
|
||
- 0x41 (size 1, "A") | ||
- 0x004200 (size 3, "\0B\0") | ||
- 0x (size 0, "") | ||
- WRONG: 0xf0f0f (must be even number of digits) | ||
- WRONG: 004200 (must be prefixed 0x) | ||
|
||
## Error Codes | ||
|
||
| **Category** | **Error Code** | **Message** | **Description** | | ||
|--------------|----------------|--------------------|-----------------------------------------------------------| | ||
| Standard | -32700 | Parse error | The JSON payload could not be parsed due to invalid syntax. | | ||
| Standard | -32600 | Invalid request | The JSON object is not a valid request structure. | | ||
| Standard | -32601 | Method not found | The requested method does not exist or is not available. | | ||
| Standard | -32602 | Invalid params | The parameters provided to the method are invalid or malformed. | | ||
| Standard | -32603 | Internal error | An unspecified internal error occurred within the JSON-RPC framework. | | ||
|
||
## The default block parameter | ||
|
||
When requests are made that act on the state of Ethereum, the last default block parameter determines the height of the block. | ||
|
||
The following options are possible for the defaultBlock parameter: | ||
|
||
- HEX String - an integer block number | ||
- String "earliest" for the earliest/genesis block | ||
- String "latest" - for the latest mined block | ||
- String "safe" - for the latest safe head block | ||
- String "finalized" - for the latest finalized block | ||
- String "pending" - for the pending state/transactions |
Oops, something went wrong.