Introduction

Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.

I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.

I also build and publish a variety of tools, libraries, and open-source projects.

On July 26, 2023, Bunzz, a platform for smart contract development, launched DeCipher, a service that automatically generates smart contract documentation using AI.

Block Explorer上のスマコンから正確なドキュメントを生成するweb3×LLMツール「DeCipher」、ローンチしました! 主要ブロックチェーンのほぼ全てのコントラクトを読み解ける。コード編集と再デプロイも可。ChromeプラグインでBlock Explorerからワンポチ起動。使い方は👇🧵https://t.co/qCfmwsCtuV
Kenta|GenX Founder, CEO (@kenta_web3) · 2023年7月26日

I had access during the closed beta and was impressed by the quality of the generated documentation. I translated some of it into Japanese in the following articles:

This article covers the basic workflow, features, and contents of the generated documentation. I also intended to compare the results with the closed beta, since the generation quality was reportedly improved.

This is a personal account of using DeCipher at launch. Please point out any mistakes in the comments. The interface, supported networks, and availability described here reflect July 2023.

Usage

Basic workflow

Start by supplying a URL from a blockchain explorer, a tool for inspecting blockchain data.

Copy the following Etherscan URL for Bored Ape Yacht Club (BAYC):

Basic workflow

Paste the URL into the field highlighted in red and click Generate Documentation.

🚀 DeCipher 本日ローンチしたBunzzの「DeCipher」を使用して、コントラクトドキュメントを自動生成してみました✨ 一瞬でドキュメントを生成してくれて精度も高いので、エンジニアの方には特におすすめです!https://t.co/hhlH9KAMCK pic.twitter.com/0Dregzo1pT
Cardene【かるでね】🦔 (@cardene777) · 2023年7月26日

The documentation is generated as shown in the video.

Documentation sections

Documentation sections

The generated documentation is organized into six main sections, highlighted in the screenshot.

Overview

This section describes the contract as a whole. For some contracts, the overview may be empty.

How To Use

This section describes the contract's functionality and the steps required to use it.

Module Parameters

This section explains the arguments passed to the constructor, which executes once during contract deployment. Each argument has a name, type, and short description.

Functions

The sidebar lists contract functions in two categories: READ and WRITE. Selecting a function displays its description and parameters.

This is particularly helpful when reading unfamiliar contracts and trying to understand the purpose of individual functions.

Events

This section describes the events defined by the contract. Emitting an event records a log on the blockchain.

Code

The source code is presented as a directory tree, including imported files. Normally, inspecting a dependency may require navigating to its GitHub repository. DeCipher lets readers explore the source in one place instead of switching repeatedly between sites.

Supported explorers

The following explorers were listed on the page at the time. The list may not have been exhaustive.

Chrome extension

DeCipher also offered a Chrome extension.

Chrome extension

When opening a contract in an explorer, a Click Here button appears in the bottom-right corner. Clicking it automatically generates the contract documentation, using the same workflow described earlier.

DeCipher GPT

DeCipher also provides a ChatGPT-powered feature for asking questions about the generated documentation.

DeCipher GPT button

Click Ask in the DeCipher GPT panel at the bottom right.

DeCipher GPT input field

A text input appears. I tried the following question (the original contains a typo, reproduced here):

What are some of the unique features of this contraption?

In other words, what are the distinctive features of this contract?

The tool returned the following response:

Based on the context, some of the unique features of the BoredApeYachtClub contract are: 1. Unique NFT Attributes and Traits: The contract allows for each NFT to have a unique set of attributes and traits. This adds to the uniqueness and value of each NFT. 2. ERC721 Standard Implementation: The contract extends the ERC721 Non-Fungible Token Standard, which provides a standardized interface for NFTs on the Ethereum blockchain. 3. Ownership Management: The contract includes functions like renouncing ownership and transferring ownership, which allow for the management of contract ownership. 4. Provenance Tracking: The contract includes a variable called BAYC_PROVENANCE, which is used for tracking the provenance or origin of the NFTs. 5. Sale Management: The contract includes variables like apePrice, maxApePurchase, and saleIsActive, which are used to manage the sale of the NFTs. Please note that this answer is based on the provided context and may not include all the unique features of the BoredApeYachtClub contract.

The Japanese article also included a Japanese translation of this response. The English response above is the original. It illustrates how the tool explains ERC-721 inheritance, ownership management, provenance, and sale configuration. Generated explanations should still be checked against the actual contract.

Bunzz CLI

The Bunzz CLI lets developers download the contract source to a local environment, build it, and deploy contracts.

https://www.npmjs.com/package/bunzz?activeTab=readme

Bunzz CLI entry point

Click Edit this code on IDE, highlighted in red, to open a modal containing commands that can be run locally.

Bunzz CLI command modal

This reduces the manual work required to move from reading a contract to working with its source locally.

Additional notes

Generation time

The displayed generation time was generally one to five minutes, depending on the length of the contract. In my experience, contracts whose documentation had already been generated seemed to return results much faster.

If previously generated documentation can be reused, increased usage may improve the likelihood of encountering an already documented contract. This was an observation rather than a confirmed description of the service's caching implementation.

Feedback

The generated documentation includes a feedback button.

Feedback button

Clicking the highlighted area lets users submit feedback with a message. Examples include suggestions for improvements, bug reports, and comments on useful features.

Conclusion

This article introduced DeCipher, an AI-powered service for generating smart contract documentation. Its explorer integration, function descriptions, source browser, question-answering feature, and CLI can reduce the effort involved in understanding unfamiliar contracts.

I have also published Japanese translations, summaries, and additional explanations of generated documentation in the following articles: