haskoin-core-0.8.1: Bitcoin & Bitcoin Cash library for Haskell

CopyrightNo rights reserved
LicenseUNLICENSE
Maintainerxenog@protonmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Network.Haskoin.Test

Description

Arbitrary instances for testing.

Synopsis

Documentation

arbitraryBS1 :: Gen ByteString Source #

Arbitrary non-empty strict ByteString

arbitraryBSn :: Int -> Gen ByteString Source #

Arbitrary strict ByteString of a given length

arbitraryUTCTime :: Gen UTCTime Source #

Arbitrary UTCTime that generates dates after 01 Jan 1970 01:00:00 CET

arbitraryMaybe :: Gen a -> Gen (Maybe a) Source #

Generate a Maybe from a Gen a

newtype TestCoin Source #

Wrapped coin value for testing.

Constructors

TestCoin 

Fields

Instances
Eq TestCoin Source # 
Instance details

Defined in Network.Haskoin.Test.Transaction

Show TestCoin Source # 
Instance details

Defined in Network.Haskoin.Test.Transaction

Coin TestCoin Source # 
Instance details

Defined in Network.Haskoin.Test.Transaction

arbitraryTxHash :: Gen TxHash Source #

Arbitrary transaction hash (for non-existent transaction).

arbitrarySatoshi :: Network -> Gen TestCoin Source #

Arbitrary amount of Satoshi as Word64 (Between 1 and 21e14)

arbitraryTx :: Network -> Gen Tx Source #

Arbitrary transaction. Can be regular or with witnesses.

arbitraryLegacyTx :: Network -> Gen Tx Source #

Arbitrary regular transaction.

arbitraryWitnessTx :: Network -> Gen Tx Source #

Arbitrary witness transaction (witness data is fake).

arbitraryWLTx :: Network -> Bool -> Gen Tx Source #

Arbitrary witness or legacy transaction.

arbitraryAddrOnlyTx :: Network -> Gen Tx Source #

Arbitrary transaction containing only inputs of type SpendPKHash, SpendScriptHash (multisig) and outputs of type PayPKHash and PaySH. Only compressed public keys are used.

arbitraryAddrOnlyTxFull :: Network -> Gen Tx Source #

Like arbitraryAddrOnlyTx without empty signatures in the inputs.

arbitraryAddrOnlyTxIn :: Network -> Gen TxIn Source #

Arbitrary TxIn that can only be of type SpendPKHash or SpendScriptHash (multisig). Only compressed public keys are used.

arbitraryAddrOnlyTxOut :: Network -> Gen TxOut Source #

Arbitrary TxOut that can only be of type PayPKHash or PaySH.

arbitrarySigInput :: Network -> Gen (SigInput, [SecKeyI]) Source #

Arbitrary SigInput with the corresponding private keys used to generate the ScriptOutput or RedeemScript.

arbitraryInputStuff :: Network -> Gen (Word64, OutPoint, SigHash) Source #

Arbitrary value, out point and sighash for an input.

arbitrarySigningData :: Network -> Gen (Tx, [SigInput], [SecKeyI]) Source #

Arbitrary Tx (empty TxIn), SigInputs and private keys that can be passed to signTx or detSignTx to fully sign the Tx.

arbitraryEmptyTx :: Network -> Gen Tx Source #

Arbitrary transaction with empty inputs.

arbitraryPartialTxs :: Network -> Gen ([Tx], [(ScriptOutput, Word64, OutPoint, Int, Int)]) Source #

Arbitrary partially-signed transactions.

arbitraryScript :: Gen Script Source #

Arbitrary Script with random script ops.

arbitraryScriptOp :: Gen ScriptOp Source #

Arbitrary ScriptOp (push operations have random data).

arbitraryIntScriptOp :: Gen ScriptOp Source #

Arbtirary ScriptOp with a value in [OP_1 .. OP_16].

arbitrarySigHash :: Gen SigHash Source #

Arbitrary SigHash (including invalid/unknown sighash codes).

arbitraryTxSignature :: Network -> Gen (TxHash, SecKey, TxSignature) Source #

Arbitrary message hash, private key and corresponding TxSignature. The signature is generated deterministically using a random message and a random private key.

arbitraryTxSignatureEmpty :: Network -> Gen TxSignature Source #

Arbitrary transaction signature that could also be empty.

arbitraryMSParam :: Gen (Int, Int) Source #

Arbitrary m of n parameters.

arbitraryScriptOutput :: Network -> Gen ScriptOutput Source #

Arbitrary ScriptOutput (Can by any valid type).

