Etica CLIHow to use Etica command line

Launch Console

In order to launch a console and start using Etica command line:

1. Open a second linux terminal
2. Move to the folder core-geth of your blockchain
3. Make sure your node is running on the other window & enter this command to launch a console:

./build/bin/geth attach

If it doesn't work, type: 
./build/bin/geth attach http://127.0.0.1:8545 
(replace http://127.0.0.1:8545 by the rpc url of your node if different) 
                                        

Load Etica Smart Contract

In order to interact with Etica smart contract with command line, in this part we explain how to launch a console on a second window and load Etica smart contract

1. Open a second linux terminal
2. Move to the folder core-geth of your blockchain
3. Make sure your node is running on the other window & enter this command to load etica smart contract:

var abi = [{"constant":true,"inputs":[],"name":"PERIOD_EDITOR_REWARD_RATIO","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"supply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"tokens","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"PROPOSERS_INCREASER","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"diseasesbyIds","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"lastRewardEthBlockNumber","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getMiningDifficulty","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"nonce","type":"uint256"},{"name":"challenge_digest","type":"bytes32"}],"name":"mint","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"IntervalsPeriodsCounter","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"accessibleSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"tokens","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"balances","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"STAKING_DURATION","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"chunksCounter","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getMiningTarget","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"proposals","outputs":[{"name":"id","type":"uint256"},{"name":"proposed_release_hash","type":"bytes32"},{"name":"disease_id","type":"bytes32"},{"name":"period_id","type":"uint256"},{"name":"chunk_id","type":"uint256"},{"name":"proposer","type":"address"},{"name":"title","type":"string"},{"name":"description","type":"string"},{"name":"freefield","type":"string"},{"name":"raw_release_hash","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"proposalsbyIndex","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"DISEASE_CREATION_AMOUNT","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"DEFAULT_VOTING_TIME","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"LAST_PERIOD_COST_UPDATE","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"DEFAULT_REVEALING_TIME","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"APPROVAL_THRESHOLD","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"_totalMiningSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"},{"name":"","type":"uint256"}],"name":"diseasechunks","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"diseases","outputs":[{"name":"disease_hash","type":"bytes32"},{"name":"name","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getMiningReward","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"propsdatas","outputs":[{"name":"starttime","type":"uint256"},{"name":"endtime","type":"uint256"},{"name":"finalized_time","type":"uint256"},{"name":"status","type":"uint8"},{"name":"prestatus","type":"uint8"},{"name":"istie","type":"bool"},{"name":"nbvoters","type":"uint256"},{"name":"slashingratio","type":"uint256"},{"name":"forvotes","type":"uint256"},{"name":"againstvotes","type":"uint256"},{"name":"lastcuration_weight","type":"uint256"},{"name":"lasteditor_weight","type":"uint256"},{"name":"approvalthreshold","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getChallengeNumber","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UNRECOVERABLE_ETI","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"bosoms","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"uint256"}],"name":"stakes","outputs":[{"name":"amount","type":"uint256"},{"name":"endTime","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"initiatormsg","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"chunks","outputs":[{"name":"id","type":"uint256"},{"name":"diseaseid","type":"bytes32"},{"name":"idx","type":"uint256"},{"name":"title","type":"string"},{"name":"desc","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"REWARD_INTERVAL","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"},{"name":"","type":"uint256"}],"name":"diseaseproposals","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"tokensMinted","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"diseasesCounter","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"lastRewardTo","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"SEVERITY_LEVEL","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"tokenOwner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"bytes32"}],"name":"commits","outputs":[{"name":"amount","type":"uint256"},{"name":"timestamp","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"nonce","type":"uint256"},{"name":"challenge_digest","type":"bytes32"},{"name":"challenge_number","type":"bytes32"},{"name":"testTarget","type":"uint256"}],"name":"checkMintSolution","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"epochCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"diseaseProposalsCounter","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"_MAXIMUM_TARGET","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"IntervalsPeriods","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"miningTarget","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"challengeNumber","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"},{"name":"","type":"address"}],"name":"votes","outputs":[{"name":"proposal_hash","type":"bytes32"},{"name":"approve","type":"bool"},{"name":"is_editor","type":"bool"},{"name":"amount","type":"uint256"},{"name":"voter","type":"address"},{"name":"timestamp","type":"uint256"},{"name":"is_claimed","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"nonce","type":"uint256"},{"name":"challenge_digest","type":"bytes32"},{"name":"challenge_number","type":"bytes32"}],"name":"getMintDigest","outputs":[{"name":"digesttest","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PROPOSAL_DEFAULT_VOTE","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"proposalsCounter","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address"},{"name":"tokens","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"PERIOD_CURATION_REWARD_RATIO","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"_BLOCKS_PER_READJUSTMENT","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"inflationrate","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PERIODS_PER_THRESHOLD","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"name":"chunkproposals","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"stakesAmount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"latestDifficultyPeriodStarted","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"blockreward","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PeriodsIssuedCounter","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"periodrewardtemp","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"stakesCounters","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"periodsCounter","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"_MINIMUM_TARGET","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"tokenOwner","type":"address"},{"name":"spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"chunkProposalsCounter","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"diseaseChunksCounter","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PROTOCOL_RATIO_TARGET","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"periods","outputs":[{"name":"id","type":"uint256"},{"name":"interval","type":"uint256"},{"name":"curation_sum","type":"uint256"},{"name":"editor_sum","type":"uint256"},{"name":"reward_for_curation","type":"uint256"},{"name":"reward_for_editor","type":"uint256"},{"name":"forprops","type":"uint256"},{"name":"againstprops","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"PeriodsIssued","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"blockedeticas","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"period_id","type":"uint256"},{"indexed":false,"name":"interval","type":"uint256"}],"name":"CreatedPeriod","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"diseaseindex","type":"uint256"},{"indexed":false,"name":"title","type":"string"}],"name":"NewDisease","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"proposed_release_hash","type":"bytes32"},{"indexed":true,"name":"_proposer","type":"address"},{"indexed":true,"name":"diseasehash","type":"bytes32"},{"indexed":true,"name":"chunkid","type":"uint256"}],"name":"NewProposal","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"chunkid","type":"uint256"},{"indexed":true,"name":"diseasehash","type":"bytes32"}],"name":"NewChunk","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"voter","type":"address"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"proposal_hash","type":"bytes32"}],"name":"RewardClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"voter","type":"address"},{"indexed":false,"name":"fee","type":"uint256"},{"indexed":false,"name":"proposal_hash","type":"bytes32"}],"name":"NewFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"voter","type":"address"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"proposal_hash","type":"bytes32"}],"name":"NewSlash","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_voter","type":"address"},{"indexed":false,"name":"votehash","type":"bytes32"}],"name":"NewCommit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_voter","type":"address"},{"indexed":true,"name":"_proposal","type":"bytes32"}],"name":"NewReveal","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"staker","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"NewStake","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"staker","type":"address"},{"indexed":false,"name":"stakeamount","type":"uint256"}],"name":"StakeClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"tokens","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"tokenOwner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"tokens","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":false,"name":"blockreward","type":"uint256"},{"indexed":false,"name":"epochCount","type":"uint256"},{"indexed":false,"name":"newChallengeNumber","type":"bytes32"}],"name":"Mint","type":"event"},{"constant":false,"inputs":[{"name":"_staker","type":"address"},{"name":"_amount","type":"uint256"}],"name":"eticatobosoms","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_stakeidx","type":"uint256"}],"name":"stakeclmidx","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_endTime","type":"uint256"},{"name":"_min_limit","type":"uint256"},{"name":"_maxidx","type":"uint256"}],"name":"stakescsldt","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_stakeidx","type":"uint256"},{"name":"_snapamount","type":"uint256"}],"name":"stakesnap","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_staker","type":"address"}],"name":"stakescount","outputs":[{"name":"slength","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_name","type":"string"}],"name":"createdisease","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_diseasehash","type":"bytes32"},{"name":"_title","type":"string"},{"name":"_description","type":"string"},{"name":"raw_release_hash","type":"string"},{"name":"_freefield","type":"string"},{"name":"_chunkid","type":"uint256"}],"name":"propose","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"updatecost","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_amount","type":"uint256"},{"name":"_votehash","type":"bytes32"}],"name":"commitvote","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_proposed_release_hash","type":"bytes32"},{"name":"_approved","type":"bool"},{"name":"_vary","type":"string"}],"name":"revealvote","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_proposed_release_hash","type":"bytes32"}],"name":"clmpropbyhash","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_diseasehash","type":"bytes32"},{"name":"_title","type":"string"},{"name":"_description","type":"string"}],"name":"createchunk","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"tokenOwner","type":"address"}],"name":"bosomsOf","outputs":[{"name":"_bosoms","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_name","type":"string"}],"name":"getdiseasehashbyName","outputs":[{"name":"_diseasehash","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"}] 

