Skip to content

Instantly share code, notes, and snippets.

@eddieoz
Forked from anonymous/Untitled
Last active December 8, 2015 19:58
Show Gist options
  • Save eddieoz/e0fa4cb5b504d20a262a to your computer and use it in GitHub Desktop.
Save eddieoz/e0fa4cb5b504d20a262a 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