Welcome to the BSV Blockchain Libraries Project, the comprehensive Go SDK designed to provide an updated and unified layer for developing scalable applications on the BSV Blockchain. This SDK addresses the limitations of previous tools by offering a fresh, peer-to-peer approach, adhering to SPV, and ensuring privacy and scalability.
The BSV Blockchain Libraries Project aims to structure and maintain a middleware layer of the BSV Blockchain technology stack. By facilitating the development and maintenance of core libraries, it serves as an essential toolkit for developers looking to build on the BSV Blockchain.
To install the SDK, run:
go install github.com/bitcoin-sv/go-sdk
Here's a simple example of using the SDK to create and sign a transaction:
package main
import (
"context"
"log"
wif "github.com/bitcoin-sv/go-sdk/compat/wif"
"github.com/bitcoin-sv/go-sdk/transaction"
"github.com/bitcoin-sv/go-sdk/transaction/unlocker"
)
func main() {
tx := transaction.NewTransaction()
unlockingScriptTemplate, _ := p2pkh.Unlock(priv, nil)
if err := tx.AddInputFrom(
"11b476ad8e0a48fcd40807a111a050af51114877e09283bfa7f3505081a1819d",
0,
"76a9144bca0c466925b875875a8e1355698bdcc0b2d45d88ac",
1500,
unlockingScriptTemplate,
); err!= nil {
log.Fatal(err.Error())
}
_ = tx.PayToAddress("1AdZmoAQUw4XCsCihukoHMvNWXcsd8jDN6", 1000)
priv, _ := ec.PrivateKeyFromWif("KznvCNc6Yf4iztSThoMH6oHWzH9EgjfodKxmeuUGPq5DEX5maspS")
if err := tx.Sign(); err != nil {
log.Fatal(err.Error())
}
log.Printf("tx: %s\n", tx)
}
See the Go Doc for a complete list of available modules and functions.
Check out the examples folder for more advanced examples.
- Performance Oriented: Designed to deliver performant functionality for large scale / high demand systems.
- Cryptographic Primitives: Secure key management, signature computations, and encryption protocols.
- Script Level Constructs: Network-compliant script interpreter with support for custom scripts and serialization formats.
- Transaction Construction and Signing: Comprehensive transaction builder API, ensuring versatile and secure transaction creation.
- Transaction Broadcast Management: Mechanisms to send transactions to both miners and overlays, ensuring extensibility and future-proofing.
- Merkle Proof Verification: Tools for representing and verifying merkle proofs, adhering to various serialization standards.
- Serializable SPV Structures: Structures and interfaces for full SPV verification.
- Secure Encryption and Signed Messages: Enhanced mechanisms for encryption and digital signatures, replacing outdated methods.
- Shamir Key Splitting & Recombining: Allows private keys to be split into N shares, and recombined by providing M of N shares.
- Compatability Packages: Supports additional / deprecated features like ECIES, Bitcoin Signed Message, and BIP32 style key derivation.
The SDK is richly documented with code-level annotations. This should show up well within editors like VSCode. For complete API docs, check out the Go Doc. Please refer to the Libraries Wiki (link to be provided) for a deep dive into each feature, tutorials, and usage examples.
We're always looking for contributors to help us improve the SDK. Whether it's bug reports, feature requests, or pull requests - all contributions are welcome.
- Fork & Clone: Fork this repository and clone it to your local machine.
- Set Up: Run
go get github.com/bitcoin-sv/go-sdk
to get all the modules. - Make Changes: Create a new branch and make your changes.
- Test: Ensure all tests pass by running
go test ./...
. - Commit: Commit your changes and push to your fork.
- Pull Request: Open a pull request from your fork to this repository.
For more details, check the contribution guidelines.
For information on past releases, check out the changelog. For future plans, check the roadmap!
Project Owners: Thomas Giacomo and Darren Kellenschwiler
Development Team Lead: Luke Rohenaz
For questions, bug reports, or feature requests, please open an issue on GitHub or contact us directly.
The license for the code in this repository is the Open BSV License. Refer to LICENSE.txt for the license text.
Thank you for being a part of the BSV Blockchain Libraries Project. Let's build the future of BSV Blockchain together!