4. Paste the line & press Enter

5. Load Etica Smart contract's address:

var address = 0x34c61EA91bAcdA647269d4e310A86b875c09946f;

6. Load Etica Smart Contract:

var EticaContract = web3.eth.contract(abi).at("0x34c61EA91bAcdA647269d4e310A86b875c09946f");

Call Etica Smart Contract GET Functions

Get ETI balance of an address:

web3.fromWei(EticaContract.balanceOf('0x2a674CC92dE583590f96135F6259553EaAABeD28'), 'ether');

Get bosoms balance of an address:

web3.fromWei(EticaContract.bosomsOf('0x2a674CC92dE583590f96135F6259553EaAABeD28'), 'ether');

Get ETI staked of an address:

web3.fromWei(EticaContract.stakesAmount('0x2a674CC92dE583590f96135F6259553EaAABeD28'), 'ether');

Get ETI locked in voting system of an address:

web3.fromWei(EticaContract.blockedeticas('0x2a674CC92dE583590f96135F6259553EaAABeD28'), 'ether');

Get number of stakes of an address:

EticaContract.stakescount('0x2a674CC92dE583590f96135F6259553EaAABeD28');

Get number of stakes of an address:

EticaContract.stakesCounters('0x2a674CC92dE583590f96135F6259553EaAABeD28');

