Solidity 12 – Reading The Storage

Published by Mario Oettler on

Last Updated on 23. March 2023 by Martin Schuster

In this lesson, we learn how to read the contract storage from outside a contract. Solidity stores variables like uint, arrays, mappings, structs, etc. in the storage. And as you know, everything on a blockchain is public to everyone.

If a contract designer wants users to easily read the content of a variable, he declares them public. The compiler then creates a get-function in the background that can be seen in the ABI. But if the variable is not declared public, this get function is missing. But still, it is possible to read the content of this variable from outside the contract.

This requires a bit of knowledge of the variable layout of the smart contract.

Categories:

https://blockchain-academy.hs-mittweida.de/wp-content/uploads/2021/04/logo_bcam_rgb_gross.png

Welcome

Blockchain Academy

Continue with credential

No account yet?

Powered by Hidy

Register with Hidy


Register
Sign in

We need the following credential to register:

please select:

To create a new account, we need the following data from you:

We would appreciate the following additional information from you for the creation of your account:

Welcome

Blockchain Academy

Continue with credential

Already have an account?

Powered by Hidy

Sign in with Hidy


Register
Sign in

We need the following credential to log in:

please select: