Created
December 8, 2015 19:48
-
-
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=
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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