Encode-Club-Solidity-Foundations / Lesson-01

21 stars 14 forks source link

How best can we secure our wallet #29

Open holyaustin opened 1 year ago

holyaustin commented 1 year ago

How best can we secure our EOA wallet to make it impossible for someone with our private key not to withdraw our funds? Cant we add some level of multi-factor authentication?

Secondly, how do we calculate the size of a contract? what is the max size allowed?

MatheusDaros commented 1 year ago

@holyaustin thanks for the questions.

How best can we secure our EOA wallet to make it impossible for someone with our private key not to withdraw our funds?

Unfortunately, it is impossible. Having your private key is the only requirement for anyone to sign a valid transaction and publish it to the blockchain moving your assets somewhere else outside your control. So unless you implement this mechanism in every single node out there connected to the blockchain, the attacker could bypass it and send the valid transaction anyway.

Secondly, how do we calculate the size of a contract? what is the max size allowed?

The size of a contract is exactly the size of its bytecode. Currently the maximum transaction size you can push to a block is around 25kb. Since the contract always need to be deployed in a single transaction, you can't go over 25kb unless you use something like diamond patterns or so.