SDK Installation

The CRE Connect SDK is distributed as a Go module. There is one core module and one optional extension per supported protocol.

Install the core SDK

go get github.com/smartcontractkit/crec-sdk

This pulls the unified client and every sub-client (channels, events, transact, wallets, watchers) along with their dependencies.

Install protocol extensions (optional)

Extensions sit on top of the core SDK and supply typed Operation builders, decoded event structs, and pre-packaged watcher provisioning for a given protocol. Install only the extensions you need.

DTA (Digital Transfer Agent)

go get github.com/smartcontractkit/crec-sdk-ext-dta/v2

Use the v2 module path explicitly. v1 is not documented or supported by the current dta.v2 service.

See the DTA Overview for the full surface.

Canonical import paths

These are the imports you will reach for most often. Each Go file should import only what it needs: there is no umbrella import that pulls everything in.

Unified client

import "github.com/smartcontractkit/crec-sdk"

This package exposes crec.NewClient, crec.NewAPIClient, all crec.Option constructors, and the sentinel errors (ErrBaseURLRequired, ErrAPIKeyRequired, ErrInvalidEventVerificationConfig, ErrListNetworks).

Sub-clients

import (
    "github.com/smartcontractkit/crec-sdk/channels"
    "github.com/smartcontractkit/crec-sdk/events"
    "github.com/smartcontractkit/crec-sdk/transact"
    "github.com/smartcontractkit/crec-sdk/wallets"
    "github.com/smartcontractkit/crec-sdk/watchers"
)

Operation types and signing

import (
    "github.com/smartcontractkit/crec-sdk/transact/types"
    "github.com/smartcontractkit/crec-sdk/transact/eip712"
    "github.com/smartcontractkit/crec-sdk/transact/signer"
)

Signer adapters

Pick whichever matches your key store:

import "github.com/smartcontractkit/crec-sdk/transact/signer/local"
import "github.com/smartcontractkit/crec-sdk/transact/signer/kms"
import "github.com/smartcontractkit/crec-sdk/transact/signer/vault"
import "github.com/smartcontractkit/crec-sdk/transact/signer/fireblocks"
import "github.com/smartcontractkit/crec-sdk/transact/signer/privy"

DTA extension

import (
    dtaops "github.com/smartcontractkit/crec-sdk-ext-dta/v2/operations"
    dtaevents "github.com/smartcontractkit/crec-sdk-ext-dta/v2/events"
    dtawatcher "github.com/smartcontractkit/crec-sdk-ext-dta/v2/watcher/bundle"
)

Use the unified client or per-package clients

Two construction patterns are supported.

client, err := crec.NewClient(
    "https://cre-connect.api.chain.link/v1",
    apiKey,
    crec.WithOrgID(orgID), // required for Events.Verify and Events.VerifyOperationStatus
)
// client.Channels, client.Events, client.Transact, client.Wallets, client.Watchers

This wires every sub-client with the same authenticated transport, logger, and event-verification configuration. Pass crec.WithOrgID(...) so the events client can derive your tenant's workflow owner address; see Prerequisites for where to find your Organization ID.

Per-package (for small footprints)

If you only need one or two sub-clients (for example a service that only polls events), share the underlying API client to avoid redundant configuration. The events client takes the same OrgID (or WorkflowOwner) you would otherwise pass to crec.NewClient, so verification still works:

api, err := crec.NewAPIClient(
    "https://cre-connect.api.chain.link/v1",
    apiKey,
)
if err != nil { return err }

eventsClient, err := events.NewClient(&events.Options{
    CRECClient: api,
    OrgID:      orgID, // required for Verify / VerifyOperationStatus
})

Both patterns talk to the same backend. Pick whichever makes your dependency surface smaller.

Verify the install

Compile a one-line program to confirm modules resolve:

package main

import (
    "fmt"
    "github.com/smartcontractkit/crec-sdk"
)

func main() {
    fmt.Printf("ErrAPIKeyRequired = %v\n", crec.ErrAPIKeyRequired)
}
go run main.go
# ErrAPIKeyRequired = API key is required

If that prints without errors, you are ready for Authentication.

Get the latest Chainlink content straight to your inbox.