https://github.com/bsv-blockchain/go-paymail
Paymail toolkit for Go with full‑stack client and server support
https://github.com/bsv-blockchain/go-paymail
bitcoin bitcoinsv bsv golang library paymail spv-wallet-team
Last synced: 4 months ago
JSON representation
Paymail toolkit for Go with full‑stack client and server support
- Host: GitHub
- URL: https://github.com/bsv-blockchain/go-paymail
- Owner: bsv-blockchain
- License: other
- Created: 2023-08-11T13:50:31.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-12-16T15:11:59.000Z (6 months ago)
- Last Synced: 2025-12-20T06:15:39.611Z (6 months ago)
- Topics: bitcoin, bitcoinsv, bsv, golang, library, paymail, spv-wallet-team
- Language: Go
- Homepage:
- Size: 1.41 MB
- Stars: 12
- Watchers: 3
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
- Security: .github/SECURITY.md
- Support: .github/SUPPORT.md
- Agents: .github/AGENTS.md
Awesome Lists containing this project
README
# ✉️ go-paymail
**Paymail toolkit for Go with full‑stack client and server support.**
### Project Navigation
📦 Installation
🧪 Examples & Tests
📚 Documentation
🤝 Contributing
🛠️ Code Standards
⚡ Benchmarks
🤖 AI Usage
📝 License
👥 Maintainers
## 📦 Installation
**go-paymail** requires a [supported release of Go](https://golang.org/doc/devel/release.html#policy).
```shell script
go get -u github.com/bsv-blockchain/go-paymail
```
## 📚 Documentation
- **API Reference** – Dive into the godocs at [pkg.go.dev/github.com/bsv-blockchain/go-paymail](https://pkg.go.dev/github.com/bsv-blockchain/go-paymail)
- **Usage Examples** – Browse practical patterns either the [examples directory](examples) or the example tests
- **Benchmarks** – Check the latest numbers in the [benchmark results](#benchmark-results)
### Features
- [Paymail Client](client.go) (outgoing requests to other providers)
- Use your own custom [Resty HTTP client](https://github.com/go-resty/resty)
- Customize the [client options](client.go)
- Use your own custom [net.Resolver](srv_test.go)
- Full network support: [`mainnet`, `testnet`, `STN`](networks.go)
- [Get & Validate SRV records](srv.go)
- [Check SSL Certificates](ssl.go)
- [Check & Validate DNSSEC](dns_sec.go)
- [Generate, Validate & Load Additional BRFC Specifications](brfc.go)
- [Fetch, Get and Has Capabilities](capabilities.go)
- [Get Public Key Information - PKI](pki.go)
- [Basic Address Resolution](resolve_address.go)
- [Verify PubKey & Handle](verify_pubkey.go)
- [Get Public Profile](public_profile.go)
- [P2P Payment Destination](p2p_payment_destination.go)
- [P2P Send Transaction](p2p_send_transaction.go)
- [Paymail Server](server) (basic example for hosting your own paymail server)
- [Example Showing Capabilities](server/capabilities.go)
- [Example Showing PKI](server/pki.go)
- [Example Verifying a PubKey](server/verify.go)
- [Example Address Resolution](server/resolve_address.go)
- [Example Getting a P2P Payment Destination](server/p2p_payment_destination.go)
- [Example Receiving a P2P Transaction](server/p2p_receive_transaction.go)
- [Paymail Utilities](utilities.go) (handy methods)
- [Sanitize & Validate Paymail Addresses](utilities.go)
- [Sign & Verify Sender Request](sender_request.go)
Development Build Commands
Get the [MAGE-X](https://github.com/mrz1836/mage-x) build tool for development:
```shell script
go install github.com/mrz1836/mage-x/cmd/magex@latest
```
View all build commands
```bash script
magex help
```
Repository Features
This repository includes 25+ built-in features covering CI/CD, security, code quality, developer experience, and community tooling.
**[View the full Repository Features list →](.github/docs/repository-features.md)**
Library Deployment
This project uses [goreleaser](https://github.com/goreleaser/goreleaser) for streamlined binary and library deployment to GitHub. To get started, install it via:
```bash
brew install goreleaser
```
The release process is defined in the [.goreleaser.yml](.goreleaser.yml) configuration file.
Then create and push a new Git tag using:
```bash
magex version:bump push=true bump=patch branch=main
```
This process ensures consistent, repeatable releases with properly versioned artifacts and citation metadata.
Pre-commit Hooks
Set up the Go-Pre-commit System to run the same formatting, linting, and tests defined in [AGENTS.md](.github/AGENTS.md) before every commit:
```bash
go install github.com/mrz1836/go-pre-commit/cmd/go-pre-commit@latest
go-pre-commit install
```
The system is configured via the [environment configuration](.github/env/README.md) and provides 17x faster execution than traditional Python-based pre-commit hooks. See the [complete documentation](http://github.com/mrz1836/go-pre-commit) for details.
GitHub Workflows
All workflows are driven by modular configuration in [`.github/env/`](.github/env/README.md) — no YAML editing required.
**[View all workflows and the control center →](.github/docs/workflows.md)**
Updating Dependencies
To update all dependencies (Go modules, linters, and related tools), run:
```bash
magex deps:update
```
This command ensures all dependencies are brought up to date in a single step, including Go modules and any tools managed by [MAGE-X](https://github.com/mrz1836/mage-x). It is the recommended way to keep your development environment and CI in sync with the latest versions.
## 🧪 Examples & Tests
All unit tests and [examples](examples) run via [GitHub Actions](https://github.com/bsv-blockchain/go-paymail/actions) and use [Go version 1.24.x](https://go.dev/doc/go1.24). View the [configuration file](.github/workflows/fortress.yml).
Run all tests (fast):
```bash script
magex test
```
Run all tests with race detector (slower):
```bash script
magex test:race
```
## ⚡ Benchmarks
Run the Go benchmarks:
```bash script
magex bench
```
### Benchmark Results
| Benchmark | Iterations | ns/op | B/op | allocs/op |
|-------------------------------|------------|-------------|---------|-----------|
| Validate SRV Record | 4,516,506 | 26.49 | 24 | 1 |
| Capabilities Has | 3,920,778 | 30.30 | 0 | 0 |
| Capabilities Get Bool | 3,938,580 | 30.27 | 0 | 0 |
| Capabilities Get String | 3,416,118 | 34.53 | 0 | 0 |
| Convert Handle | 1,938,082 | 61.95 | 24 | 2 |
| Validate Timestamp | 984,312 | 118.1 | 0 | 0 |
| BRFC Spec Generate | 568,420 | 196.9 | 144 | 4 |
| BRFC Spec Validate | 615,147 | 200.6 | 144 | 4 |
| Get SRV Record | 405,182 | 286.4 | 144 | 8 |
| Validate Paymail | 394,790 | 306.2 | 0 | 0 |
| Validate Domain | 375,542 | 307.7 | 113 | 3 |
| Sanitize Paymail | 157,504 | 703.0 | 317 | 9 |
| Validate And Sanitize Paymail | 121,256 | 1,001 | 346 | 10 |
| Get Public Profile | 26,770 | 4,378 | 4,944 | 54 |
| Get PKI | 27,373 | 4,487 | 4,928 | 55 |
| Add Invite Request | 24,337 | 4,772 | 5,091 | 54 |
| Resolve Address | 22,069 | 5,352 | 4,922 | 64 |
| Get Outputs Template | 21,830 | 5,367 | 4,971 | 63 |
| Get Capabilities | 22,478 | 5,414 | 5,421 | 70 |
| Verify Pub Key | 21,445 | 5,646 | 5,281 | 56 |
| Send P2P Transaction | 20,475 | 5,657 | 5,726 | 62 |
| Get P2P Payment Destination | 13,077 | 7,855 | 6,391 | 115 |
| Default Client Options | 3,102 | 39,799 | 13,976 | 152 |
| New Client | 2,960 | 41,008 | 15,840 | 174 |
| Load BRFCs | 2,949 | 41,832 | 14,704 | 169 |
| Sender Request Verify | 518 | 230,894 | 4,388 | 115 |
| Sender Request Sign | 356 | 337,052 | 9,757 | 171 |
| Check DNSSEC | 1 | 266,799,625 | 55,840 | 539 |
| Check SSL | 1 | 388,776,125 | 856,032 | 8,190 |
> These benchmarks reflect fast, allocation-free lookups for most retrieval functions, ensuring optimal performance in production environments.
> Performance benchmarks for the core functions in this library, executed on an Apple M1 Max (ARM64).
## 🛠️ Code Standards
Read more about this Go project's [code standards](.github/CODE_STANDARDS.md).
## 🤖 AI Usage & Assistant Guidelines
Read the [AI Usage & Assistant Guidelines](.github/tech-conventions/ai-compliance.md) for details on how AI is used in this project and how to interact with AI assistants.
## 👥 Maintainers
| [
](https://github.com/icellan) | [
](https://github.com/galt-tr) | [
](https://github.com/mrz1836) |
|:--------------------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------------------:|
| [Siggi](https://github.com/icellan) | [Dylan](https://github.com/galt-tr) | [MrZ](https://github.com/mrz1836) |
## 🤝 Contributing
View the [contributing guidelines](.github/CONTRIBUTING.md) and please 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:.
[](https://github.com/bsv-blockchain/go-paymail/stargazers)
## 📝 License
[](LICENSE)