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
const fetchLatestBlock = () => | |
fetch(`https://blockchain.info/q/latesthash?cors=true`) | |
.then(r => r.text()); | |
const fetchMerkleRootAndTransactions = block => | |
fetch(`https://blockchain.info/rawblock/${block}?cors=true`) | |
.then(r => r.json()) | |
.then(d => [d.mrkl_root, d.tx.map(t => t.hash)]); | |
const random = arr => |
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
pragma solidity ^0.4.21; | |
import "../../node_modules/zeppelin-solidity/contracts/token/ERC20/ERC20.sol"; | |
import "../../node_modules/zeppelin-solidity/contracts/ownership/Ownable.sol"; | |
import "../webshop/Webshop.sol"; | |
contract Escrow is Ownable { | |
enum PaymentStatus { Pending, Completed, Refunded } | |
event PaymentCreation(uint indexed orderId, address indexed customer, uint value); |
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
from hashlib import sha256 | |
from sys import argv | |
with open(argv[1], "rb") as f: | |
blocks = [] | |
block = f.read(1024) | |
while block: | |
blocks.append(block) | |
block = f.read(1024) |