Recently, I've seen that Etherscan is able to automatically figure out passed constructor arguments. how were they able to figure it out?
This was already answered in the comments to your own previous question
- The transaction that created the contract is visible on Etherscan (example here)
- The input data to that transaction, which is mostly the compiled bytecode of the contract itself, also contains the constructor parameter values in the last bytes (32 bytes per parameter)
- Hence Etherscan is able to extract and decode the arguments passed, even without the source code, and so can you
- Although it is not possible to know the names of the parameters without access to the source code, decompiling the bytecode can at least tell you what number and datatype/size of arguments is expected. You can use this to make sense of those 32*n bytes from the contract creation data (where n is the number of parameters)
The answer by Daniel Hume is wrong. Some constructors require more than 32 bytes for storage. Here is a constructor that requires 8*32 bytes: https://etherscan.io/address/0x317dc3f08f7947f363dfc7cb008048a5a5ea1840#code
So the question is still open.