Deploying Your First LLL contract — Part 1

In which we prepare our workspace for deployment

Daniel Ellison
ConsenSys Media
3 min readMay 18, 2017

--

In this and a subsequent article I’ll be going through the process of deploying a simple LLL contract to an Ethereum blockchain. If you prefer to follow along with a video, please refer to the companion screencast on this subject. The work will be done in Linux at a bash command line.

Setup

First, if you didn’t read my previous article or missed my screencast on the subject and want to generate your own EVM bytecode binary, go ahead and do that. We’ll wait. But if you do that, you’ll also need an LLL compiler, which has its own article and screencast. But hurry up: We won’t wait forever.

As a quick test, type the following in your terminal:

If you don’t see the banner and version you’ll have to go back to the drawing board.

node.js

Next, you’ll need a few node-based tools, including node.js itself. Sadly, the version of node.js that ships with Ubuntu 16.04 is too old for our purposes. We’ll have to install it manually. If you’re following along at a bash prompt, type the following:

I know it’s a lot of mumbo-jumbo to some people but that’s ok. You don’t need to understand what’s happening in order to execute the commands. If anyone wants more details, please say so in the comments. To verify that node and npm have been installed correctly, type the following:

If you don’t get that output or you get error you’ll have to troubleshoot your system.

In addition to the node.js packages, you’ll need two other things in order to deploy contracts to an Ethereum blockchain. Since we’re in the development process we don’t want to waste ether or wait for transaction confirmations by deploying to the Ethereum mainnet. There’s a great solution for trying out your contracts on a developer’s blockchain called testrpc. This test blockchain executes transactions immediately without having to wait until blocks are mined, which is ideal for rapidly iterating on contract development. Install testrpc by typing the following:

This will take a few minutes. Once it’s done, type testrpc. If you get “command not found”, type this and try the testrpc command again:

UPDATE: If you get permission errors while installing testrpc, please refer to Sam Bowne’s comment for a resolution.

web3.js

You’ll need one more utility in order to deploy contracts: web3.js. According to the documentation,

web3.js is a collection of libraries which allow you to interact with a local or remote ethereum node, using a HTTP or IPC connection.

To install the web3.js libraries, type the following.

Conclusion

That’s it for setup. It was quite a journey, but you’re now ready to deploy contracts to an Ethereum blockchain. I hope this was informative. The actual deployment process will be described in part 2. See you there!

Read More:

An Introduction to LLL for Ethereum Smart Contract Development
Building and Installing Ethereum Compilers

Compiling an LLL Contract for the First Time
Deploying Your First LLL Contract — Part 2
The Structure of an LLL Contract — Part 1
The Structure of an LLL Contract — Part 2
The Structure of an LLL Contract — Part 3

Like this piece? Sign up here for the ConsenSys weekly newsletter.

Disclaimer: The views expressed by the author above do not necessarily represent the views of Consensys AG. ConsenSys is a decentralized community with ConsenSys Media being a platform for members to freely express their diverse ideas and perspectives. To learn more about ConsenSys and Ethereum, please visit our website.

--

--