Prerequisites

command line

sbt-ethereum offers a text-based user interface to the ethereum blockchain. You work with it from a “terminal” or “command prompt” window. On a Mac or Linux, run the Terminal application to get started. On Windows, you can use “Windows Power Shell”, or if you are old-school, CMD.exe. You can also use the version of “bash” that comes with some versions of Windows git.

java 8 or 11 runtime

To work with sbt-ethereum, you’ll need a Java 8 or 11 runtime installed on your computer.

Warning

Early versions of Java 8 did not include some important certificate authorities. sbt-ethereum fails to launch because its dependencies fail to download over https.

Please use a version of Java 8 no older than Java 8u101 ("1.8.0_101").

Non-“long-term-support” versions like Java 12 and 13 are not supported!

To see whether you already have an appropriate JVM installed, type

$ java -version

You should see something like

java version "1.8.0_172"
Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.172-b11, mixed mode)

The exact version number doesn’t matter, as long as it begins with “11”, or begins with “1.8” (and is not older than 1.8.0_101).

If you do not already have a Java VM installed, you can download one from Oracle:

git

In order to download, modify, and publish sbt-ethereum repositories, you will want to have the git command line tool installed as well. You may have it already. Try

$ git --version

If it’s already installed, you’ll see something like

git version 2.18.0

Don’t worry too much about what version you have. It’ll probably be fine.

If it is not installed, you can download it from here. Alternatively, on a Mac it comes with X Code Command Line Tools (you’ll have to sign up for a free developer account), and on Linux, it will be available through your distribution’s package manager (dnf, yum, apt, etc.).

sbt

sbt-ethereum is based on a command-line development tool called sbt. Many sbt-ethereum distributions include sbt launch scripts for Mac or Linux, so it is not strictly necessary to download sbt seprately. But it doesn’t hurt. And on Windows it is necessary.

You can download sbt here.

etherscan API key (optional)

To interact with deployed ethereum smart contracts, it is usually necessary to have an ABI (application binary interface) that describes what users can do with the contract. The on-line service etherscan collect the source code and ABI of deployed ethereum contracts, and verifies that they match the applications actually deployed on the blockchain. sbt-ethereum can automatically import these verified ABIs into its internal database, so that it is very easy to interact with deployed, verified, smart contracts.

To get an etherscan API key, you’ll need to create an account, then click on “MY ACCOUNT”, then “API-KEYs” under the “Developers” menu. Finally click “Create Api Key”.

Once you have created your etherscan API key, just run

> etherscanApiKeySet <your-etherscan-api-key>

You will now be able to automatically import ABIs when you run ethContractAbiImport or ethContractAbiDefaultImport.

Later [TK] we’ll see how to import this key into your sbt-ethereum database, which will make it extremely easy to work with published smart contracts.