by
3 7
0
3
431
0
Top 5% !
Popular
Specified
Created
Modified Aug 30, 2017

Published on:

No tags for this snippet yet.
Languagecsharp
LanguagePython
SourceGitHub

The block structure for SnakeCoin.

The block structure for SnakeCoin.: 
snakecoin-block.py
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/2573367/The-block-structure-for-SnakeCoin-?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
import hashlib as hasher class Block: def __init__(self, index, timestamp, data, previous_hash): self.index = index self.timestamp = timestamp self.data = data self.previous_hash = previous_hash self.hash = self.hash_block() def hash_block(self): sha = hasher.sha256() sha.update(str(self.index) + str(self.timestamp) + str(self.data) + str(self.previous_hash)) return sha.hexdigest()
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus