Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: BitcoinSchema/go-aip
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.0.12
Choose a base ref
...
head repository: BitcoinSchema/go-aip
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Oct 28, 2020

  1. comment

    rohenaz committed Oct 28, 2020
    Copy the full SHA
    5f062f1 View commit details
  2. Copy the full SHA
    fa0c3f6 View commit details
  3. update comment

    rohenaz committed Oct 28, 2020
    Copy the full SHA
    63e1404 View commit details

Commits on Oct 29, 2020

  1. Copy the full SHA
    7f3bbb1 View commit details
  2. Copy the full SHA
    b504090 View commit details

Commits on Oct 30, 2020

  1. Upgrade deps, fix lint

    mrz1836 committed Oct 30, 2020
    Copy the full SHA
    1f9bb20 View commit details
  2. Upgraded deps

    mrz1836 committed Oct 30, 2020
    Copy the full SHA
    94ea396 View commit details
  3. Working on tests and examples

    mrz1836 committed Oct 30, 2020
    Copy the full SHA
    21bb932 View commit details

Commits on Oct 31, 2020

  1. Upgraded deps

    mrz1836 committed Oct 31, 2020
    Copy the full SHA
    5f05172 View commit details
  2. Minor fixes

    mrz1836 committed Oct 31, 2020
    Copy the full SHA
    292a191 View commit details

Commits on Nov 1, 2020

  1. urename method

    rohenaz committed Nov 1, 2020
    Copy the full SHA
    78b868a View commit details
  2. all tests passing

    rohenaz committed Nov 1, 2020
    Copy the full SHA
    4c9eae2 View commit details

Commits on Nov 2, 2020

  1. Upgraded deps

    mrz1836 committed Nov 2, 2020
    Copy the full SHA
    48b6779 View commit details
  2. Fix int->string conversion

    mrz1836 committed Nov 2, 2020
    Copy the full SHA
    658abf1 View commit details
  3. Fix int->string conversion

    mrz1836 committed Nov 2, 2020
    Copy the full SHA
    7ec1e37 View commit details
  4. Copy the full SHA
    b816a66 View commit details
  5. Copy the full SHA
    56b59c0 View commit details
  6. Upgraded deps

    mrz1836 committed Nov 2, 2020
    Copy the full SHA
    064cd0e View commit details
  7. Merge pull request #1 from BitcoinSchema/feature/fixes

    Fixes for Int Conversion (Review) (tests NOT passing)
    mrz1836 authored Nov 2, 2020
    Copy the full SHA
    a05e22a View commit details

Commits on Nov 6, 2020

  1. Updated go-bob

    mrz1836 committed Nov 6, 2020
    Copy the full SHA
    042d072 View commit details
  2. Added dependabot config

    mrz1836 committed Nov 6, 2020
    Copy the full SHA
    090dcc2 View commit details

Commits on Nov 8, 2020

  1. Updated share image

    mrz1836 committed Nov 8, 2020
    Copy the full SHA
    bf1b335 View commit details

