Constants and Variables

Let's jump back up to the very first line in the marketplace code:

imageHash = "ac39af4793119ee46bbff351d8cb6b5f23da60222126add4268e261199a2921b";

This is what we call a variable assignment. Variables are pointers to data we can refer to and play with within our programs. For this assignment specifically, if we try to find imageHash in any other place in the code, we see that's it's actually never changed. Hence we can actually call this a constant. The two prepending words string, and public declare the type of data this constant points to (some text) and whether the contract exposes its value or keeps it private within the contract (this constant is public, meaning its value can be read by external accounts like us, or other smart contracts). Even though it's not used anywhere else it's one of the most important lines in the entire contract, as we've gone through in the "Punks PNG" section.

Let's continue looking at the next few lines...

address owner;

This instantiates a variable of type address called owner, but doesn't assign any initial value to it. Every participant in the Ethereum network is identified by an address, which is a 40 hexadecimal character long string1. Sidenote: This line refers to LarvaLabs themselves, the creators of the contract and will be set a bit further down during the "contract deployment" (the moment it's added to the Ethereum blockchain). This instantiation doesn't have the public declaration, so this variable is only accessible from within the contract code itself.

Jump a couple lines down:

uint public nextPunkIndexToAssign = 0;

Here we assign the number zero 0 to a publicly accessible "unsigned (positive) integer" uint to the variable nextPunkIndexToAssign. Our contract keeps track of this variable ↔ value relationship so we can refer to it or update it easily throughout our code.

Footnotes

  1. This hexadecimal string is commonly known as a wallet address or "public key". These act like digital identities and are derived from a private key. Private keys are what allows participants to securely sign and authenticate their actions on the network.