Skip to content

zkSync Era JSON-RPC methods #18

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 65 commits into from
Jun 1, 2023
Merged

zkSync Era JSON-RPC methods #18

merged 65 commits into from
Jun 1, 2023

Conversation

ilitteri
Copy link
Collaborator

@ilitteri ilitteri commented May 20, 2023

zkSync Era’s JSON-RPC methods

The ZKSProvider trait

zkSync Era fully supports the standard Ethereum JSON-RPC API and adds some L2-specific features.

As long as code does not involve deploying new smart contracts, which can only be deployed using EIP712 transactions, no changes to the codebase are needed.

zkSync Era The ZKSProvider trait defines the methods that can be used to interact with zkSync Era's JSON-RPC API (the previously L2-specific features mentioned above).

Status (for full compatibility)

Method Description Supported Tested
debug_traceBlockByHash Returns debug trace of all executed calls contained in a block given by its L2 hash.
debug_traceBlockByNumber Returns debug trace of all executed calls contained in a block given by its L2 block number.
debug_traceCall Returns debug trace containing information on a specific calls given by the call request.
debug_traceTransaction Uses the EVM's callTracer to return a debug trace of a specific transaction given by its transaction hash.
zks_estimateFee Returns the fee for the transaction.
zks_estimateGasL1ToL2 Returns an estimate of the gas required for a L1 to L2 transaction.
zks_getAllAccountBalances Returns all balances for confirmed tokens given by an account address.
zks_getBlockDetails Returns additional zkSync-specific information about the L2 block. committed: The batch is closed and the state transition it creates exists on layer 1. proven: The batch proof has been created, submitted, and accepted on layer 1. executed: The batch state transition has been executed on L1; meaning the root state has been updated.
zks_getBridgeContracts Returns L1/L2 addresses of default bridges.
zks_getBytecodeByHash Returns bytecode of a transaction given by its hash.
zks_getConfirmedTokens Returns [address, symbol, name, and decimal] information of all tokens within a range of ids given by parameters from and limit. Confirmed in the method name means the method returns any token bridged to zkSync via the official bridge.
zks_getL1BatchBlockRange Returns the range of blocks contained within a batch given by batch number. The range is given by beginning/end block numbers in hexadecimal.
zks_getL1BatchDetails Returns data pertaining to a given batch.
zks_getL2ToL1LogProof Given a transaction hash, and an index of the L2 to L1 log produced within the transaction, it returns the proof for the corresponding L2 to L1 log. The index of the log that can be obtained from the transaction receipt (it includes a list of every log produced by the transaction).
zks_getL2ToL1MsgProof Given a block, a sender, a message, and an optional message log index in the block containing the L1->L2 message, it returns the proof for the message sent via the L1Messenger system contract.
zks_getMainContract Returns the address of the zkSync Era contract.
zks_getRawBlockTransactions Returns data of transactions in a block.
zks_getTestnetPaymaster Returns the address of the testnet paymaster: the paymaster that is available on testnets and enables paying fees in ERC-20 compatible tokens.
zks_getTokenPrice Returns the price of a given token in USD.
zks_getTransactionDetails Returns data from a specific transaction given by the transaction hash.
zks_L1BatchNumber Returns the latest L1 batch number.
zks_L1ChainId Returns the chain id of the underlying L1.

@ilitteri ilitteri self-assigned this May 20, 2023
@ilitteri ilitteri marked this pull request as ready for review May 22, 2023 18:39
@mationorato
Copy link
Collaborator

Resolves #19

@mationorato mationorato linked an issue May 22, 2023 that may be closed by this pull request
Base automatically changed from zksolc_compiler_integration to main May 22, 2023 20:42
ilitteri and others added 4 commits May 23, 2023 15:54
* Merge branch 'zkprovider_impl' of github.com:lambdaclass/zksync-web3-rs into support_transfers

* Support EIP1559 transfers on L2
@ilitteri ilitteri marked this pull request as draft May 31, 2023 17:27
@IAvecilla IAvecilla marked this pull request as ready for review May 31, 2023 20:13
Copy link
Collaborator

@mationorato mationorato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ilitteri ilitteri merged commit fdeaa8b into main Jun 1, 2023
@ilitteri ilitteri deleted the zkprovider_impl branch June 1, 2023 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Suport zkSync Era JSON-RPC methods
3 participants