MCPcopy Index your code
hub / github.com/smartcontractkit/chainlink

github.com/smartcontractkit/chainlink @v2.53.0

repository ↗ · DeepWiki ↗ · release v2.53.0 ↗ · Ask this repo → · + Follow
50,486 symbols 232,087 edges 3,294 files 11,259 documented · 22% updated todayv2.53.0 · 2026-06-30★ 8,220110 open issues
README

Chainlink logo

GitHub tag (latest SemVer) GitHub license GitHub workflow changeset GitHub contributors GitHub commit activity Official documentation

Chainlink expands the capabilities of smart contracts by enabling access to real-world data and off-chain computation while maintaining the security and reliability guarantees inherent to blockchain technology.

This repo contains the Chainlink core node and contracts. The core node is the bundled binary available to be run by node operators participating in a decentralized oracle network. All major release versions have pre-built docker images available for download from the Chainlink dockerhub. If you are interested in contributing please see our contribution guidelines. If you are here to report a bug or request a feature, please check currently open Issues. For more information about how to get started with Chainlink, check our official documentation.

Community

Chainlink has an active and ever growing community. Discord is the primary communication channel used for day to day communication, answering development questions, and aggregating Chainlink related content. Take a look at the community docs for more information regarding Chainlink social accounts, news, and networking.

Build Chainlink

  1. Install Go 1.26.4, and add your GOPATH's bin directory to your PATH
  2. Example Path for macOS export PATH=$GOPATH/bin:$PATH & export GOPATH=/Users/$USER/go
  3. Install NodeJS v20 & pnpm v10 via npm.
  4. It might be easier long term to use nvm to switch between node versions for different projects. For example, assuming $NODE_VERSION was set to a valid version of NodeJS, you could run: nvm install $NODE_VERSION && nvm use $NODE_VERSION
  5. Install Postgres (>= 12.x). It is recommended to run the latest major version of postgres.
  6. Note if you are running the official Chainlink docker image, the highest supported Postgres version is 17.x due to the bundled client.
  7. You should configure Postgres to use SSL connection (or for testing you can set ?sslmode=disable in your Postgres query string).
  8. Download Chainlink: git clone https://github.com/smartcontractkit/chainlink && cd chainlink
  9. Build and install Chainlink: make install
  10. Run the node: chainlink help

For the latest information on setting up a development environment, see the Development Setup Guide.

Build from PR

To build an unofficial testing-only image from a feature branch or PR. You can do one of the following:

  1. Send a workflow dispatch event from our docker-build workflow.
  2. Add the build-publish label to your PR and then either retry the docker-build workflow, or push a new commit.

Build Plugins

Plugins are defined in yaml files within the plugins/ directory. Each plugin file is a yaml file and has a plugins. prefix name. Plugins are installed with loopinstall.

To install the plugins, run:

make install-plugins

Some plugins (such as those in plugins/plugins.private.yaml) reference private GitHub repositories. To build these plugins, you must have a GITHUB_TOKEN environment variable set, or preferably use the gh GitHub CLI tool to use the GitHub CLI credential helper like:

# Sets up a credential helper.
gh auth setup-git

Then you can build the plugins with:

make install-plugins-private

Docker Builds

To build the experimental "plugins" Chainlink docker image, you can run this from the root of the repository:

# The GITHUB_TOKEN is required to access private repos which are used by some plugins.
export GITHUB_TOKEN=$(gh auth token) # requires the `gh` cli tool.
make docker-plugins

Ethereum Execution Client Requirements

In order to run the Chainlink node you must have access to a running Ethereum node with an open websocket connection. Any Ethereum based network will work once you've configured the chain ID. Ethereum node versions currently tested and supported:

[Officially supported]

[Supported but broken] These clients are supported by Chainlink, but have bugs that prevent Chainlink from working reliably on these execution clients.

  • Nethermind Blocking issues:
  • ~https://github.com/NethermindEth/nethermind/issues/4384~
  • Erigon Blocking issues:
  • https://github.com/ledgerwatch/erigon/discussions/4946
  • https://github.com/ledgerwatch/erigon/issues/4030#issuecomment-1113964017

We cannot recommend specific version numbers for ethereum nodes since the software is being continually updated, but you should usually try to run the latest version available.

Running a local Chainlink node

NOTE: By default, chainlink will run in TLS mode. For local development you can disable this by using a dev build using make chainlink-dev and setting the TOML fields:

[WebServer]
SecureCookies = false
TLS.HTTPSPort = 0

[Insecure]
DevWebServer = true

Alternatively, you can generate self signed certificates using tools/bin/self-signed-certs or manually.

To start your Chainlink node, simply run:

