Giter VIP home page Giter VIP logo

go-wasabi-rpc-client's Introduction

Photo of Alexey Navalny

“The only thing necessary for the triumph of evil is for good men to do nothing.”

Alexey Navalny, Russian opposition politician, founder of the Anti-Corruption Foundation, consistent opponent of Vladimir Putin and his regime.

Go Wasabi RPC Client

GoDoc License

Wasabi Gopher

Implementation of a client for interacting with WasabiWallet via RPC in the Go programming language.

You can use this client to interact with WasabiWallet via RPC. The current version of the client supports all methods used in WasabiWallet in the main repository branch. This means that some methods are not yet available in the current wallet release and are partially absent from the RPC documentation on the WasabiWallet website.

The client can be used with WasabiWallet, both when running in GUI mode and as a headless daemon.

Links to WasabiWallet resources:

¹ - WasabiWallet documentation on GitHub contains documentation for all RPC methods, including those not yet available in the wallet release. Such methods are described in the pull requests section. You can find documentation for these methods by searching the repository. ² - RPC documentation on the WasabiWallet website contains documentation only for methods available in the current wallet release.

Installing WasabiWallet.

Option 1: Installing the wallet from the current release:

Option 2: Building the wallet from source and running as a headless daemon in a Docker container under debian:bookworm-20240211:

# Dockerfile for wasabi-wallet

FROM debian:bookworm-20240211 AS wallet

ENV COMMIT_HASH 848df269f1021bacc5d7d85e683ef4384a87cde6

RUN apt-get update && apt-get install -y \
    wget \
    software-properties-common \
    netcat-openbsd \
    curl \
    gnupg2 \
    git \
    libevent-2.1-7 && \
    wget https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -O packages-microsoft-prod.deb && \
    dpkg -i packages-microsoft-prod.deb && \
    rm packages-microsoft-prod.deb && \
    apt-get update && apt-get install -y \
    apt-transport-https \
    dotnet-sdk-8.0 && \
    apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/apt/*

RUN mkdir -p /wasabi/data

ENV DOTNET_CLI_TELEMETRY_OPTOUT=1

RUN git clone --single-branch --branch=master https://github.com/zkSNACKs/WalletWasabi.git \
    && cd WalletWasabi \
    && git checkout $COMMIT_HASH 

RUN cd /WalletWasabi/WalletWasabi.Fluent.Desktop && dotnet build && rm -rf ~/.nuget ~/.local

WORKDIR /WalletWasabi/WalletWasabi.Daemon

CMD ["dotnet", "run", "--jsonrpcserverenabled=true", "--enablegpu=false", "--datadir=\"/wasabi/data\"", "--network=testnet"]

Detailed information about wallet startup parameters is available here.

Building the image and running the container with the wallet:

docker build --target wallet -t wasabi_wallet .

docker run -d -p 37128:37128/tcp --name wasabi_container wasabi_wallet

Check the wallet logs:

docker logs -f wasabi_container

Using our client.

Downloading the client:

go get -u github.com/acfnv/go-wasabi-rpc-client

Example of usage:

package main

import (
	"flag"
	"fmt"
	"log"
	"net/http"
	"time"
	
	"github.com/acfnv/go-wasabi-rpc-client"
)

var (
	rpcHost     = flag.String("rpc_host", "127.0.0.1", "Host of the wasabi rpc server.")
	rpcPort     = flag.Int("rpc_port", 37128, "Port of the wasabi rpc server.")
)

func main() {
	flag.Parse()
	
	// Define the configuration for the RPC client.
	config := wasabi.Config{
		Host: *rpcHost,
		Port: *rpcPort,
	}
	
	// Create a new RPC client.
	client, err := wasabi.NewClient(config)
	if err != nil {
		return nil, err
	}
	
	// Check the availability of the RPC server.
	for {
		if client.IsWasabiWalletUp() {
			break
		}
		time.Sleep(1 * time.Second)
	}
	log.Printf("WasabiWallet RPC Server started")
	
	// Making a request to the RPC server.
	resp, err := client.GetStatus()
	if err != nil {
		return err
	}
	log.Printf("WasabiWallet RPC Server status: %v", resp)
	
	// ...
}

Contribution

  • You can fork this, extend it and contribute back.
  • You can contribute with pull requests.

Support further developments:

You can support the Anti-Corruption Foundation (ACF), using bank cards, electronic wallets, and cryptocurrencies.

LICENSE

MIT License

go-wasabi-rpc-client's People

Contributors

putins-nightmare avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.