Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Blockchain by (12.7k points)

Consider a Contract:

Contract Example{

    uint array[];

    address owner;

    function Example(){

        owner = msg.sender

    }

    function setArray(uint index, uint value) public {

        if (msg.sender == owner){

            array[index] = value;

        }

    }

}

Is there any possibility that hackers update array[] directly by generate a specific block. (steer clear of the condition that "only owner can update array")

1 Answer

0 votes
by (29.5k points)
edited by

No, nothing but the smart contract itself is allowed to modify its storage. This is assuming that the basic security of the blockchain is still intact

Know how Blockchain works in depth by enrolling in Blockchain Course.

Browse Categories

...