States

Besides a transaction, a state is another type of data storage on the Ethereum blockchain. A smart contract typically has a few variables defined and the values of these variables are called blockchain states. Some key protocol/dApp metrics are stored inside the blockchain states and their values change over time or blocks.

To retrieve the value of a state of a smart contract, you need to call the corresponding smart contract function that would output the value.

For example, the total number of Livepeer token that is staked in the network is stored in a variable called totalBonded. It can be retrieved by calling the function getTotalBonded.

contractAddress: The address of the contract that owns the state.

name 🌶: The name of the function that needs to be called to retrieve the state.

methodId: This is a value encoded based on the name and parameters of a function. Its uniqueness is not completely guaranteed. Most time, you don't need to pay attention to it. More technical details can be found here.

inputs: The input arguments of a function. All the arguments are stored in an array. For functions which don't have input arguments, its value is an empty array. Each argument has three attributes: name, type and value. Most time, you only need to pay attention to the value attribute.

outputs: The value of the state. It's stored in an array. Each element of the array has three attributes: name, type and value. Most time, you only need to pay attention to the value attribute.

blockNumber and blockTimestamp: The block number and the time of when the state was retrieved. BlockTimestamp is in UTC format.

We do not automatically track every blockchain state since it would be way too much data to process. But you can set up state tracking through this self-serve tool. Once the tracking is set up, the state values will show up in the States data source automatically.

Last updated