Get n'th stake of an address:

EticaContract.stakes('0x2a674CC92dE583590f96135F6259553EaAABeD28', 1); // Get 1st stake of address '0x2a674CC92dE583590f96135F6259553EaAABeD28'
EticaContract.stakes('0x2a674CC92dE583590f96135F6259553EaAABeD28', 2); //  Get 2nd stake of address '0x2a674CC92dE583590f96135F6259553EaAABeD28'
EticaContract.stakes('0x2a674CC92dE583590f96135F6259553EaAABeD28', 3); // Get 3rd stake of address '0x2a674CC92dE583590f96135F6259553EaAABeD28'
// returns stake if exists:
// returned array result correspond to this:
// struct Stake{
//  uint amount; // stake amount in ETI wei (need to divide by 10^18 to get ETI amount)
//  uint endtime; // timestamp in second of when the stake becomes claimable
// }
        

Get commit from an address and the commit hash:

EticaContract.commits('0x2a674CC92dE583590f96135F6259553EaAABeD28', '0xzoiin85suhduih45zuhziuhzhi'); // replace 0x2a674CC92dE583590f96135F6259553EaAABeD28 by an address and 0xzoiin85suhduih45zuhziuhzhi with your commit hash
// returns commit if exists:
// returned array result correspond to this:
// struct Commit{
//  uint amount;
//  uint timestamp; // epoch time of the vote
// }
        

Get vote on a proposal by a specific address:
Remark: Once the commit is revealed, it becomes an actual vote that is taken into account. Otherwise commits do not become votes

EticaContract.votes('0x2a979a78e48bba15ec0586eeeb4029dd361ff4b844b00c9ba22a78184c558c23', '0x2a674CC92dE583590f96135F6259553EaAABeD28'); // Get vote on Proposal '0x2a979a78e48bba15ec0586eeeb4029dd361ff4b844b00c9ba22a78184c558c23'  by address '0x2a674CC92dE583590f96135F6259553EaAABeD28'
// returns vote if exists:
// returned array result correspond to this:
// struct Vote{
//  bytes32 proposal_hash; // proposed_release_hash of proposal
//  bool approve;
//  bool is_editor;
//  uint amount;
//  address voter; // address of the voter
//  uint timestamp; // epoch time of the vote
//  bool is_claimed; // keeps track of whether or not vote has been claimed to avoid double claim on same vote
// }
        

