EVMTransaction
Information about an Ethereum Virtual Machine (EVM) transaction, including details on associated events if specified.
Supported chains
ETH
(Ethereum)FLR
(Flare Mainnet)SGB
(Songbird Canary-Network)- Test networks:
testETH
(Ethereum Sepolia),testFLR
(Flare Testnet Coston2),testSGB
(Songbird Testnet Coston)
Request
Field | Solidity Type | Description |
---|---|---|
transactionHash | bytes32 | The hash of the transaction. |
requiredConfirmations | uint16 | The number of confirmations required for the block containing the transaction to be considered final by the requestor. |
provideInput | bool | If set to true , the input data field of the transaction will be included in the response. |
listEvents | bool | If true , events specified by logIndices will be included in the response. If false , no events are included. |
logIndices | uint32[] | A list of event indices (logIndex ) to be relayed if listEvents is true . Should be sorted by the requestor. Maximum of 50 indices allowed. An empty list indicates all events up to a maximum of 50. If listEvents is false , this field must be empty. |
Using Event Logs Correctly
- Events (logs) are indexed at the block level, not at the transaction level.
- The contract using this attestation should define the order of event logs, and the requestor should ensure
logIndices
are sorted according to these specifications.
Response
The response fields align with EVM's JSON-RPC API:
Field | Solidity Type | Description |
---|---|---|
blockNumber | uint64 | The block number in which the transaction is included. |
timestamp | uint64 | The timestamp of the block in which the transaction is included. |
sourceAddress | address | The address (from ) that signed the transaction. |
isDeployment | bool | Indicates whether the transaction is a contract creation (true ) or a regular transaction (false ). |
receivingAddress | address | The address (to ) receiving the transaction. Zero address if isDeployment is true . |
value | uint256 | The value transferred in the transaction, in wei. |
input | bytes | Transaction input data if provideInput is true ; otherwise, returns 0x00 . |
status | uint8 | Transaction status: 1 for success, 0 for failure. |
events | Event[] | An array of requested events if listEvents is true ; otherwise, an empty array. |
Event
Struct
Each Event
struct represents a log entry similar to EVM event logs:
Field | Solidity Type | Description |
---|---|---|
logIndex | uint32 | The index of the event within the block. |
emitterAddress | address | The address of the contract that emitted the event. |
topics | bytes32[] | An array of up to four 32-byte strings representing indexed log arguments. |
data | bytes | Non-indexed log data, concatenated as 32-byte strings. Must be at least 32 bytes long. |
removed | bool | true if the log was removed due to a chain reorganization; false if it is still valid. |
Verification process
- The function checks if the transaction with the given
transactionHash
is included in a block on the main chain with at least the specifiedrequiredConfirmations
. - If the block has insufficient confirmations or if the transaction is not found, the request is rejected.
- If
listEvents
is enabled and an event specified bylogIndices
does not exist, the request is also rejected. - The specified data (transaction details, input data, and events) is retrieved and relayed based on the request parameters.
Event handling
- Ensure
logIndices
are sorted as required by the consuming contract. - If
logIndices
is not empty whilelistEvents
is set tofalse
, the request will be rejected. - Events are capped at a maximum of 50 entries to optimize performance.
Contract interface
Sourced from IEVMTransaction.sol
on GitHub.
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.6 <0.9;
/**
* @custom:name IEVMTransaction
* @custom:id 0x06
* @custom:supported ETH, FLR, SGB
* @author Flare
* @notice A relay of a transaction from an EVM chain.
* This type is only relevant for EVM-compatible chains.
* @custom:verification If a transaction with the `transactionId` is in a block on the main branch with
* at least `requiredConfirmations`, the specified data is relayed.
* If an indicated event does not exist, the request is rejected.
* @custom:lut `timestamp`
* @custom:lutlimit `0x41eb00`, `0x41eb00`, `0x41eb00`
*/
interface IEVMTransaction {
/**
* @notice Toplevel request
* @param attestationType ID of the attestation type.
* @param sourceId ID of the data source.
* @param messageIntegrityCode `MessageIntegrityCode` that is derived from the expected response.
* @param requestBody Data defining the request. Type (struct) and interpretation is
* determined by the `attestationType`.
*/
struct Request {
bytes32 attestationType;
bytes32 sourceId;
bytes32 messageIntegrityCode;
RequestBody requestBody;
}
/**
* @notice Toplevel response
* @param attestationType Extracted from the request.
* @param sourceId Extracted from the request.
* @param votingRound The ID of the State Connector round in which the request was considered.
* @param lowestUsedTimestamp The lowest timestamp used to generate the response.
* @param requestBody Extracted from the request.
* @param responseBody Data defining the response. The verification rules for the construction
* of the response body and the type are defined per specific `attestationType`.
*/
struct Response {
bytes32 attestationType;
bytes32 sourceId;
uint64 votingRound;
uint64 lowestUsedTimestamp;
RequestBody requestBody;
ResponseBody responseBody;
}
/**
* @notice Toplevel proof
* @param merkleProof Merkle proof corresponding to the attestation response.
* @param data Attestation response.
*/
struct Proof {
bytes32[] merkleProof;
Response data;
}
/**
* @notice Request body for EVM transaction attestation type
* @custom:below Note that events (logs) are indexed in block not in each transaction.
* The contract that uses the attestation should specify the order of event logs as needed and the requestor should
* sort `logIndices` with respect to the set specifications.
* If possible, the contact should require one `logIndex`.
* @param transactionHash Hash of the transaction(transactionHash).
* @param requiredConfirmations The height at which a block is considered confirmed by the requestor.
* @param provideInput If true, "input" field is included in the response.
* @param listEvents If true, events indicated by `logIndices` are included in the response.
* Otherwise, no events are included in the response.
* @param logIndices If `listEvents` is `false`, this should be an empty list, otherwise,
* the request is rejected. If `listEvents` is `true`, this is the list of indices (logIndex)
* of the events to be relayed (sorted by the requestor). The array should contain at most 50 indices.
* If empty, it indicates all events in order capped by 50.
*/
struct RequestBody {
bytes32 transactionHash;
uint16 requiredConfirmations;
bool provideInput;
bool listEvents;
uint32[] logIndices;
}
/**
* @notice Response body for EVM transaction attestation type
* @custom:below The fields are in line with transaction provided by EVM node.
* @param blockNumber Number of the block in which the transaction is included.
* @param timestamp Timestamp of the block in which the transaction is included.
* @param sourceAddress The address (from) that signed the transaction.
* @param isDeployment Indicate whether it is a contract creation transaction.
* @param receivingAddress The address (to) of the receiver of the initial transaction.
* Zero address if `isDeployment` is `true`.
* @param value The value transferred by the initial transaction in wei.
* @param input If `provideInput`, this is the data send along with the initial transaction.
* Otherwise it is the default value `0x00`.
* @param status Status of the transaction 1 - success, 0 - failure.
* @param events If `listEvents` is `true`, an array of the requested events.
* Sorted by the logIndex in the same order as `logIndices`. Otherwise, an empty array.
*/
struct ResponseBody {
uint64 blockNumber;
uint64 timestamp;
address sourceAddress;
bool isDeployment;
address receivingAddress;
uint256 value;
bytes input;
uint8 status;
Event[] events;
}
/**
* @notice Event log record
* @custom:above An `Event` is a struct with the following fields:
* @custom:below The fields are in line with EVM event logs.
* @param logIndex The consecutive number of the event in block.
* @param emitterAddress The address of the contract that emitted the event.
* @param topics An array of up to four 32-byte strings of indexed log arguments.
* @param data Concatenated 32-byte strings of non-indexed log arguments. At least 32 bytes long.
* @param removed It is `true` if the log was removed due to a chain reorganization
* and `false` if it is a valid log.
*/
struct Event {
uint32 logIndex;
address emitterAddress;
bytes32[] topics;
bytes data;
bool removed;
}
}