I am trying to compile the following contract on Remix IDE (online): pragma solidity ^0.4.24;
contract ProofofExistence{
event ProofCreated(
uint256 indexed id,
bytes32 documentHash);//an event can be listened by any client
address public owner;//getters are already generated for public variables
mapping (uint => bytes32) hashesById;
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
modifier noHashExistsYet(uint256 id) {
require(hashesById[id] == "");
_;
}//The modifeir can be prepended to any function
constructor() public {//constructor is executed when the contract s created
owner = msg.sender;
}
function notarizeHash(uint256 id, bytes32 documentHash) onlyOwner noHashExistsYet(id) public{
hashesById[id] = documentHash;
emit ProofCreated(id, documentHash);//Proof created event is emited to the block chain
}//The core function of this contract allows its owner
//to confirm a document id with a certain content
function doesProofExist(uint256 id, bytes32 documentHash) public view returns (bool) {
return hashesById[id] == documentHash;
}//view/constant functions are read-only and do not cost gas
}
I am getting the following compilation error message:
browser/ProofofExistence.sol:1:1: SyntaxError: Source file requires different compiler version (current compiler is 0.5.1+commit.c8a2cb62.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version pragma solidity ^0.4.24; ^----------------------^
Can somebody please guide me how to fix this problem?
Zulfi.