Get current mining challenge Number:

EticaContract.challengeNumber();

Get current mining difficulty:

EticaContract.getMiningDifficulty();

Get total number of ETI blocks mined:

EticaContract.epochCount();

Get current APPROVAL THRESHOLD:

EticaContract.APPROVAL_THRESHOLD();
// returns current approval threshold in integer format
// example: 5030 means 50.30%, 6324 means 60.24% ...
        

Get ETI supply:

web3.fromWei(EticaContract.supply(), 'ether');
// (Note: Actual ETI circulating supply is less because this shows total ETI ever issued 
// without taking into account eti burnt by fees, diseases creation ...)          
        

Get total ETI ever mined:

web3.fromWei(EticaContract._totalMiningSupply(), 'ether');
// (Note: doesn't take into account ETI issued for research rewards ...) 
// ETI for research rewards are not mined but issued for each new period         
        

Get current block reward:

web3.fromWei(EticaContract.getMiningReward(), 'ether');

Get last ETI miner address:

EticaContract.lastRewardTo();

Get the block number of last ETI mint:

EticaContract.lastRewardEthBlockNumber();

Get number of diseases:

EticaContract.diseasesCounter();

Get disease hash by Name:

EticaContract.getdiseasehashbyName('Malaria');
// returns disease's hash if name exists
        

Get disease index by hash:

EticaContract.diseasesbyIds('0xf6d8716087544b8fe1a306611913078dd677450d90295497e433503483ffea6e');
// returns disease index if hash exists
        

Get disease by index:

EticaContract.diseases(1);
EticaContract.diseases(2);
...
// returns disease if index exists, the max index is number of diseases
// number of diseases can be obtained with diseasesCounter() function above
        

Get a disease's number of proposals:

EticaContract.diseasesProposalsCounter();

Get disease nth proposal:

EticaContract.diseaseproposals('0xf6d8716087544b8fe1a306611913078dd677450d90295497e433503483ffea6e', 1); // Get 1st proposal of disease '0xf6d8716087544b8fe1a306611913078dd677450d90295497e433503483ffea6e' 
EticaContract.diseaseproposals('0xf6d8716087544b8fe1a306611913078dd677450d90295497e433503483ffea6e', 2); // Get 2nd proposal of disease '0xf6d8716087544b8fe1a306611913078dd677450d90295497e433503483ffea6e'
...
// returns the proposal's hash if proposal exists, the max index is number of proposals for specified disease
// number of proposals can be obtained with diseaseProposalsCounter() function above
        

Get a disease's number of chunks:

EticaContract.diseasesChunksCounter();

Get a disease's chunks:

EticaContract.diseasechunks('0xf6d8716087544b8fe1a306611913078dd677450d90295497e433503483ffea6e', 1); // Get 1st chunk of disease '0xf6d8716087544b8fe1a306611913078dd677450d90295497e433503483ffea6e' 
EticaContract.diseasechunks('0xf6d8716087544b8fe1a306611913078dd677450d90295497e433503483ffea6e', 2); // Get 2nd chunk of disease '0xf6d8716087544b8fe1a306611913078dd677450d90295497e433503483ffea6e'
...
// returns the chunk's ID if chunk exists, the max index is number of chunks for specified disease
// number of chunks can be obtained with diseaseChunksCounter() function above
        

Get number of chunks:

EticaContract.chunksCounter();

Get chunk by index:

EticaContract.chunks(1);
EticaContract.chunks(2);
...
// returns chunk if index exists, the max index is number of chunks
// result array conrrespond to this:
// struct Chunk{
//  uint id;
//  bytes32 diseaseid; // hash of the disease
//  uint idx;
//  string title;
//  string desc;
// }
// number of chunks can be obtained with chunksCounter() function above
        

Get chunk's proposals by indexes:
(proposals that were submited for a chunk)

EticaContract.chunkproposals(1,1); // get 1st chunk's 1st proposal
// EticaContract.chunkproposals(1,2); // get 1st chunk's 2nd proposal
// EticaContract.chunkproposals(2,1); // get 2nd chunk's 1st proposal
...
// returns proposal hash
        

