Gas optimization
ETL(Extract - Transform - Load) Listens to blockchain nodes for new blocks and events. Decodes raw data (e.g., smart contract calls, token transfers) into meaningful records. Stores this structured data in a specialized database.
트랜잭션 및 기록 nonce 관리 - Noncemanager. Async Tx - success, fail(retry by order), timeout(replace).
retry: 다른 논스, New 트랜잭션 (While revert, out of gas)
replace: 같은 논스, 가스비 변경. TX Drop: 잔액 비교 후 다를 경우, 온체인 데이터로 최신화(변경). 순서 보장: blockNumber + transactionIndex
Nonce conflict: pending tx를 조회해서 증가시킴. (Noncemanager가 하는일) and 메모리에서 관리함.
Nonce gap: monitoring -> retry
네트워크 커넥션 실패 -> 논스 그대로 재전송
블록체인 실패(가스비orRequire) -> 가스비 증가 or require구문에 맞게 다시 요청.
Keccak-256: Save data storage(public key is long), Quantum Resistance
How to communicate other node for reaching stable consensus: Gossip network
Nodes: full, archive(full+historical)
PoS - committee(128 validators)
latest block, safe block: 12 blocks, finalized block: 64 blocks = 64 slot = 2 epoch
The journal contains **the list of state modifications applied since the last state commit. These are tracked to be able to be reverted in the case of an execution exception or request for reversal.
Transactions Flow: 트랜잭션 생성 및 서명 → 서명 검증
storage: persistent data store(state variables)
storage layout: (key: $2^{256}$ slot, value: 한 slot당 32 bytes이하.)
keccak(slotID): {
{ key: slotID, value: data length },
{ key: hashed slotID, value: data },
{ key: hashed slotID, value: data }
}
contract StorageExample {
uint256 public x; // Slot 0
uint256[] public dynamicArray; // Slot 1 (length stored here, elements at keccak256(1))
mapping(uint256 => uint256) public map; // Hash-based storage
struct MyStruct {
uint128 a;
uint128 b;
uint256 c;
}
MyStruct public s; // Starts at Slot 2
}
memory: temporary data store(function parameters, local variables)
stack: opcode operation
calldata: read-only data
Log
Signing
Input: Random Integer, Hashed message, Private key
Output: Signature (R, S)
Verifying
Input: RecoveryId(v) Signature (R, S), Hashed message
Output: Uncompressed ECC public key → hash → ethereum address(last 20bytes)
match: Valid or Invalid
Elliptic Curve Cryptography(ECC) Public key
uncompressed(prefix 04) => 65 bytes (0x + 04(1byte) + x(32bytes) + y(32bytes)
why compress? → Bitcoin, L2, P2P에서 사용.
two times less space in memory by removing the y coordinate.
prefix 02(y is even): 33 bytes, prefix 03(y is odd): 33 bytes
x를 알면 y값을 알 수 있음. 그래서, 공개키를 구할 수 있음.