webycash SDK

Native webcash protocol integration for every major platform. One Rust core, platform bindings on top.

Overview

The webycash SDK provides a complete interface to the webcash protocol: secret webcash strings, wallet insert / pay / merge / recover, proof-of-work mining, local SQLite storage, and server communication.

The core is written in Rust for safety and performance. Language bindings expose the same API surface through idiomatic wrappers for each target platform. No runtime dependencies beyond the native binary (or a published package that bundles it).

Prerequisites

You need the native library (libwebycash_sdk) on your loader path, or use published wheels/npm packages that bundle it. See each binding’s README on GitHub.

Python

ctypes binding; pip install webycash-sdk.

Install
pip install webycash-sdk
Amount helpers (parse / format)
from webycash_sdk import amount_parse, amount_format

wats = amount_parse("1.5")          # 150_000_000
print(amount_format(wats))          # "1.5"
Open or create wallet
from webycash_sdk import Wallet

with Wallet("wallet.db") as w:
    print("Balance:", w.balance())
Balance & stats (wallet info)
import json
from webycash_sdk import Wallet

with Wallet("wallet.db") as w:
    print("Balance:", w.balance())
    stats = json.loads(w.stats())
    print("Unspent outputs:", stats["unspent_webcash"])
    print("Total balance:", stats["total_balance"])
Insert (receive secret webcash)
from webycash_sdk import Wallet

# Full bearer secret string you received
with Wallet("wallet.db") as w:
    w.insert("e1.00000000:secret:…")
Pay (create payment line for recipient)
from webycash_sdk import Wallet

with Wallet("wallet.db") as w:
    payment_line = w.pay("0.5", "memo for recipient")
    print(payment_line)
Check (verify outputs with server)
from webycash_sdk import Wallet

with Wallet("wallet.db") as w:
    w.check()
Merge (consolidate outputs)
from webycash_sdk import Wallet

with Wallet("wallet.db") as w:
    summary = w.merge(20)
    print(summary)
Recover (HD scan from master secret hex)
from webycash_sdk import Wallet

# 64 hex chars =32-byte master secret (from backup / export_snapshot)
with Wallet("wallet.db") as w:
    print(w.recover("aabb…64_hex_chars…", gap_limit=20))
Export snapshot & encrypt seed
from webycash_sdk import Wallet

with Wallet("wallet.db") as w:
    backup_json = w.export_snapshot()
    # store backup_json offline
    w.encrypt_seed("strong-password")

TypeScript / Node.js

koffi binding; build with npm run build in the package.

Install
npm install webycash-sdk
Amount helpers (parse / format)
const sdk = require("webycash-sdk");
const wats = sdk.amountParse("1.5");
console.log(sdk.amountFormat(wats));
Open or create wallet
const { Wallet } = require("webycash-sdk");
const w = new Wallet("wallet.db");
try {
  console.log(w.balance());
} finally {
  w.close();
}
Balance & stats (wallet info)
const { Wallet } = require("webycash-sdk");
const w = new Wallet("wallet.db");
try {
  console.log(w.balance());
  console.log(JSON.parse(w.stats()));
} finally {
  w.close();
}
Insert (receive secret webcash)
const { Wallet } = require("webycash-sdk");
const w = new Wallet("wallet.db");
try {
  w.insert("e1.00000000:secret:…");
} finally {
  w.close();
}
Pay (create payment line for recipient)
const { Wallet } = require("webycash-sdk");
const w = new Wallet("wallet.db");
try {
  console.log(w.pay("0.5", "memo"));
} finally {
  w.close();
}
Check (verify outputs with server)
const { Wallet } = require("webycash-sdk");
const w = new Wallet("wallet.db");
try {
  w.check();
} finally {
  w.close();
}
Merge (consolidate outputs)
const { Wallet } = require("webycash-sdk");
const w = new Wallet("wallet.db");
try {
  console.log(w.merge(20));
} finally {
  w.close();
}
Recover (HD scan from master secret hex)
const { Wallet } = require("webycash-sdk");
const w = new Wallet("wallet.db");
try {
  console.log(w.recover("aabb…64_hex…", 20));
} finally {
  w.close();
}
Export snapshot & encrypt seed
const { Wallet } = require("webycash-sdk");
const w = new Wallet("wallet.db");
try {
  console.log(w.exportSnapshot());
  w.encryptSeed("strong-password");
} finally {
  w.close();
}

