Skip to content

Instantly share code, notes, and snippets.

@maraoz
maraoz / p2pkh.bit
Created July 20, 2015 19:04
Bitcoin Pay-to-PubkeyHash Transaction Script template
OP_DUP
OP_HASH160
<hash(publicKey)>
OP_EQUALVERIFY OP_CHECKSIG
@maraoz
maraoz / multisig.bit
Last active August 29, 2015 14:25
Bitcoin Multisig Transaction Script template
OP_0
OP_<M>
<pubkey1> <pubkey2> ... <pubkeyN>
OP_<N>
OP_CHECKMULTISIG
@maraoz
maraoz / links.txt
Last active June 20, 2018 12:57
some smart contracts links
@maraoz
maraoz / gist:bf1d7fa98dc1506cb448
Created July 11, 2015 02:57
How to stream a movie from a torrent into a terminal with peerflix+mplayer+libcaca
sudo npm install -g peerflix
peerflix "magnet:?xt=urn:btih:ef330b39f4801d25b4245212e75a38634bfc856e"
TERM=xterm-256color DISPLAY= mplayer -vo caca -quiet http://10.0.0.128:8888/
@maraoz
maraoz / Original version
Last active October 5, 2016 13:25
Hashed Timelock Contract (HTLC) as proposed in lightning.network paper
OP_DEPTH 3 OP_EQUAL
OP_IF
OP_HASH160 <hash160(R)> OP_EQUALVERIFY
OP_0 2 <AlicePubkey1> <BobPubkey1> 2 OP_CHECKMULTISIG
OP_ELSE
OP_0 2 <AlicePubkey2> <BobPubkey2> 2 OP_CHECKMULTISIG
OP_END
@maraoz
maraoz / gist:1e7ed2238492db6600fb
Created July 8, 2015 01:01
Generic smart contract for trustless service with a time restriction
OP_IF
<service provided conditions>
<provider pubkey>
ELSE
<expiry time> OP_CHECKLOCKTIMEVERIFY OP_DROP
<client pubkey>
OP_ENDIF
OP_CHECKSIGVERIFY
@maraoz
maraoz / gist:6619395a475eadec25b5
Created July 8, 2015 00:56
Smart contract for trustless double-sha256 pre-image cracking service with a time restriction
OP_IF
OP_HASH256 <challenge hash> OP_EQUALVERIFY
<provider pubkey>
ELSE
<expiry time> OP_CHECKLOCKTIMEVERIFY OP_DROP
<client pubkey>
OP_ENDIF
OP_CHECKSIGVERIFY
@maraoz
maraoz / gist:6963b877294fbc24e1f8
Last active August 29, 2015 14:13
Transaction proposal protocol
transaction_proposal: {
raw,
xpubs[],
m,
input_metadata: [
{
input_transaction, // (optional for participants with no access to the blockchain)
path || paths[],
sighash_type (defaults to SIGHASH_ALL)
} || null
@maraoz
maraoz / gist:43ab4c787c46f5caa490
Created January 15, 2015 20:51
bitcore browser submodule example usage
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Bitcore ECIES browser usage</title>
<script src="bitcore.min.js"></script>
<script src="bitcore-ecies.min.js"></script>
module.exports = {
UserContact: User_Contact,
EntityContact: Entity_Contact
}