synor/sdk/go
Gulshan Yadav e65ea40af2 feat: implement Privacy and Contract SDKs for all 12 languages (Phase 5)
Privacy SDK features:
- Confidential transactions with Pedersen commitments
- Bulletproof range proofs for value validation
- Ring signatures for anonymous signing with key images
- Stealth addresses for unlinkable payments
- Blinding factor generation and value operations

Contract SDK features:
- Smart contract deployment (standard and CREATE2)
- Call (view/pure) and Send (state-changing) operations
- Event log filtering, subscription, and decoding
- ABI encoding/decoding utilities
- Gas estimation and contract verification
- Multicall for batched operations
- Storage slot reading

Languages implemented:
- JavaScript/TypeScript
- Python (async with httpx)
- Go
- Rust (async with reqwest/tokio)
- Java (async with OkHttp)
- Kotlin (coroutines with Ktor)
- Swift (async/await with URLSession)
- Flutter/Dart
- C (header-only interface)
- C++ (header-only with std::future)
- C#/.NET (async with HttpClient)
- Ruby (Faraday HTTP client)

All SDKs follow consistent patterns:
- Configuration with API key, endpoint, timeout, retries
- Custom exception types with error codes
- Retry logic with exponential backoff
- Health check endpoints
- Closed state management
2026-01-28 09:03:34 +05:30
..
bridge Add Synor Storage and Wallet SDKs for Swift 2026-01-27 01:56:45 +05:30
contract feat: implement Privacy and Contract SDKs for all 12 languages (Phase 5) 2026-01-28 09:03:34 +05:30
database Add Synor Storage and Wallet SDKs for Swift 2026-01-27 01:56:45 +05:30
economics feat: add Economics, Governance, and Mining SDKs for core languages 2026-01-27 02:39:27 +05:30
governance feat: add Economics, Governance, and Mining SDKs for core languages 2026-01-27 02:39:27 +05:30
hosting Add Synor Storage and Wallet SDKs for Swift 2026-01-27 01:56:45 +05:30
mining feat: add Economics, Governance, and Mining SDKs for core languages 2026-01-27 02:39:27 +05:30
privacy feat: implement Privacy and Contract SDKs for all 12 languages (Phase 5) 2026-01-28 09:03:34 +05:30
rpc feat(sdk): implement Phase 1 SDKs for Wallet, RPC, and Storage 2026-01-27 00:46:24 +05:30
storage feat(sdk): implement Phase 1 SDKs for Wallet, RPC, and Storage 2026-01-27 00:46:24 +05:30
wallet feat(sdk): implement Phase 1 SDKs for Wallet, RPC, and Storage 2026-01-27 00:46:24 +05:30
go.mod feat(sdk): implement Phase 1 SDKs for Wallet, RPC, and Storage 2026-01-27 00:46:24 +05:30
README.md docs(sdk): add comprehensive documentation for all 12 SDKs 2026-01-11 18:05:03 +05:30
synor.go feat(sdk): add consumer SDKs for JavaScript, Python, and Go 2026-01-11 14:11:58 +05:30
synor_test.go test(sdk): add comprehensive unit tests for all SDKs 2026-01-11 17:56:11 +05:30

Synor Compute SDK for Go

Access distributed heterogeneous compute at 90% cost reduction.

Installation

go get github.com/synor/compute-sdk-go

Quick Start

package main

import (
    "context"
    "fmt"
    "log"

    synor "github.com/synor/compute-sdk-go"
)

func main() {
    client := synor.NewClient("your-api-key")

    // Create tensors
    a := synor.NewTensor(data, []int{512, 512}, synor.FP32)
    b := synor.Zeros([]int{512, 512}, synor.FP32)

    // Matrix multiplication
    ctx := context.Background()
    result, err := client.MatMul(ctx, a, b,
        synor.WithPrecision(synor.FP16),
        synor.WithProcessor(synor.GPU),
    )
    if err != nil {
        log.Fatal(err)
    }

    fmt.Printf("Execution time: %.2fms\n", result.Metrics.ExecutionTimeMs)
}

Configuration

config := synor.Config{
    APIKey:    "your-api-key",
    Endpoint:  "https://api.synor.io/compute/v1",
    Strategy:  synor.Balanced,
    Precision: synor.FP16,
    Timeout:   30 * time.Second,
}

client := synor.NewClientWithConfig(config)

Tensor Operations

// Create tensors
zeros := synor.Zeros([]int{3, 3}, synor.FP32)
ones := synor.Ones([]int{2, 2}, synor.FP32)

// From slice
data := []float32{1, 2, 3, 4, 5, 6}
tensor := synor.NewTensor(data, []int{2, 3}, synor.FP32)

// Serialize for API
serialized := tensor.Serialize()

Matrix Operations

// Matrix multiplication
result, err := client.MatMul(ctx, a, b,
    synor.WithPrecision(synor.FP16),
    synor.WithProcessor(synor.GPU),
    synor.WithStrategy(synor.Speed),
)

// 2D Convolution
conv, err := client.Conv2D(ctx, input, kernel,
    synor.WithStride(1, 1),
    synor.WithPadding(1, 1),
)

// Attention
attention, err := client.Attention(ctx, query, key, value,
    synor.WithNumHeads(8),
    synor.WithFlash(true),
)

LLM Inference

// Single response
response, err := client.Inference(ctx, "llama-3-70b", "Explain quantum computing",
    synor.WithMaxTokens(512),
    synor.WithTemperature(0.7),
)
fmt.Println(response.Result)

// Streaming (using channel)
stream, err := client.InferenceStream(ctx, "llama-3-70b", "Write a poem")
for chunk := range stream {
    fmt.Print(chunk)
}

Job Management

// Submit async job
job, err := client.SubmitJob(ctx, "matmul", map[string]interface{}{
    "a": a.Serialize(),
    "b": b.Serialize(),
})

// Get status
status, err := client.GetJobStatus(ctx, job.ID)

// Cancel
err = client.CancelJob(ctx, job.ID)

Error Handling

result, err := client.MatMul(ctx, a, b)
if err != nil {
    if synorErr, ok := err.(*synor.SynorError); ok {
        fmt.Printf("API Error: %s (status: %d)\n",
            synorErr.Message, synorErr.StatusCode)
    }
}

Processor Types

synor.CPU     // General-purpose CPU
synor.GPU     // NVIDIA/AMD GPU
synor.TPU     // Google TPU
synor.NPU     // Neural Processing Unit
synor.LPU     // Language Processing Unit
synor.FPGA    // Field-Programmable Gate Array
synor.WASM    // WebAssembly runtime
synor.WebGPU  // Browser GPU

Precision Levels

synor.FP64  // 64-bit float
synor.FP32  // 32-bit float (default)
synor.FP16  // 16-bit float
synor.BF16  // Brain float 16
synor.INT8  // 8-bit integer
synor.INT4  // 4-bit integer

Testing

go test ./...

License

MIT