Build once. Integrate your blockchain everywhere.
The mesh-geth-sdk
repository provides a collection of packages used for interaction with the Mesh API specification. The goal of this SDK is to help accelerate Mesh API implementation on go-ethereum based chains.
Mesh is an open-source specification and set of tools that makes integrating with blockchains simpler, faster, and more reliable. The Mesh API is specified in the OpenAPI 3.0 format.
Jump to:
This ethereum example provides a reference implementation of the Mesh API for Ethereum in Golang. This example highlights how to load a configuration, load supported operation types and errors, create a new Ethereum client, and start the Mesh server.
package main
import (
"log"
"github.com/coinbase/mesh-geth-sdk/examples/ethereum/client"
"github.com/coinbase/mesh-geth-sdk/examples/ethereum/config"
sdkTypes "github.com/coinbase/mesh-geth-sdk/types"
"github.com/coinbase/mesh-geth-sdk/utils"
)
func main() {
// Load configuration using the ENVs in the environment.
cfg, err := config.LoadConfiguration()
if err != nil {
log.Fatalln("unable to load configuration: %w", err)
}
// Load all the supported operation types, status
types := sdkTypes.LoadTypes()
errors := sdkTypes.Errors
// Create a new ethereum client by leveraging SDK functionalities
client, err := client.NewEthereumClient()
if err != nil {
log.Fatalln("cannot initialize client: %w", err)
}
// Bootstrap to start the Mesh API server
err = utils.BootStrap(cfg, types, errors, client)
if err != nil {
log.Fatalln("unable to bootstrap Mesh server: %w", err)
}
}
The LoadConfiguration file loads all the Blockchain metadata and Mesh configuration.
The NewEthereumClient file creates a new service client, which leverages SDK functionalities, and implements a few gas related interfaces.
See (examples/tokenList.json) for a list of supported ERC20 tokens.
go-ethereum
based blockchainSee the Configuration file for more information on how to configure the SDK.
The SDK defines a list of Client interfaces, which allows the Mesh service to interact with a go-ethereum based blockchain.
The SDK provides a default implementation of the client module for a quick start. However, these interfaces require custom integration to override:
Helpful commands for development:
make deps
make test
make lint
make salus
make coverage-local
To validate mesh-geth-sdk
, install mesh-cli
and run one of the following commands:
mesh-cli check:data --configuration-file mesh-cli-conf/testnet/config.json
- This command validates that the Data API implementation is correct, using the ethereum testnet
node. It also ensures that the implementation does not miss any balance-changing operations.mesh-cli check:construction --configuration-file mesh-cli-conf/testnet/config.json
- This command validates the Construction API implementation. It also verifies transaction construction, signing, and submissions to the testnet
network.mesh-cli check:data --configuration-file mesh-cli-conf/mainnet/config.json
- This command validates that the Data API implementation is correct, using the ethereum mainnet
node. It also ensures that the implementation does not miss any balance-changing operations.Read the How to Test your Mesh Implementation documentation for additional details.
You may contribute to the mesh-geth-sdk
project in various ways:
Read our Contributing documentation for more information.
You can also find community implementations for a variety of blockchains in the mesh-ecosystem repository.
You can find the Mesh API documentation here.
Check out the Getting Started section to start diving into Mesh.
mesh-sdk-go
SDK provides a collection of packages used for interaction with the Mesh API specification. mesh-cli
tool to test your Mesh API implementation. The tool also provides the ability to look up block contents and account balances.This project is available open source under the terms of the Apache 2.0 License.
© 2022 Coinbase