Code Monkey home page Code Monkey logo

ethr's Introduction

'ethr' - An Ethereum Package for R

Description

The 'ethr' R package is an interface for accessing Ethereum blockchain data in R, querying the Ethereum Blockchain via the JSON-RPC API.

ethr provides several convenience and helper functions, such as:

  • Handling of hexadecimal conversion
  • Access block data
  • Access transaction data/transaction receipts
  • Bulk download management

Installation

The package will be submitted to CRAN soon, until then you can install it from Github using devtools:

# install.packages("devtools")
devtools::install_github("BSDStudios/ethr")

Setup

The package connects to either a Geth or Parity client running on a full Ethereum node via the JSON-RPC interface https://github.com/ethereum/wiki/wiki/JSON-RPC.

Please enable the following flags for Geth and Parity respectively to ensure that they can access the client.

  • Geth: --rpc --rpccorsdomain localhost
  • Parity: --jsonrpc-cors '*' --geth - not connecting in latest build, we're investigating.

Base Functions

These base functions are direct implementations of the available JSON-RPC methods detailed here, https://github.com/ethereum/wiki/wiki/JSON-RPC and replicate their functionality as much as possible.

  • eth_coinbase - Returns the client coinbase address.
  • eth_gasPrice - Returns the current price per gas in wei.
  • eth_accounts - Returns a list of addresses owned by client.
  • eth_blockNumber - Returns the number of most recent block.
  • eth_getBalance - Returns the balance of the account of given address.
  • eth_getStorageAt - Returns the value from a storage position at a given address.
  • eth_getTransactionCount - Returns the number of transactions sent from an address at given block number.
  • eth_gethBlockTransactionCountByHash - Returns the number of transactions in a block, given the block hash.
  • eth_getBlockTransactionCountByNumber - Returns the number of transactions in a block the given block number.
  • eth_getCode - Returns code at a given address.
  • eth_getBlockByHash - Returns information about a block from a hash.
  • eth_getBlockByNumber - Returns information about a block from the block number.
  • eth_getTransactionByHash - Returns the information about a transaction requested by transaction hash.
  • eth_getTransactionByBlockHashAndIndex - Returns information about a transaction by block hash and transaction index position.
  • eth_getTransactionByBlockNumberAndIndex - Returns information about a transaction by block number and transaction index position.
  • eth_getTransactionReceipt - Returns the receipt of a transaction by transaction hash.

Helper functions

These functions use the base function, queering the blockchain, but make it easier for the user to download larger chunks of data and to have more control over where those chunks are taken from.

  • getBockTransations will return a data frame of the transactions for either a given number of blocks or a specified range of blocks.

  • getBlockHeaders will return just the block header data for a given number of blocks or specified range of blocks.getBlockHeaders will return just the block header data for a given number of blocks or specified range of blocks.

  • bulkBlockDownload.R breaks a large block range up and manages the download size. All downloaded blocks will be stored in a ethr_blocks folder in the data_dir.

  • getBlockRange - Returns the minimum and maximum blocks that are currently downloaded for the analysis table. Note: this does not check for continuity, only returns min and max vales.

ethr's People

Contributors

tinmice avatar kateharris142 avatar

Watchers

James Cloos avatar Pscion avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.