1

輕鬆看懂 Etherscan

 1 year ago
source link: https://medium.com/taipei-ethereum-meetup/viewing-blocks-and-transactions-on-etherscan-3bb5b3685ba7
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Block Page

假設我們想了解 block 14895081 發生了什麼事?您可以前往 Etherscan 首頁,並於搜尋框輸入數字做查詢,接著應能看到以下畫面:

1*yhWCudYXFmv_uVk0Z4gBFw.png

Figure 1

① 顯示您正在看哪個 block number,點「<」和「>」可以切換不同 block

② 包裹這個 block 的 miner/proposer 提交的時間戳記,隨著使用的瀏覽器自動調整時區(此欄位原始資料為 Unix epoch 1654230140

③ 這個 block 與前一個 block 時間戳記的差值

④ 給 PoW miner 的固定獎勵(註:在 The Merge 後將取消這部分獎勵)

⑤ 這個 block 的所有 transaction fee 總和

⑥ 這個 block 的所有 burnt fee 總和(請參考 ⑩ 的說明)

⑦ 把這個區塊的 difficulty (註:在 The Merge 後將永遠是 0x0)加上前一個區塊的 total difficulty,就能得到這個區塊的 total difficulty

⑧ 把這個區塊的 gas used 除以 gas limit 就能得到 gas 實際消耗比例

⑨ 把這個區塊的 gas used 除以 15M gas,就能得到與 EIP-1559 設定之區塊 gas target 差異量的比例

⑩ 把 gas used 乘以 base fee per gas 就能得到 burnt fee 總和(EIP-1559 機制將區塊內所有 base fee 都燃燒掉,而非給予 miner;此欄位等於 ⑥)

⑪ 包裹這個 block 的 miner/proposer 提交的額外資訊(長度至多 32 bytes)

p.s.transaction 經常會簡寫成 txn,所以 txn fee 就是 transaction fee

接著,點擊網頁當中的「73 transactions」按鈕,將開啟另一個頁面,其表列出包含在這個 block 之內的所有 transaction 細節。

List of Transactions

新開啟的網頁表列出這個 block 所有 transaction 的細節:

1*6ZVsHozsQHYT-yhom-msHg.png

Figure 2

① 如果 transaction hash 前面有「橙色」驚嘆號,代表它是 reverted transaction,錯誤發生在執行 internal transaction(message call)的過程

② 如果 transaction hash 前面有「紅色」驚嘆號,代表它是 reverted transaction,錯誤發生在執行 transaction 本身

③ 如果看到 transaction fee 後方有「綠色氣球」,代表 transaction 是以 type-2(EIP-1559)格式發送到 Ethereum 區塊鏈

④ 這個直行的數值代表 transaction 所攜帶的 ETH 數額(msg.value

⑤ 把這個直行的所有數字加總起來,就等於 Figure 1 當中的 ⑤

接著,點擊網頁當中的任意一條 transaction hash,將開啟另一個頁面顯示更多關於 transaction 的執行細節。(假設我們如圖所示點擊第一條 txn)

Transaction Page

關於 Figure 2 的第一條 transaction 細節,在下方 Figure 3 當中一覽無遺:

1*AawhIwoOKvblywhd3ozrTQ.png

Figure 3

① Ethereum 最新 block number 與包含這條 txn 的 block number 的差異量

② 時間戳記的性質與 Figure 1 ② 相同

③ Etherscan 的伺服器首次發現這條 transaction 之後,經過多久時間這條 transaction 才被納入這個 block

④ 這個數值的性質與 Figure 2 ④ 相同

⑤ 把 (gas) usage by transaction 乘以 gas price 就能得到 transaction fee

⑥ 把 (gas) usage by transaction 乘以 base fee (per gas) 就能得到 burnt fee

⑦ 若 (Base fee + Max Priority fee) ≦ Max fee,則 gas price = (Base fee + Max Priority fee);反之,gas price = Max fee;非 EIP-1559 transaction 的 gas price 則由交易發起者指定,超過 Base fee 的份額才會交給 block miner/proposer

⑧ 把 (gas) usage by transaction 乘以 (Max fee - gas price) 就能得到transaction savings,意思是 EIP-1559 幫助交易發起者省下的錢 (關於 EIP-1559 的內容,請參考其他文章 [1, 2])

⑨ 此 txn 是發起者(tx.origin)從古至今發出的第幾筆(zero-indexed)

⑩ 這條 transaction 是 block 第七十三個被執行的交易(zero-indexed)

p.s. 可能有讀者想看看 gas price 在 ⑦ 的各種情況實例,請讀者參考這個 block 的 position 12、position 72 和 position 13 transaction。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK