bitcoin-hs-0.0.1: Partial implementation of the Bitcoin protocol (as of 2013)

Safe HaskellNone
LanguageHaskell98

Bitcoin.Script.Standard

Description

Standard scripts

Synopsis

Documentation

data InputScript Source #

Standard input scripts (also known as "scriptSig")

Constructors

CoinGeneration !RawScript

coin generation (the script has no meaning)

RedeemAddress !SignatureExt !PubKey

redeem a standard (to-address) transaction: <sig> <pubKey>

RedeemPubKey !SignatureExt

redeem a to-pubkey transaction (?)

RedeemMultiSig [SignatureExt]

redeem a multisig transaction

RedeemP2SH [SignatureExt] !RawScript

redeem a pay-to-script-hash transaction (???)

RedeemEmpty

OP_TRUE - accepts an AnyCanSpend script

UnknownInput (Either RawScript Script)

something else (that is, non-standard)

data OutputScript Source #

Standard output scripts (also known as "scriptSig")

Constructors

PayToAddress !PubKeyHash

OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG

PayToPubKey !PubKey

<pubKey> OP_CHECKSIG (accept generation, for example, but also others?)

PayToMultiSig !Int [PubKey]

eg. OP_2 <pubkey1> <pubkey2> <pubkey3> OP_3 OP_CHECKMULTISIG

PayToScriptHash !ScriptHash

OP_HASH160 <script-hash> OP_EQUAL

Unspendable

OP_RETURN {zero or more ops}

AnyCanSpend

(empty)

UnknownOutput (Either RawScript Script)

something else (that is, non-standard)

createInputScript :: InputScript -> RawScript Source #

Note: RedeemP2SH is a hack. I should think again how that should work (certainly not this way...)

recognizeTxInput :: TxInput RawScript -> TxInput InputScript Source #

Recognize standard input scripts (also known as "scriptSig").

We need the whole TxInput since coinbase transactions are not possible to recognize only from the script (which can be anything).

recognizeInputScript :: RawScript -> InputScript Source #

Note: this cannot recognize coinbase transactions.

recognizeTxOutput :: TxOutput RawScript -> TxOutput OutputScript Source #

Recognize standard output scripts (also known as "scriptPubKey")