Rust (webylib)

Use webylib directly for the full async API (recommended on Rust). FFI crate is webycash-sdk.

Install
cargo add webylib
# Tokio async runtime required — add tokio with "macros", "rt-multi-thread"
Amount helpers (parse / format)
use webylib::Amount;
use std::str::FromStr;

let a = Amount::from_str("1.5")?;
assert_eq!(a.wats, 150_000_000);
Open or create wallet
use webylib::Wallet;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let w = Wallet::open("wallet.db").await?;
    println!("{}", w.balance().await?);
    Ok(())
}
Balance & stats (wallet info)
use webylib::Wallet;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let w = Wallet::open("wallet.db").await?;
    println!("{}", w.balance().await?);
    let s = w.stats().await?;
    println!("unspent: {}", s.unspent_webcash);
    Ok(())
}
Insert (receive secret webcash)
use webylib::{SecretWebcash, Wallet};
use std::str::FromStr;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let w = Wallet::open("wallet.db").await?;
    let wc = SecretWebcash::parse("e1.00000000:secret:…")?;
    w.insert(wc).await?;
    Ok(())
}
Pay (create payment line for recipient)
use webylib::{Amount, Wallet};
use std::str::FromStr;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let w = Wallet::open("wallet.db").await?;
    let msg = w.pay(Amount::from_str("0.5")?, "memo").await?;
    println!("{}", msg);
    Ok(())
}
Check (verify outputs with server)
use webylib::Wallet;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let w = Wallet::open("wallet.db").await?;
    let r = w.check().await?;
    println!("valid: {}, spent: {}", r.valid_count, r.spent_count);
    Ok(())
}
Merge (consolidate outputs)
use webylib::Wallet;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let w = Wallet::open("wallet.db").await?;
    println!("{}", w.merge(20).await?);
    Ok(())
}
Recover (HD scan from master secret hex)
use webylib::Wallet;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let w = Wallet::open("wallet.db").await?;
    println!("{}", w.recover("aabb…64_hex…", 20).await?);
    Ok(())
}
Export snapshot & encrypt seed
use webylib::Wallet;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let w = Wallet::open("wallet.db").await?;
    let snap = w.export_snapshot()?;
    println!("backup {} chars", snap.master_secret.len());
    w.encrypt_database_with_password("strong-password").await?;
    Ok(())
}

Swift

SwiftPM target WebycashSDK; link native library.

Install
# Package.swift
.package(url: "https://github.com/webycash/webycash-sdk", from: "0.2.0")
Open or create wallet
import WebycashSDK
var w = try Wallet(path: "wallet.db")
defer { w.close() }
print(try w.balance())
Balance & stats (wallet info)
import WebycashSDK
var w = try Wallet(path: "wallet.db")
defer { w.close() }
print(try w.balance())
print(try w.stats())
Insert (receive secret webcash)
import WebycashSDK
var w = try Wallet(path: "wallet.db")
defer { w.close() }
try w.insert("e1.00000000:secret:…")
Pay (create payment line for recipient)
import WebycashSDK
var w = try Wallet(path: "wallet.db")
defer { w.close() }
print(try w.pay(amount: "0.5", memo: "memo"))
Check (verify outputs with server)
import WebycashSDK
var w = try Wallet(path: "wallet.db")
defer { w.close() }
try w.check()
Merge (consolidate outputs)
import WebycashSDK
var w = try Wallet(path: "wallet.db")
defer { w.close() }
print(try w.merge(maxOutputs: 20))
Recover (HD scan from master secret hex)
import WebycashSDK
var w = try Wallet(path: "wallet.db")
defer { w.close() }
print(try w.recover(masterSecretHex: "aabb…64_hex…", gapLimit: 20))
Export snapshot & encrypt seed
import WebycashSDK
var w = try Wallet(path: "wallet.db")
defer { w.close() }
print(try w.exportSnapshot())
try w.encryptSeed(password: "strong-password")

Kotlin / JVM

JNA; Gradle dependency cash.weby:webycash-sdk.

Install
implementation("cash.weby:webycash-sdk:0.2.8")
Open or create wallet
import cash.weby.sdk.Wallet

fun main() {
    Wallet.open("wallet.db").use { w ->
        println(w.balance())
    }
}
Balance & stats (wallet info)
import cash.weby.sdk.Wallet