Get chunk's number of proposals:
(number of proposals that were submited for a chunk)

EticaContract.chunkProposalsCounter(1); // get chunk number of  (1 is chunk_id)
EticaContract.chunkProposalsCounter(2); // get chunk number of proposals (2 is chunk_id)
...
// returns chunk number of proposals
          

Get number of proposals:

EticaContract.proposalsCounter();

Get proposals hashes by Index:

EticaContract.proposalsbyIndex(1);
EticaContract.proposalsbyIndex(2);
...
// returns proposal's hash if index exists, the max index is number of proposals
// number of proposals can be obtained with proposalsCounter() function above
        

Get proposals by Hash:

EticaContract.proposals('0x2a979a78e48bba15ec0586eeeb4029dd361ff4b844b00c9ba22a78184c558c23');
EticaContract.proposals('0xc2328b05d5833bbf24ecbabb6b6ad203560e4809de79cfd24b98ca7775207f4c');
...
// returns proposal if hash exists (hash can be obtained with proposalsbyIndex() function above)
// result array conrrespond to this:
//struct Proposal{
//  uint id;
//  bytes32 proposed_release_hash; // Hash of "raw_release_hash + name of Disease"
//  bytes32 disease_id;
//  uint period_id;
//  uint chunk_id;
//  address proposer; // address of the proposer
//  string title; // Title of the Proposal
//  string description; // Description of the Proposal
//  string freefield;
//  string raw_release_hash;
// }
        

Get proposals data by Hash:

EticaContract.propsdatas('0x2a979a78e48bba15ec0586eeeb4029dd361ff4b844b00c9ba22a78184c558c23');
EticaContract.propsdatas('0xc2328b05d5833bbf24ecbabb6b6ad203560e4809de79cfd24b98ca7775207f4c');
...
// returns proposal if hash exists (hash can be obtained with proposalsbyIndex() function above)
// result array conrrespond to this:
// struct ProposalData{

// uint starttime; // epoch time of the proposal
//  uint endtime;  // voting limite
//  uint finalized_time; // when first clmpropbyhash() was called
//  ProposalStatus status; // Only updates once, when the voting process is over
//  ProposalStatus prestatus; // Updates During voting process
//  bool istie;  // will be initialized with value 0. if prop is tie it won't slash nor reward participants
//  uint nbvoters;
//  uint slashingratio; // solidity does not support float type. So will emulate float type by using uint
//  uint forvotes;
//  uint againstvotes;
//  uint lastcuration_weight; // period curation weight of proposal
//  uint lasteditor_weight; // period editor weight of proposal
//  uint approvalthreshold; // proposal approvalthreshold
// }
        

Get number of periods (number of weeks with at least one proposal):

EticaContract.periodsCounter();

Get period from its index:

EticaContract.periods(1);
EticaContract.periods(2);          
...
// returns period if index exists, the max index is number of periods
// result array conrrespond to this:
// struct Period{
//  uint id;
//  uint interval;
//  uint curation_sum; // used for proposals weight system
//  uint editor_sum; // used for proposals weight system
//  uint reward_for_curation; // total ETI issued to be used as Period reward for Curation
//  uint reward_for_editor; // total ETI issued to be used as Period reward for Editor
//  uint forprops; // number of accepted proposals in this period
//  uint againstprops; // number of rejected proposals in this period
// }
// number of periods can be obtained with periodsCounter() function above
        

Make transactions

In order to make transactions with command line, you need to have done step 1 (launching console and loading Etica smart contract). If you haven't yet, do step 1 and then come back here

1. Unlock your account by running following command:
(replace '0x5oyf640557999a82aa1fe7c92d06b628f352C845' by your address and 'Ge852zUoik52hyfl8521Kbsgq' by the password of your address)

web3.personal.unlockAccount('0x5oyf640557999a82aa1fe7c92d06b628f352C845', 'Ge852zUoik52hyfl8521Kbsgq')

Make sure to check your account EGAZ balance, if there is not enough EGAZ txs will be rejected:

web3.fromWei(web3.eth.getBalance('0x2a674CC92dE583590f96135F6259553EaAABeD28'), 'ether')

Now you're ready to make transactions with the unlocked account