arbitraryMSOutputC :: Gen ScriptOutput Source #

Arbitrary ScriptOutput of type PayMS, only using compressed keys.

arbitraryPKHashInputFullC :: Network -> Gen ScriptInput Source #

Like above but only compressed.

arbitraryMulSigSHInput :: Network -> Gen ScriptInput Source #

Arbitrary ScriptInput of type ScriptHashInput containing a RedeemScript of type PayMulSig and an input of type SpendMulSig.

arbitraryMulSigSHInputC :: Network -> Gen ScriptInput Source #

Arbitrary ScriptInput of type ScriptHashInput containing a RedeemScript of type PayMulSig and an input of type SpendMulSig.

arbitraryMulSigSHInputFull :: Network -> Gen ScriptInput Source #

Like arbitraryMulSigSHCInput with no empty signatures.

arbitraryMulSigSHInputFullC :: Network -> Gen ScriptInput Source #

Like arbitraryMulSigSHCInput with no empty signatures.

arbitraryInv1 :: Gen Inv Source #

Arbitrary non-empty Inv.

arbitraryAddr1 :: Gen Addr Source #

Arbitrary non-empty Addr.

arbitraryAlert :: Gen Alert Source #

Arbitrary Alert with random payload and signature. Signature is not valid.

arbitraryGetData :: Gen GetData Source #

Arbitrary non-empty GetData.

arbitraryBloomFlags :: Gen BloomFlags Source #

Arbitrary bloom filter flags.

arbitraryBloomFilter :: Gen (Int, Double, BloomFilter) Source #

Arbitrary bloom filter with its corresponding number of elements and false positive rate.

arbitrarySecKeyI :: Gen SecKeyI Source #

Arbitrary private key with arbitrary compressed flag.

arbitraryKeyPair :: Gen (SecKeyI, PubKeyI) Source #

Arbitrary keypair, both either compressed or not.

arbitraryXPrvKey :: Gen XPrvKey Source #

Arbitrary extended private key.

arbitraryXPubKey :: Gen (XPrvKey, XPubKey) Source #

Arbitrary extended public key with its corresponding private key.

genIndex :: Gen Word32 Source #

Arbitrary derivation index with last bit unset.

arbitraryBip32PathIndex :: Gen Bip32PathIndex Source #

Arbitrary BIP-32 path index. Can be hardened or not.

arbitraryHardPath :: Gen HardPath Source #

Arbitrary BIP-32 derivation path composed of only hardened derivations.

arbitrarySoftPath :: Gen SoftPath Source #

Arbitrary BIP-32 derivation path composed of only non-hardened derivations.

arbitraryDerivPath :: Gen DerivPath Source #

Arbitrary derivation path composed of hardened and non-hardened derivations.

arbitraryParsedPath :: Gen ParsedPath Source #

Arbitrary parsed derivation path. Can contain ParsedPrv, ParsedPub or ParsedEmpty elements.

arbitrarySignature :: Gen (Hash256, SecKey, Sig) Source #

Arbitrary message hash, private key, nonce and corresponding signature. The signature is generated with a random message, random private key and a random nonce.

arbitraryHash160 :: Gen Hash160 Source #

Arbitrary 160-bit hash.

arbitraryHash256 :: Gen Hash256 Source #

Arbitrary 256-bit hash.

arbitraryHash512 :: Gen Hash512 Source #

Arbitrary 512-bit hash.

arbitraryCheckSum32 :: Gen CheckSum32 Source #

Arbitrary 32-bit checksum.

arbitraryBlock :: Network -> Gen Block Source #

Block full or arbitrary transactions.

arbitraryBlockHeader :: Gen BlockHeader Source #

Block header with random hash.

arbitraryBlockHash :: Gen BlockHash Source #

Arbitrary block hash.

arbitraryGetBlocks :: Gen GetBlocks Source #

Arbitrary GetBlocks object with at least one block hash.

arbitraryGetHeaders :: Gen GetHeaders Source #

Arbitrary GetHeaders object with at least one block header.

arbitraryHeaders :: Gen Headers Source #

Arbitrary Headers object with at least one block header.

arbitraryMerkleBlock :: Gen MerkleBlock Source #

Arbitrary MerkleBlock with at least one hash.

arbitraryAddress :: Gen Address Source #

Arbitrary pay-to-public-key-hash or pay-to-script-hash address.

arbitraryPubKeyAddress :: Gen Address Source #

Arbitrary pay-to-public-key-hash address.

arbitraryScriptAddress :: Gen Address Source #

Arbitrary pay-to-script-hash address.