NGD Enterprise’s head of development Harry Pierson recently shared a Twitter thread documenting a major enhancement to the Neo Blockchain Toolkit’s Smart Contract Debugger. Now available in a preview release, the latest update overhauls the Debugger’s contract storage viewer to display stored keys and values in a much more developer friendly manner.

The Neo Debugger allows developers to step through the execution of a smart contract locally, exploring changes in its storage. Traditionally, the Debugger’s storage view would show key and value data the same way it exists within the VM—raw byte streams.

These values could be copied and converted manually using other tools or via the simple conversion feature made available in the Debugger’s watch menu. However, the NGD Enterprise team was in search of a more intuitive experience for contract storage exploration.

Debugger storage view with Storage Schema enhancements

The new functionality is powered by upgrades Pierson made to NCCS, the Roslyn-based C# compiler developed newly for N3 by Erik Zhang. The modifications alter the compiler to emit a Storage Schema, which contains type information for both runtime and storage types. Changes in the Debugger allowed it to interpret this schema and conveniently decode values for the developer.

Initially, Pierson delivered a PoC which required the Storage Schema to be manually defined in JSON. With the preview release of the C# compiler and Debugger, developers will instead be able to define storage types within their smart contract code using the new StorageGroup and StorageKeySegment attributes. This information is used to generate the Storage Schema, which is included as part of the standard debug info file.

Defining the Storage Schema in C# contract source code

Using the new storage attributes results in substantial improvements to the Storage view. Values are decoded to their appropriate types, making easy for a developer to verify correctness at a glance.

Developers can start adding storage attributes in their own smart contracts using the preview release. Pierson notes that the attribute-based approach to create the storage schema is a first draft, welcoming feedback from developers on the best way to provide this information to the compiler.

NGD Enterprise has released an overview of the Storage Schema to break down the latest changes. The document details use of the new Storage attributes and includes primers on Neo’s contract storage and type models. Inside the overview, a Getting Started guide can be found, which makes use of a new branch of the Neo Contributor Token example NFT contract to quickly get developers up and running with Storage schemas.