Posts

Showing posts from March 29, 2019

Solidity! Invalid implicit conversion from string memory to bytes memory requested

Image
3 pragma solidity ^0.5 contract ProofOfExistence { // ... some code here function proofFor(string memory document) public view returns(bytes32) { return sha256(document); } // ... some more code here } Gives following error : TypeError: Invalid type for argument in function call. Invalid implicit conversion from string memory to bytes memory requested. I am unable to understand why this error is coming. UPDATE : pragma solidity ^0.5; // Proof of Existence contract, version 3 contract ProofOfExistence3 { mapping (bytes32 => bool) private proofs; // store a proof of existence in the contract state function storeProof(bytes32 proof) public{ proofs[proof] = true; } // calculate and store the proof for a document function notarize(string m