Skip to content

Instantly share code, notes, and snippets.

@vasa-develop
Created May 26, 2018 04:08
Show Gist options
  • Save vasa-develop/ec2a9fbbbfad15bd63ec335f232b4747 to your computer and use it in GitHub Desktop.
Save vasa-develop/ec2a9fbbbfad15bd63ec335f232b4747 to your computer and use it in GitHub Desktop.
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