Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/datawookie/ether
An R package for working with Ethereum
https://github.com/datawookie/ether
Last synced: 3 months ago
JSON representation
An R package for working with Ethereum
- Host: GitHub
- URL: https://github.com/datawookie/ether
- Owner: datawookie
- Created: 2017-12-27T03:22:31.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-01-27T06:25:06.000Z (almost 5 years ago)
- Last Synced: 2023-02-27T16:42:32.949Z (almost 2 years ago)
- Language: R
- Homepage:
- Size: 66.4 KB
- Stars: 18
- Watchers: 5
- Forks: 11
- Open Issues: 2
-
Metadata Files:
- Readme: README.Rmd
Awesome Lists containing this project
README
---
output: github_document
self_contained: false
---```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
source("setup-key-for-test.R")
```# ether
[![Travis-CI Build Status](https://travis-ci.org/datawookie/ether.svg?branch=master)](https://travis-ci.org/datawookie/ether)
The `ether` package provides functions for interacting with the Ethereum network.
The details of the RPC interface along with `curl` examples of interacting with it are documented in the [JSON RPC page](https://github.com/ethereum/wiki/wiki/JSON-RPC) on the Ethereum Wiki.
## Installation
Install from GitHub using
```{r gh-installation, eval = FALSE}
# install.packages("devtools")
devtools::install_github("datawookie/ether")
```Alternatively there is a stable version listed on CRAN.
## Example
Load the package.
```{r}
library(ether)
```You'll need to connect to an Ethereum node exposing a RPC interface. By default the package will attempt to connect to a node on `localhost` using port 8545. However, you can also make use of the public RPC nodes hosted by [infura.io](https://infura.io/). Assuming that you have created an infura.io API key and stored it in the `INFURA_MAINNET_KEY` environment variable.
```{r}
set_rpc_address("https://mainnet.infura.io/", key = Sys.getenv("INFURA_MAINNET_KEY"))
```Once you've configured the connection to RPC you are ready to interact with the Ethereum blockchain.
```{r}
eth_blockNumber()
```
```{r}
eth_gasPrice()
``````{r}
eth_getBalance("0xD34DA389374CAAD1A048FBDC4569AAE33fD5a375")
``````{r}
eth_getTransactionCount("0xD34DA389374CAAD1A048FBDC4569AAE33fD5a375")
```