Golang JSON RPC client to talk with Electrum server

Electrum JSON RPC Client

Build Status Go Report Card GoDoc License MIT

Note: The library does not have implementations of all Electrum RPC resources[WIP]. PRs for new resources and endpoints are welcome, or you can simply implement some yourself as-you-go.

Preposition

1. Install Electrum and create a wallet

2. Set RPC port

By default, it's random port - set it to any port you want

./run_electrum setconfig rpcport 7777

3. Set user and password for RPC

./run_electrum setconfig rpcuser user
./run_electrum setconfig rpcpassword password

4. Run Electrum as daemon

./run_electrum daemon start

If you want to start in testnet mode

./run_electrum --testnet daemon start

5. Load daemon wallet

./run_electrum daemon load_wallet

If daemon is running in testnet, you need to specify to load testnet wallet

./run_electrum --testnet daemon load_wallet

Now you have a local Electrum JSON RPC server running - congrats 🥳

If you need to stop it, use

./run_electrum daemon stop

or if running in testnet

./run_electrum --testnet daemon stop

Install

go get github.com/MarinX/electrumrpc

Use

import "github.com/MarinX/electrumrpc"

Example

You can find more in electrumrpc_test.go

// httpClient is optional
// if nil, the http.DefaultClient will be used
client := electrumrpc.New("<rpc-user>", "<rpc-password>", "<rpc-endpoint>", nil)

// Call RPC methods
ver, err := client.Version()
if err != nil {
	//handle error
	panic(err)
}
fmt.Println("Electrum version:", ver)

Not all endpoints are implemented right now. In those case, you can use Call method and point your model

var rpcResponse string
err := client.Call("version", nil, &rpcResponse)
if err != nil {
	fmt.Println(err)
	return
}
fmt.Println("Electrum version:", rpcResponse)

Available RPC methods

RPC Method Available
version ✅
getaddressbalance ✅
getbalance ✅
validateaddress ✅
getservers ✅
createnewaddress ✅
getunusedaddress ✅
ismine ✅
gettransaction ✅
getseed ✅
listaddresses ✅
addrequest ✅
rmrequest ✅
clearrequests ✅
getrequest ✅
getfeerate ✅
signmessage ✅
verifymessage ✅

Contributing

PR's are welcome. Please read CONTRIBUTING.md for more info

License

MIT

Owner
Marin Basic
#gopher #remoteok
Marin Basic
Similar Resources

Concurrent ssh client

go-cs Concurrent ssh client cs is a program for concurrently executing local or remote commands on multiple hosts. It is using OpenSSH for running rem

Feb 21, 2022

Huobi Eco Chain client based on the go-ethereum fork

The Huobi Open Platform is a unified infrastructure platform based on the technical, traffic and ecological resources of the Huobi Group, and will be gradually open to the blockchain industry.

Dec 31, 2022

Yet another Binance Smart Chain client based on TrustFi Network

TrustFi Smart Chain The goal of TrustFi Smart Chain is to bring programmability and interoperability to Binance Chain. In order to embrace the existin

Mar 27, 2021

A phoenix Chain client based on the go-ethereum fork,the new PoA consensus engine is based on the VRF algorithm.

Phoenix Official Golang implementation of the Phoenix protocol. !!!The current version is for testing and developing purposes only!!! Building the sou

Apr 28, 2022

A Go client and CLI for Filecoin Storage Auctions.

go-auctions-client A Go library and CLI to interact with Filecoin Storage Auctions. Join us on our public Slack channel for news, discussions, and sta

Nov 24, 2022

Akroma GO client - Akroma is an EVM based application development platform (smart-contracts).

Akroma Akroma is an EVM based application development platform (smart-contracts). Akroma will utilize a Masternode system, and build out an Oracle pla

Dec 11, 2022

Yet another filecoin secondary retrieval client

Yet another filecoin secondary retrieval client

fcr Yet another filecoin secondary retrieval client FCR is a filecoin secondary retrieval client featured with the ability to participate in an ipld r

Nov 9, 2022

LEO (Low Ethereum Orbit) is an Ethereum Portal Network client.

LEO LEO (Low Ethereum Orbit) is an Ethereum Portal Network client. What makes LEO different from other Portal Network clients is that it uses libp2p f

Apr 19, 2022

A Commander for Go implementation of official Ethereum Client

Young A Commander for Go implementation of official Ethereum Client by zhong-my. Overview Young Dependencies Young stands on the shoulder of many grea

Oct 14, 2021
Comments
  • Decode electrum error response

    Decode electrum error response

    Electrum response the error a json object with code and message fields: https://github.com/spesmilo/electrum/blob/62e1d8ed78635ca6566078583c11933581c0212b/electrum/daemon.py#L232-L235

    If there is an error response from electrum (with MarinX/rpc#1), the decoded custom error object is returned. Can be used any error function same as standard golang error object.

LightRPC Encrypted reliable components RPC

light LightRPC Multi-protocol encryption RPC Multi-protocol TCP KCP UNIX HTTP MQTT QUIC Encoding JSON MessagePack Protobuf Compress RawData Snappy GZI

Dec 7, 2022
The Fabric Smart Client is a new Fabric Client that lets you focus on the business processes and simplifies the development of Fabric-based distributed application.

Fabric Smart Client The Fabric Smart Client (FSC, for short) is a new Fabric client-side component whose objective is twofold. FSC aims to simplify th

Dec 14, 2022
sops is an editor of encrypted files that supports YAML, JSON, ENV, INI and BINARY formats and encrypts with AWS KMS, GCP KMS, Azure Key Vault, age, and PGP
sops is an editor of encrypted files that supports YAML, JSON, ENV, INI and BINARY formats and encrypts with AWS KMS, GCP KMS, Azure Key Vault, age, and PGP

sops is an editor of encrypted files that supports YAML, JSON, ENV, INI and BINARY formats and encrypts with AWS KMS, GCP KMS, Azure Key Vault, age, and PGP. (demo)

Jan 9, 2023
Bitcoin futures curve from Deribit as a JSON webservice

Curve Bitcoin futures curve from Deribit as a JSON webservice Building go build . Running ./curve Expiration date and annualised yield of each contr

Dec 13, 2021
Ethereum-vanity-wallet - A fork of https://github.com/meehow/ethereum-vanity-wallet but the key can be exported to a JSON keystore file

ethereum-vanity-wallet See https://github.com/meehow/ethereum-vanity-wallet This version: doesn't display the private key let's you interactively expo

Jan 2, 2022
Fallback to build simdjson-go tape using only encoding/json

fakesimdjson builds a simdjson-go tape using the stdlib's JSON parser. It is slow and does a lot of allocations. This is a workaround to run programs

Mar 11, 2022
Miller is like awk, sed, cut, join, and sort for name-indexed data such as CSV, TSV, and tabular JSON
Miller is like awk, sed, cut, join, and sort for name-indexed data such as CSV, TSV, and tabular JSON

What is Miller? Miller is like awk, sed, cut, join, and sort for data formats such as CSV, TSV, JSON, JSON Lines, and positionally-indexed. What can M

Jan 5, 2023
Small utility to sign a small json containing basic kyc information. The key generated by it is fully compatible with cosmos based chains.

Testnet signer utility This utility generates a signed JSON-formatted ID to prove ownership of a key used to submit tx on the blockchain. This testnet

Sep 10, 2022
A more elegant Client for huobi API with golang

huobi A more elegant Client for huobi API example package main import ( "context" "log" "os" "github.com/zhenzou/huobi" "github.com/zhenzou/huo

Dec 28, 2021
Terra client in golang with multiple protocol implementation (anchor, astroport, prism, ...)

Terra A terra client with some protocol partial implementations (anchor, prism, terraswap type routers, ...) To be able to compile, you need to add th

Apr 11, 2022