Commits on Nov 9, 2020

  1. Bump github.com/bitcoinschema/go-bitcoin from 0.2.26 to 0.2.27

    Bumps [github.com/bitcoinschema/go-bitcoin](https://github.com/bitcoinschema/go-bitcoin) from 0.2.26 to 0.2.27.
    - [Release notes](https://github.com/bitcoinschema/go-bitcoin/releases)
    - [Changelog](https://github.com/BitcoinSchema/go-bitcoin/blob/master/.goreleaser.yml)
    - [Commits](BitcoinSchema/go-bitcoin@v0.2.26...v0.2.27)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Nov 9, 2020
    Copy the full SHA
    95271c8 View commit details
  2. Merge pull request #2 from BitcoinSchema/dependabot/go_modules/master…

    …/github.com/bitcoinschema/go-bitcoin-0.2.27
    
    Bump github.com/bitcoinschema/go-bitcoin from 0.2.26 to 0.2.27
    mrz1836 authored Nov 9, 2020
    Copy the full SHA
    3f27cd2 View commit details

Commits on Nov 11, 2020

  1. Bump github.com/bitcoinschema/go-bitcoin from 0.2.27 to 0.2.28

    Bumps [github.com/bitcoinschema/go-bitcoin](https://github.com/bitcoinschema/go-bitcoin) from 0.2.27 to 0.2.28.
    - [Release notes](https://github.com/bitcoinschema/go-bitcoin/releases)
    - [Changelog](https://github.com/BitcoinSchema/go-bitcoin/blob/master/.goreleaser.yml)
    - [Commits](BitcoinSchema/go-bitcoin@v0.2.27...v0.2.28)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Nov 11, 2020
    Copy the full SHA
    d5865b9 View commit details
  2. Merge pull request #3 from BitcoinSchema/dependabot/go_modules/master…

    …/github.com/bitcoinschema/go-bitcoin-0.2.28
    
    Bump github.com/bitcoinschema/go-bitcoin from 0.2.27 to 0.2.28
    mrz1836 authored Nov 11, 2020
    Copy the full SHA
    98e0aa0 View commit details
  3. Upgraded go-bitcoin

    mrz1836 committed Nov 11, 2020
    Copy the full SHA
    d190db2 View commit details
  4. Fixed func sig

    mrz1836 committed Nov 11, 2020
    Copy the full SHA
    201a659 View commit details
  5. Copy the full SHA
    a82b3e2 View commit details
  6. Upgraded common makefile

    mrz1836 committed Nov 11, 2020
    Copy the full SHA
    ed47494 View commit details
  7. minor test fix

    rohenaz committed Nov 11, 2020
    Copy the full SHA
    e727f22 View commit details
  8. Copy the full SHA
    c6e7baa View commit details

Commits on Nov 13, 2020

  1. Bump github.com/bitcoinschema/go-bob from 0.0.14 to 0.0.15

    Bumps [github.com/bitcoinschema/go-bob](https://github.com/bitcoinschema/go-bob) from 0.0.14 to 0.0.15.
    - [Release notes](https://github.com/bitcoinschema/go-bob/releases)
    - [Changelog](https://github.com/BitcoinSchema/go-bob/blob/master/.goreleaser.yml)
    - [Commits](BitcoinSchema/go-bob@v0.0.14...v0.0.15)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Nov 13, 2020
    Copy the full SHA
    54ad9de View commit details
  2. Merge pull request #4 from BitcoinSchema/dependabot/go_modules/master…

    …/github.com/bitcoinschema/go-bob-0.0.15
    
    Bump github.com/bitcoinschema/go-bob from 0.0.14 to 0.0.15
    mrz1836 authored Nov 13, 2020
    Copy the full SHA
    a1678c1 View commit details
  3. Copy the full SHA
    f51b5a0 View commit details
  4. Different tx package

    mrz1836 committed Nov 13, 2020
    Copy the full SHA
    aee9407 View commit details
  5. Updated references

    mrz1836 committed Nov 13, 2020
    Copy the full SHA
    2e56553 View commit details

Commits on Nov 17, 2020

  1. Bump github.com/libsv/go-bt from 0.0.1 to 0.0.2

    Bumps [github.com/libsv/go-bt](https://github.com/libsv/go-bt) from 0.0.1 to 0.0.2.
    - [Release notes](https://github.com/libsv/go-bt/releases)
    - [Changelog](https://github.com/libsv/go-bt/blob/master/.goreleaser.yml)
    - [Commits](libsv/go-bt@v0.0.1...v0.0.2)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Nov 17, 2020
    Copy the full SHA
    7c40e19 View commit details
  2. Merge pull request #5 from BitcoinSchema/dependabot/go_modules/master…

    …/github.com/libsv/go-bt-0.0.2
    
    Bump github.com/libsv/go-bt from 0.0.1 to 0.0.2
    mrz1836 authored Nov 17, 2020
    Copy the full SHA
    5fb97b4 View commit details
  3. Upgraded all core deps

    mrz1836 committed Nov 17, 2020
    Copy the full SHA
    b4f4817 View commit details

Commits on Nov 27, 2020

  1. update go-bitcoin

    rohenaz committed Nov 27, 2020
    Copy the full SHA
    b6bd2c5 View commit details

Commits on Nov 28, 2020

  1. Copy the full SHA
    cb67f42 View commit details

Commits on Dec 1, 2020

  1. Bump github.com/bitcoinschema/go-bitcoin from 0.3.5 to 0.3.6

    Bumps [github.com/bitcoinschema/go-bitcoin](https://github.com/bitcoinschema/go-bitcoin) from 0.3.5 to 0.3.6.
    - [Release notes](https://github.com/bitcoinschema/go-bitcoin/releases)
    - [Changelog](https://github.com/BitcoinSchema/go-bitcoin/blob/master/.goreleaser.yml)
    - [Commits](BitcoinSchema/go-bitcoin@v0.3.5...v0.3.6)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Dec 1, 2020
    Copy the full SHA
    00f8e5b View commit details
  2. Bump github.com/libsv/go-bt from 0.0.3 to 0.0.4

    Bumps [github.com/libsv/go-bt](https://github.com/libsv/go-bt) from 0.0.3 to 0.0.4.
    - [Release notes](https://github.com/libsv/go-bt/releases)
    - [Changelog](https://github.com/libsv/go-bt/blob/master/.goreleaser.yml)
    - [Commits](libsv/go-bt@v0.0.3...v0.0.4)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Dec 1, 2020
    Copy the full SHA
    912d7cd View commit details
  3. Merge pull request #6 from BitcoinSchema/dependabot/go_modules/master…

    …/github.com/bitcoinschema/go-bitcoin-0.3.6
    
    Bump github.com/bitcoinschema/go-bitcoin from 0.3.5 to 0.3.6
    mrz1836 authored Dec 1, 2020
    Copy the full SHA
    4e7ee80 View commit details
  4. Merge pull request #7 from BitcoinSchema/dependabot/go_modules/master…

    …/github.com/libsv/go-bt-0.0.4
    
    Bump github.com/libsv/go-bt from 0.0.3 to 0.0.4
    mrz1836 authored Dec 1, 2020
    Copy the full SHA
    cf46a32 View commit details
  5. Upgraded deps

    mrz1836 committed Dec 1, 2020
    Copy the full SHA
    f71c583 View commit details

Commits on Dec 4, 2020

  1. Upgraded deps

    mrz1836 committed Dec 4, 2020
    Copy the full SHA
    8cd84e4 View commit details

Commits on Dec 11, 2020

  1. Copy the full SHA
    53ff0b7 View commit details

Commits on Dec 21, 2020

  1. Bump github.com/bitcoinschema/go-bitcoin from 0.3.7 to 0.3.9

    Bumps [github.com/bitcoinschema/go-bitcoin](https://github.com/bitcoinschema/go-bitcoin) from 0.3.7 to 0.3.9.
    - [Release notes](https://github.com/bitcoinschema/go-bitcoin/releases)
    - [Changelog](https://github.com/BitcoinSchema/go-bitcoin/blob/master/.goreleaser.yml)
    - [Commits](BitcoinSchema/go-bitcoin@v0.3.7...v0.3.9)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Dec 21, 2020
    Copy the full SHA
    00e70eb View commit details
File renamed without changes.
2 changes: 1 addition & 1 deletion CODE_STANDARDS.md → .github/CODE_STANDARDS.md
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ View the [effective go](https://golang.org/doc/effective_go.html) standards docu
### *golangci-lint* specifications
The package [golangci-lint](https://golangci-lint.run/usage/quick-start) runs several linters in one package/cmd.

View the active linters in the [configuration file](.golangci.yml).
View the active linters in the [configuration file](../.golangci.yml).

Install via macOS:
```shell
File renamed without changes.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# These are supported funding model platforms

github: BitcoinSchema
custom: https://gobitcoinsv.com/#sponsor
custom: https://gobitcoinsv.com/#sponsor?utm_source=github&utm_medium=sponsor-link&utm_campaign=go-aip&utm_term=go-aip&utm_content=go-aip
Binary file modified .github/IMAGES/github-share-image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
name: Bug report
about: Create a report to help us improve this project
labels: bug-p3
assignees: mrz1836
assignees: rohenaz

---

2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
name: Feature request
about: Suggest an idea for this project
labels: idea
assignees: mrz1836
assignees: rohenaz

---

2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
name: Question
about: 'General template for a question '
labels: question
assignees: mrz1836
assignees: rohenaz

---

File renamed without changes.
33 changes: 33 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Basic dependabot.yml to update gomod

version: 2
updates:
- package-ecosystem: "gomod"
target-branch: "master"
directory: "/"
schedule:
interval: "daily"
# Check for npm updates at 9am UTC (5am EST)
time: "10:00"
reviewers:
- "rohenaz"
assignees:
- "rohenaz"
# Labels must be created first
labels:
- "update"

# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
target-branch: "master"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
reviewers:
- "rohenaz"
assignees:
- "rohenaz"
labels:
- "chore"
open-pull-requests-limit: 10
51 changes: 51 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
- color: 0075ca
description: "Improvements or additions to documentation"
name: "documentation"
- color: b23128
description: "Highest rated bug or issue, affects all"
name: "bug-P1"
- color: de3d32
description: "Medium rated bug, affects a few"
name: "bug-P2"
- color: f44336
description: "Lowest rated bug, affects nearly none or low-impact"
name: "bug-P3"
- color: 0e8a16
description: "Any new significant addition"
name: "feature"
- color: b60205
description: "Urgent or important fix/patch"
name: "hot-fix"
- color: cccccc
description: "Any idea, suggestion"
name: "idea"
- color: d4c5f9
description: "Experimental - can break!"
name: "prototype"
- color: cc317c
description: "Any question or concern"
name: "question"
- color: c2e0c6
description: "Unit tests, mocking, integration testing"
name: "test"
- color: fbca04
description: "Anything GUI related"
name: "ui-ux"
- color: 006b75
description: "Simple dependency updates or version bumps"
name: "chore"
- color: 006b75
description: "General updates"
name: "update"
- color: FFA500
description: "Any significant refactoring"
name: "refactor"
- color: FEF2C0
description: "Used for automatic merging"
name: "automerge"
- color: FBCA04
description: "Used for denoting a WIP, stops auto-merge"
name: "work-in-progress"
- color: c2e0c6
description: "Old, unused, stale"
name: "stale"
222 changes: 222 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
pull_request_rules:

# ===============================================================================
# DEPENDABOT
# ===============================================================================

- name: Automatic Merge for Dependabot Minor Version Pull Requests
conditions:
- -draft
- author~=^dependabot(|-preview)\[bot\]$
- check-success='test (1.23.x, ubuntu-latest)'
- check-success='Analyze (go)'
- title~=^Bump [^\s]+ from ([\d]+)\..+ to \1\.
actions:
review:
type: APPROVE
message: Automatically approving dependabot pull request
merge:
method: merge
- name: Alert on major version detection
conditions:
- author~=^dependabot(|-preview)\[bot\]$
- check-success='test (1.23.x, ubuntu-latest)'
- check-success='Analyze (go)'
- -title~=^Bump [^\s]+ from ([\d]+)\..+ to \1\.
actions:
comment:
message: "⚠️ @rohenaz: this is a major version bump and requires your attention"

# ===============================================================================
# AUTOMATIC MERGE (APPROVALS)
# ===============================================================================

- name: Automatic Merge ⬇️ on Approval ✔
conditions:
- "#approved-reviews-by>=1"
- "#review-requested=0"
- "#changes-requested-reviews-by=0"
- check-success='test (1.23.x, ubuntu-latest)'
- check-success='Analyze (go)'
- -title~=(?i)wip
- label!=work-in-progress
- -draft
actions:
merge:
method: merge

# ===============================================================================
# AUTHOR
# ===============================================================================

- name: Auto-Assign Author
conditions:
- "#assignee=0"
actions:
assign:
users: [ "rohenaz" ]

# ===============================================================================
# ALERTS
# ===============================================================================

- name: Notify on merge
conditions:
- merged
- label=automerge
actions:
comment:
message: "✅ @{{author}}: **{{title}}** has been merged successfully."
- name: Alert on merge conflict
conditions:
- conflict
- label=automerge
actions:
comment:
message: "🆘 @{{author}}: `{{head}}` has conflicts with `{{base}}` that must be resolved."
- name: Alert on tests failure for automerge
conditions:
- label=automerge
- status-failure=commit
actions:
comment:
message: "🆘 @{{author}}: unable to merge due to CI failure."

# ===============================================================================
# LABELS
# ===============================================================================
# Automatically add labels when PRs match certain patterns
#
# NOTE:
# - single quotes for regex to avoid accidental escapes
# - Mergify leverages Python regular expressions to match rules.
#
# Semantic commit messages
# - chore: updating grunt tasks etc.; no production code change
# - docs: changes to the documentation
# - feat: feature or story
# - feature: new feature or story
# - fix: bug fix for the user, not a fix to a build script
# - idea: general idea or suggestion
# - question: question regarding code
# - test: test related changes
# - wip: work in progress PR
# ===============================================================================

- name: Work in Progress
conditions:
- "head~=(?i)^wip" # if the PR branch starts with wip/
actions:
label:
add: ["work-in-progress"]
- name: Hotfix label
conditions:
- "head~=(?i)^hotfix" # if the PR branch starts with hotfix/
actions:
label:
add: ["hot-fix"]
- name: Bug / Fix label
conditions:
- "head~=(?i)^(bug)?fix" # if the PR branch starts with (bug)?fix/
actions:
label:
add: ["bug-P3"]
- name: Documentation label
conditions:
- "head~=(?i)^docs" # if the PR branch starts with docs/
actions:
label:
add: ["documentation"]
- name: Feature label
conditions:
- "head~=(?i)^feat(ure)?" # if the PR branch starts with feat(ure)?/
actions:
label:
add: ["feature"]
- name: Chore label
conditions:
- "head~=(?i)^chore" # if the PR branch starts with chore/
actions:
label:
add: ["update"]
- name: Question label
conditions:
- "head~=(?i)^question" # if the PR branch starts with question/
actions:
label:
add: ["question"]
- name: Test label
conditions:
- "head~=(?i)^test" # if the PR branch starts with test/
actions:
label:
add: ["test"]
- name: Idea label
conditions:
- "head~=(?i)^idea" # if the PR branch starts with idea/
actions:
label:
add: ["idea"]

# ===============================================================================
# CONTRIBUTORS
# ===============================================================================

- name: Welcome New Contributors
conditions:
- and:
- author!=dependabot[bot]
- author!=mergify[bot]
- author!=rohenaz
actions:
comment:
message: |
Welcome to our open-source project! 💘
# ===============================================================================
# STALE BRANCHES
# ===============================================================================

- name: Close stale pull request
conditions:
- base=master
- -closed
- updated-at<21 days ago
actions:
close:
message: |
This pull request looks stale. Feel free to reopen it if you think it's a mistake.
label:
add: [ "stale" ]

# ===============================================================================
# BRANCHES
# ===============================================================================

- name: Delete head branch after merge
conditions:
- merged
actions:
delete_head_branch:

# ===============================================================================
# CONVENTION
# ===============================================================================
# https://www.conventionalcommits.org/en/v1.0.0/
# Premium feature only

#- name: Conventional Commit
# conditions:
# - "title~=^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\\(.+\\))?:"
# actions:
# post_check:
# title: |
# {% if check_succeed %}
# Title follows Conventional Commit
# {% else %}
# Title does not follow Conventional Commit
# {% endif %}
# summary: |
# {% if not check_succeed %}
# Your pull request title must follow [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/).
# {% endif %}
70 changes: 35 additions & 35 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -11,8 +11,8 @@ on:
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
schedule:
- cron: '0 23 * * 0'
# schedule:
# - cron: '0 23 * * 0'

jobs:
analyze:
@@ -29,43 +29,43 @@ jobs:
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2
- name: Checkout repository
uses: actions/checkout@v4
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can check out the head.
fetch-depth: 2

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}
# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
# - run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
36 changes: 36 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# From: https://goreleaser.com/ci/actions/#usage
name: release

env:
GO111MODULE: on

on:
push:
tags:
- '*'

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.23
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6.0.0
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Syndicate to GoDocs
run: make godocs
46 changes: 46 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: run-go-tests

env:
GO111MODULE: on

on:
pull_request:
branches:
- "*"
push:
branches:
- "*"

jobs:
test:
strategy:
matrix:
go-version: [ 1.23.x ]
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/go/pkg/mod # Module download cache
~/.cache/go-build # Build cache (Linux)
~/Library/Caches/go-build # Build cache (Mac)
'%LocalAppData%\go-build' # Build cache (Windows)
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run linter and tests
run: make test-ci
- name: Update code coverage
uses: codecov/codecov-action@v5.3.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
19 changes: 19 additions & 0 deletions .github/workflows/sync-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Workflow: https://github.com/micnncim/action-label-syncer
# Export your labels: https://github.com/micnncim/label-exporter
name: sync-labels
on:
push:
branches:
- master
paths:
- .github/labels.yml
jobs:
sync-labels:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: micnncim/action-label-syncer@v1.3.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
manifest: .github/labels.yml
195 changes: 66 additions & 129 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -19,50 +19,18 @@ run:
build-tags:
- mytag

# which dirs to skip: issues from them won't be reported;
# can use regexp here: generated.*, regexp is applied on full path;
# default value is empty list, but default dirs are skipped independently
# from this option's value (see skip-dirs-use-default).
# "/" will be replaced by current OS file path separator to properly work
# on Windows.
skip-dirs:
- .github
- .make
- dist

# default is true. Enables skipping of directories:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs-use-default: true

# which files to skip: they will be analyzed, but issues from them
# won't be reported. Default value is empty list, but there is
# no need to include all autogenerated files, we confidently recognize
# autogenerated files. If it's not please let us know.
# "/" will be replaced by current OS file path separator to properly work
# on Windows.
skip-files:
- ".*\\.my\\.go$"
- lib/bad.go

# by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules":
# If invoked with -mod=readonly, the go command is disallowed from the implicit
# automatic updating of go.mod described above. Instead, it fails when any changes
# to go.mod are needed. This setting is most useful to check that go.mod does
# not need updates, such as in a continuous integration and testing system.
# If invoked with -mod=vendor, the go command assumes that the vendor
# directory holds the correct copies of dependencies and ignores
# the dependency descriptions in go.mod.
#modules-download-mode: readonly|release|vendor
# skip-dirs-use-default: true

# Allow multiple parallel golangci-lint instances running.
# If false (default) - golangci-lint acquires file lock on start.
allow-parallel-runners: false


# output configuration options
output:
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
format: colored-line-number
# formats:
# - colored-line-number

# print lines of code with issue, default is true
print-issued-lines: true
@@ -76,7 +44,6 @@ output:
# add a prefix to the output file references; default is no prefix
path-prefix: ""


# all available settings of specific linters
linters-settings:
dogsled:
@@ -94,14 +61,11 @@ linters-settings:
# default is false: such cases aren't reported by default.
check-blank: false

# [deprecated] comma-separated list of pairs of the form pkg:regex
# the regex is used to ignore names within pkg. (default "fmt:.*").
# see https://github.com/kisielk/errcheck#the-deprecated-method for details
ignore: fmt:.*,io/ioutil:^Read.*
# use exclude-functions instead of ignore
exclude-functions:
- fmt:.*
- io/ioutil:^Read.*

# path to a file containing a list of functions to exclude from checking
# see https://github.com/kisielk/errcheck#excluding-functions for details
#exclude: /path/to/file.txt
exhaustive:
# indicates that switch statements are to be considered exhaustive if a
# 'default' case is present, even if all enum members aren't listed in the
@@ -111,10 +75,10 @@ linters-settings:
lines: 60
statements: 40
gci:
# put imports beginning with prefix after 3rd-party packages;
# only support one prefix
# if not set, use goimports.local-prefixes
local-prefixes: github.com/org/project
sections:
- Standard
- Default
- Prefix(github.com/org/project)
gocognit:
# minimal code complexity to report, 30 by default (but we recommend 10-20)
min-complexity: 10
@@ -166,16 +130,16 @@ linters-settings:
gofmt:
# simplify code: gofmt with `-s` option, true by default
simplify: true
goheader:
values:
const:
# define here const type values in format k:v, for example:
# YEAR: 2020
# COMPANY: MY COMPANY
regexp:
# define here regexp type values, for example
# AUTHOR: .*@mycompany\.com
template:
# goheader:
# values:
# const:
# # define here const type values in format k:v, for example:
# # YEAR: 2020
# # COMPANY: MY COMPANY
# regexp:
# # define here regexp type values, for example
# # AUTHOR: .*@mycompany\.com
# template:
# put here copyright header template for source code files, for example:
# {{ AUTHOR }} {{ COMPANY }} {{ YEAR }}
# SPDX-License-Identifier: Apache-2.0
@@ -191,23 +155,25 @@ linters-settings:
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
template-path:
# template-path:
# also as alternative of directive 'template' you may put the path to file with the template source
goimports:
# put imports beginning with prefix after 3rd-party packages;
# it's a comma-separated list of prefixes
local-prefixes: github.com/org/project
golint:
# minimal confidence for issues, default is 0.8
min-confidence: 0.8
gomnd:
settings:
mnd:
# the list of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description.
checks: argument,case,condition,operation,return,assign
# gomnd:
# checks:
# - argument
# - case
# - condition
# - operation
# - return
# - assign
# ignored-numbers: [] # Add numbers here if needed
# ignored-files: [] # Add file patterns to ignore if needed
# ignored-functions: [] # Add function patterns to ignore if needed
govet:
# report about shadowed variables
check-shadowing: true
# Removed deprecated `check-shadowing` option

# settings per analyzer
settings:
@@ -222,26 +188,23 @@ linters-settings:
enable:
- atomicalign
enable-all: false
disable:
# disable:
#- shadow
disable-all: false
depguard:
list-type: blacklist
include-go-root: false
packages:
- github.com/sirupsen/logrus
packages-with-error-message:
# specify an error message to output when a blacklisted package is used
- github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
# depguard:
# list-type: blacklist
# include-go-root: false
# packages:
# - github.com/sirupsen/logrus
# packages-with-error-message:
# # specify an error message to output when a blacklisted package is used
# - github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
lll:
# max line length, lines longer will be reported. Default is 120.
# '\t' is counted as 1 character by default, and can be changed with the tab-width option
line-length: 120
# tab width in spaces. Default to 1.
tab-width: 1
maligned:
# print struct with more effective memory layout or not, false by default
suggest-new: true
misspell:
# Correct spellings using locale preferences for US or UK.
# Default is to use a neutral variety of English.
@@ -266,7 +229,7 @@ linters-settings:
# Enable to ensure that nolint directives are all used. Default is true.
allow-unused: false
# Disable to ensure that nolint directives don't have a leading space. Default is true.
allow-leading-space: true
# allow-leading-space: true
# Exclude following linters from requiring an explanation. Default is [].
allow-no-explanation: []
# Enable to require an explanation of nonzero length after each nolint directive. Default is false.
@@ -285,12 +248,12 @@ linters-settings:
# if it's called for subdir of a project it can't find external interfaces. All text editor integrations
# with golangci-lint call it on a directory with the changed file.
check-exported: false
unused:
# unused:
# treat code as a program (not a library) and report unused exported identifiers; default is false.
# XXX: if you enable this setting, unused will report a lot of false-positives in text editors:
# if it's called for subdir of a project it can't find funcs usages. All text editor integrations
# with golangci-lint call it on a directory with the changed file.
check-exported: false
# check-exported: false
whitespace:
multi-if: false # Enforces newlines (or comments) after every multi-line if statement
multi-func: false # Enforces newlines (or comments) after every multi-line function signature
@@ -311,51 +274,42 @@ linters-settings:
force-case-trailing-whitespace: 0
# Force cuddling of err checks with err var assignment
force-err-cuddling: false
# Allow leading comments to be separated with empty liens
# Allow leading comments to be separated with empty lines
allow-separated-leading-comment: false
gofumpt:
# Choose whether or not to use the extra rules that are disabled
# by default
extra-rules: false

# The custom section can be used to define linter plugins to be loaded at runtime. See README doc
# for more info.
custom:
# Each custom linter should have a unique name.
#example:
# The path to the plugin *.so. Can be absolute or local. Required for each custom linter
#path: /path/to/example.so
# The description of the linter. Optional, just for documentation purposes.
#description: This is an example usage of a plugin linter.
# Intended to point to the repo location of the linter. Optional, just for documentation purposes.
#original-url: github.com/golangci/example-linter

# linters configuration
linters:
enable:
- megacheck
- gosimple
- staticcheck
- unused
- govet
- gosec
- bodyclose
- golint
- revive
- unconvert
- dupl
- maligned
- misspell
- dogsled
- prealloc
- exportloopref
- copyloopvar
- exhaustive
- sqlclosecheck
- nolintlint
- gci
- goconst
- lll
# - shadow # Added as per the deprecation notice
disable:
- gocritic # use this for very opinionated linting
- gochecknoglobals
- whitespace
- wsl
- goerr113
- err113
- godot
- testpackage
- nestif
@@ -366,12 +320,17 @@ linters:
- unused
fast: false


# issues configuration
issues:
exclude-files:
- ".*\\.my\\.go$"
- lib/bad.go
exclude-dirs:
- .github
- .make
- dist

# List of regexps of issue texts to exclude, empty list by default.
# But independently from this option we use default exclude patterns,
# it can be disabled by `exclude-use-default: false`. To list all
# excluded by default patterns execute `golangci-lint run --help`
exclude:
- abcdef

@@ -384,7 +343,6 @@ issues:
- errcheck
- dupl
- gosec
- maligned
- lll

# Exclude known linters from partially hard-vendored code,
@@ -411,13 +369,9 @@ issues:
exclude-use-default: false

# The default value is false. If set to true exclude and exclude-rules
# regular expressions become case sensitive.
# regular expressions become case-sensitive.
exclude-case-sensitive: false

# The list of ids of default excludes to include or disable. By default it's empty.
include:
- EXC0002 # disable excluding of issues about comments from golint

# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
max-issues-per-linter: 0

@@ -426,38 +380,21 @@ issues:

# Show only new issues: if there are unstaged changes or untracked files,
# only those changes are analyzed, else only changes in HEAD~ are analyzed.
# It's a super-useful option for integration of golangci-lint into existing
# large codebase. It's not practical to fix all existing issues at the moment
# of integration: much better don't allow issues in new code.
# Default is false.
new: false

# Show only new issues created after git revision `REV`
new-from-rev: ""

# Show only new issues created in git patch with set file path.
#new-from-patch: path/to/patch/file

# severity configuration
severity:
# Default value is empty string.
# Set the default severity for issues. If severity rules are defined and the issues
# do not match or no severity is provided to the rule this will be the default
# severity applied. Severities should match the supported severity names of the
# selected out format.
# - Code climate: https://docs.codeclimate.com/docs/issues#issue-severity
# - Checkstyle: https://checkstyle.sourceforge.io/property_types.html#severity
# - Github: https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message
default-severity: error

# The default value is false.
# If set to true severity-rules regular expressions become case sensitive.
case-sensitive: false

# Default value is empty list.
# When a list of severity rules are provided, severity information will be added to lint
# issues. Severity rules have the same filtering capability as exclude rules except you
# are allowed to specify one matcher per severity rule.
# Only affects out formats that support setting severity information.
rules:
- linters:
- dupl
51 changes: 43 additions & 8 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Make sure to check the documentation at http://goreleaser.com
# .goreleaser.yaml

version: 2

# ---------------------------
# GENERAL
# General
# ---------------------------
before:
hooks:
@@ -12,16 +15,48 @@ changelog:
filters:
exclude:
- '^.github:'
- '^.vscode:'
- '^test:'

# ---------------------------
# BUILDER
# Builders
# ---------------------------
build:
skip: true
builds:
- skip: true

# ---------------------------
# Github Release
# GitHub Release
# ---------------------------
release:
prerelease: true
name_template: "Release v{{.Version}}"
prerelease: false
name_template: "Release v{{ .Version }}"

# ---------------------------
# Announce
# ---------------------------
announce:
slack:
enabled: false
message_template: '{{ .ProjectName }} {{ .Tag }} is out! Changelog: https://github.com/BitcoinSchema/{{ .ProjectName }}/releases/tag/{{ .Tag }}'
channel: '#test_slack'
# username: ''
# icon_emoji: ''
# icon_url: ''

twitter:
enabled: false
message_template: '{{ .ProjectName }} {{ .Tag }} is out!'

discord:
enabled: false
message_template: '{{ .ProjectName }} {{ .Tag }} is out!'
# author: ''
# color: ''
# icon_url: ''

reddit:
enabled: false
application_id: ""
username: ""
title_template: '{{ .ProjectName }} {{ .Tag }} is out!'
# url_template: 'https://github.com/BitcoinSchema/{{ .ProjectName }}/releases/tag/{{ .Tag }}'
90 changes: 0 additions & 90 deletions .make/Makefile.go

This file was deleted.

22 changes: 20 additions & 2 deletions .make/Makefile.common → .make/common.mk
Original file line number Diff line number Diff line change
@@ -31,42 +31,60 @@ ifndef DISTRIBUTIONS_DIR
endif
export DISTRIBUTIONS_DIR

.PHONY: diff

diff: ## Show the git diff
$(call print-target)
git diff --exit-code
RES=$$(git status --porcelain) ; if [ -n "$$RES" ]; then echo $$RES && exit 1 ; fi

help: ## Show this help message
@egrep -h '^(.+)\:\ ##\ (.+)' ${MAKEFILE_LIST} | column -t -c 2 -s ':#'

install-releaser: ## Install the GoReleaser application
@echo "installing GoReleaser..."
@curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sh

release:: ## Full production release (creates release in Github)
@echo "releasing..."
@test $(github_token)
@export GITHUB_TOKEN=$(github_token) && goreleaser --rm-dist

release-test: ## Full production test release (everything except deploy)
@echo "creating a release test..."
@goreleaser --skip-publish --rm-dist

release-snap: ## Test the full release (build binaries)
@echo "creating a release snapshot..."
@goreleaser --snapshot --skip-publish --rm-dist

replace-version: ## Replaces the version in HTML/JS (pre-deploy)
@echo "replacing version..."
@test $(version)
@test "$(path)"
@find $(path) -name "*.html" -type f -exec sed -i '' -e "s/{{version}}/$(version)/g" {} \;
@find $(path) -name "*.js" -type f -exec sed -i '' -e "s/{{version}}/$(version)/g" {} \;

tag: ## Generate a new tag and push (tag version=0.0.0)
@echo "creating new tag..."
@test $(version)
@git tag -a v$(version) -m "Pending full release..."
@git push origin v$(version)
@git fetch --tags -f

tag-remove: ## Remove a tag if found (tag-remove version=0.0.0)
@echo "removing tag..."
@test $(version)
@git tag -d v$(version)
@git push --delete origin v$(version)
@git fetch --tags

tag-update: ## Update an existing tag to current commit (tag-update version=0.0.0)
@echo "updating tag to new commit..."
@test $(version)
@git push --force origin HEAD:refs/tags/v$(version)
@git fetch --tags -f

update-releaser: ## Update the goreleaser application
@brew update
@brew upgrade goreleaser
@echo "updating GoReleaser application..."
@$(MAKE) install-releaser
146 changes: 146 additions & 0 deletions .make/go.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
## Default to the repo name if empty
ifndef BINARY_NAME
override BINARY_NAME=app
endif

## Define the binary name
ifdef CUSTOM_BINARY_NAME
override BINARY_NAME=$(CUSTOM_BINARY_NAME)
endif

## Set the binary release names
DARWIN=$(BINARY_NAME)-darwin
LINUX=$(BINARY_NAME)-linux
WINDOWS=$(BINARY_NAME)-windows.exe

## Define the binary name
TAGS=
ifdef GO_BUILD_TAGS
override TAGS=-tags $(GO_BUILD_TAGS)
endif

.PHONY: bench
bench: ## Run all benchmarks in the Go application
@echo "running benchmarks..."
@go test -bench=. -benchmem $(TAGS)

.PHONY: build-go
build-go: ## Build the Go application (locally)
@echo "building go app..."
@go build -o bin/$(BINARY_NAME) $(TAGS)

.PHONY: clean-mods
clean-mods: ## Remove all the Go mod cache
@echo "cleaning mods..."
@go clean -modcache

.PHONY: coverage
coverage: ## Shows the test coverage
@echo "creating coverage report..."
@go test -coverprofile=coverage.out ./... $(TAGS) && go tool cover -func=coverage.out $(TAGS)

.PHONY: generate
generate: ## Runs the go generate command in the base of the repo
@echo "generating files..."
@go generate -v $(TAGS)

.PHONY: godocs
godocs: ## Sync the latest tag with GoDocs
@echo "syndicating to GoDocs..."
@test $(GIT_DOMAIN)
@test $(REPO_OWNER)
@test $(REPO_NAME)
@test $(VERSION_SHORT)
@curl https://proxy.golang.org/$(GIT_DOMAIN)/$(REPO_OWNER)/$(REPO_NAME)/@v/$(VERSION_SHORT).info

.PHONY: install
install: ## Install the application
@echo "installing binary..."
@go build -o $$GOPATH/bin/$(BINARY_NAME) $(TAGS)

.PHONY: install-go
install-go: ## Install the application (Using Native Go)
@echo "installing package..."
@go install $(GIT_DOMAIN)/$(REPO_OWNER)/$(REPO_NAME) $(TAGS)

.PHONY: lint
lint: ## Run the golangci-lint application (install if not found)
@echo "installing golangci-lint..."
@#Travis (has sudo)
@if [ "$(shell command -v golangci-lint)" = "" ] && [ $(TRAVIS) ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.61.0 && sudo cp ./bin/golangci-lint $(go env GOPATH)/bin/; fi;
@#AWS CodePipeline
@if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(CODEBUILD_BUILD_ID)" != "" ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.61.0; fi;
@#GitHub Actions
@if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(GITHUB_WORKFLOW)" != "" ]; then curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sudo sh -s -- -b $(go env GOPATH)/bin v1.61.0; fi;
@#Brew - MacOS
@if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(shell command -v brew)" != "" ]; then brew install golangci-lint; fi;
@#MacOS Vanilla
@if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(shell command -v brew)" != "" ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- v1.61.0; fi;
@echo "running golangci-lint..."
@golangci-lint run --verbose

.PHONY: test
test: ## Runs lint and ALL tests
@$(MAKE) lint
@echo "running tests..."
@go test ./... -v $(TAGS)

.PHONY: test-unit
test-unit: ## Runs tests and outputs coverage
@echo "running unit tests..."
@go test ./... -race -coverprofile=coverage.txt -covermode=atomic $(TAGS)

.PHONY: test-short
test-short: ## Runs vet, lint and tests (excludes integration tests)
@$(MAKE) lint
@echo "running tests (short)..."
@go test ./... -v -test.short $(TAGS)

.PHONY: test-ci
test-ci: ## Runs all tests via CI (exports coverage)
@$(MAKE) lint
@echo "running tests (CI)..."
@go test ./... -race -coverprofile=coverage.txt -covermode=atomic $(TAGS)

.PHONY: test-ci-no-race
test-ci-no-race: ## Runs all tests via CI (no race) (exports coverage)
@$(MAKE) lint
@echo "running tests (CI - no race)..."
@go test ./... -coverprofile=coverage.txt -covermode=atomic $(TAGS)

.PHONY: test-ci-short
test-ci-short: ## Runs unit tests via CI (exports coverage)
@$(MAKE) lint
@echo "running tests (CI - unit tests only)..."
@go test ./... -test.short -race -coverprofile=coverage.txt -covermode=atomic $(TAGS)

.PHONY: test-no-lint
test-no-lint: ## Runs just tests
@echo "running tests..."
@go test ./... -v $(TAGS)

.PHONY: uninstall
uninstall: ## Uninstall the application (and remove files)
@echo "uninstalling go application..."
@test $(BINARY_NAME)
@test $(GIT_DOMAIN)
@test $(REPO_OWNER)
@test $(REPO_NAME)
@go clean -i $(GIT_DOMAIN)/$(REPO_OWNER)/$(REPO_NAME)
@rm -rf $$GOPATH/src/$(GIT_DOMAIN)/$(REPO_OWNER)/$(REPO_NAME)
@rm -rf $$GOPATH/bin/$(BINARY_NAME)

.PHONY: update
update: ## Update all project dependencies
@echo "updating dependencies..."
@go get -u ./... && go mod tidy

.PHONY: update-linter
update-linter: ## Update the golangci-lint package (macOS only)
@echo "upgrading golangci-lint..."
@brew upgrade golangci-lint

.PHONY: vet
vet: ## Run the Go vet application
@echo "running go vet..."
@go vet -v ./... $(TAGS)
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Common makefile commands & variables between projects
include .make/Makefile.common
include .make/common.mk

# Common Golang makefile commands & variables between projects
include .make/Makefile.go
include .make/go.mk

## Not defined? Use default repo name which is the application
ifeq ($(REPO_NAME),)
@@ -14,15 +14,16 @@ ifeq ($(REPO_OWNER),)
REPO_OWNER="bitcoinschema"
endif

.PHONY: clean

.PHONY: all
all: ## Runs multiple commands
@$(MAKE) test

.PHONY: clean
clean: ## Remove previous builds and any test cache data
@go clean -cache -testcache -i -r
@test $(DISTRIBUTIONS_DIR)
@if [ -d $(DISTRIBUTIONS_DIR) ]; then rm -r $(DISTRIBUTIONS_DIR); fi

.PHONY: release
release:: ## Runs common.release then runs godocs
@$(MAKE) godocs
99 changes: 56 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
@@ -2,25 +2,31 @@
> Library for working with [Author Identity Protocol](https://github.com/BitcoinFiles/AUTHOR_IDENTITY_PROTOCOL) in Go
[![Release](https://img.shields.io/github/release-pre/BitcoinSchema/go-aip.svg?logo=github&style=flat&v=3)](https://github.com/BitcoinSchema/go-aip/releases)
[![Build Status](https://travis-ci.com/BitcoinSchema/go-aip.svg?branch=master&v=3)](https://travis-ci.com/BitcoinSchema/go-aip)
[![Build Status](https://img.shields.io/github/actions/workflow/status/BitcoinSchema/go-aip/run-tests.yml?branch=master&logo=github&v=3)](https://github.com/BitcoinSchema/go-aip/actions)
[![Report](https://goreportcard.com/badge/github.com/BitcoinSchema/go-aip?style=flat&v=3)](https://goreportcard.com/report/github.com/BitcoinSchema/go-aip)
[![codecov](https://codecov.io/gh/BitcoinSchema/go-aip/branch/master/graph/badge.svg?v=3)](https://codecov.io/gh/BitcoinSchema/go-aip)
[![Go](https://img.shields.io/github/go-mod/go-version/BitcoinSchema/go-aip?v=3)](https://golang.org/)
<br>
[![Mergify Status](https://img.shields.io/endpoint.svg?url=https://api.mergify.com/v1/badges/BitcoinSchema/go-aip&style=flat&v=3)](https://mergify.io)
[![Sponsor](https://img.shields.io/badge/sponsor-BitcoinSchema-181717.svg?logo=github&style=flat&v=3)](https://github.com/sponsors/BitcoinSchema)
[![Donate](https://img.shields.io/badge/donate-bitcoin-ff9900.svg?logo=bitcoin&style=flat&v=3)](https://gobitcoinsv.com/#sponsor)
[![Donate](https://img.shields.io/badge/donate-bitcoin-ff9900.svg?logo=bitcoin&style=flat&v=3)](https://gobitcoinsv.com/#sponsor?utm_source=github&utm_medium=sponsor-link&utm_campaign=go-aip&utm_term=go-aip&utm_content=go-aip)

<br/>

## Table of Contents
- [Installation](#installation)
- [Documentation](#documentation)
- [Examples & Tests](#examples--tests)
- [Benchmarks](#benchmarks)
- [Code Standards](#code-standards)
- [Usage](#usage)
- [Maintainers](#maintainers)
- [Contributing](#contributing)
- [License](#license)
- [go-aip](#go-aip)
- [Table of Contents](#table-of-contents)
- [Installation](#installation)
- [Documentation](#documentation)
- [Features](#features)
- [Examples \& Tests](#examples--tests)
- [Benchmarks](#benchmarks)
- [Code Standards](#code-standards)
- [Usage](#usage)
- [Maintainers](#maintainers)
- [Contributing](#contributing)
- [How can I help?](#how-can-i-help)
- [License](#license)

<br/>

@@ -49,9 +55,8 @@ View the generated [documentation](https://pkg.go.dev/github.com/bitcoinschema/g
<summary><strong><code>Package Dependencies</code></strong></summary>
<br/>

- [bitcoinschema/go-bitcoin](https://github.com/bitcoinschema/go-bitcoin)
- [bitcoin-sv/go-sdk](https://github.com/bitcoin-sv/go-sdk)
- [bitcoinschema/go-bob](https://github.com/bitcoinschema/go-bob)
- [libsv/libsv](https://github.com/libsv/libsv)
</details>

<details>
@@ -76,36 +81,44 @@ make help

List of all current commands:
```text
all Runs multiple commands
clean Remove previous builds and any test cache data
clean-mods Remove all the Go mod cache
coverage Shows the test coverage
godocs Sync the latest tag with GoDocs
help Show this help message
install Install the application
install-go Install the application (Using Native Go)
lint Run the Go lint application
release Full production release (creates release in Github)
release Runs common.release then runs godocs
release-snap Test the full release (build binaries)
release-test Full production test release (everything except deploy)
replace-version Replaces the version in HTML/JS (pre-deploy)
tag Generate a new tag and push (tag version=0.0.0)
tag-remove Remove a tag if found (tag-remove version=0.0.0)
tag-update Update an existing tag to current commit (tag-update version=0.0.0)
test Runs vet, lint and ALL tests
test-short Runs vet, lint and tests (excludes integration tests)
test-travis Runs all tests via Travis (also exports coverage)
test-travis-short Runs unit tests via Travis (also exports coverage)
uninstall Uninstall the application (and remove files)
vet Run the Go vet application
all Runs multiple commands
clean Remove previous builds and any test cache data
clean-mods Remove all the Go mod cache
coverage Shows the test coverage
diff Show the git diff
generate Runs the go generate command in the base of the repo
godocs Sync the latest tag with GoDocs
help Show this help message
install Install the application
install-go Install the application (Using Native Go)
install-releaser Install the GoReleaser application
lint Run the golangci-lint application (install if not found)
release Full production release (creates release in Github)
release Runs common.release then runs godocs
release-snap Test the full release (build binaries)
release-test Full production test release (everything except deploy)
replace-version Replaces the version in HTML/JS (pre-deploy)
tag Generate a new tag and push (tag version=0.0.0)
tag-remove Remove a tag if found (tag-remove version=0.0.0)
tag-update Update an existing tag to current commit (tag-update version=0.0.0)
test Runs lint and ALL tests
test-ci Runs all tests via CI (exports coverage)
test-ci-no-race Runs all tests via CI (no race) (exports coverage)
test-ci-short Runs unit tests via CI (exports coverage)
test-no-lint Runs just tests
test-short Runs vet, lint and tests (excludes integration tests)
test-unit Runs tests and outputs coverage
uninstall Uninstall the application (and remove files)
update-linter Update the golangci-lint package (macOS only)
vet Run the Go vet application
```
</details>

<br/>

## Examples & Tests
All unit tests and [examples](examples) run via [Travis CI](https://travis-ci.com/bitcoinschema/go-aip) and uses [Go version 1.15.x](https://golang.org/doc/go1.15). View the [deployment configuration file](.travis.yml).
All unit tests and [examples](examples) run via [GitHub Actions](https://github.com/BitcoinSchema/go-aip/actions) and
uses [Go version 1.23.x](https://golang.org/doc/go1.23). View the [configuration file](.github/workflows/run-tests.yml).

Run all tests (including integration tests)
```shell script
@@ -128,7 +141,7 @@ make bench
<br/>

## Code Standards
Read more about this Go project's [code standards](CODE_STANDARDS.md).
Read more about this Go project's [code standards](.github/CODE_STANDARDS.md).

<br/>

@@ -139,23 +152,23 @@ Checkout all the [examples](examples)!

## Maintainers
| [<img src="https://github.com/rohenaz.png" height="50" alt="MrZ" />](https://github.com/rohenaz) | [<img src="https://github.com/mrz1836.png" height="50" alt="MrZ" />](https://github.com/mrz1836) |
|:---:|:---:|
| [Satchmo](https://github.com/rohenaz) | [MrZ](https://github.com/mrz1836) |
|:------------------------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------------------:|
| [Satchmo](https://github.com/rohenaz) | [MrZ](https://github.com/mrz1836) |

<br/>

## Contributing

View the [contributing guidelines](CONTRIBUTING.md) and follow the [code of conduct](CODE_OF_CONDUCT.md).
View the [contributing guidelines](.github/CONTRIBUTING.md) and follow the [code of conduct](.github/CODE_OF_CONDUCT.md).

### How can I help?
All kinds of contributions are welcome :raised_hands:!
The most basic way to show your support is to star :star2: the project, or to raise issues :speech_balloon:.
You can also support this project by [becoming a sponsor on GitHub](https://github.com/sponsors/BitcoinSchema) :clap:
or by making a [**bitcoin donation**](https://gobitcoinsv.com/#sponsor) to ensure this journey continues indefinitely! :rocket:
or by making a [**bitcoin donation**](https://gobitcoinsv.com/#sponsor?utm_source=github&utm_medium=sponsor-link&utm_campaign=go-aip&utm_term=go-aip&utm_content=go-aip) to ensure this journey continues indefinitely! :rocket:

<br/>

## License

![License](https://img.shields.io/github/license/BitcoinSchema/go-aip.svg?style=flat&v=3)
[![License](https://img.shields.io/github/license/BitcoinSchema/go-aip.svg?style=flat&v=3)](LICENSE)
97 changes: 69 additions & 28 deletions aip.go
Original file line number Diff line number Diff line change
@@ -8,15 +8,24 @@ package aip

import (
"bytes"
"encoding/base64"
"encoding/hex"
"errors"
"fmt"
"strings"

"github.com/bitcoinschema/go-bitcoin"
"github.com/libsv/libsv/transaction/output"
bsm "github.com/bitcoin-sv/go-sdk/compat/bsm"
ec "github.com/bitcoin-sv/go-sdk/primitives/ec"
"github.com/bitcoin-sv/go-sdk/script"
)

// Prefix is the Bitcom prefix used by AIP
const Prefix = "15PciHG22SNLQJXMoSUaWVi7WSqc7hCfva"
var Prefix = "15PciHG22SNLQJXMoSUaWVi7WSqc7hCfva"

var hexPrefix = hex.EncodeToString([]byte(Prefix))

const pipe = "|"
const opReturn = string(rune(script.OpRETURN)) // creates: j

// Algorithm is an enum for the different possible signature algorithms
type Algorithm string
@@ -38,77 +47,109 @@ type Aip struct {
}

// Validate returns true if the given AIP signature is valid for given data
func (a *Aip) Validate() bool {
func (a *Aip) Validate() (bool, error) {

// Both data and component are required
if len(a.Data) == 0 || len(a.AlgorithmSigningComponent) == 0 {
return false
return false, errors.New("missing data or signing component")
}

// Check to be sure OP_RETURN was prepended before trying to validate
if a.Data[0] != opReturn {
return false, fmt.Errorf("the first item in payload is always OP_RETURN, got: %s", a.Data[0])
}

sig, err := base64.StdEncoding.DecodeString(a.Signature)
if err != nil {
return false, err
}
// Convert pubkey to address
if a.Algorithm == Paymail {

// Get the public address for this paymail from pki
addr, err := bitcoin.GetAddressFromPubKeyString(a.AlgorithmSigningComponent)
// Detect whether this key was compressed when sig was made
_, wasCompressed, err := bsm.PubKeyFromSignature(sig, []byte(strings.Join(a.Data, "")))
if err != nil {
return false
return false, err
}
var pubKey *ec.PublicKey
var addr *script.Address
if pubKey, err = ec.PublicKeyFromString(a.AlgorithmSigningComponent); err != nil {
return false, err
}
if addr, err = script.NewAddressFromPublicKeyWithCompression(
pubKey,
true,
wasCompressed); err != nil {
return false, err
}
a.AlgorithmSigningComponent = addr.String()
a.AlgorithmSigningComponent = addr.AddressString

}

// You get the address associated with the pki instead of the current address
return bitcoin.VerifyMessage(a.AlgorithmSigningComponent, a.Signature, strings.Join(a.Data, "")) == nil
err = bsm.VerifyMessage(a.AlgorithmSigningComponent, sig, []byte(strings.Join(a.Data, "")))
return err == nil, err
}

// Sign will provide an AIP signature for a given private key and message using
// the provided algorithm
func Sign(privateKey string, algorithm Algorithm, message string) (a *Aip, err error) {
// the provided algorithm. It prepends an OP_RETURN to the payload
func Sign(privateKey *ec.PrivateKey, algorithm Algorithm, message string) (a *Aip, err error) {

// Prepend the OP_RETURN to keep consistent with BitcoinFiles SDK
// data = append(data, []byte{byte(txscript.OP_RETURN)})
prependedData := []string{opReturn, message}

// Create the base AIP object
a = &Aip{Algorithm: algorithm, Data: []string{message}}
a = &Aip{Algorithm: algorithm, Data: prependedData}

// Sign using the private key and the message
if a.Signature, err = bitcoin.SignMessage(privateKey, message); err != nil {
return
var sig []byte
if sig, err = bsm.SignMessage(privateKey, []byte(strings.Join(prependedData, ""))); err != nil {
return nil, err
}

a.Signature = base64.StdEncoding.EncodeToString(sig)

// Store address vs pubkey
switch algorithm {
case BitcoinECDSA, BitcoinSignedMessage:

// Signing component = bitcoin address
// Get the address of the private key
if a.AlgorithmSigningComponent, err = bitcoin.GetAddressFromPrivateKey(privateKey); err != nil {
return
if add, err := script.NewAddressFromPublicKey(privateKey.PubKey(), true); err != nil {
return nil, err
} else {
a.AlgorithmSigningComponent = add.AddressString
}
case Paymail:

// Signing component = paymail identity key
// Get pubKey from private key and overload the address field in AIP
if a.AlgorithmSigningComponent, err = bitcoin.PubKeyFromPrivateKeyString(privateKey); err != nil {
return
}
// if pubkey, err := bitcoin.PubKeyFromPrivateKeyString(privateKey, false); err != nil {
// return
// }
a.AlgorithmSigningComponent = hex.EncodeToString(privateKey.PubKey().Compressed())
}

return
}

// SignOpReturnData will append the given data and return an output.Output
func SignOpReturnData(privateKey string, algorithm Algorithm, data [][]byte) (out *output.Output, a *Aip, err error) {
// SignOpReturnData will append the given data and return a bt.Output
func SignOpReturnData(privateKey *ec.PrivateKey, algorithm Algorithm,
data [][]byte) (outData [][]byte, a *Aip, err error) {

// Sign with AIP
if a, err = Sign(privateKey, algorithm, string(bytes.Join(data, []byte{}))); err != nil {
return
}

// Add AIP signature
data = append(
outData = append(
data,
[]byte(Prefix),
[]byte(a.Algorithm),
[]byte(a.AlgorithmSigningComponent),
[]byte(a.Signature),
)

// Create the output
out, err = output.NewOpReturnParts(data)
// // Create the output
// out, err = bt.NewOpReturnPartsOutput(outData)
return
}
304 changes: 183 additions & 121 deletions aip_test.go

Large diffs are not rendered by default.

211 changes: 153 additions & 58 deletions bob.go
Original file line number Diff line number Diff line change
@@ -2,43 +2,70 @@ package aip

import (
"encoding/hex"
"errors"
"strconv"
"strings"

"github.com/bitcoinschema/go-bob"
ec "github.com/bitcoin-sv/go-sdk/primitives/ec"
"github.com/bitcoinschema/go-bpu"
)

// NewFromTape will create a new AIP object from a bob.Tape
// Using the FromTape() alone will prevent validation (data is needed via SetData to enable)
func NewFromTape(tape bob.Tape) (a *Aip) {
func NewFromTape(tape bpu.Tape) (a *Aip) {
a = new(Aip)
a.FromTape(tape)
return
}

// FromTape takes a BOB Tape and returns a Aip data structure.
// FromTape takes a BOB Tape and returns an Aip data structure.
// Using the FromTape() alone will prevent validation (data is needed via SetData to enable)
func (a *Aip) FromTape(tape bob.Tape) {
func (a *Aip) FromTape(tape bpu.Tape) {

// Not a valid tape?
if len(tape.Cell) < 4 || tape.Cell[0].S != Prefix {
if len(tape.Cell) < 4 {
return
}

// Loop to find start of AIP
var startIndex int
found := false
for i, cell := range tape.Cell {
if *cell.S == Prefix {
startIndex = i
found = true
break
}
}

if !found {
return
}
// Set the AIP fields
a.Algorithm = Algorithm(tape.Cell[1].S)
a.AlgorithmSigningComponent = tape.Cell[2].S
a.Signature = tape.Cell[3].B
if tape.Cell[startIndex+1].S != nil {
a.Algorithm = Algorithm(*tape.Cell[startIndex+1].S)
}
if tape.Cell[startIndex+2].S != nil {
a.AlgorithmSigningComponent = *tape.Cell[startIndex+2].S
}
if tape.Cell[startIndex+3].B != nil {
a.Signature = *tape.Cell[startIndex+3].B
}

// Final index count
finalIndexCount := startIndex + 4

// Store the indices
if len(tape.Cell) > 4 {
if len(tape.Cell) > finalIndexCount {

// TODO: Consider OP_RETURN is included in sig when processing a tx using indices
// Loop over remaining indices if they exist and append to indices slice
a.Indices = make([]int, len(tape.Cell)-4)
for x := 4; x < len(tape.Cell); x++ {
index, err := strconv.Atoi(tape.Cell[x].S)
if err == nil {
a.Indices = make([]int, len(tape.Cell)-finalIndexCount)
for x := finalIndexCount - 1; x < len(tape.Cell); x++ {
if tape.Cell[x].S == nil {
continue
}
if index, err := strconv.Atoi(*tape.Cell[x].S); err == nil {
a.Indices = append(a.Indices, index)
}
}
@@ -47,14 +74,14 @@ func (a *Aip) FromTape(tape bob.Tape) {

// NewFromTapes will create a new AIP object from a []bob.Tape
// Using the FromTapes() alone will prevent validation (data is needed via SetData to enable)
func NewFromTapes(tapes []bob.Tape) (a *Aip) {
func NewFromTapes(tapes []bpu.Tape) (a *Aip) {
// Loop tapes -> cells (only supporting 1 sig right now)
for _, t := range tapes {
for _, cell := range t.Cell {
if cell.S == Prefix {
if cell.S != nil && *cell.S == Prefix {
a = new(Aip)
a.FromTape(t)
a.SetDataFromTapes(tapes)
a.SetDataFromTapes(tapes, 0)
return
}
}
@@ -63,61 +90,101 @@ func NewFromTapes(tapes []bob.Tape) (a *Aip) {
}

// SetDataFromTapes sets the data the AIP signature is signing
func (a *Aip) SetDataFromTapes(tapes []bob.Tape) {
func (a *Aip) SetDataFromTapes(tapes []bpu.Tape, instance int) {
// Set OP_RETURN to be consistent with BitcoinFiles SDK
// var data [][]byte
var data = []string{opReturn}
var foundAIP bool
var aipTapeIndex int
var aipCellIndex int

var data = []string{"j"}
// First find the AIP tape and cell index
aipCount := 0
for i, tape := range tapes {
for j, cell := range tape.Cell {
if cell.S != nil && *cell.S == Prefix {
if aipCount == instance {
aipTapeIndex = i
aipCellIndex = j
foundAIP = true
break
}
aipCount++
}

if len(a.Indices) == 0 {
}
if foundAIP {
break
}
}

// If we found AIP, collect data from all tapes up to the AIP tape
if foundAIP {
if len(a.Indices) == 0 {

// Walk over all output values and concatenate them until we hit the AIP prefix, then add in the separator
for i, tape := range tapes {
for j, cell := range tape.Cell {

if cell.S != nil && *cell.S == Prefix {
data = append(data, pipe)
a.Data = data
if i == aipTapeIndex && j >= aipCellIndex {
return
}
}

// Walk over all output values and concatenate them until we hit the AIP prefix, then add in the separator
for _, tape := range tapes {
for _, cell := range tape.Cell {
if cell.S != Prefix {
// Skip the OPS
if cell.Ops != "" {
// if cell.Ops != nil {
if cell.Op != nil && (*cell.Op == 0 || *cell.Op > 0x4e) {
continue
}
data = append(data, cell.S)
} else {
data = append(data, pipe)
a.Data = data
return
if cell.S != nil {
data = append(data, strings.TrimSpace(*cell.S))
}

}
}
}

} else {
var indexCt = 0
} else {

for _, tape := range tapes {
for _, cell := range tape.Cell {
if cell.S != Prefix && contains(a.Indices, indexCt) {
data = append(data, cell.S)
} else {
data = append(data, pipe)
var indexCt = 0

for _, tape := range tapes {
for _, cell := range tape.Cell {
if cell.S != nil && *cell.S != Prefix && contains(a.Indices, indexCt) {
data = append(data, *cell.S)
} else {
data = append(data, pipe)
}
indexCt++
}
indexCt++
}
}

a.Data = data
}

}

// SignBobOpReturnData appends a signature to a BOB Tx by adding a
// protocol separator followed by AIP information
func SignBobOpReturnData(privateKey string, algorithm Algorithm, output bob.Output) (*bob.Output, *Aip, error) {
func SignBobOpReturnData(privateKey *ec.PrivateKey, algorithm Algorithm, output bpu.Output) (*bpu.Output, *Aip, error) {

// Parse the data to sign
var dataToSign []string
for _, tape := range output.Tape {
for _, cell := range tape.Cell {
if len(cell.S) > 0 {
dataToSign = append(dataToSign, cell.S)
if cell.S != nil {
dataToSign = append(dataToSign, *cell.S)
} else {
// TODO: Review this case. Should we assume the b64 is signed?
// Should protocol doc for AIP mention this?
dataToSign = append(dataToSign, cell.B)
if cell.B != nil {
dataToSign = append(dataToSign, *cell.B)
}
// else if cell.Op != nil {
// dataToSign = append(dataToSign, string(*cell.Op))
// }
}
}
}
@@ -128,42 +195,48 @@ func SignBobOpReturnData(privateKey string, algorithm Algorithm, output bob.Outp
return nil, nil, err
}

algoHex := hex.EncodeToString([]byte(algorithm))
algoStr := string(algorithm)

hexAlgoSigningComponent := hex.EncodeToString([]byte(a.AlgorithmSigningComponent))
hexSig := hex.EncodeToString([]byte(a.Signature))

// Create the output tape
output.Tape = append(output.Tape, bob.Tape{
Cell: []bob.Cell{{
H: hex.EncodeToString([]byte(Prefix)),
S: Prefix,
output.Tape = append(output.Tape, bpu.Tape{
Cell: []bpu.Cell{{
H: &hexPrefix,
S: &Prefix,
}, {
H: hex.EncodeToString([]byte(algorithm)),
S: string(algorithm),
H: &algoHex,
S: &algoStr,
}, {
H: hex.EncodeToString([]byte(a.AlgorithmSigningComponent)),
S: a.AlgorithmSigningComponent,
H: &hexAlgoSigningComponent,
S: &a.AlgorithmSigningComponent,
}, {
H: hex.EncodeToString([]byte(a.Signature)),
S: a.Signature,
H: &hexSig,
S: &a.Signature,
}},
})

return &output, a, nil
}

// ValidateTapes validates the AIP signature for a given []bob.Tape
func ValidateTapes(tapes []bob.Tape) bool {
func ValidateTapes(tapes []bpu.Tape) (bool, error) {
// Loop tapes -> cells (only supporting 1 sig right now)
for _, tape := range tapes {
for _, cell := range tape.Cell {

// Once we hit AIP Prefix, stop
if cell.S == Prefix {
if cell.S != nil && *cell.S == Prefix {
a := NewFromTape(tape)
a.SetDataFromTapes(tapes)
a.SetDataFromTapes(tapes, 0)
return a.Validate()
}
}

}
return false
return false, errors.New("no AIP tape found")
}

// contains looks in a slice for a given value
@@ -175,3 +248,25 @@ func contains(s []int, e int) bool {
}
return false
}

// NewFromAllTapes will create all AIP objects from a []bob.Tape
func NewFromAllTapes(tapes []bpu.Tape) []*Aip {
var aips []*Aip

// Find all tapes that contain the AIP prefix
instance := 0
for i, t := range tapes {
for _, cell := range t.Cell {
if cell.S != nil && *cell.S == Prefix {
a := new(Aip)
a.FromTape(t)
// For all AIP entries, include all data from the start up to this entry
a.SetDataFromTapes(tapes[:i+1], instance)
instance++
aips = append(aips, a)
continue
}
}
}
return aips
}
257 changes: 133 additions & 124 deletions bob_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package aip

import (
"encoding/hex"
"fmt"
"testing"

"github.com/bitcoinschema/go-bitcoin"
"github.com/bitcoin-sv/go-sdk/script"
"github.com/bitcoin-sv/go-sdk/transaction"
"github.com/bitcoinschema/go-bob"
"github.com/bitcoinschema/go-bpu"
)

// TestNewFromTape will test the method NewFromTape()
@@ -25,7 +28,7 @@ func TestNewFromTape(t *testing.T) {
var (
// Testing private methods
tests = []struct {
inputTapes []bob.Tape
inputTapes []bpu.Tape
inputIndex int
expectedSignature string
expectedAlgorithm Algorithm
@@ -52,7 +55,7 @@ func TestNewFromTape(t *testing.T) {
false,
},
{
[]bob.Tape{*new(bob.Tape)},
[]bpu.Tape{*new(bpu.Tape)},
0,
"",
"",
@@ -64,23 +67,23 @@ func TestNewFromTape(t *testing.T) {
)

// Run tests
for _, test := range tests {
for idx, test := range tests {
if a := NewFromTape(test.inputTapes[test.inputIndex]); a == nil && !test.expectedNil {
t.Errorf("%s Failed: [%v] inputted and nil was not expected", t.Name(), test.inputTapes[test.inputIndex])
t.Errorf("%d %s Failed: [%v] inputted and nil was not expected", idx, t.Name(), test.inputTapes[test.inputIndex])
} else if a != nil && test.expectedNil {
t.Errorf("%s Failed: [%v] inputted and nil was expected", t.Name(), test.inputTapes[test.inputIndex])
t.Errorf("%d %s Failed: [%v] inputted and nil was expected", idx, t.Name(), test.inputTapes[test.inputIndex])
} else if a != nil && a.Signature != test.expectedSignature {
t.Errorf("%s Failed: [%v] inputted and expected [%s] but got [%s]", t.Name(), test.inputTapes[test.inputIndex], test.expectedSignature, a.Signature)
t.Errorf("%d %s Failed: [%v] inputted and expected [%s] but got [%s]", idx, t.Name(), test.inputTapes[test.inputIndex], test.expectedSignature, a.Signature)
} else if a != nil && a.Algorithm != test.expectedAlgorithm {
t.Errorf("%s Failed: [%v] inputted and expected [%s] but got [%s]", t.Name(), test.inputTapes[test.inputIndex], test.expectedAlgorithm, a.Algorithm)
t.Errorf("%d %s Failed: [%v] inputted and expected [%s] but got [%s]", idx, t.Name(), test.inputTapes[test.inputIndex], test.expectedAlgorithm, a.Algorithm)
} else if a != nil && a.AlgorithmSigningComponent != test.expectedComponent {
t.Errorf("%s Failed: [%v] inputted and expected [%s] but got [%s]", t.Name(), test.inputTapes[test.inputIndex], test.expectedComponent, a.AlgorithmSigningComponent)
t.Errorf("%d %s Failed: [%v] inputted and expected [%s] but got [%s]", idx, t.Name(), test.inputTapes[test.inputIndex], test.expectedComponent, a.AlgorithmSigningComponent)
} else if a != nil && len(test.inputTapes) > 1 {
valid := ValidateTapes(test.inputTapes)
valid, err := ValidateTapes(test.inputTapes)
if valid && !test.expectedValidation {
t.Errorf("%s Failed: [%v] inputted and validation should have failed", t.Name(), test.inputTapes)
} else if !valid && test.expectedValidation {
t.Errorf("%s Failed: [%v] inputted and validation should have passed", t.Name(), test.inputTapes)
t.Errorf("%d %s Failed: [%v] inputted and validation should have failed", idx, t.Name(), test.inputTapes)
} else if !valid && test.expectedValidation && err != nil {
t.Errorf("%d %s Failed: [%v] inputted and validation should have passed, error: %s", idx, t.Name(), test.inputTapes, err.Error())
}
}
}
@@ -127,7 +130,7 @@ func TestNewFromTapes(t *testing.T) {
var (
// Testing private methods
tests = []struct {
inputTapes []bob.Tape
inputTapes []bpu.Tape
expectedSignature string
expectedAlgorithm Algorithm
expectedComponent string
@@ -142,7 +145,7 @@ func TestNewFromTapes(t *testing.T) {
"H+lubfcz5Z2oG8B7HwmP8Z+tALP+KNOPgedo7UTXwW8LBpMkgCgatCdpvbtf7wZZQSIMz83emmAvVS4S3F5X1wo=",
BitcoinECDSA,
"134a6TXxzgQ9Az3w8BcvgdZyA5UqRL89da",
"j",
opReturn,
"1BAPSuaPnfGnSBM3GLV9yhxUdYe4vGbdMT",
"ATTEST",
false,
@@ -153,14 +156,14 @@ func TestNewFromTapes(t *testing.T) {
"H+lubfcz5Z2oG8B7HwmP8Z+tALP+KNOPgedo7UTXwW8LBpMkgCgatCdpvbtf7wZZQSIMz83emmAvVS4S3F5X1wo=",
BitcoinECDSA,
"invalid-address",
"j",
opReturn,
"1BAPSuaPnfGnSBM3GLV9yhxUdYe4vGbdMT",
"ATTEST",
false,
false,
},
{
[]bob.Tape{*new(bob.Tape)},
[]bpu.Tape{*new(bpu.Tape)},
"",
"",
"",
@@ -192,11 +195,12 @@ func TestNewFromTapes(t *testing.T) {
} else if a != nil && len(a.Data) > 0 && a.Data[2] != test.expectedData2 {
t.Errorf("%s Failed: [%v] inputted and expected [%s] but got [%s]", t.Name(), test.inputTapes, test.expectedData2, a.Data[2])
} else if a != nil && len(test.inputTapes) > 1 {
valid := ValidateTapes(test.inputTapes)
var valid bool
valid, err = ValidateTapes(test.inputTapes)
if valid && !test.expectedValidation {
t.Errorf("%s Failed: [%v] inputted and validation should have failed", t.Name(), test.inputTapes)
} else if !valid && test.expectedValidation {
t.Errorf("%s Failed: [%v] inputted and validation should have passed", t.Name(), test.inputTapes)
} else if !valid && test.expectedValidation && err != nil {
t.Errorf("%s Failed: [%v] inputted and validation should have passed, error: %s", t.Name(), test.inputTapes, err.Error())
}
}
}
@@ -243,7 +247,7 @@ func TestValidateTapes(t *testing.T) {
var (
// Testing private methods
tests = []struct {
inputTapes []bob.Tape
inputTapes []bpu.Tape
expectedValidation bool
}{
{
@@ -255,18 +259,18 @@ func TestValidateTapes(t *testing.T) {
false,
},
{
[]bob.Tape{*new(bob.Tape)},
[]bpu.Tape{*new(bpu.Tape)},
false,
},
}
)

// Run tests
for _, test := range tests {
if valid := ValidateTapes(test.inputTapes); valid && !test.expectedValidation {
t.Errorf("%s Failed: [%v] inputted and validation should have failed", t.Name(), test.inputTapes)
} else if !valid && test.expectedValidation {
t.Errorf("%s Failed: [%v] inputted and validation should have passed", t.Name(), test.inputTapes)
for idx, test := range tests {
if valid, err := ValidateTapes(test.inputTapes); valid && !test.expectedValidation {
t.Errorf("%d %s Failed: inputted and validation should have failed", idx, t.Name())
} else if !valid && test.expectedValidation && err != nil {
t.Errorf("%d %s Failed: inputted and validation should have passed, error: %s", idx, t.Name(), err.Error())
}
}
}
@@ -281,10 +285,10 @@ func ExampleValidateTapes() {
}

// Get from tape
if ValidateTapes(bobValidData.Out[0].Tape) {
if valid, err := ValidateTapes(bobValidData.Out[0].Tape); valid {
fmt.Print("AIP is valid")
} else {
fmt.Print("AIP is invalid")
} else if err != nil {
fmt.Printf("AIP is invalid: %s", err.Error())
}
// Output:AIP is valid
}
@@ -293,112 +297,117 @@ func ExampleValidateTapes() {
func BenchmarkValidateTapes(b *testing.B) {
bobValidData, _ := bob.NewFromString(sampleValidBobTx)
for i := 0; i < b.N; i++ {
_ = ValidateTapes(bobValidData.Out[0].Tape)
_, _ = ValidateTapes(bobValidData.Out[0].Tape)
}
}

// getBobOutput helper to get op_return in BOB format
func getBobOutput() bob.Output {

// Create op_return
opReturn := bitcoin.OpReturnData{[]byte("prefix1"), []byte("example data"), []byte{0x13, 0x37}}
func getBobOutput() bpu.Output {

// Create a transaction
privateKey, _ := bitcoin.PrivateKeyFromString(examplePrivateKey)
tx, _ := bitcoin.CreateTx(nil, nil, []bitcoin.OpReturnData{opReturn}, privateKey)
// privateKey, _ := bitcoin.PrivateKeyFromString(examplePrivateKey)
tx := transaction.NewTransaction()
scr := &script.Script{}
scr.AppendOpcodes(script.OpFALSE, script.OpRETURN)
scr.AppendPushDataArray([][]byte{[]byte("prefix1"), []byte("example data"), {0x13, 0x37}})
tx.AddOutput(&transaction.TransactionOutput{
Satoshis: 0,
LockingScript: scr,
})
// tx, _ := bitcoin.CreateTx(nil, nil, []bitcoin.OpReturnData{opReturn})

// Create the bob tx from hex
bobTx, _ := bob.NewFromRawTxString(tx.ToString())
bobTx, _ := bob.NewFromRawTxString(hex.EncodeToString(tx.Bytes()))

return bobTx.Out[0]
}

// TestSignBobOpReturnData tests for nil case in SignBobOpReturnData()
func TestSignBobOpReturnData(t *testing.T) {
t.Parallel()

var (
// Testing private methods
tests = []struct {
inputPrivateKey string
inputAlgorithm Algorithm
inputData bob.Output
expectedSignature string
expectedAipNil bool
expectedOutNil bool
expectedError bool
expectedValidation bool
}{
{
"80699541455b59a8a8a33b85892319de8b8e8944eb8b48e9467137825ae192e59f01",
BitcoinECDSA,
getBobOutput(),
"H2Nn2dLDOO86cnblfLEAWsNMGokR8fglDu7boPC7bVslEX0EOc/W66yso2MRdHd/RZD0NiQJ6JEtk9H4EgSssBo=",
false,
false,
false,
true,
},
{
"",
BitcoinECDSA,
getBobOutput(),
"",
true,
true,
true,
false,
},
{
"80699541455b59a8a8a33b85892319de8b8e8944eb8b48e9467137825ae192e59f01",
Paymail,
getBobOutput(),
"H2Nn2dLDOO86cnblfLEAWsNMGokR8fglDu7boPC7bVslEX0EOc/W66yso2MRdHd/RZD0NiQJ6JEtk9H4EgSssBo=",
false,
false,
false,
true,
},
}
)

// Run tests
for _, test := range tests {
if out, a, err := SignBobOpReturnData(test.inputPrivateKey, test.inputAlgorithm, test.inputData); err != nil && !test.expectedError {
t.Errorf("%s Failed: [%s] [%s] [%v] inputted and error not expected but got: %s", t.Name(), test.inputPrivateKey, test.inputAlgorithm, test.inputData, err.Error())
} else if err == nil && test.expectedError {
t.Errorf("%s Failed: [%s] [%s] [%v] inputted and error was expected", t.Name(), test.inputPrivateKey, test.inputAlgorithm, test.inputData)
} else if a == nil && !test.expectedAipNil {
t.Errorf("%s Failed: [%s] [%s] [%v] inputted and nil was not expected (aip)", t.Name(), test.inputPrivateKey, test.inputAlgorithm, test.inputData)
} else if a != nil && test.expectedAipNil {
t.Errorf("%s Failed: [%s] [%s] [%v] inputted and nil was expected (aip)", t.Name(), test.inputPrivateKey, test.inputAlgorithm, test.inputData)
} else if out == nil && !test.expectedOutNil {
t.Errorf("%s Failed: [%s] [%s] [%v] inputted and nil was not expected (out)", t.Name(), test.inputPrivateKey, test.inputAlgorithm, test.inputData)
} else if out != nil && test.expectedOutNil {
t.Errorf("%s Failed: [%s] [%s] [%v] inputted and nil was expected (out)", t.Name(), test.inputPrivateKey, test.inputAlgorithm, test.inputData)
} else if a != nil && a.Signature != test.expectedSignature {
t.Errorf("%s Failed: [%s] [%s] [%v] inputted and expected signature [%s] but got [%s]", t.Name(), test.inputPrivateKey, test.inputAlgorithm, test.inputData, test.expectedSignature, a.Signature)
} else if a != nil {
valid := a.Validate()
if valid && !test.expectedValidation {
t.Errorf("%s Failed: [%s] [%s] [%v] inputted and validation should have failed", t.Name(), test.inputPrivateKey, test.inputAlgorithm, test.inputData)
} else if !valid && test.expectedValidation {
t.Errorf("%s Failed: [%s] [%s] [%v] inputted and validation should have passed", t.Name(), test.inputPrivateKey, test.inputAlgorithm, test.inputData)
}
}
}
}

// ExampleSignBobOpReturnData example using SignBobOpReturnData()
func ExampleSignBobOpReturnData() {
_, a, err := SignBobOpReturnData(examplePrivateKey, BitcoinECDSA, getBobOutput())
if err != nil {
fmt.Printf("error occurred: %s", err.Error())
return
}
fmt.Printf("signature: %s", a.Signature)
// Output:signature: H2C5brtzppiz3zXe0W8klUeG99ox2sOY6nmXKBOPdkUrURVE0O37JXsjkGV8m9ZCPEAPzCrS2GrWMQrcHFBdFCA=
}
// // TestSignBobOpReturnData tests for nil case in SignBobOpReturnData()
// func TestSignBobOpReturnData(t *testing.T) {
// t.Parallel()

// var (
// // Testing private methods
// tests = []struct {
// inputPrivateKey string
// inputAlgorithm Algorithm
// inputData bpu.Output
// expectedSignature string
// expectedAipNil bool
// expectedOutNil bool
// expectedError bool
// expectedValidation bool
// }{
// {
// "80699541455b59a8a8a33b85892319de8b8e8944eb8b48e9467137825ae192e59f01",
// BitcoinECDSA,
// getBobOutput(),
// "G/tmf2aRfTqri7pCF793/xDZO2COIzcY2BRpb5P0o+zGIG0tCF3JJLadQwCCC+Lu+Xcanv+Fl82lrk3hVlo8bXY=",
// false,
// false,
// false,
// true,
// },
// {
// "",
// BitcoinECDSA,
// getBobOutput(),
// "",
// true,
// true,
// true,
// false,
// },
// {
// "80699541455b59a8a8a33b85892319de8b8e8944eb8b48e9467137825ae192e59f01",
// Paymail,
// getBobOutput(),
// "G/tmf2aRfTqri7pCF793/xDZO2COIzcY2BRpb5P0o+zGIG0tCF3JJLadQwCCC+Lu+Xcanv+Fl82lrk3hVlo8bXY=",
// false,
// false,
// false,
// true,
// },
// }
// )

// // Run tests
// for _, test := range tests {
// if out, a, err := SignBobOpReturnData(test.inputPrivateKey, test.inputAlgorithm, test.inputData); err != nil && !test.expectedError {
// t.Errorf("%s Failed: [%s] [%s] [%v] inputted and error not expected but got: %s", t.Name(), test.inputPrivateKey, test.inputAlgorithm, test.inputData, err.Error())
// } else if err == nil && test.expectedError {
// t.Errorf("%s Failed: [%s] [%s] [%v] inputted and error was expected", t.Name(), test.inputPrivateKey, test.inputAlgorithm, test.inputData)
// } else if a == nil && !test.expectedAipNil {
// t.Errorf("%s Failed: [%s] [%s] [%v] inputted and nil was not expected (aip)", t.Name(), test.inputPrivateKey, test.inputAlgorithm, test.inputData)
// } else if a != nil && test.expectedAipNil {
// t.Errorf("%s Failed: [%s] [%s] [%v] inputted and nil was expected (aip)", t.Name(), test.inputPrivateKey, test.inputAlgorithm, test.inputData)
// } else if out == nil && !test.expectedOutNil {
// t.Errorf("%s Failed: [%s] [%s] [%v] inputted and nil was not expected (out)", t.Name(), test.inputPrivateKey, test.inputAlgorithm, test.inputData)
// } else if out != nil && test.expectedOutNil {
// t.Errorf("%s Failed: [%s] [%s] [%v] inputted and nil was expected (out)", t.Name(), test.inputPrivateKey, test.inputAlgorithm, test.inputData)
// } else if a != nil && a.Signature != test.expectedSignature {
// t.Errorf("%s Failed: [%s] [%s] [%v] inputted and expected signature [%s] but got [%s]", t.Name(), test.inputPrivateKey, test.inputAlgorithm, test.inputData, test.expectedSignature, a.Signature)
// } else if a != nil {
// var valid bool
// if valid, err = a.Validate(); valid && !test.expectedValidation {
// t.Errorf("%s Failed: [%s] [%s] [%v] inputted and validation should have failed", t.Name(), test.inputPrivateKey, test.inputAlgorithm, test.inputData)
// } else if !valid && test.expectedValidation && err != nil {
// t.Errorf("%s Failed: [%s] [%s] [%v] inputted and validation should have passed, error: %s", t.Name(), test.inputPrivateKey, test.inputAlgorithm, test.inputData, err.Error())
// }
// }
// }
// }

// // ExampleSignBobOpReturnData example using SignBobOpReturnData()
// func ExampleSignBobOpReturnData() {
// _, a, err := SignBobOpReturnData(examplePrivateKey, BitcoinECDSA, getBobOutput())
// if err != nil {
// fmt.Printf("error occurred: %s", err.Error())
// return
// }
// fmt.Printf("signature: %s", a.Signature)
// // Output:signature: G1oBzIBhluBmdu2U6xfb75ACIPpDVmjCV4OV1hVAlnovG1IN3jyIOYK/HJQuH5UOjf2rfaI45SZqPxx9llN+Mgs=
// }

// BenchmarkSignBobOpReturnData benchmarks the method SignBobOpReturnData()
func BenchmarkSignBobOpReturnData(b *testing.B) {
41 changes: 41 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Reference: https://docs.codecov.com/docs/codecovyml-reference
# ----------------------
codecov:
require_ci_to_pass: true

# Coverage configuration
# ----------------------
coverage:
status:
patch: false
range: 70..90 # First number represents red, and second represents green
# (default is 70..100)
round: down # up, down, or nearest
precision: 2 # Number of decimal places, between 0 and 5

# Ignoring Paths
# --------------
# which folders/files to ignore
ignore:
- "*/.make/.*"
- "*/.github/.*"
- "*/examples/.*"

# Parsers
# --------------
parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: no
macro: no

# Pull request comments:
# ----------------------
# Diff is the Coverage Diff of the pull request.
# Files are the files impacted by the pull request
comment:
layout: "reach,diff,flags,files,footer"
behavior: default
require_changes: false
4 changes: 3 additions & 1 deletion examples/sign/sign.go
Original file line number Diff line number Diff line change
@@ -3,12 +3,14 @@ package main
import (
"log"

ec "github.com/bitcoin-sv/go-sdk/primitives/ec"
"github.com/bitcoinschema/go-aip"
)

func main() {
priv, _ := ec.NewPrivateKey()
a, err := aip.Sign(
"54035dd4c7dda99ac473905a3d82f7864322b49bab1ff441cc457183b9bd8abd",
priv,
aip.BitcoinECDSA,
"example message",
)
8 changes: 5 additions & 3 deletions examples/sign_op_return/sign_op_return.go
Original file line number Diff line number Diff line change
@@ -3,12 +3,14 @@ package main
import (
"log"

ec "github.com/bitcoin-sv/go-sdk/primitives/ec"
"github.com/bitcoinschema/go-aip"
)

func main() {
out, a, err := aip.SignOpReturnData(
"54035dd4c7dda99ac473905a3d82f7864322b49bab1ff441cc457183b9bd8abd",
priv, _ := ec.NewPrivateKey()
outData, a, err := aip.SignOpReturnData(
priv,
aip.BitcoinECDSA,
[][]byte{[]byte("some op_return data")},
)
@@ -17,5 +19,5 @@ func main() {
}
log.Printf("address: %s", a.AlgorithmSigningComponent)
log.Printf("signature: %s", a.Signature)
log.Printf("output: %s", out.GetLockingScriptHexString())
log.Printf("output: %x", outData)
}
8 changes: 5 additions & 3 deletions examples/validate/validate.go
Original file line number Diff line number Diff line change
@@ -3,21 +3,23 @@ package main
import (
"log"

ec "github.com/bitcoin-sv/go-sdk/primitives/ec"
"github.com/bitcoinschema/go-aip"
)

func main() {
priv, _ := ec.NewPrivateKey()
a, err := aip.Sign(
"54035dd4c7dda99ac473905a3d82f7864322b49bab1ff441cc457183b9bd8abd",
priv,
aip.BitcoinECDSA,
"example message",
)
if err != nil {
log.Fatalf("error occurred: %s", err.Error())
}
if a.Validate() {
if _, err = a.Validate(); err == nil {
log.Printf("signature is valid: %s", a.Signature)
} else {
log.Fatal("signature failed validiation")
log.Fatalf("signature failed validation: %s", err.Error())
}
}
15 changes: 10 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
module github.com/bitcoinschema/go-aip

go 1.15
go 1.23.1

require (
github.com/bitcoinschema/go-bitcoin v0.2.7
github.com/bitcoinschema/go-bob v0.0.5
github.com/libsv/libsv v0.0.11
github.com/piotrnar/gocoin v0.0.0-20201027184336-0c389d7eb2c0 // indirect
github.com/bitcoin-sv/go-sdk v1.1.18
github.com/bitcoinschema/go-bob v0.5.1
github.com/bitcoinschema/go-bpu v0.2.1

)

require (
github.com/pkg/errors v0.9.1 // indirect
golang.org/x/crypto v0.32.0 // indirect
)
84 changes: 15 additions & 69 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,72 +1,18 @@
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
github.com/bitcoinschema/go-bitcoin v0.2.5 h1:258yHVqr4bo8D78UO+Nj3fF3GiqWDrYcESXC9LiFgdQ=
github.com/bitcoinschema/go-bitcoin v0.2.5/go.mod h1:DbEPU/krXiht+Jh5QbpHTJnj/vilMBFAaCGbV5a6IQk=
github.com/bitcoinschema/go-bitcoin v0.2.7 h1:qgrjapt/d6Yukl3q1hGgov47iM5T24erTiHl8M/HQQA=
github.com/bitcoinschema/go-bitcoin v0.2.7/go.mod h1:DbEPU/krXiht+Jh5QbpHTJnj/vilMBFAaCGbV5a6IQk=
github.com/bitcoinschema/go-bob v0.0.5 h1:0keqcxs2wdb68IDfUO/XQQmmC8ktHzPz3N5Mw3nRnvg=
github.com/bitcoinschema/go-bob v0.0.5/go.mod h1:HTIt/BWRAGfz4gs1DYnxGAsUw5JmarPyKDpPZNNCabs=
github.com/bitcoinsv/bsvd v0.0.0-20190609155523-4c29707f7173 h1:2yTIV9u7H0BhRDGXH5xrAwAz7XibWJtX2dNezMeNsUo=
github.com/bitcoinsv/bsvd v0.0.0-20190609155523-4c29707f7173/go.mod h1:BZ1UcC9+tmcDEcdVXgpt13hMczwJxWzpAn68wNs7zRA=
github.com/bitcoinsv/bsvlog v0.0.0-20181216181007-cb81b076bf2e h1:6f+gRvaPE/4h0g39dqTNPr9/P4mikw0aB+dhiExaWN8=
github.com/bitcoinsv/bsvlog v0.0.0-20181216181007-cb81b076bf2e/go.mod h1:WPrWor6cSeuGQZ15qPe+jqFmblJEFrJHYfr5cD7cmyk=
github.com/bitcoinsv/bsvutil v0.0.0-20181216182056-1d77cf353ea9 h1:hFI8rT84FCA0FFy3cFrkW5Nz4FyNKlIdCvEvvTNySKg=
github.com/bitcoinsv/bsvutil v0.0.0-20181216182056-1d77cf353ea9/go.mod h1:p44KuNKUH5BC8uX4ONEODaHUR4+ibC8todEAOGQEJAM=
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
github.com/btcsuite/btcd v0.21.0-beta h1:At9hIZdJW0s9E/fAz28nrz6AmcNlSVucCH796ZteX1M=
github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94=
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
github.com/btcsuite/btcutil v1.0.2/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts=
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg=
github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY=
github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I=
github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc=
github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc=
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY=
github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs=
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/bitcoin-sv/go-sdk v1.1.18 h1:6lMdQGxlLFWysR2O4m8t0FpdEmdvqHIvYjp8+UV8AjI=
github.com/bitcoin-sv/go-sdk v1.1.18/go.mod h1:E/gP4wd23aa7clO4vYx+xMNwEs/I3shKv5NdwWgNkx8=
github.com/bitcoinschema/go-bob v0.5.1 h1:pvRX16sAkQRRNBu1UpRnrbd/WX9MKwYEh0LRb7/u9FI=
github.com/bitcoinschema/go-bob v0.5.1/go.mod h1:z/et0FNbSJobzmU6cQYjByGFNcUfRwgSsqKR9uJOg9k=
github.com/bitcoinschema/go-bpu v0.2.1 h1:4p4LKa+BtP4Ahv5wFbt/RuQbob3u37CrBSuD1aruSQ0=
github.com/bitcoinschema/go-bpu v0.2.1/go.mod h1:WhXazKw2p4OIKhkd5A9JgDsaq3a7QRPmqzwCb/835uA=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/itchyny/base58-go v0.1.0 h1:zF5spLDo956exUAD17o+7GamZTRkXOZlqJjRciZwd1I=
github.com/itchyny/base58-go v0.1.0/go.mod h1:SrMWPE3DFuJJp1M/RUhu4fccp/y9AlB8AL3o3duPToU=
github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ=
github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4=
github.com/libsv/libsv v0.0.11 h1:tb2w/RFpsZLEfPNDGl4tlwk3haMSXYXKspta16+nyv4=
github.com/libsv/libsv v0.0.11/go.mod h1:jhXD2sLtYUNMWoD9mWmsQN0hoGZUK1wCvindT1Odijo=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/piotrnar/gocoin v0.0.0-20201004105208-19152002e94e h1:GxCWyrs5rRKX+ntbqWGCjquzK99g6vIOMmrXzMOWC2E=
github.com/piotrnar/gocoin v0.0.0-20201004105208-19152002e94e/go.mod h1:sW6i99ojgdRHcz53PCjyEeoTEDFh9dfP5iiEIiNfcaM=
github.com/piotrnar/gocoin v0.0.0-20201027184336-0c389d7eb2c0 h1:PuqJFsnjEnbgSk7b629KC4jyuWqr5tM09k80ZpyptHY=
github.com/piotrnar/gocoin v0.0.0-20201027184336-0c389d7eb2c0/go.mod h1:sW6i99ojgdRHcz53PCjyEeoTEDFh9dfP5iiEIiNfcaM=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E=
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
10 changes: 1 addition & 9 deletions tx_test.go

Large diffs are not rendered by default.