Solidity’s Cheap Public Face

This article discusses automatic storage getters provided by Solidity, the defacto smart contract language for the Ethereum blockchain.

Jules Goddard
Coinmonks
Published in
8 min readJul 6, 2020

--

Photo by Brandon Erlinger-Ford on Unsplash

Background

During the development and testing of Datona Labs’ Solidity Smart-Data-Access-Contract (S-DAC) templates, we wanted to publish values of some storage variables, for example:

ExampleSDA is the example contract for this article and contains 4 variables which are referred to as the SDA data in the discussion below.

Discussion

Solidity contracts conveniently provide automatic getters for storage variables declared as public. See the Solidity documentation here. These getters are functions that enable read access to the variables externally. Thus in the ExampleSDA above, the automatically generated getters are the equivalent of:

--

--

Jules Goddard
Coinmonks

Experienced high-integrity software engineer, crypto code compactor and Datona Labs founder — providing smart contracts to protect your digital information.