0

I'm trying to figure out how to calculate the size of the bytecode given the string, given that there is a hard limit for contract size of 24kb.

ie. for USDT Token: https://etherscan.io/token/0xdac17f958d2ee523a2206206994597c13d831ec7#code

606060405260008060146101000a81548160ff021916908315150217
9055506000600355600060045534156200003457600080fd5b604051
62002d7c38038062002d7c8339810160405280805190602001909190
80518201919060200180518201919060200180519060200190919050
50336000806101000a81548173ffffffffffffffffffffffffffffff
ffffffffff021916908373ffffffffffffffffffffffffffffffffff
ffffff16021790555083600181905550826007908051906020019062
0000cf9291906200017a565b508160089080519060200190620000e8
9291906200017a565b508060098190555083600260008....

Is it literally byte[] all = new byte[s.length() / 2] - number of characters in the string divided by 2? or it is something more complicated?

zcaudate
  • 105
  • 7

1 Answers1

0

You can take a look at this resource on how to figure out the size of the bytecode from compiler output.

See:

How to check the size of a contract in Solidity?

How to estimate my contract code size? it is too big to deploy now

Yongjian P.
  • 4,170
  • 1
  • 3
  • 10