Ethereum library for Ruby

A simple library for Ethereum.


  • Pure Ruby implementation
  • IPC Client with batch calls support
  • HTTP Client with batch calls support
  • Compile and deploy Solidity contracts
  • Deploy contracts with constructor parameters.
  • Expose deployed contracts as Ruby classes
  • Test solidity contracts with a Ruby testing framework of your choice
  • Call and wait for the result of Solidity function calls.
  • Contract events

Ruby Compatibility

  • Ruby 2.x
  • Ruby 1.9.x
  • JRuby
  • Rubinius


We currently support UNIX/Linux environments and Windows IPC support on the roadmap.

You will need to have a properly working Ruby installation. We recommend RVM

To use this library you will need to have a running Ethereum node with IPC support enabled (default). We currently support Go-Ethereum client


Add this line to your application's Gemfile:

gem 'ethereum'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ethereum

Basic Usage

IPC Client Connection

client ="#{ENV['HOME']}/.ethereum_testnet/geth.ipc")

Solidity contract compilation and deployment

init ="#{ENV['PWD']}/spec/fixtures/SimpleNameRegistry.sol", client)
simple_name_registry_instance =

Transacting and Calling Solidity Functions

Solidity functions are exposed using the following conventions:


Example Contract in Solidity

contract SimpleNameRegistry {

  mapping (address => bool) public myMapping;

  function register(address _a, bytes32 _b) {

  function getSomeValue(address _x) public constant returns(bool b, address b) {

simple_name_registry_instance.transact_and_wait_register("0x5b6cb65d40b0e27fab87a2180abcab22174a2d45", "minter.contract.dgx")
simple_name_registry_instance.transact_register("0x385acafdb80b71ae001f1dbd0d65e62ec2fff055", "[email protected]")

Run contracts using a different address"0x0c0d99d3608a2d1d38bb1b28025e970d3910b1e1")

Point contract instance to a previously deployed contract"0x734533083b5fc0cd14b7cb8c8eb6ed0c9bd184d3")


  • Add Windows IPC Client (named pipes)
  • Add support for creating and sending of raw transactions
  • Offline account creation
  • ContractTransaction class
  • Add more examples
  • API documentation
  • Unit testing and contract testing examples. Use web3.js tests as a baseline.


Please join our Gitter chat room or open a new issue in this repository



After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to


Bug reports and pull requests are welcome on GitHub at This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.


The gem is available as open source under the terms of the MIT License.