Help us shape the future of Go! Take the 2026 Go Developer Survey

btcgateway

package
v1.3.104 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package btcgateway pkg/btcgateway/gateway.go c4-app-wallet translating them to an Electrum backend, so a Skywire visor can provide the in-browser BTC wallet its chain data (balance / utxos / history / fee / broadcast). The wallet keeps keys, address derivation and signing entirely client-side (skycoin-lite WASM) — only these chain queries cross the mesh.

The Electrum connection is dialed via an optional DialFunc, so the visor can reach an ssl:// Electrum server through skysocks/dmsg over the mesh (nil dial = clearnet, for a native visor that already has egress). This is what lets BTC "just work" in the browser wallet without per-port dmsg forwarding — a raw ssl://host:port electrum URL is enough.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DialFunc

type DialFunc = electrum.DialFunc

DialFunc routes the Electrum TCP connection over a custom transport (e.g. skysocks-client-lite for clearnet, or a dmsg stream). nil = stdlib clearnet.

type Gateway

type Gateway struct {
	// contains filtered or unexported fields
}

Gateway is an /v1/btc/* HTTP handler backed by Electrum. Backends are cached per Electrum server URL because Electrum connections are long-lived.

func New

func New(dial DialFunc) *Gateway

New returns a Gateway that dials Electrum via dial (nil = clearnet).

func (*Gateway) Close

func (g *Gateway) Close()

Close shuts down all cached Electrum backends.

func (*Gateway) ServeHTTP

func (g *Gateway) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP dispatches /v1/btc/{balance,utxos,history,fee,send}. The Electrum server URL comes from the X-Skywire-Btc-Backend header (the wallet shim sets it from localStorage['skywire-btc-backend']); addresses come from ?addrs=.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL