Milstone
Definition
TransactionsDatalake
This datalake facilitates iterating over a set of transactions originating from a specific Ethereum address, denoted as sender. The iteration begins from a specified nonce and concludes at another specified nonce. Note that sampled_property can include all fields from both transaction
and transaction receipts
.
An example usage TransactionsBySenderDatalake
is as follows:
TransactionsDatalake(
account_type= "sender",
address="0x7b2f05ce9ae365c3dbf30657e2dc6449989e83d6",
from_nonce=0,
to_nonce=20,
sampled_property="recipient",
increment=1 # optional, default value 1
)
Here are some examples of sampled_property
fields:
For transactions:
pub enum TransactionField {
// ===== Transaction fields =====
Nonce,
GasPrice,
GasLimit,
To,
Value,
Input,
V,
R,
S,
ChainId,
// Not for legacy transactions
AccessList,
// EIP-1559 transactions and EIP-4844 transactions
MaxFeePerGas,
// EIP-1559 transactions and EIP-4844 transactions
MaxPriorityFeePerGas,
// Only for EIP-4844 transactions
BlobVersionedHashes,
// Only for EIP-4844 transactions
MaxFeePerBlobGas,
}
For transaction receipts:
pub enum TransactionReceiptField {
Success,
CumulativeGasUsed,
Logs,
Bloom,
}
Implementation
An important detail in the implementation is that, although we use the same interface as TransactionsBySenderDatalake
, the sampled_property
fields determine whether we should obtain proof against the transaction trie
or the transaction receipt trie
.
Here is step by step implementation:
- Scope block numbers: get nonce by
eth_getTransactionCount
while iterate the blocks. Have to iterate the block number that the account has deployed to reduce irrelevant rpc calls. And track the nonce difference, and scope the block numbers that only contains tx sent by senders
- Header proofs: get relevant mmr proofs and header data from indexer
- Transaction / Transaction receipt Proofs: get tx proof or tx reciept proof per each block numbers. Whether if it's tx or tx receipt is determine by
sampled_property
.
If property requires transaction receipt, call eth_getBlockReceipts
iterate all scoped block numbers, and filter out sender match with given address and get proof for matched ones.
If property requires transaction, first, get filtered tx_hash from step above, and call eth_getTransactionByHash
to get detail tx
Open to discuss
Base on implementation steps listed above, as eth_getTransactionCount
compatible method for receiver doesn't exist, we couldn't scope minimum target block numbers by given nonce. We could have iterate all blocks since receiver account deployed usingeth_getAccount
, and scope target block numbers.
- does all this iteration around 1. finding target block numbers using nonce 2. filter out sender or receiver address all all necessary iteration? can't we reduce it somehow?
eth_getAccount
or TransactionsByReceiverDatalake
need to be compare as it both provide sender's nonce information
- another interface suggestion : could put identifier in
sampled_property
instead of address. but personally I think it's less intuitive then put identifier in account_type
TransactionsDatalake(
address="0x7b2f05ce9ae365c3dbf30657e2dc6449989e83d6",
from_nonce=0,
to_nonce=20,
sampled_property="sender.recipient",
increment=1 # optional, default value 1
)