mdg

0.0.4 • Public • Published

Madagascar (mdg)

npm version

General purpose Ethereum smart contract API server

The library is designed to make it easier to programmatically interact with smart contracts on Ethereum. It achieves that by creating a RESTful JSON api that mirrors all functions of a given contract. As a result, calls to contract functions can be made remotely via a traditional HTTP endpoint interface.

It also features a fully functional integration test suite that allows for automated testing of smart contract functions.

To see how this works please check the SimpleCoin API test

Installation

npm install mdg

Dependencies

io.js

The library is built with the latest features of ES6 supported by https://iojs.org/en/index.html

Ethereum

The library requires a running instance of an Ethereum client with JSON-RPC enabled. See:

If you are planning to use Geth (best choice as it stands), you will also need solc from cpp-ethereum if you want to be able to compile contracts from cli.

Make sure your primary account (or coinbase) has some funds, or otherwise you will not be able to send any transactions. Apart from this, your primary account needs to be explicitly "unlocked" to allow for transactions being sent via a programmatic interface (web3). For example, with Geth you need to start your client with --unlock primary. The full command would look like:

geth --unlock primary --rpc

Usage

var Mdg = require("mdg");
 
var mdg = (new Mdg(settings)).start();

Settings

A sample settings file can be found in test/

A note on running tests

If you configured your Ethereum client to work as described in the Dependencies section then testing should be pretty straight forward. A word of advice would be to set up your Ethereum client to run a private chain so you have plenty of ether to spend. I would also recommend reducing the amount of hardware resources allocated to mining so that your machine makes a bit less noise :) With Geth the full command would look like this (replace "12345" with any number):

geth --networkid 12345 --minerthreads 1  --rpc --unlock primary --mine

Readme

Keywords

none

Package Sidebar

Install

npm i mdg

Weekly Downloads

6

Version

0.0.4

License

MIT

Last publish

Collaborators

  • ethertools