Giter Club home page Giter Club logo

merkle-sdk-gojircs's Introduction

merkle is building crypto infrastructure. Join us on discord.

merkle SDK

The merkle SDK is a great way to access our products.

Install

Install the merkle SDK package:

go get github.com/merkle3/merkle-sdk-go

Authentication

Get an API key from merkle Blockchain Services (MBS).

package main

import (
    "github.com/merkle3/merkle-sdk-go/merkle"
)

func main() {
    merkleSdk := merkle.New()

    merkleSdk.SetApiKey("sk_mbs_......") // get one at mbs.https://mbs.merkle.io
}

Features

Stream transactions

Access merkle's private stream of transactions on Ethereum & Polygon. Learn more

package main

import (
    "github.com/merkle3/merkle-sdk-go/merkle"
)

func main() {
    merkleSdk := merkle.New()

    merkleSdk.SetApiKey("sk_mbs_......") // get one at mbs.https://mbs.merkle.io

    txs, err := merkleSdk.Transactions().Stream(merkle.EthereumMainnet) // pass a chain id, e.g. merkle.EthereumMainnet, merkle.PolygonMainnet or merkle.BnbMainnet

    for {
        select {
            case e := <-err:
			    // error happened
			    fmt.Printf("error: %v\n", e)
            case tx := <-txs:
                // process the transaction
                fmt.Printf("hash: %v\n", tx.Hash().String())
        }
    }
}

Stream auctions

Stream auctions from the Merkle Private Pool. Learn more.

package main

import (
    "github.com/merkle3/merkle-sdk-go/merkle"
)

func main() {
    merkleSdk := merkle.New()

    merkleSdk.SetApiKey("sk_mbs_......") // get one at mbs.merkle.io

    auctions, err := merkleSdk.Pool().Auctions()

    for {
        select {
            case e := <-err:
            // error happened
            case auction := <-auctions:
            // process the auction, create a backrun

            // then send the bid
            err := auction.SendBid(tx) // a signed types.Transaction

            // or send a raw bid
            err := auction.SendRawBid([]string{
                // hex encoded bid
                "0x...."
            })

            // check for error in case the auction is already closed
        }
    }
}

Send transaction to the private mempool

Send Ethereum, BSC and Polygon transactions to the private mempool to get MEV protection and recovery. Learn more

package main

import (
    "github.com/merkle3/merkle-sdk-go/merkle"
)

func main() {
    merkleSdk := merkle.New()

    merkleSdk.SetApiKey("sk_mbs_......") // get one at mbs.https://mbs.merkle.io

    err := merkleSdk.Pool().Send(&merkle.NewTransactionOptions{
        tx: nil, // a types.Transaction from go-ethereum
    })

    if err != nil {
        fmt.Printf("error: %v\n", err)
    }
}

Transaction tracing

Know exactly when and where a transaction was broadcasted. Learn more

package main

import (
    "github.com/merkle3/merkle-sdk-go/merkle"
)

func main() {
    merkleSdk := merkle.New()

    merkleSdk.SetApiKey("sk_mbs_......") // get one at mbs.merkle.io

    trace, err := merkleSdk.Transactions().Trace("0x....") // a transaction hash

    // check for error
    if err != nil {
        fmt.Printf("error: %v\n", err)
        return
    }

    fmt.Printf("first seen at: %v\n", trace.FirstSeenAt.String())
}

merkle-sdk-gojircs's People

Contributors

theo- avatar

Stargazers

Jircs$1 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.