$30 off During Our Annual Pro Sale. View Details »

Decrypting Crypto-Currency with F#

Decrypting Crypto-Currency with F#

Robert Pickering

June 27, 2014
Tweet

More Decks by Robert Pickering

Other Decks in Programming

Transcript

  1. Decrypting Crypto-Currency
    with F#
    A Very Serious Presentation by
    Robert Pickering

    View Slide

  2. much dogecoin
    wow

    View Slide

  3. such coin
    very crypto
    wow

    View Slide

  4. much peer-to-peer
    such distributed wow

    View Slide

  5. type IPeerToPeerConnectionManager =
    abstract Connect: unit -> unit
    abstract Broadcast: Message -> unit
    abstract SendTo: IPAddress -> Message -> unit
    []
    abstract MessageReceived: IEvent

    View Slide

  6. Such database
    Block Block Block Block
    Genasis
    Block
    Trans Trans Trans Trans
    Address Address Address Address
    Trans
    Address
    Reward Reward Reward Reward
    Payment

    View Slide

  7. type Block =
    { OffSet: int64
    Length: int
    Version: int
    Hash: array
    // hash of previous block
    MerKleRoot: array
    Timestamp: DateTime
    Target: int
    Nonce: int
    NumberOfTransactions: uint64
    Transactions: array }

    View Slide

  8. type Transaction =
    { TransactionVersion: int
    NumberOfInputs: uint64
    Inputs: array
    NumberOfOutputs: uint64
    Outputs: array
    LockTime: int
    TransactionHash: array }

    View Slide

  9. type Input =
    { InputHash: array
    InputTransactionIndex: int
    ResponseScriptLength: uint64
    ResponseScript: array
    ParsedResponseScript: option>
    SequenceNumber: int }
    type Output =
    { Value: int64
    OutputScriptLength: uint64
    OutputScript: array
    ParsedOutputScript: option>
    CanonicalOutputScript: option }

    View Slide

  10. very crypto
    such private key

    View Slide

  11. [|Op_Dup; Op_HASH160;
    Op_PushData
    (Vector(20uy),
    [|174uy; 162uy; 183uy; 35uy; 215uy; 73uy; 186uy; 28uy; 7uy; 81uy;
    57uy; 60uy; 120uy; 183uy; 65uy; 181uy; 159uy; 157uy; 79uy; 247uy|]);
    Op_EqualVerify; Op_CheckSig|];
    very output

    View Slide

  12. [|Op_PushData
    (Vector(72uy),
    [|48uy; 69uy; 2uy; 32uy; 124uy; 166uy; 68uy; 95uy; 86uy; 220uy;
    43uy; 209uy; 203uy; 254uy; 114uy; 34uy; 110uy; 142uy; 200uy;
    164uy; 243uy; 111uy; 76uy; 77uy; 162uy; 249uy; 121uy; 216uy;
    149uy; 52uy; 233uy; 34uy; 147uy; 147uy; 246uy; 180uy; 2uy; 33uy;
    0uy; 217uy; 84uy; 56uy; 142uy; 241uy; 234uy; 57uy; 137uy; 54uy;
    24uy; 166uy; 78uy; 141uy; 235uy; 22uy; 249uy; 196uy; 220uy; 0uy;
    98uy; 0uy; 222uy; 121uy; 12uy; 110uy; 20uy; 2uy; 168uy; 21uy;
    235uy; 92uy; 134uy; 1uy|]);
    Op_PushData
    (Vector(33uy),
    [|2uy; 231uy; 24uy; 167uy; 187uy; 86uy; 155uy; 0uy; 14uy; 185uy;
    222uy; 52uy; 154uy; 160uy; 83uy; 42uy; 172uy; 224uy; 229uy; 26uy;
    22uy; 244uy; 169uy; 246uy; 108uy; 79uy; 236uy; 176uy; 42uy; 85uy;
    46uy; 103uy; 47uy|])|];
    very input

    View Slide

  13. wow
    very hard
    much work

    View Slide

  14. ddf4829b8a9fc60acf4aa74d28e7a188e3e1c22721ea87095a77eb0140fb1428
    Normal Hash:
    0000000000000000423235bbb96c073b9d97dc6f9bc733b09b3594b49d7ffa4c
    Special Hash:
    so zero
    wow

    View Slide

  15. View Slide

  16. Explore the block chain:
    http://blockchain.info/
    Good explanation of the block chain:
    http://james.lab6.com/2012/01/12/bitcoin-285-bytes-that-changed-the-world/
    The protocol specification:
    https://en.bitcoin.it/wiki/Protocol_specification
    My explanation of bitcoin:
    http://robertpi.github.io/blog/2014/01/01/bitcoins-a-detailed-yet-easy-to-
    understand-explaination/
    much info

    View Slide

  17. Questions?

    View Slide