merry

package module
v0.0.34 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2025 License: MIT Imports: 23 Imported by: 0

README

GitHub Release

Merry

Streamline your multi-chain testing with Merry!

This CLI tool leverages Docker to effortlessly set up a multi-chain testing environment in a single command. Merry includes Bitcoin regtest node, Ethereum localnet node, and essential Catalog.fi services, providing a self-contained space to test your applications independently of external services.

It supports various features, including a faucet, electrum services, and an orderbook with COBI.

Prerequisites

Before using Merry, please ensure you have Docker installed and running on your system. If not, download and install Docker from the official website.

Installation

You can install Merry using the following command.

curl https://get.merry.dev | bash

Merry stores its configuration files and other data in a directory on your system, typically named ~/.merry/.

See the Install from scratch section to install Merry from scratch.

Commands

Merry provides a variety of commands to manage your testing environment:

Starting Merry

merry go

This starts all services, including the Bitcoin regtest node, Ethereum localnet node, explorers for the nodes, and the Catalog services.

  • --bare flag: Starts only the multi-chain services (Bitcoin and Ethereum nodes with explorers) and excludes Catalog services. This option is helpful if you don't need the additional functionalities like COBI and Orderbook provided by Catalog.

  • --headless flag: Starts all services except for frontend interfaces. This can help run Merry in headless environments (e.g., servers) where a graphical user interface is not required.

Stopping Merry

merry stop

# Reset data
merry stop -d

Stops all running services. Use --delete or -d to remove data.

Getting logs

merry logs -s <service>

# Getting logs of EVM service
merry logs -s evm

Replace with the specific service (e.g., cobi, orderbook, evm) to view its logs.

Replacing a service with a local one

merry replace <service>

This command allows you to replace a service with your local development version. Make sure you're in the directory containing the local service's Dockerfile. Supported services include COBI, Orderbook, and EVM.

Calling Bitcoin RPC methods

merry rpc <method> <params>

# example: get blockchain info
merry rpc getblockchaininfo

Interact with the Bitcoin regtest node directly using RPC methods.

Updating Docker images

merry update

Keep your testing environment up-to-date by updating all Docker images.

Fund accounts

merry faucet <address>

Fund any EVM and Bitcoin address for testing purposes. Replace <address> with the address you want to fund. It could be a Bitcoin or Ethereum address.

List active services

merry status

Lists all currently running services with their respective ports and operational status.

List all commands

merry --help

Testing with Merry

Once your environment is set up:

  • Connect to the Orderbook using its provided URL within your client application.
  • Leverage the built-in Bitcoin regtest and Ethereum testnet nodes to test your multi-chain functionalities.

Contributing

We welcome contributions to Merry! There are no special requirements needed. Fork the repository, make your changes, and submit a pull request.

Let Merry simplify your multi-chain testing journey!

Install from scratch

  • Clone the repository
git clone https://github.com/catalogfi/merry.git
  • Building and installing
cd cmd/merry
# build and install the binary
go install

Service Endpoints

The following services are available with their respective ports:

Blockchain Nodes

  • Ethereum: 8545

  • Arbitrum: 8546

  • Bitcoin: 18443

Explorers

  • Ethereum Explorer: 5100
  • Arbitrum Explorer: 5101
  • Esplora: 5050

Blockchain Tools

  • Electrs: 30000
  • Chopsticks: 3000
  • Cosigner: 11818
  • Virtual Balance: 3008

Garden Services

Quote Server

  • quote: 6969

Relayers & Executors

  • Relayer: 4426

Databases

  • Postgres: 5432
  • Garden DB: 5433
  • Redis: 6379

Documentation

Index

Constants

View Source
const (
	ErrorCodeParseError        = -32700
	ErrorMessageParseError     = "Parse error"
	ErrorCodeInvalidRequest    = -32600
	ErrorMessageInvalidRequest = "Invalid Request"
	ErrorCodeMethodNotFound    = -32601
	ErrorMessageMethodNotFound = "Method not found"
	ErrorCodeInvalidParams     = -32602
	ErrorMessageInvalidParams  = "Invalid params"
	ErrorCodeInternalError     = -32603
	ErrorMessageInternalError  = "Internal error"
)

Error codes

Variables

View Source
var DefaultComposePath string

Functions

func Update

func Update() error

Types

type Error

type Error struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    string `json:"data"`
}

Error defines a JSON-RPC 2.0 error object.

func NewError

func NewError(code int, message string, data string) *Error

NewError returns a new JSON-RPC 2.0 error object.

func NewInvalidParams

func NewInvalidParams(err error) *Error

func NewInvalidRequest

func NewInvalidRequest(err error) *Error

func NewMethodNotFound

func NewMethodNotFound() *Error

func NewParseError

func NewParseError(err error) *Error

type Merry

type Merry struct {
	Running    bool `json:"running"`
	Ready      bool `json:"ready"`
	IsBare     bool `json:"isBare"`
	IsHeadless bool `json:"isHeadless"`

	Version string `json:"version"`
	Commit  string `json:"commit"`
	Date    string `json:"date"`

	Services map[string]string `json:"-"`
}

func Default

func Default() Merry

func (*Merry) FormatVersion

func (m *Merry) FormatVersion() string

func (*Merry) Fund

func (m *Merry) Fund(to string) error

func (*Merry) Load added in v0.0.28

func (m *Merry) Load() error

func (*Merry) Logs

func (m *Merry) Logs(service string, outWriter, errWriter io.Writer) error

func (*Merry) Proxy

func (m *Merry) Proxy(req interface{}, service, method string) (Response, error)

func (*Merry) Relay

func (m *Merry) Relay(generate int64, named bool, rpcwallet string, args ...string) error

func (*Merry) Replace

func (m *Merry) Replace(path, image string) error

func (*Merry) Save added in v0.0.28

func (m *Merry) Save() error

func (*Merry) Start

func (m *Merry) Start() error

func (*Merry) Status added in v0.0.32

func (m *Merry) Status() error

func (*Merry) Stop

func (m *Merry) Stop(isDelete bool) error

type Request

type Request struct {
	Version string          `json:"jsonrpc"`
	ID      interface{}     `json:"id"`
	Method  string          `json:"method"`
	Params  json.RawMessage `json:"params,omitempty"`
}

Request defines a JSON-RPC 2.0 request object.

type Response

type Response struct {
	Version string          `json:"jsonrpc"`
	ID      interface{}     `json:"id"`
	Result  json.RawMessage `json:"result,omitempty"`
	Error   *Error          `json:"error,omitempty"`
}

Response defines a JSON-RPC 2.0 response object.

func NewResponse

func NewResponse(id interface{}, result json.RawMessage, err *Error) Response

NewResponse returns a new JSON-RPC 2.0 response object.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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