Transfer ETI (get bosoms)

Prerequisites: Having ETI on your address.

Check ETI balance:
web3.fromWei(EticaContract.balanceOf('0x2a674CC92dE583590f96135F6259553EaAABeD28'), 'ether');

This command transfers 1.5 ETI from '0x2a674CC92dE583590f96135F6259553EaAABeD28' to address '0xeD2fA378d1311A9C4527b235b74a2e66A1c396d4':
to change amount replace 1.5 in web3.toWei('1.5', 'ether')

EticaContract.transfer('0xeD2fA378d1311A9C4527b235b74a2e66A1c396d4', web3.toWei(1.5, 'ether'), {from: '0x2a674CC92dE583590f96135F6259553EaAABeD28', gas:200000});

Stake ETI (get bosoms)

Prerequisites: Having ETI on your address.

Check ETI balance:
web3.fromWei(EticaContract.balanceOf('0x2a674CC92dE583590f96135F6259553EaAABeD28'), 'ether');

This command stakes 1.2 ETI:
to change amount replace 1.2 in web3.toWei('1.2', 'ether')

EticaContract.eticatobosoms('0x2a674CC92dE583590f96135F6259553EaAABeD28', web3.toWei('1.2', 'ether'), {from: '0x2a674CC92dE583590f96135F6259553EaAABeD28', gas:200000})

Create Disease

Prerequisites: Having at least 100 ETI on your address.

Check ETI balance:
web3.fromWei(EticaContract.balanceOf('0x2a674CC92dE583590f96135F6259553EaAABeD28'), 'ether');

This command would add disease Malaria to network:
(Following Tx will not pass as Malaria already exists but you can create any disease not already added to network)

EticaContract.createdisease('Malaria', {from: '0x2a674CC92dE583590f96135F6259553EaAABeD28', gas:200000})

Create Chunk

Prerequisites: Having at least 5 ETI on your address.

Check ETI balance:
web3.fromWei(EticaContract.balanceOf('0x2a674CC92dE583590f96135F6259553EaAABeD28'), 'ether');

This command adds a chunk to a disease:

(Following command will not pass as you need to replace 'diseasehashhere' with one of Etica Blockchain diseases' hash.)
Don't forget to replace 'Test Chunk' and 'Test chunk description' by your new chunk title and description

EticaContract.createchunk('diseasehashhere','Test chunk', 'Test chunk description', {from: '0x2a674CC92dE583590f96135F6259553EaAABeD28', gas:200000})

Submit proposal

Prerequisites: Having at least 10 bosoms on your address.

Check BOSOMS balance:
web3.fromWei(EticaContract.bosomsOf('0x2a674CC92dE583590f96135F6259553EaAABeD28'), 'ether');

a) This command would submit a proposal to a disease (with no specific chunk):

(Following command will not pass as you need to replace 'diseasehashhere' with one of Etica Blockchain diseases' hash.)
Also you need to replace 'IPFSHASHHERE' with your proposal IPFS hash
Don't forget to replace 'Test Proposal' and 'Test proposal description' by your proposal title and description

EticaContract.propose('diseasehashhere','Proposal title', 'Proposal description', 'IPFS hash here', 'Freefield add additional info here',0, {from: '0x2a674CC92dE583590f96135F6259553EaAABeD28', gas:1000000})

b) To submit a proposal to a disease for a specific chunk:

Verify your chunk id corresponds to the right chunk :

EticaContract.chunks(1)   // replace 1 by your chunk id
// results correspond to this:
//struct Chunk{
//  uint id;  // id of the chunk at protocol level
//  bytes32 diseaseid; // hash of the disease
//  uint idx; // index of the chunk within the disease. For instance if the chunk was the 4th chunk added to this disease this index value will be 4
//  string title;
//  string desc;   // description
//}
                                    

If the chunk id is right, then create proposal with following command:
Replace fields (for chunkid replace by number not string for instance if chunk id is 1 replace by 1 not '1')

EticaContract.propose('diseasehashhere','Proposal title', 'Proposal description', 'IPFS hash here', 'Freefield add additional info here',chunkid, {from: '0x2a674CC92dE583590f96135F6259553EaAABeD28', gas:1000000})

Commit vote