fun main() {
    Wallet.open("wallet.db").use { w ->
        println(w.balance())
        println(w.stats())
    }
}
Insert (receive secret webcash)
import cash.weby.sdk.Wallet

fun main() {
    Wallet.open("wallet.db").use { w ->
        w.insert("e1.00000000:secret:…")
    }
}
Pay (create payment line for recipient)
import cash.weby.sdk.Wallet

fun main() {
    Wallet.open("wallet.db").use { w ->
        println(w.pay("0.5", "memo"))
    }
}
Check (verify outputs with server)
import cash.weby.sdk.Wallet

fun main() {
    Wallet.open("wallet.db").use { w ->
        w.check()
    }
}
Merge (consolidate outputs)
import cash.weby.sdk.Wallet

fun main() {
    Wallet.open("wallet.db").use { w ->
        println(w.merge(20))
    }
}
Recover (HD scan from master secret hex)
import cash.weby.sdk.Wallet

fun main() {
    Wallet.open("wallet.db").use { w ->
        println(w.recover("aabb…64_hex…", 20))
    }
}
Export snapshot & encrypt seed
import cash.weby.sdk.Wallet

fun main() {
    Wallet.open("wallet.db").use { w ->
        println(w.exportSnapshot())
        w.encryptSeed("strong-password")
    }
}

Java

Same JAR as Kotlin; JNA loads webycash_sdk.

Install
<!-- Maven -->
<dependency>
  <groupId>cash.weby</groupId>
  <artifactId>webycash-sdk</artifactId>
  <version>0.2.8</version>
</dependency>
Open or create wallet
import cash.weby.sdk.WebycashSDK;

try (WebycashSDK.Wallet w = new WebycashSDK.Wallet("wallet.db")) {
    System.out.println(w.balance());
}
Balance & stats (wallet info)
import cash.weby.sdk.WebycashSDK;

try (WebycashSDK.Wallet w = new WebycashSDK.Wallet("wallet.db")) {
    System.out.println(w.balance());
    System.out.println(w.stats());
}
Insert (receive secret webcash)
import cash.weby.sdk.WebycashSDK;

try (WebycashSDK.Wallet w = new WebycashSDK.Wallet("wallet.db")) {
    w.insert("e1.00000000:secret:…");
}
Pay (create payment line for recipient)
import cash.weby.sdk.WebycashSDK;

try (WebycashSDK.Wallet w = new WebycashSDK.Wallet("wallet.db")) {
    System.out.println(w.pay("0.5", "memo"));
}
Check (verify outputs with server)
import cash.weby.sdk.WebycashSDK;

try (WebycashSDK.Wallet w = new WebycashSDK.Wallet("wallet.db")) {
    w.check();
}
Merge (consolidate outputs)
import cash.weby.sdk.WebycashSDK;

try (WebycashSDK.Wallet w = new WebycashSDK.Wallet("wallet.db")) {
    System.out.println(w.merge(20));
}
Recover (HD scan from master secret hex)
import cash.weby.sdk.WebycashSDK;

try (WebycashSDK.Wallet w = new WebycashSDK.Wallet("wallet.db")) {
    System.out.println(w.recover("aabb…64_hex…", 20));
}
Export snapshot & encrypt seed
import cash.weby.sdk.WebycashSDK;

try (WebycashSDK.Wallet w = new WebycashSDK.Wallet("wallet.db")) {
    System.out.println(w.exportSnapshot());
    w.encryptSeed("strong-password");
}

Go

cgo; set CGO_LDFLAGS to find libwebycash_sdk.

Install
go get github.com/webycash/webycash-sdk/go
Open or create wallet
package main

import (
    "fmt"
    webcash "github.com/webycash/webycash-sdk/go"
)

func main() {
    w, err := webcash.Open("wallet.db")
    if err != nil { panic(err) }
    defer w.Close()
    b, _ := w.Balance()
    fmt.Println(b)
}
Balance & stats (wallet info)
package main

import (
    "fmt"
    webcash "github.com/webycash/webycash-sdk/go"
)

func main() {
    w, err := webcash.Open("wallet.db")
    if err != nil { panic(err) }
    defer w.Close()
    b, _ := w.Balance()
    fmt.Println(b)
    s, _ := w.Stats()
    fmt.Println(s)
}
Insert (receive secret webcash)
package main

