Ethereum Contract Tool
Install
$ npm install -g @crypto/contract
Command Line Options
$ contract -h
Specify Contract File
$ contract -f <path_to_file>
$ contract -h amazing.com -p 9999 -f <path_to_file>
If omitted host defaults to localhost
and port defaults to 6767
.
Prompt Options
Compile
contract$ compile
Deploy
contract$ deploy
contract$ deploy -a <account_address>
If omitted account address defaults to the first account web3.eth.accounts[0]
.
contract$ deploy -g <gas_amount>
If omitted the gas amount defaults to 1000000
.
Init
contract$ init -a <contract_address>
Set Name
contract$ name <name>
contract$ <name>
Execute Methods
contract$ name: newDocument('hash', {from: web3.eth.coinbase, gas: 1800000})
Watch for Events
contract$ notereth$ DocumentEvent({}, {fromBlock: 0, toBlock: 'latest'}).watch
contract$ notereth$ allEvents({}, {fromBlock: 0, toBlock: 'latest'}).watch
Example
Basics
$ contract -f <path_to_file>
contract$ deploy
contract$ name notereth
contract$ notereth
notereth$ notereth: newDocument('hash', {from: web3.eth.coinbase, gas: 1800000})
Watching
$ contract -f <path_to_file>
contract$ init -a 0x241bbd0ef9492aa17866c662b750f24003c812c6
contract$ name notereth
contract$ notereth
contract$ notereth:
contract$ notereth$ DocumentEvent({}, {fromBlock: 0, toBlock: 'latest'}).watch
Notice that the callback for the watch
method is missing.
contract$ notereth$ newDocument('hash', {from: web3.eth.coinbase, gas: 1800000})