Published in


Photo by Hannah Joshua on Unsplash

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

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

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 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 sbt-ethereum 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. sbt 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, sbt 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 sbt-ethereum in action.


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

Clone this GitHub repo:

git clone https://github.com/swaldman/eth-command-line.git --branch 0.1.10

Now, go inside the directory:

$ cd eth-command-line

If you do ls , you can see the below files:

$ ls
LICENSE README.md build.sbt project sbtw

Here, sbtw is a wrapper script which will install sbt.

$ ./sbtw

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 👇

There are no wallets in the sbt-ethereum keystore. Would you like to generate one? [y/n] yWould you like the new address '0x1144f4f7aad0c463c667e0f8d73fc13f1e7e86a2' to be the default sender on chain with ID 1? [y/n] y

Running commands in sbt-ethereum

sbt-ethereum strives for simplicity and provides easy-to-read commands. For example, it uses ethAddressAlias rather than something like etaa, eta. This makes commands bigger and difficult to type, that's why sbt 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 ethShoeboxBackup (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 ethShoeboxRestore.

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 TAB to complete your commands. Let’s connect to our Ethereum node (I masked my QuikNode Web3 URL, you can get yours here.)

sbt:eth-command-line> ethNodeUrlDefaultSet https://xxxx-xxxx-xxxx.quiknode.io/uuid/token/

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

sbt:eth-command-line> ethNodeBlockNumberPrint

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

For that, sbt provides the following commands:

ethNodeBlockNumberPrint       ethNodeChainId                ethNodeChainIdDefaultDrop     ethNodeChainIdDefaultPrint    ethNodeChainIdDefaultSet      
ethNodeChainIdOverride ethNodeChainIdOverrideDrop ethNodeChainIdOverridePrint ethNodeChainIdOverrideSet ethNodeChainIdPrint
ethNodeUrl ethNodeUrlDefaultDrop ethNodeUrlDefaultPrint ethNodeUrlDefaultSet ethNodeUrlOverride
ethNodeUrlOverrideDrop ethNodeUrlOverridePrint ethNodeUrlOverrideSet ethNodeUrlPrint

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 sbt uses aliases for addresses. It already added an alias for your default address: to check it, run the command below:

sbt:eth-command-line> ethAddressAliasList

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:

ethAddressAliasSet new-name default-sender

To check an alias, you can run ethAddressAliasList again.

Wallet commands

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

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.

ethKeystoreList 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:

ethKeystorePrivateKeyReveal <hex address> or <alias-name>

Import wallet

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

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

2. Using eth-rpc v3 JSON

> ethKeystoreWalletV3FromJsonImportV3 Wallet JSON: {"address":"d78fe1d978ad8cc5a94484725d059bec694f215e","crypto":{"mac":"98c53c7d05c7daeb1b8d2bef6af8643bf679a73a34d014f09a45f7035088f89b","kdf":"pbkdf2","cipherparams":{"iv":"70c4340f5305dca3fad9e54d47db4a2b"},"ciphertext":"9a2fc0212827877068d5a54f0ad64fab8767d52849535305e984682db25be23d","cipher":"aes-128-ctr","kdfparams":{"salt":"b9562670465f5ec13a4babe91aea6bd41d3400dfb0f97b1fb21617cbd62e9782","dklen":32,"c":262144,"prf":"hmac-sha256"}},"id":"f2f3bad7-4da0-424b-a363-fde7a6e3cb49","version":3}
[info] Imported JSON wallet for address '0xd78fe1d978ad8cc5a94484725d059bec694f215e', but have not validated it.
[info] Consider validating the JSON using 'ethKeystoreWalletV3Validate 0xd78fe1d978ad8cc5a94484725d059bec694f215e'.
[success] Total time: 3 s, completed Mar 16, 2019 12:35:14 AM

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

ethKeystoreWalletV3Validate <address-hex> or  <alias-name>

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

ethKeystoreWalletV3Print <address-hex> or <alias-name>


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

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!! 😃




A platform to access ETH, BTC, BSC, MATIC, OPTIMISM, ARBITRUM, FTM, CELO, SOL, TERRA & xDAI blockchains via API. Infra & tools to build + scale your #Web3 dApp!

Recommended from Medium

Chainstake DEFI CD token is now officially listed on World Coin Index

Slang, Memes, and more — A guide to understanding millennial crypto investors

Crypto-Industry News Update — 01/04/2021

How to Profit from Cryptocurrencies — Part 1

Ultra is Partnering with Xangle for Transparency

Tezos now on imToken

Starter Pack of Defi Tools

Gate.io Leveraged Airdrop $10,000

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
Gaurav Agrawal

Gaurav Agrawal

Telegram @gaurav_zen , Editor — Coinmonks publication (medium.com/coinmonks) and working on (https://coincodecap.com)

More from Medium

CSC Web Wallet Using Web3.js

How to set up a MetaMask wallet?

How are transactions executed? (Part 2)

Polkadot cross-chain bridge: connecting the Polkadot ecosystem with external networks