contract test{
mapping(uint8 => bytes32) public check;
uint8 [] public array;
function Adddata(string document, uint8 number) returns (bytes32) {
check[number] = sha256(document);
array.push(number);
return check[number];
}
function Getdata(uint8 number) returns(bytes32){
return check[number];
}
}
so this is a simple test contract, I suppose to call Adddata to with a number a string, it maps an uint8 to bytes32(sha256 would convert string to bytes)
So if I call Adddata function, it will return me the sha256 of the stirng, but when I call Getdata afterwards, it returns me 0x000000000 whatever what input I gave...
Anyone know what happened?
MyContract.methods.Adddata(word,num).call
.Adddata
mutates state, so it needs to be invoked via a transaction.