Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var a = eth.accounts[0]
web3.eth.defaultAccount = a;
// abi and bytecode generated from simplestorage.sol:
// > solcjs --bin --abi simplestorage.sol
var abi = <ABI>;
var Contract = web3.eth.contract(abi);
var contract = Contract.at(<ContractAddress>);
console.log(contract);
//string pubKey, string userHash, string metadataHash, string userClass, bool isOrg
contract.createAccount("<pubKey>","<userHash>","<metahash>","userclass",true,function(error, result){
if(!error)
{
console.log("RESULT: ");
console.log(result);
}
else{
console.log("ERROR: ");
console.error(error);
}
});
//The Result must contain the details entered above, but the result comes out to blank. Thus the transaction was not executed.
contract.getAccount("<userHash>",function(error, result){
if(!error)
{
console.log("RESULT: ");
console.log(result);
}
else{
console.log("ERROR: ");
console.error(error);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment