Skip to content
Afr Schoe edited this page May 16, 2022 · 10 revisions

Welcome to the eth.rb wiki! We'll try to use this space to explore some usage examples of the Ethereum Ruby gem.

A straightforward library to build, sign, and broadcast Ethereum transactions. It allows the separation of key and node management. Sign transactions and handle keys anywhere you can run Ruby and broadcast transactions through any local or remote node. Sign messages and recover signatures for authentication.

Want to fiddle around? Download the gem and run bin/console which loads the eth gem from a local path and includes the entire Eth:: namespace in a Pry console.

#!/usr/bin/env ruby

# use the local version of the code instead of a globally installed gem
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
require "eth"
include Eth

require "pry"
Pry.start

All examples in this wiki use this console for the sake of simplicity.

Note, that this wiki only covers eth of version ~> 0.5 and later. You can install it from Rubygems with gem install eth and add it to your project.

Gemspec:

spec.add_dependency "eth", "~> 0.5"

Gemfile:

gem "eth", "~> 0.5"

Require:

require "eth"

Include (optional):

include Eth

Happy hacking. We have an informal Telegram community at @ruby_eth if you want to contribute or face any issues.

Clone this wiki locally