You must install geth (OSX commands below, see link for more information or other platforms):
brew tap ethereum/ethereum
brew install ethereum
- path
Model for setting deployed contract addresses in a plain text file and getting those addresses.
- findConfig(originalDirectory, levels) ⇒
Object
Recursively calls up directories from this file to find delib.js configuration file. If it doesn't find one it gets the default config file.
Kind: global class
- Ethereum
- new Ethereum()
- ._getBuiltContract(contractName) ⇒
Contract
- .buildContracts(contractFiles, contractPath, buildPath)
- .init(rpcHost, rpcPort, contractOptions) ⇒
Web3
- .initIPC(ipcPath) ⇒
Web3
- .check() ⇒
bool
- .changeAccount(index) ⇒
string
- .createAccount(password) ⇒
Promise
- .unlockAccount(address, password, timeLength) ⇒
boolean
- .getBalanceEther(index) ⇒
number
- .getBalanceWei(index) ⇒
number
- .toWei(amount) ⇒
number
- .toEther(amount) ⇒
number
- .deploy(contractName, args, options) ⇒
Promise
- .exec(contractName) ⇒
Contract
- .execAt(contractName, contractAddress) ⇒
Contract
- .getEventLogs(contractName, contractAddress, method, filter) ⇒
Promise
Create an Ethereum object. Will need to use Ethereum.init() to connect to the Web3 RPC provider and use the Ethereun object methods
Kind: instance method of Ethereum
Returns: Contract
- The built contract
Param | Type | Description |
---|---|---|
contractName | string |
Name of contract in the directory path provided in Ethereum.contract.build |
Builds Solidity contracts.
Kind: instance method of Ethereum
Param | Type | Description |
---|---|---|
contractFiles | array |
Array of contract file names in the directory path provided in Ethereum.config.contracts |
contractPath | string |
Optional. Directory path where contract files are located. If none is given the directory path will be retrieved from config.path. |
buildPath | string |
Optional. Directory path where built contracts will be put. If none is given the directory path will be retrieved from config.built. |
Initializes a RPC connection with a local Ethereum node. The RPC provider is set in Ethereum.config.rpc.port. Need to call before using the Ethereum object. If RPC connection is already initalized and valid the RPC connection will be set to the current provider.
Kind: instance method of Ethereum
Returns: Web3
- The Web3 object Ethereum uses set up to the RPC provider
Param | Type | Description |
---|---|---|
rpcHost | string |
The host URL path to the RPC connection. Optional. If not given the rpcHost path will be taken from Ethereum.config.rpc.host. |
rpcPort | number |
The port number to the RPC connection. Optional. If not given the rpcPort path will be taken from Ethereum.config.rpc.port. |
contractOptions | Object |
Options to set up the contract paths. Takes in path, built, and address properties. |
Initializes an IPC connection with a local Ethereum node. The IPC provider is set in Ethereum.config.ipc.host. Need to call before using the Ethereum object IPC methods.
Kind: instance method of Ethereum
Returns: Web3
- The Web3 object Ethereum uses for its IPC connection.
Param | Type | Description |
---|---|---|
ipcPath | string |
Path to the IPC provider. Example for Unix: process.env.HOME + '/Library/Ethereum/geth.ipc' |
Checks the connection to the RPC provider
Kind: instance method of Ethereum
Returns: bool
- The true or false status of the RPC connection
Change the account address being used by the Ethereum object.
Kind: instance method of Ethereum
Returns: string
- The account address now being used.
Param | Type | Description |
---|---|---|
index | number |
Index of the account address returned from web3.eth.accounts to change to. |
Creates a new Ethereum account. The account will be located in your geth Ethereum directory in a JSON file encrpyted with the password provided. process.exit() needs to be called in Promise or the method will run indefinately. Don't use process.exit() if using method in Electron.
Kind: instance method of Ethereum
Returns: Promise
- Promise return is a string with the newly created account's address.
Param | Type | Description |
---|---|---|
password | string |
The password to create the new account with. |
Unlocks an Ethereum account. process.exit() needs to be called in Promise or the method will run indefinately. Don't use process.exit() if using method in Electron.
Kind: instance method of Ethereum
Returns: boolean
- Status if account was sucessfully unlocked.
Param | Type | Description |
---|---|---|
address | string |
The address of the account. |
password | string |
Password of account. |
timeLength | number |
Time in seconds to have account remain unlocked for. |
Get the Ether balance of an account in Ether denomination.
Kind: instance method of Ethereum
Returns: number
- The amount of Ether contained in the account.
Param | Type | Description |
---|---|---|
index | number |
Index of the account to check the balance of in Ether. |
Get the Ether balance of an account in Wei denomination. 1 Ether = 1,000,000,000,000,000,000 wei
Kind: instance method of Ethereum
Returns: number
- The amount of Ether in Wei contained in the account.
Param | Type | Description |
---|---|---|
index | number |
Index of the account to check the balance of inWei. |
Convert an Ether amount to Wei
Kind: instance method of Ethereum
Returns: number
- Converted Wei amount.
Param | Type | Description |
---|---|---|
amount | number |
Amount to convert. Can also be a BigNumber object. |
Convert a Wei amount to Ether.
Kind: instance method of Ethereum
Returns: number
- Converted Ether amount.
Param | Type | Description |
---|---|---|
amount | number |
Amount to convert. Can also be a BigNumber object. |
Deploy a built contract.
Kind: instance method of Ethereum
Returns: Promise
- The response is a Contract object of the deployed instance.
Param | Type | Description |
---|---|---|
contractName | string |
Name of built contract located in the directory provided in Ethereum.config.built. |
args | Array |
Arguments to be passed into the deployed contract as initial parameters. |
options | Object |
Transaction options. Options are: {from: contract address, value: number, gas: number, gasValue: number}. |
Calls a deployed contract. Will take the address provided in the config address
Kind: instance method of Ethereum
Returns: Contract
- Contract object that you can call methods with.
Param | Type | Description |
---|---|---|
contractName | string |
Name of built contract located in the directory provided in Ethereum.config.built. |
Calls a deployed contract at a specific address.
Kind: instance method of Ethereum
Returns: Contract
- Contract object that you can call methods with.
Param | Type | Description |
---|---|---|
contractName | string |
Name of built contract located in the directory provided in Ethereum.config.built. |
contractAddress | string |
Address of the contract. |
Kind: instance method of Ethereum
Returns: Promise
- The response contains an array event logs.
Param | Type | Description |
---|---|---|
contractName | string |
Name of built contract located in the directory provided in Ethereum.config.built. |
contractAddress | string |
Address of the contract. |
method | string |
The name of the event method. |
filter | Object |
Options to filter the events. Default: { address: contractAddress }. |
Kind: global class
- IPFS
- new IPFS()
- .init(manualConfig) ⇒
IPFS
- .daemon()
- .addFiles(filePaths) ⇒
Promise
- .download(hashAddress, writePath) ⇒
Promise
- .links(hashAddress) ⇒
Promise
- .pin(hashAddress) ⇒
Promise
- .unpin(hashAddress) ⇒
Promise
Create a new IPFS object
ipfS.init(manualConfig) ⇒ IPFS
Initalize the connection to an IPFS node. If no network configuration is given the configuration will be taken from IPFS.config.
Kind: instance method of IPFS
Returns: IPFS
- IPFS object
Param | Type | Description |
---|---|---|
manualConfig | Object |
Object containing the configuration parameters for IPFS. Default: { host: 'localhost', port: 5001, protocol: 'http' } |
Open an IPFS daemon is a child process
Kind: instance method of IPFS
Add a single file or multiple files to the connected IPFS node.
Kind: instance method of IPFS
Returns: Promise
- Response of Promise is an array of objects with {path: string, hash: string, size: number, file: filePath}
Param | Type | Description |
---|---|---|
filePaths | string |
Path to file. Can also be an array of paths. |
Retrieve a file based on his hash address from the IPFS network.
Kind: instance method of IPFS
Returns: Promise
- Response of Promise is an array of all file buffer chunks.
Param | Type | Description |
---|---|---|
hashAddress | string |
Hashaddress of the file. |
writePath | string |
Path in which to write the file to. |
Take a hash address corresponding to a particular file and retrieve the Merkle Dag links of that file.
Kind: instance method of IPFS
Returns: Promise
- Response of Promise is an array of Objects with DAGLink info. {name: String, hashAddress: String, size: Number, hash: Buffer of hash address}
Param | Type | Description |
---|---|---|
hashAddress | string |
Hash address of the file. |
Pin a hash address to the connected to IPFS node.
Kind: instance method of IPFS
Returns: Promise
- Response of Promise is an array of the hash addresses of the pinned files.
Param | Type | Description |
---|---|---|
hashAddress | string |
Hash address of the file. |
Unpin a hash address to the connected to IPFS node.
Kind: instance method of IPFS
Returns: Promise
- Response of Promise is an array of the hash addresses of the unpinned files.
Param | Type | Description |
---|---|---|
hashAddress | string |
Hash address of the file. |
Model for setting deployed contract addresses in a plain text file and getting those addresses.
Recursively calls up directories from this file to find delib.js configuration file. If it doesn't find one it gets the default config file.
Kind: global function
Returns: Object
- The configuration object.
Param | Type | Description |
---|---|---|
originalDirectory | string |
The original directory. Pass in process.cwd() |
levels | number |
The number of folders to go up |