Prerequisites: Having at least some BOSOMS on your address & having calculated the hash of the vote:

Check BOSOMS balance:
web3.fromWei(EticaContract.bosomsOf('0x2a674CC92dE583590f96135F6259553EaAABeD28'), 'ether');

Here is how to obtain the hashes of your vote commit:
How to calculate vote hashes


This command will make a vote commit worth 1.18 ETI for commit hash '0x524e9b9941ea6bfb289ec7d0f90c4b744906d579d982134b40a1e6c52fd42a81':

EticaContract.commitvote(web3.toWei('1.18', 'ether'), '0x524e9b9941ea6bfb289ec7d0f90c4b744906d579d982134b40a1e6c52fd42a81', {from: '0x2a674CC92dE583590f96135F6259553EaAABeD28', gas:200000})
// note you can increase your commits. To increase just make a new commit to same hash                                                
                                              

Check commit:
replace 0x2a674CC92dE583590f96135F6259553EaAABeD28 by your address
replace 0x524e9b9941ea6bfb289ec7d0f90c4b744906d579d982134b40a1e6c52fd42a81 by your vote hash

EticaContract.commits('0x2a674CC92dE583590f96135F6259553EaAABeD28', '0x524e9b9941ea6bfb289ec7d0f90c4b744906d579d982134b40a1e6c52fd42a81')

Reveal Vote

Prerequisites: The proposal must be in revealing stage and you must have voted on the proposal.

This command reveals vote:

(Following command will not pass as you need to replace '0x0123197fdd119eb692e5c2c8a29b27ed6abc9b298eda52c828f61624b1ca4a6e' with the proposal's hash.)
replace false by true if you voted for the proposal. replace 'secretphrasehere' by your secret phrase or leave it empty if no secret phrse for this vote commit

EticaContract.revealvote('0x0123197fdd119eb692e5c2c8a29b27ed6abc9b298eda52c828f61624b1ca4a6e',false,'', {from: '0x2a674CC92dE583590f96135F6259553EaAABeD28', gas:200000})

Claim Proposal

Prerequisites: The proposal must have past its revealing stage and you must have reevealed your vote on the proposal.

This command claims vote:

(replace '0x0123197fdd119eb692e5c2c8a29b27ed6abc9b298eda52c828f61624b1ca4a6e' with the proposal's hash.)

EticaContract.clmpropbyhash('0x0123197fdd119eb692e5c2c8a29b27ed6abc9b298eda52c828f61624b1ca4a6e', {from: '0x2a674CC92dE583590f96135F6259553EaAABeD28', gas:200000})

Claim stake

Prerequisites: The proposal must have past its revealing stage and you must have reevealed your vote on the proposal.

This command claims a stake:

EticaContract.stakeclmidx(1, {from: '0x2a674CC92dE583590f96135F6259553EaAABeD28', gas:200000})   // this command claims your stake whose index is 1
EticaContract.stakeclmidx(2, {from: '0x2a674CC92dE583590f96135F6259553EaAABeD28', gas:200000})   // this command claims your stake whose index is 2                                        
                                      

Stake consolidation

Prerequisites: You need to have several stakes on your address.

This command consolidates stakes (reduce total number of stakes):

EticaContract.stakescsldt(_endTime, _min_limit, _maxidx, {from: '0x2a674CC92dE583590f96135F6259553EaAABeD28', gas:200000})   // this command cconsolidate your stakes

Stake snap

Prerequisites: No Prerequisites, you only need to have at least one stake.

This command snap a stake (split a stake in two stakes) :

The snap will be worth 2.07 ETI. If the initial stake was worth 10 ETI it will split the stake into a stake of 2.07 ETI and another stake of 7.93 ETI

EticaContract.stakesnap(1, web3.toWei(2.07,'ether'), {from: '0x2a674CC92dE583590f96135F6259553EaAABeD28', gas:200000})   // this command snap a stake
// EticaContract.stakesnap(_stakeidx, web3.toWei(_snapamount,'ether'), {from: '0x2a674CC92dE583590f96135F6259553EaAABeD28', gas:200000}) 
// _stakeidx : The index of the stake you want to snap
// _snapamount : The amount of the new stake (must be less than previous )