Ethereum Smart Contracts GUI Generator

NPM package to automatically generate a customizable interface from ABI to interact with Ethereum smart contracts.

If you need to create a graphical user interface to interact with your Ethereum smart contracts, then you might be interested in the ethereum-interface-generator NPM package.

The NPM package ethereum-interface-generator creates a GUI from your smart contract ABI (Application Binary Interface). You can export the GUI to HTML files or use the interface directly on the local development server.

The exported interface is easily customizable: the GUI is built using bootstrap and vanilla javascript (and of course Web3.js 🙂).

This package is helpful for testing your smart contracts or creating a customizable interface quickly.

Below an example of how the interface looks like:

Installation

To use the command you have to install first the NPM package on your computer:

npm i ethereum-interface-generator -g

Once the installation is done you can run the command eth-ui-gen -h to read the help.

Serving the GUI

If you want to interact with your smart contracts you might want to generate the GUI on a local server (without exporting it). If you want to export the GUI please read the next section.

To start the server you can execute the command below in the same folder where your smart contract ABI is located:

eth-ui-gen serve

For example, if you compiled your smart contracts with truffle framework, first you have to CD into the folder build/contracts and then execute the command eth-ui-gen serve.

After running the local server, the GUI is available on the URL http://localhost:5432.

If you want instead to specify a custom port and/or the path of the directory of the smart contract ABIs, you can add the optional parameter as per below:

eth-ui-gen serve -c /../dapp/build/contracts/ -p 7765

The command above generates the GUI using the ABI found in the folder /../dapp/build/contracts/ and then it starts the server on the URL http://localhost:7765.

For more information on the serve command you can run the command eth-ui-gen serve -h in the terminal.

Exporting the GUI

You can export your smart contract ABIs into HTML using the export command. You must run the command below in the same folder where smart contract ABI is located.

eth-ui-gen export

If you compiled your smart contracts using truffle framework, first you have to CD into the folder build/contracts and then execute the command eth-ui-gen export.

The command will create a folder with the GUI in the directory where the command has been executed.

Alternatively, you can add optional parameters to the source folder of the ABI and/or the destination folder where the GUI has to be exported to. For example:

eth-ui-gen export -c /../dapp/build/contracts/ -t /home/dan/Desktop/smart-contracts-ui/

The command above generates the GUI using the ABI found in the folder /../dapp/build/contracts/ and it exports the code to the folder /home/dan/Desktop/smart-contracts-ui/

You can add the flag -m (or --minify) to minify the Javascript.

For more information on the export command you can run eth-ui-gen export -h in the terminal.

GUI Walk-through

NPM and GitHub repository links

Related Articles

How to Test Smart Contracts - Tutorial

Category: Blockchain

Testing a smart contract is a must of the blockchain development process. Remember that the blockchain does not forgive you any errors because of its immutability! The only way to fix a bug ...

Create your Blockchain DApp with Ethereum and VueJS - Tutorial Part 2

Category: Blockchain

In the second part of the tutorial we are going to develop the front-end and see how to interact with the smart contract developed in the PART 1. If you missed the introduction and you want to ...

Create your Blockchain DApp with Ethereum and VueJS - Tutorial Part 1

Category: Blockchain

In this first part of the tutorial we are going to create the smart contract that handles the registration of users; then we are going to deploy the smart contract to the blockchain using ...

Create your Blockchain DApp with Ethereum and VueJS - Tutorial Intro

Category: Blockchain

This is a simple decentralized application built using Ethereum blockchain and VueJS for the front-end. This DApp example lets the users store their name and status on the ...

What is a fork? Why is it dangerous?

Category: Blockchain

Often a blockchain can have some flaws, bugs or it just needs improvements. To fix those vulnerabilities the blockchain has to be forked. A fork rewrites the rules which a full node must follow in ...

Blockchain For Not Technical People (public speech)

Category: Blockchain

A 4 minutes speech about blockchain I delivered during a course on public speaking in November 2019.