{"id":37021355,"url":"https://github.com/dcdpr/libtxref-java","last_synced_at":"2026-01-14T02:31:09.531Z","repository":{"id":48704392,"uuid":"179909866","full_name":"dcdpr/libtxref-java","owner":"dcdpr","description":null,"archived":false,"fork":false,"pushed_at":"2021-07-13T16:41:15.000Z","size":94,"stargazers_count":0,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-03T05:53:49.636Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dcdpr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-07T02:35:16.000Z","updated_at":"2021-07-13T16:41:18.000Z","dependencies_parsed_at":"2022-09-14T12:40:19.988Z","dependency_job_id":null,"html_url":"https://github.com/dcdpr/libtxref-java","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dcdpr/libtxref-java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcdpr%2Flibtxref-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcdpr%2Flibtxref-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcdpr%2Flibtxref-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcdpr%2Flibtxref-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dcdpr","download_url":"https://codeload.github.com/dcdpr/libtxref-java/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcdpr%2Flibtxref-java/sbom","scorecard":{"id":329531,"data":{"date":"2025-08-11","repo":{"name":"github.com/dcdpr/libtxref-java","commit":"e7aee1eab859c0510c9dd17fb6d0a7c838dd6018"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.1,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":8,"reason":"Found 8/9 approved changesets -- score normalized to 8","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: BSD 3-Clause \"New\" or \"Revised\" License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 29 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T03:14:35.426Z","repository_id":48704392,"created_at":"2025-08-18T03:14:35.426Z","updated_at":"2025-08-18T03:14:35.426Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408711,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2026-01-14T02:31:08.949Z","updated_at":"2026-01-14T02:31:09.518Z","avatar_url":"https://github.com/dcdpr.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# libtxref-java\n\nThis is a Java library for converting between bitcoin transaction IDs (txid)\nand \"Bech32 Encoded Tx Position References\" (txref). Txrefs are\ndescribed in [BIP 0136](https://github.com/bitcoin/bips/blob/master/bip-0136.mediawiki).\n\nThe only external dependencies libtxref-java has are [libbech32-java](https://github.com/dcdpr/libbech32-java) and `JUnit.`\n\n## Getting libtxref-java\n\nTo use libtxref-java in your project, you can get\nthe package from Maven Central:\n\nTo use the package, you need the following Maven dependency:\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003edesign.contract\u003c/groupId\u003e\n  \u003cartifactId\u003elibtxref\u003c/artifactId\u003e\n  \u003cversion\u003e1.1.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Usage Examples\n\n### Encoding Examples\n\nSee [the full code for the following examples](src/main/java/design/contract/example/TxrefEncodingExample.java).\n\n#### Create a txref for a mainnet transaction, with only a blockHeight and transactionIndex:\n\n```java\nprivate static void createStandardMainnetTxref() {\n    int blockHeight = 170;\n    int transactionIndex = 1;\n\n    String txref = Txref.encode(blockHeight, transactionIndex);\n\n    System.out.println(txref);\n    // prints \"tx1:r52q-qqpq-qpty-cfg\"\n}\n```\n\n#### Create a txref for a testnet transaction, with only a blockHeight and transactionIndex:\n\n```java\nprivate static void createStandardTestnetTxref() {\n    int blockHeight = 170;\n    int transactionIndex = 1;\n\n    String txref = Txref.encodeTestnet(blockHeight, transactionIndex);\n\n    System.out.println(txref);\n    // prints \"txtest1:x52q-qqpq-qvr9-ztk\"\n}\n```\n\n#### Create an extended txref for a mainnet transaction, with a blockHeight and transactionIndex and a specific txoIndex:\n\n```java\nprivate static void createExtendedMainnetTxref() {\n    int blockHeight = 170;\n    int transactionIndex = 1;\n    int txoIndex = 1;\n\n    String txref = Txref.encode(blockHeight, transactionIndex, txoIndex);\n\n    System.out.println(txref);\n    // prints \"tx1:y52q-qqpq-qpqq-4lkz-zc\"\n}\n```\n\n#### Create an extended txref for a testnet transaction, with a blockHeight and transactionIndex and a specific txoIndex:\n\n```java\nprivate static void createExtendedTestnetTxref() {\n    int blockHeight = 170;\n    int transactionIndex = 1;\n    int txoIndex = 1;\n\n    String txref = Txref.encodeTestnet(blockHeight, transactionIndex, txoIndex);\n\n    System.out.println(txref);\n    // prints \"txtest1:852q-qqpq-qpqq-m8ef-pl\"\n}\n```\n\n### Decoding Examples\n\nSee [the full code for the following examples](src/main/java/design/contract/example/TxrefDecodingExample.java).\n\n#### Decode a txref\n\n```java\nprivate static void decodeTxref() {\n        DecodedResult decodedResult = Txref.decode(\"tx1:r52q-qqpq-qpty-cfg\");\n\n        assert(decodedResult.getBlockHeight() == 170);\n        assert(decodedResult.getTransactionIndex() == 1);\n        assert(decodedResult.getTxoIndex() == 0);\n        assert(decodedResult.getEncoding() == DecodedResult.Encoding.BECH32M);\n        }\n```\n\n#### Decode an \"original\" txref\n\nThis txref has been encoded with the original bech32 internal constant. The \ndecoding will still succeed, but the library will also return a commentary \nstring that contains an explanatory message along with the txref that should \nbe used instead.\n\n```java\n    private static void decodeStandardTxrefUsingOriginalConstant() {\n        DecodedResult decodedResult = Txref.decode(\"tx1:r52q-qqpq-q5h5-5v2\");\n\n        assert(decodedResult.getBlockHeight() == 170);\n        assert(decodedResult.getTransactionIndex() == 1);\n        assert(decodedResult.getTxoIndex() == 0);\n        assert(decodedResult.getEncoding() == DecodedResult.Encoding.BECH32);\n\n        System.out.println(decodedResult.getCommentary());\n        // prints:\n        // \"The txref tx1:r52q-qqpq-q5h5-5v2 uses an old encoding scheme and should be updated to tx1:r52q-qqpq-qpty-cfg See https://github.com/dcdpr/libtxref-java#regarding-bech32-checksums for more information.\"\n        }\n```\n\n## Building libtxref-java\n\nTo build libtxref-java, you will need:\n\n* Java (8+)\n* Maven\n\nlibtxref-java uses a standard maven build process:\n\n```console\nmvn install\n```\n\nYou can also run just the tests without installing:\n\n```console\nmvn test\n```\n\n## Regarding bech32 checksums\n\nThe Bech32 data encoding format was first proposed by Pieter Wuille in early 2017 in\n[BIP 0173](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki). Later, in November 2019, Pieter published\nsome research that a constant used in the bech32 checksum algorithm (value = 1) may not be\noptimal for the error detecting properties of bech32. In February 2021, Pieter published\n[BIP 0350](https://github.com/bitcoin/bips/blob/master/bip-0350.mediawiki) reporting that \"exhaustive analysis\" showed the best possible constant value is\n0x2bc830a3. This improved variant of Bech32 is called \"Bech32m\".\n\nWhen decoding a txref, libtxref-java returns an enum value showing whether bech32m or bech32\nwas used to encode. If the original bech32 variant is detected, libtxref-java also returns a \ncommentary string that can be shown to the user. This commentary will contain a new txref that represents\nthe same transaction data, but using the new bech32m variant. This can be seen in the examples above.\n\nWhen encoding data, libtxref-java will only use the new constant value of 0x2bc830a3.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcdpr%2Flibtxref-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdcdpr%2Flibtxref-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcdpr%2Flibtxref-java/lists"}