chainlink node start

By default this will start on port 6688. You should be able to access the UI at http://localhost:6688/.

Chainlink provides a remote CLI client as well as a UI. Once your node has started, you can open a new terminal window to use the CLI. You will need to log in to authorize the client first:

chainlink admin login

(You can also set ADMIN_CREDENTIALS_FILE=/path/to/credentials/file in future if you like, to avoid having to login again).

Now you can view your current jobs with:

chainlink jobs list

To find out more about the Chainlink CLI, you can always run chainlink help.

Check out the doc pages on Jobs to learn more about how to create Jobs.

Configuration

Node configuration is managed by a combination of environment variables and direct setting via API/UI/CLI.

Check the official documentation for more information on how to configure your node.

External Adapters

External adapters are what make Chainlink easily extensible, providing simple integration of custom computations and specialized APIs. A Chainlink node communicates with external adapters via a simple REST API.

For more information on creating and using external adapters, please see our external adapters page.

Verify Official Chainlink Releases

We use cosign with OIDC keyless signing during the Build, Sign and Publish Chainlink workflow.

It is encourage for any node operator building from the official Chainlink docker image to verify the tagged release version was did indeed built from this workflow.

You will need cosign in order to do this verification. Follow the instruction here to install cosign.

# tag is the tagged release version - ie. 2.16.0
cosign verify index.docker.io/smartcontract/chainlink:${tag} \
      --certificate-oidc-issuer https://token.actions.githubusercontent.com \
      --certificate-identity "https://github.com/smartcontractkit/chainlink/.github/workflows/build-publish.yml@refs/tags/v${tag}"

Development

Running tests

  1. Install pnpm 10 via npm

  2. Install gencodec and jq to be able to run go generate ./... and make abigen

  3. Install mockery

make mockery

Using the make command will install the correct version.

  1. Generate and compile static assets:
make generate
  1. Prepare your development environment:

The tests require a postgres database. In turn, the environment variable CL_DATABASE_URL must be set to value that can connect to _test database, and the user must be able to create and drop the given _test database.

Note: Other environment variables should not be set for all tests to pass

There helper script for initial setup to create an appropriate test user. It requires postgres to be running on localhost at port 5432. You will be prompted for the postgres user password

make setup-testdb

This script will save the CL_DATABASE_URL in .dbenv

Changes to database require migrations to be run. Similarly, pull'ing the repo may require migrations to run. After the one-time setup above:

source .dbenv
make testdb

If you encounter the error database accessed by other users (SQLSTATE 55006) exit status 1 and you want force the database creation then use

source .dbenv
make testdb-force
  1. Run tests:
go test ./...

New, Condensed Test Flow

Use make test which handles most of the test DB setup for you in plain go (see tools/test/README.md for details).

make test ARGS="-h"         # See full capabilities of the test harness
make test ARGS="./core/..." # Setup ephemeral test DB and run all tests in ./core

# Re-run tests in full isolation and get detailed stats to root out flakes and races
make test ARGS="diagnose --iterations 5 --parallel-iterations 3 -- ./core/config/..."

Notes

  • The parallel flag can be used to limit CPU usage, for running tests in the background (-parallel=4) - the default is GOMAXPROCS
  • The p flag can be used to limit the number of packages tested concurrently, if they are interfering with one another (-p=1)
  • The -short flag skips tests which depend on the database, for quickly spot checking simpler tests in around one minute

Race Detector

As of Go 1.1, the runtime includes a data race detector, enabled with the -race flag. This is used in CI via the tools/bin/go_core_race_tests script. If the action detects a race, the artifact on the summary page will include race.* files with detailed stack traces.

It will not issue false positives, so take its warnings seriously.

For local, targeted race detection, you can run:

GORACE="log_path=$PWD/race" go test -race ./core/path/to/pkg -count 10
GORACE="log_path=$PWD/race" go test -race ./core/path/to/pkg -count 100 -run TestFooBar/sub_test

https://go.dev/doc/articles/race_detector

Fuzz tests

As of Go 1.18, fuzz tests func FuzzXXX(*testing.F) are included as part of the normal test suite, so existing cases are executed with go test.

Additionally, you can run active fuzzing to search for new cases:

go test ./pkg/path -run=XXX -fuzz=FuzzTestName

https://go.dev/doc/fuzz/

Go Modules

This repository contains three Go modules:

flowchart RL
    github.com/smartcontractkit/chainlink/v2
    github.com/smartcontractkit/chainlink/integration-tests --> github.com/smartcontractkit/chainlink/v2
    github.com/smartcontractkit/chainlink/core/scripts --> github.com/smartcontractkit/chainlink/v2