import (
    webcash "github.com/webycash/webycash-sdk/go"
)

func main() {
    w, err := webcash.Open("wallet.db")
    if err != nil { panic(err) }
    defer w.Close()
    _ = w.Insert("e1.00000000:secret:…")
}
Pay (create payment line for recipient)
package main

import (
    "fmt"
    webcash "github.com/webycash/webycash-sdk/go"
)

func main() {
    w, err := webcash.Open("wallet.db")
    if err != nil { panic(err) }
    defer w.Close()
    out, _ := w.Pay("0.5", "memo")
    fmt.Println(out)
}
Check (verify outputs with server)
package main

import (
    webcash "github.com/webycash/webycash-sdk/go"
)

func main() {
    w, err := webcash.Open("wallet.db")
    if err != nil { panic(err) }
    defer w.Close()
    _ = w.Check()
}
Merge (consolidate outputs)
package main

import (
    "fmt"
    webcash "github.com/webycash/webycash-sdk/go"
)

func main() {
    w, err := webcash.Open("wallet.db")
    if err != nil { panic(err) }
    defer w.Close()
    out, _ := w.Merge(20)
    fmt.Println(out)
}
Recover (HD scan from master secret hex)
package main

import (
    "fmt"
    webcash "github.com/webycash/webycash-sdk/go"
)

func main() {
    w, err := webcash.Open("wallet.db")
    if err != nil { panic(err) }
    defer w.Close()
    out, _ := w.Recover("aabb…64_hex…", 20)
    fmt.Println(out)
}
Export snapshot & encrypt seed
package main

import (
    "fmt"
    webcash "github.com/webycash/webycash-sdk/go"
)

func main() {
    w, err := webcash.Open("wallet.db")
    if err != nil { panic(err) }
    defer w.Close()
    snap, _ := w.ExportSnapshot()
    fmt.Println(len(snap))
    _ = w.EncryptSeed("strong-password")
}

C# / .NET

NuGet Webycash.SDK; native DLL on PATH / beside app.

Install
dotnet add package Webycash.SDK
Open or create wallet
using WebycashSDK;

using var w = new Wallet("wallet.db");
Console.WriteLine(w.Balance());
Balance & stats (wallet info)
Console.WriteLine(w.Balance());
Console.WriteLine(w.Stats());
Insert (receive secret webcash)
w.Insert("e1.00000000:secret:…");
Pay (create payment line for recipient)
Console.WriteLine(w.Pay("0.5", "memo"));
Check (verify outputs with server)
w.Check();
Merge (consolidate outputs)
Console.WriteLine(w.Merge(20));
Recover (HD scan from master secret hex)
Console.WriteLine(w.Recover("aabb…64_hex…", 20));
Export snapshot & encrypt seed
Console.WriteLine(w.ExportSnapshot());
w.EncryptSeed("strong-password");

C++

Header webycash_sdk.hpp; link webycash_sdk.

Install
# Link libwebycash_sdk + include webycash.h / webycash_sdk.hpp
# See webycash-sdk/examples/cpp
Open or create wallet
#include <webycash_sdk.hpp>
webcash::Wallet w("wallet.db");
std::cout << w.balance() << "\n";
Balance & stats (wallet info)
std::cout << w.balance() << "\n";
std::cout << w.stats() << "\n";
Insert (receive secret webcash)
w.insert("e1.00000000:secret:…");
Pay (create payment line for recipient)
std::cout << w.pay("0.5", "memo") << "\n";
Check (verify outputs with server)
w.check_wallet();
Merge (consolidate outputs)
std::cout << w.merge(20) << "\n";
Recover (HD scan from master secret hex)
std::cout << w.recover("aabb…64_hex…", 20) << "\n";
Export snapshot & encrypt seed
std::cout << w.export_snapshot().size() << "\n";
w.encrypt_seed("strong-password");

Core capabilities

Secret webcash

Work with bearer secret strings (e…:secret:…), amount parsing / formatting, and HD derivation inside the wallet.

Replace

Split and merge outputs through the protocol replace endpoint (used internally for pay, merge, and insert).

Mining

SHA256 proof-of-work with configurable difficulty. CPU and GPU backends. Submit mining reports to the server.

Wallet management

Local wallet storage, balance tracking, and transaction history. Secrets never leave the client.