SDK
Go SDK
Full Buff SDK for Go — stdlib-only core, no CGO.
Install
$
go get github.com/buff-protocol/sdk-goCopyQuick Start
main.go
typescript
1package main23import (4 "fmt"5 buff "github.com/buff-protocol/sdk-go"6)78func main() {9 // Calculate round-up10 r := buff.CalculateRoundUp(27.63, 0.50, 1.0)11 fmt.Printf("Round-up: $%.2f\n", r.RoundUpUsd) // $0.371213 // Full breakdown14 b := buff.CalculateFees(27.63, 150.0, 0.50)15 fmt.Printf("Investing: $%.4f\n", b.UserInvestmentUsd)16 fmt.Printf("Buff fee: $%.4f\n", b.BuffFeeUsd)1718 // Derive wallet19 sig := make([]byte, 64) // from wallet signMessage20 _, pubkey, _ := buff.DeriveWallet(sig)21 fmt.Printf("Buff wallet: %x\n", pubkey)22}Functions
| Function | Purpose |
|---|---|
| CalculateRoundUp() | Fixed-point round-up calculation |
| CalculateFees() | Full fee breakdown with SOL conversion |
| DeriveWallet() | SHA-256 + ed25519 keypair from signature |
| GetBuffFeePercent() | Get fee tier for a round-up increment |
Note
The Go SDK uses only the standard library (crypto/sha256, crypto/ed25519) for core functionality. No external dependencies for fee calculation and wallet derivation.