{"id":26509641,"url":"https://github.com/ppad-tech/script","last_synced_at":"2025-10-13T18:01:55.656Z","repository":{"id":273198298,"uuid":"918740591","full_name":"ppad-tech/script","owner":"ppad-tech","description":"Representations and fast conversions for Script","archived":false,"fork":false,"pushed_at":"2025-03-10T16:57:41.000Z","size":70,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-10T17:50:59.881Z","etag":null,"topics":["bitcoin","bitcoin-script","haskell"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ppad-tech.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-18T18:25:21.000Z","updated_at":"2025-03-10T16:57:44.000Z","dependencies_parsed_at":"2025-02-19T16:28:55.041Z","dependency_job_id":"51cbaf09-5530-4794-906e-2cca95b8d8e7","html_url":"https://github.com/ppad-tech/script","commit_stats":null,"previous_names":["ppad-tech/script"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppad-tech%2Fscript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppad-tech%2Fscript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppad-tech%2Fscript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppad-tech%2Fscript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ppad-tech","download_url":"https://codeload.github.com/ppad-tech/script/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244717471,"owners_count":20498306,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitcoin","bitcoin-script","haskell"],"created_at":"2025-03-21T01:19:59.610Z","updated_at":"2025-10-13T18:01:55.439Z","avatar_url":"https://github.com/ppad-tech.png","language":"Haskell","readme":"# script\n\n[![](https://img.shields.io/hackage/v/ppad-script?color=blue)](https://hackage.haskell.org/package/ppad-script)\n![](https://img.shields.io/badge/license-MIT-brightgreen)\n[![](https://img.shields.io/badge/haddock-script-lightblue)](https://docs.ppad.tech/script)\n\nRepresentations for [Script](https://en.bitcoin.it/wiki/Script),\nincluding abstract syntax, 'ByteArray', and base16-encoded 'ByteString'\nversions, as well as fast conversion utilities for working with them.\n\n## Usage\n\nA sample GHCi session:\n\n```\n  \u003e :set -XOverloadedStrings\n  \u003e\n  \u003e -- import qualified\n  \u003e import qualified Bitcoin.Prim.Script as S\n  \u003e\n  \u003e -- base16-encoded p2pkh scriptPubKey\n  \u003e let p2pkh = \"76a91489abcdefabbaabbaabbaabbaabbaabbaabbaabba88ac\"\n  \u003e\n  \u003e -- bytearray-encoded\n  \u003e let Just script = S.from_base16 p2pkh\n  \u003e script\n  Script [ 0x76, 0xa9, 0x14, 0x89, 0xab, 0xcd, 0xef\n         , 0xab, 0xba, 0xab, 0xba, 0xab, 0xba, 0xab\n         , 0xba, 0xab, 0xba, 0xab, 0xba, 0xab, 0xba\n         , 0xab, 0xba, 0x88, 0xac\n         ]\n  \u003e\n  \u003e -- abstract syntax-encoded\n  \u003e let terms = S.from_script script\n  \u003e terms\n  [ OP_DUP, OP_HASH160, OP_PUSHBYTES_20, 0x89, 0xab, 0xcd, 0xef\n  , 0xab, 0xba, 0xab, 0xba, 0xab, 0xba, 0xab\n  , 0xba, 0xab, 0xba, 0xab, 0xba, 0xab, 0xba\n  , 0xab, 0xba, OP_EQUALVERIFY, OP_CHECKSIG\n  ]\n  \u003e\n  \u003e -- round-trip\n  \u003e S.to_base16 (S.to_script terms)\n  \"76a91489abcdefabbaabbaabbaabbaabbaabbaabbaabba88ac\"\n```\n\n## Documentation\n\nHaddocks (API documentation, etc.) are hosted at\n[docs.ppad.tech/script](https://docs.ppad.tech/script).\n\n## Performance\n\nThe aim is best-in-class performance for highly-auditable Haskell code.\n\nCurrent benchmark figures on my mid-2020 MacBook Air look like (use\n`cabal bench` to run the benchmark suite):\n\n```\n  benchmarking to_script\n  time                 484.9 ns   (478.3 ns .. 491.4 ns)\n                       0.998 R²   (0.997 R² .. 0.999 R²)\n  mean                 496.2 ns   (485.8 ns .. 508.1 ns)\n  std dev              37.17 ns   (30.08 ns .. 49.95 ns)\n  variance introduced by outliers: 83% (severely inflated)\n\n  benchmarking from_script\n  time                 380.8 ns   (374.3 ns .. 387.5 ns)\n                       0.998 R²   (0.996 R² .. 0.999 R²)\n  mean                 383.0 ns   (375.3 ns .. 395.4 ns)\n  std dev              31.88 ns   (22.41 ns .. 43.86 ns)\n  variance introduced by outliers: 86% (severely inflated)\n\n  benchmarking to_base16\n  time                 291.3 ns   (285.6 ns .. 297.9 ns)\n                       0.996 R²   (0.995 R² .. 0.998 R²)\n  mean                 298.3 ns   (291.8 ns .. 308.1 ns)\n  std dev              26.38 ns   (21.25 ns .. 34.27 ns)\n  variance introduced by outliers: 87% (severely inflated)\n\n  benchmarking from_base16\n  time                 439.1 ns   (429.9 ns .. 448.2 ns)\n                       0.997 R²   (0.996 R² .. 0.998 R²)\n  mean                 437.9 ns   (429.9 ns .. 450.0 ns)\n  std dev              32.67 ns   (26.12 ns .. 44.04 ns)\n  variance introduced by outliers: 83% (severely inflated)\n```\n\nwhere the inputs to the above functions are variations of the script found\nin the 'Usage' section.\n\n## Security\n\nThis library aims at the maximum security achievable in a\ngarbage-collected language under an optimizing compiler such as GHC, in\nwhich strict constant-timeness can be challenging to achieve.\n\nIf you discover any vulnerabilities, please disclose them via\nsecurity@ppad.tech.\n\n## Development\n\nYou'll require [Nix][nixos] with [flake][flake] support enabled. Enter a\ndevelopment shell with:\n\n```\n$ nix develop\n```\n\nThen do e.g.:\n\n```\n$ cabal repl ppad-script\n```\n\nto get a REPL for the main library.\n\n## Attribution\n\nThe list of opcodes was originally taken\nverbatim from the 'opcode' crate found in\n[rust-bitcoin](https://github.com/rust-bitcoin/rust-bitcoin).\n\n[nixos]: https://nixos.org/\n[flake]: https://nixos.org/manual/nix/unstable/command-ref/new-cli/nix3-flake.html\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fppad-tech%2Fscript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fppad-tech%2Fscript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fppad-tech%2Fscript/lists"}