Skip to content

CLI for helper libraries to follow along with the decypher.tv ethereum screencast series

Notifications You must be signed in to change notification settings

AlwaysBCoding/decyphertv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DecypherTV

A simple library for interacting with the Ethereum blockchain without needing to run your own node. This library is intended to be used as a command-line interface to follow along with the Ethereum Ðapp Development series on http://decypher.tv/series/ethereum-development - but the library can also be used as a simple command line interface into Ethereum for your own purposes.

Installation

This library is going to be changing constantly, however there will be a snapshot of the current state of the library at the time each episode was recorded available.

To install the specific version used in an episode

$ npm install -g [email protected].{episodeNumber}

To simply install the latest version

$ npm install -g decyphertv

Usage

There are two modes. Local and Remote. Local assumes that you are running your own node locally (via testrpc, geth, or parity). Remote assumes that you are transacting to a remote node running on a different computer (via infura, blockcypher, or any custom endpoint)

Start Shell (Local)

To start a shell that is connected to a local node. Pass the flags -m local and -e endpoint where endpoint is the URL of the node
$ decypher -m local -e ${endpoint}
$ decypher -m local -e http://localhost:8545

Start Shell (Remote)

To start a shell that is connected to a remote node. Pass the flags -m remote and -e endpoint where endpoint is the URL of the node
$ decypher -m remote -e ${endpoint}
$ decypher -m remote -e https://mainnet.infura.io/123

Globals Loaded

NPM Package Global Variable
solc solc
ethereumjs-tx EthTx
ethereumjs-util EthUtil
web3 (class) Web3
web3 (instance) web3

Helper Methods

The contract source can either be a string of the contract code, or a relative/absolute path to a .sol solidity file.

decypher.opcodes(source)
decypher.abi(source)
decypher.contract(source)
decypher.deployed(source, address)
decypher.etherBalance(contract|account)

Contract Calls (Remote)

All contract calls take an optional final parameter of an options hash that can override the defaults

// Function Signature
decypher.sendEther({to, value}, options={})

// Example Usage
decypher.sendEther({to: "0xC46CDe805aCC8e7507E53E36486C7D8600559d65", value: web3.toWei(1, 'ether')}, {gas: 21000})
// Function Signature
decypher.deployContract(source, params=[], options={})

// Example Usage
var source = `contract HelloWorld {
  string public message;

  function HelloWorld(string _message) {
    message = _message;
  }
}`

decypher.deployContract(source, ["Hello, World!"], {gas: 500000})
// Function Signature
decypher.callContract(deployed, methodName, params=[], options={})

// Example Usage
var source = `contract HelloWorld {
  string public message;

  function HelloWorld(string _message) {
    message = _message;
  }

  function updateMessage(string _message) {
  	message = _message;
  }

}`

var deployed = decypher.deployed(source, "0xC46CDe805aCC8e7507E53E36486C7D8600559d65")

decypher.callContract(deployed, "updateMessage", ["New Message!!"], {gas: 500000})

decypher.last

The CLI will do it's best to automatically store recently returned data in the decypher.last object. For example, whenever you deploy a contract the address it ultimately deploys to will be automatically stored for quick referene at decypher.last.contractAddress Return values the CLI will try to resolve are:

decypher.last.contractAddress
decypher.last.txHash
decypher.last.blockNumber

Tests

Tests will be added at a future time.

Contributing

Contribution guides will be added at a future time.

About

CLI for helper libraries to follow along with the decypher.tv ethereum screencast series

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published