2

As the question suggests, I'm curious about how to find statistics for:

  • what is the biggest contract by loc/bytecode size
  • what contract is currently taking up the most storage space on the chain.

2 Answers 2

3
+50

I was able to find that out via Google's BigQuery engine by running the following query:

SELECT
  contracts.address,
  SAFE_DIVIDE(SAFE_SUBTRACT(LENGTH(contracts.bytecode), 2), 2) AS bytecode_length
FROM
  `bigquery-public-data.crypto_ethereum.contracts` as contracts
ORDER BY
  bytecode_length
  DESC

The results show that the largest smart contract bytecode size is 24,576 bytes, which is also the size limit that was introduced in the Spurious Dragon hard fork.

Here are a couple of smart contracts with that size:

  • 0xb1effc011f8ed3df599f8cf2ec205d99e0544ce6
  • 0x38a4bded512eb5b115f8224e9830cac7124c209e
  • 0x99179faac2c7ce615a3cfeb13cfcd0aaf8d48871
  • 0xef323fbbc6342e6daede0b045bbd843e92edb528

enter image description here

7
  • I tried decompiling one of them and it seemed like the source code is only 50loc etherscan.io/…. It seems really strange.
    – zcaudate
    Sep 22, 2022 at 5:31
  • Would you know roughly how many loc of solidity would end up going over the limit?
    – zcaudate
    Sep 22, 2022 at 5:37
  • @zcaudate From Solidity by Example: "Solidity storage is like an array of length 2^256. Each slot in the array can store 32 bytes." Sep 22, 2022 at 15:37
  • @zcaudate The deployed bytecode is not stored in the storage layout. You get a clean slate of 2^256 storage slots when you deploy a smart contract. Each storage slot is 32 bytes long. Sep 22, 2022 at 15:41
  • ok. so I guess my question is... how many lines of solidity code does it take to get up to the smart contract bytecode size limit of 24,576 bytes?
    – zcaudate
    Sep 23, 2022 at 4:35
1

Although I couldn't find statistics on what is the biggest contract by loc/bytecode size and what contract is currently taking up the most storage space on the chain, I found the relationship between transaction costs and contract size is that transaction costs are the costs for sending the contract code to the Ethereum blockchain, and they depend on the size of the contract.

See: What is the difference between transaction cost and execution cost in remix?

What I found are statistics of lists of projects on the Ethereum blockchain by total transaction fee, which could shed light on what is the biggest contract by loc/bytecode size and what contract is currently currently taking up the most storage space on the chain.

See: https://dune.com/agaperste/The-State-of-Ethereum-Network

1
  • sweet. that's really helpful. would you of any way to explore the memory layout of the blockchain? I'm trying to figure out how to query a mapping without knowing all of it's current keys beforehand.
    – zcaudate
    Sep 21, 2022 at 3:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.