The integration-tests and core/scripts modules import the root module using a relative replace in their go.mod files, so dependency changes in the root go.mod often require changes in those modules as well. After making a change, go mod tidy can be run on all three modules using:

``` make gomodtidy

Extension points exported contracts — how you extend this code

TransactionRetrier (Interface)
TransactionRetrier is an interface that every retrier of failed funds transfer transaction needs to implement [6 implementers]
integration-tests/actions/refund.go
TransactionRetrier (Interface)
TransactionRetrier is an interface that every retrier of failed funds transfer transaction needs to implement [6 implementers]
devenv/products/refund.go
AbigenLog (Interface)
AbigenLog is an interface for abigen generated log topics [92 implementers]
devenv/contracts/keeper.go
BasicAdminUsersORM (Interface)
BasicAdminUsersORM is the interface that defines the functionality required for supporting basic admin functionality adj [7 …
core/sessions/authentication.go
EthereumLogIterator (Interface)
EthereumLogIterator is the interface provided by gethwrapper representations of EVM logs. [110 implementers]
core/internal/cltest/cltest.go
RelayerChainInterops (Interface)
RelayerChainInterops is the minimal interface needed for relayer chain interops [96 implementers]
core/services/cre/cre.go
SessionRequestBuilder (Interface)
SessionRequestBuilder is an interface that returns a SessionRequest, abstracting how session requests are generated, whe [6 …
core/cmd/shell.go
Authorizer (Interface)
Authorizer selects the applicable auth mechanism for a Vault request. [7 implementers]
core/capabilities/vault/authorizer.go

Core symbols most depended-on inside this repo

Errorf
called by 11384
core/logger/logger.go
Equal
called by 6908
core/services/workflows/types/workflow_meta.go
PP
called by 6564
core/web/assets/main.c9e0252e18f800d8e1c5.js
n
called by 4158
core/web/assets/main.c9e0252e18f800d8e1c5.js
String
called by 3266
core/services/workflows/types/workflow_meta.go
Run
called by 2643
core/services/pipeline/common.go
rf
called by 2266
core/web/assets/main.c9e0252e18f800d8e1c5.js
Get
called by 2223
core/services/s4/orm.go

Shape

Method 22,181
Function 20,252
Struct 6,714
Interface 546
Class 488
TypeAlias 222
FuncType 83

Languages

Go78%
TypeScript22%
Python1%

Modules by API surface

core/web/assets/main.c9e0252e18f800d8e1c5.js8,312 symbols
deployment/environment/web/sdk/internal/generated/generated.go1,110 symbols
core/scripts/cre/environment/examples/workflows/ts/cron/mietekstefan3.js877 symbols
core/scripts/cre/environment/examples/workflows/ts/cron/mietekstefan2.js877 symbols
core/scripts/cre/environment/examples/workflows/ts/cron/mietekstefan.js877 symbols
deployment/ccip/shared/bindings/hybrid_with_external_minter_fast_transfer_token_pool/hybrid_with_external_minter_fast_transfer_token_pool.go581 symbols
deployment/ccip/shared/bindings/token_governor/token_governor.go537 symbols
deployment/ccip/shared/bindings/burn_mint_with_external_minter_fast_transfer_token_pool/burn_mint_with_external_minter_fast_transfer_token_pool.go492 symbols
core/services/chainlink/mocks/general_config.go388 symbols
common/txmgr/mocks/evm_tx_store.go388 symbols
deployment/common/view/v1_0/mocks/workflow_registry_interface.go358 symbols
deployment/ccip/shared/bindings/usd_stablecoin/usd_stablecoin.go292 symbols

Dependencies from manifests, versioned

charm.land/fang/v2v2.0.1 · 1×
cloud.google.com/go/auth/oauth2adaptv0.2.8 · 1×
cloud.google.com/go/compute/metadatav0.9.0 · 1×
cosmossdk.io/apiv0.7.6 · 1×
cosmossdk.io/collectionsv0.4.0 · 1×
cosmossdk.io/corev0.11.0 · 1×
cosmossdk.io/depinjectv1.1.0 · 1×
cosmossdk.io/errorsv1.0.1 · 1×
cosmossdk.io/logv1.4.1 · 1×
cosmossdk.io/mathv1.4.0 · 1×

Datastores touched

chainlink_testDatabase · 1 repos
dbnameDatabase · 1 repos
postgresDatabase · 1 repos
asdfDatabase · 1 repos
backupdbnameDatabase · 1 repos
chainlinkDatabase · 1 repos
chainlink_0_testDatabase · 1 repos
chainlink_1_testDatabase · 1 repos

For agents

$ claude mcp add chainlink \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact