@catena/contract
Ethereum smart contracts for Catena blockchain explorer
Last updated 7 months ago by dylanseago .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @catena/contract 
SYNC missed versions from official npm registry.

Catena Smart Contract

npm (scoped) Build Status

Used to publish NRC public funding disclosures and on the Ethereum blockchain.

Built using the Truffle Framework.

Usage

Install:

npm install @catena/contract

Example usage:

const { CatenaContract } = require('@catena/contract')

const catenaContract = CatenaContract(web3)

catenaContract.getDisclosure(687)
  .then(result => console.log(result))

For more information on using a truffle contract see Truffle Docs.

Development

Setup

  • Install node dependencies: npm install
  • Install an ethereum node: Parity or Geth

Parity

Parity works well but you must have the geth flag enabled or truffle migrations will fail.

parity --chain rinkeby --geth

Optionally, add the following for more convenient testing:

--unlock <address> --password <passwordfile>

Geth

If connecting to an actual testnet or mainnet network, you will first need time to sync the blockchain. Running in --fast mode helps:

geth --fast --rpc --rpcapi eth,net,web3,personal --rpccorsdomain="*"

Using mist:

./mist --syncmode=fast --cache=1024

To test using rinkeby:

geth --rinkeby --fast --rpc --rpcapi eth,net,web3,personal --rpccorsdomain="*"

Attaching to the geth node (assuming it's on localhost):

geth attach http://127.0.0.1:8545

  • geth commands

From the geth console you can look at the balance of your primary account:

eth.getBalance("0x0d9cf77f30e7af582762418d7011ef486a388275")

Also, you can unlock your primary account to use its ether for testing or execution:

personal.unlockAccount("0x0d9cf77c30e7af582752418d7011ef486a388275", "password123", 0)

Testing

Testing the smart contract can be done as follows:

npm test

This will start a testrpc server and run truffle test. To run a specific test:

npm test test/DisclosureManageTests.sol

If you want to run tests on a different network like rinkeby, for example, use:

npm test --network rinkeby

Current Tags

  • 1.5.9                                ...           latest (7 months ago)

20 Versions

  • 1.5.9                                ...           7 months ago
  • 1.5.8                                ...           7 months ago
  • 1.5.7                                ...           8 months ago
  • 1.5.6                                ...           8 months ago
  • 1.5.5                                ...           8 months ago
  • 1.5.4                                ...           8 months ago
  • 1.5.3                                ...           8 months ago
  • 1.5.2                                ...           9 months ago
  • 1.4.4                                ...           a year ago
  • 1.4.3                                ...           a year ago
  • 1.4.2                                ...           a year ago
  • 1.4.1                                ...           a year ago
  • 1.4.0                                ...           a year ago
  • 1.3.0                                ...           a year ago
  • 1.2.0                                ...           a year ago
  • 1.1.0                                ...           a year ago
  • 1.0.3                                ...           a year ago
  • 1.0.2                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 21
Last Day 0
Last Week 20
Last Month 1
Dependencies (1)
Dev Dependencies (26)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |