Skip to content

Instantly share code, notes, and snippets.

Created December 8, 2015 19:48
Show Gist options
  • Save anonymous/86608a06c1b178df6581 to your computer and use it in GitHub Desktop.
Save anonymous/86608a06c1b178df6581 to your computer and use it in GitHub Desktop.
Created using soleditor: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://chriseth.github.io/browser-solidity?gist=
contract proofOfExistence {
mapping (bytes32 => Document) public documents;
struct Document {
uint date;
address creator;
bytes32 hash;
address[] signers;
}
function createNewHash(string document) {
bytes32 hash = sha3(document);
address[] signer;
signer[0] = msg.sender;
if (documents[hash].date > 0) throw;
documents[hash] = Document({
date: now,
creator: msg.sender,
hash: hash,
signers: signer
});
}
function acknowledgeDocument(string document){
bytes32 hash = sha3(document);
Document doc = documents[hash];
uint signerID = doc.signers.length++;
doc.signers[signerID] = msg.sender;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment