{"id":20170683,"url":"https://github.com/bitcoinschema/go-bpu","last_synced_at":"2025-04-10T02:27:37.218Z","repository":{"id":65231354,"uuid":"586973939","full_name":"BitcoinSchema/go-bpu","owner":"BitcoinSchema","description":"Transform Bitcoin Transactions into Virtual Procedure Call Units","archived":false,"fork":false,"pushed_at":"2025-03-18T16:06:29.000Z","size":884,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T03:53:23.068Z","etag":null,"topics":["bitcoin","bitcoin-tx","bpu","go","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","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/BitcoinSchema.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"BitcoinSchema","custom":"https://gobitcoinsv.com/#sponsor?utm_source=github\u0026utm_medium=sponsor-link\u0026utm_campaign=go-bpu\u0026utm_term=go-bpu\u0026utm_content=go-bpu"}},"created_at":"2023-01-09T17:05:10.000Z","updated_at":"2025-03-18T16:05:32.000Z","dependencies_parsed_at":"2023-10-14T13:59:10.609Z","dependency_job_id":"4cf2b147-dbe3-47fe-8219-a1071e4d619c","html_url":"https://github.com/BitcoinSchema/go-bpu","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BitcoinSchema%2Fgo-bpu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BitcoinSchema%2Fgo-bpu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BitcoinSchema%2Fgo-bpu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BitcoinSchema%2Fgo-bpu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BitcoinSchema","download_url":"https://codeload.github.com/BitcoinSchema/go-bpu/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248143878,"owners_count":21054838,"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-tx","bpu","go","golang"],"created_at":"2024-11-14T01:20:15.295Z","updated_at":"2025-04-10T02:27:37.187Z","avatar_url":"https://github.com/BitcoinSchema.png","language":"Go","funding_links":["https://github.com/sponsors/BitcoinSchema","https://gobitcoinsv.com/#sponsor?utm_source=github\u0026utm_medium=sponsor-link\u0026utm_campaign=go-bpu\u0026utm_term=go-bpu\u0026utm_content=go-bpu"],"categories":[],"sub_categories":[],"readme":"# go-bpu\n\n\u003e Transform Bitcoin Transactions into Virtual Procedure Call Units (Bitcoin Processing Unit)\n\n![bpu](./bpu.png)\n\n[![Release](https://img.shields.io/github/release-pre/BitcoinSchema/go-bpu.svg?logo=github\u0026style=flat\u0026v=2)](https://github.com/BitcoinSchema/go-bpu/releases)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/BitcoinSchema/go-bpu/run-tests.yml?branch=master\u0026logo=github\u0026v=2)](https://github.com/BitcoinSchema/go-bpu/actions)\n[![Go](https://img.shields.io/github/go-mod/go-version/BitcoinSchema/go-bpu?v=2)](https://golang.org/)\n\u003cbr\u003e\n[![Mergify Status](https://img.shields.io/endpoint.svg?url=https://api.mergify.com/v1/badges/BitcoinSchema/go-bpu\u0026style=flat\u0026v=2)](https://mergify.io)\n[![Sponsor](https://img.shields.io/badge/sponsor-BitcoinSchema-181717.svg?logo=github\u0026style=flat\u0026v=2)](https://github.com/sponsors/BitcoinSchema)\n[![Donate](https://img.shields.io/badge/donate-bitcoin-ff9900.svg?logo=bitcoin\u0026style=flat\u0026v=2)](https://gobitcoinsv.com/#sponsor?utm_source=github\u0026utm_medium=sponsor-link\u0026utm_campaign=go-bpu\u0026utm_term=go-bpu\u0026utm_content=go-bpu)\n\u003cbr\u003e\n\u003cbr/\u003e\n\nTransforms raw transactions to BOB format. Port from the original [bpu](https://github.com/interplanaria/bpu) library by [unwriter](https://github.com/unwriter)\n\nSince this is intended to be used by low level transaction parsers dependencies are kept to a bare minimum. It does not include the RPC client functionality that connects to a node to get a raw tx. It's designed to be a fast raw tx to BOB processor.\n\nThere is also a [Typescript version](https://github.con/rohenaz/bpu-ts) which does include the originally RPC functionality.\n\n## Installation\n\n**go-bpu** requires a [supported release of Go](https://golang.org/doc/devel/release.html#policy).\n\n```shell script\ngo get -u github.com/bitcoinschema/go-bpu\n```\n\n\u003cbr/\u003e\n\n## Documentation\n\nView the generated [documentation](https://pkg.go.dev/github.com/bitcoinschema/go-bpu)\n\n[![GoDoc](https://godoc.org/github.com/bitcoinschema/go-bpu/?status.svg\u0026style=flat)](https://pkg.go.dev/github.com/bitcoinschema/go-bpu)\n\n\u003cbr/\u003e\n\n## Usage\n\n### Split Config\n\n```go\nvar separator = \"|\"\nvar l = bpu.IncludeL\nvar opReturn = uint8(106)\nvar opFalse = uint8(0)\n\nvar splitConfig = []SplitConfig{\n\t{\n\t\tToken: \u0026Token{\n\t\t\tOp: \u0026opReturn,\n\t\t},\n\t\tInclude: \u0026l,\n\t},\n\t{\n\t\tToken: \u0026Token{\n\t\t\tOp: \u0026opFalse,\n\t\t},\n\t\tInclude: \u0026l,\n\t},\n\t{\n\t\tToken: \u0026Token{\n\t\t\tS: \u0026separator,\n\t\t},\n    Require: \u0026opFalse,\n\t},\n}\n\nbpuTx, err := Parse(ParseConfig{RawTxHex: \u0026sampleTx, SplitConfig: splitConfig, Mode: *bpu.Shallow})\nif err != nil {\n  fmt.Println(err)\n}\n```\n\n### Transaction Source\n\nYou can either use SplitConfig.RawTxHex and set by hex string, or use SplitConfig.Tx to set by bt.Tx.\n\n\u003cbr/\u003e\n\n### Transform Function\n\nYou can pass an optional Transform function to bpu.Parse. Function should look something like this:\n\n```go\nvar splitTransform Transform = func(o Cell, c string) (to *Cell, e error) {\n\t// if the buffer is larger than 512 bytes,\n\t// replace the key with \"l\" prepended attribute\n\tto = \u0026o\n\tbytes, err := hex.DecodeString(c)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(bytes) \u003e 512 {\n\t\tto.LS = to.S\n\t\tto.LB = to.B\n\t\tto.S = nil\n\t\tto.B = nil\n\t}\n\treturn to, nil\n}\n```\n\n\u003cbr/\u003e\n\n## More Usage details\n\nSee the [Typescript library](https://github.com/rohenaz/bpu-ts) README for more examples of split configuration options, transformation, and a look at the output.\n\n\u003cbr/\u003e\n\n## Errata\n\nThe original BPU library used bsv (javascript) v1.5 to determine if a script chunk was a valid opcode. At the time, the bsv library supported a limited number of OP codes (inherited from limitations imposed by Bitcoin core). In this version all opcodes are recognized which surfaces a new issue where fields previously available would be missing if the data is now recognized as an opcode.\n\nPreviously, BPU would omit the op and ops fields for non opcode data, while recognized opcodes would omit the s, b and h fields. To solve the issue of missing fields that happen to be opcodes, all keys are included if the recognized pushdata is also in the Printable ASCII range.\n\n\u003cbr/\u003e\n\n## Contributing\n\nView the [contributing guidelines](.github/CONTRIBUTING.md) and follow the [code of conduct](.github/CODE_OF_CONDUCT.md).\n\n### How can I help?\n\nAll kinds of contributions are welcome :raised_hands:!\nThe most basic way to show your support is to star :star2: the project, or to raise issues :speech_balloon:.\nYou can also support this project by [becoming a sponsor on GitHub](https://github.com/sponsors/BitcoinSchema) :clap:\nor by making a [**bitcoin donation**](https://gobitcoinsv.com/#sponsor?utm_source=github\u0026utm_medium=sponsor-link\u0026utm_campaign=go-bpu\u0026utm_term=go-bpu\u0026utm_content=go-bpu) to ensure this journey continues indefinitely! :rocket:\n\n[![Stars](https://img.shields.io/github/stars/BitcoinSchema/go-bpu?label=Please%20like%20us\u0026style=social)](https://github.com/BitcoinSchema/go-bpu/stargazers)\n\n\u003cbr/\u003e\n\n## License\n\n[![License](https://img.shields.io/github/license/BitcoinSchema/go-bpu.svg?style=flat\u0026v=2)](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitcoinschema%2Fgo-bpu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitcoinschema%2Fgo-bpu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitcoinschema%2Fgo-bpu/lists"}