sbt-ethereum — A Tool for Interacting with the Ethereum Blockchain via Command Line

simple, elegant way to develop/deploy smart contracts & more!

Gaurav Agrawal
May 1, 2019 · 5 min read

Today, we are going to talk about an awesome Ethereum development tool, which will change your life as an Ethereum developer forever 😎

sbt is an open-source build tool for Scala and Java projects, similar to Java’s Maven and Ant.

sbt-ethereum

sbt-ethereum is an awesome tool for developers and hobbyists to start with Ethereum development in minutes.

sbt-ethereum aims for the following goals:

  • An interactive text-based platform with which “hobbyists” — people who are not programmers, but who are willing to devote a bit of time to learning — can interact with Ethereum (and other compatible blockchains), and do so with a great deal of power and sophistication.
  • A publication tool for Ethereum smart contact applications, as repositories strive to be portable, and to both permit deployment of new smart contract instances and convenient interaction with already-deployed smart contracts.
  • For those who are (or wish to become!) programmers, a rich development environment for Ethereum smart contracts
  • An integration tool, which facilitates the development of high-performance Scala libraries and applications that interact with Ethereum smart contracts

If you are a beginner dev, the main friction comes while setting up the new project/tech. reduces friction and teaches you how to work with the Ethereum blockchain using the command line interface (CLI).

Command line? Isn’t it difficult?

No, keeps things basic and manages a lot of things behind the scenes to maintain simplicity.

What does sbt-ethereum provide?

  • Wallet functionality
  • Smart contract development functionality
  • Ethereum blockchain interactions
  • ENS support
  • Etherscan integration

Yes! All of above through command line. Now let's see in action.

Installation

We’ll be using Ubuntu (if you are using Windows, follow these instructions).

Clone this GitHub repo:

Now, go inside the directory:

If you do , you can see the below files:

Here, is a wrapper script which will install .

As sbt-ethereum is an interactive tool, during installation it will ask a few questions to set up your wallet. You can set a wallet later too, but for now, you will see questions like 👇

Running commands in sbt-ethereum

sbt-ethereum strives for simplicity and provides easy-to-read commands. For example, it uses rather than something like etaa, eta. This makes commands bigger and difficult to type, that's why supports rich tab completions. You can check the full list of sbt commands here.

Taking Backups

Your wallets and address aliases, as well as other information such as your transaction history, smart contract compilations, and ABIs of contracts you interact with, are stored in the sbt-ethereum “shoebox”, which you will want to get into the habit of backing up. So, using the command (which takes no arguments).

The command is interactive. It will ask us for a directory in which we would like to store backups (which will be retained — in the shoebox! — for optional future reuse). Provide a directory appropriate to your system. You may want to back up to a thumb drive or external disk, so if something happens to your computer’s hard disk, you have a copy elsewhere.

We can restore our shoebox, if something bad happens, from the generated file using .

Connect your QuikNode to sbt-ethereum

We can connect our Ethereum node to sbt-ethereum (sbt may have a default ETH node you can use for testing, however their documentation recommends using a personal node for reliability and performance).

Signup for QuikNode, if you want the fastest and best experience for interacting with an Ethereum node.

Remember you can use to complete your commands. Let’s connect to our Ethereum node (I masked my QuikNode Web3 URL, you can get yours here.)

To check the current node URL, let’s run command to check the latest block number:

You can override or change your default Node configuration whenever you like.

For that, provides the following commands:

Using Alias

Everyone knows that working with addresses can be problematic. We, humans, are not designed for working with hexadecimal values (machines are) — so remembering them or even just matching them correctly can be difficult. That's why uses aliases for addresses. It already added an alias for your default address: to check it, run the command below:

You will see a “default-sender” in front of your address. To add a new alias for an address or an existing alias, just use this command:

To check an alias, you can run again.

Wallet commands

To manage wallets, addresses, and keys, let's check some commands provided by .

Create a new wallet

This command creates a new eth-rpc “v3” JSON wallet representing an Ethereum address and a passcode-encrypted private key in sbt-ethereum’s “shoebox” keystore.

command displays the Ethereum addresses in sbt-ethereum’s “shoebox” keystore, and any aliases associated with those addresses.

To check the private key for your wallet, use the command below:

Import wallet

There are multiple ways to import a wallet to . Let’s see them one by one:

  1. Using private keys — you can import a wallet to using private keys

2. Using eth-rpc v3 JSON

Always validate your wallet after importing! To validate the wallet use the command below:

To print the wallet JSON (v3), run the command below:

Conclusion

provides rich functionality and we will dig deeper into it in future articles. We can create smart contracts and also ENS names using command line tool. In the next article, we will create, deploy and read a smart contact using .

further reading:

About QuikNode

QuikNode is building infrastructure to support the future of Web3. Since 2017, we’ve worked with hundreds of developers & companies, helping scale dApps and providing high-performance Ethereum nodes. We’re working on something interesting from the past few months and will be launching soon, so subscribe our newsletter for more updates!! 😃

QuikNode

Cloud-hosted Ethereum nodes for dApps, developers, and…

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store