Request form
ChainLink
  • Oracles
  • Protocol
Docs
Source
ChefGPT

Chainlink decentralized oracle networks provide tamper-proof inputs, outputs, and computations to support advanced smart contracts on any blockchain.

Aggregator.sol
Chainlink.sol
ChainlinkClient.sol
Chainlinked.sol
ERC677Token.sol
AggregatorInterface.sol
ChainlinkRequestInterface.sol
ENSInterface.sol
ERC20.sol
ERC20Basic.sol
ERC677.sol
ERC677Receiver.sol
LinkTokenInterface.sol
OracleInterface.sol
PointerInterface.sol
LinkToken.sol
Oracle.sol
BasicConsumer.sol
ConcreteChainlink.sol
ConcreteChainlinked.sol
Consumer.sol
EmptyOracle.sol
MaliciousChainlink.sol
MaliciousChainlinked.sol
MaliciousConsumer.sol
MaliciousRequester.sol
UpdatableConsumer.sol
BasicToken.sol
Buffer.sol
CBOR.sol
ENSResolver.sol
Ownable.sol
SafeMathChainlink.sol
SignedSafeMath.sol
StandardToken.sol
Chainlink.sol
ChainlinkClient.sol
Coordinator.sol
CoordinatorInterface.sol
OracleSignaturesDecoder.sol
ServiceAgreementDecoder.sol
ChainlinkRequestInterface.sol
ENSInterface.sol
LinkTokenInterface.sol
OracleInterface.sol
PointerInterface.sol
WithdrawalInterface.sol
LinkTokenReceiver.sol
Median.sol
Oracle.sol
BasicConsumer.sol
ChainlinkTestHelper.sol
Consumer.sol
EmptyAggregator.sol
MaliciousChainlink.sol
MaliciousChainlinkClient.sol
MaliciousConsumer.sol
MaliciousRequester.sol
MeanAggregator.sol
MedianTestHelper.sol
ServiceAgreementConsumer.sol
Buffer.sol
CBOR.sol
ENSResolver.sol
Ownable.sol
SafeMathChainlink.sol
SignedSafeMath.sol
AggregatorFacade.sol
AggregatorProxy.sol
Chainlink.sol
ChainlinkClient.sol
CheckedMath.sol
DeviationFlaggingValidator.sol
EACAggregatorProxy.sol
VRFD20.sol
Flags.sol
FluxAggregator.sol
AccessControllerInterface.sol
AggregatorInterface.sol
AggregatorV2V3Interface.sol
AggregatorV3Interface.sol
AggregatorValidatorInterface.sol
BlockHashStoreInterface.sol
ChainlinkRequestInterface.sol
ENSInterface.sol
FeedRegistryInterface.sol
FlagsInterface.sol
LinkTokenInterface.sol
OracleInterface.sol
PointerInterface.sol
WithdrawalInterface.sol
LinkTokenReceiver.sol
Median.sol
Oracle.sol
Owned.sol
SafeMath128.sol
SafeMath32.sol
SafeMath64.sol
SignedSafeMath.sol
SimpleReadAccessController.sol
SimpleWriteAccessController.sol
AggregatorValidatorMock.sol
BasicConsumer.sol
ChainlinkClientTestHelper.sol
ChainlinkTestHelper.sol
CheckedMathTestHelper.sol
ConcreteSignedSafeMath.sol
Consumer.sol
EmptyOracle.sol
FlagsTestHelper.sol
FluxAggregatorTestHelper.sol
GasGuzzlingConsumer.sol
MaliciousMultiWordConsumer.sol
MedianTestHelper.sol
MockETHLINKAggregator.sol
MockGASAggregator.sol
MockOracle.sol
MockV3Aggregator.sol
MultiWordConsumer.sol
TestAPIConsumer.sol
VRFConsumer.sol
VRFCoordinatorMock.sol
VRFRequestIDBaseTestHelper.sol
VRFTestHelper.sol
BufferChainlink.sol
CBORChainlink.sol
ENSResolver.sol
Ownable.sol
SafeMathChainlink.sol
VRF.sol
VRFConsumerBase.sol
VRFCoordinator.sol
VRFRequestIDBase.sol
AuthorizedForwarder.sol
AuthorizedReceiver.sol
Chainlink.sol
ChainlinkClient.sol
ConfirmedOwner.sol
ConfirmedOwnerWithProposal.sol
AggregatorProxy.sol
CompoundPriceFlaggingValidator.sol
StalenessFlaggingValidator.sol
AggregatorInterface.sol
AggregatorProxyInterface.sol
AggregatorV2V3Interface.sol
AggregatorV3Interface.sol
AuthorizedReceiverInterface.sol
ChainlinkRequestInterface.sol
ENSInterface.sol
FeedRegistryInterface.sol
FlagsInterface.sol
KeeperCompatibleInterface.sol
KeeperRegistryInterface.sol
LinkTokenInterface.sol
OperatorInterface.sol
OracleInterface.sol
OwnableInterface.sol
PointerInterface.sol
TypeAndVersionInterface.sol
UniswapAnchoredView.sol
WithdrawalInterface.sol
KeeperBase.sol
KeeperCompatible.sol
KeeperRegistry1_1.sol
LinkTokenReceiver.sol
Operator.sol
OperatorFactory.sol
ChainlinkClientTestHelper.sol
ChainlinkTestHelper.sol
ConfirmedOwnerTestHelper.sol
Consumer.sol
KeeperCompatibleTestHelper.sol
MockCompoundOracle.sol
MockV2Aggregator.sol
MockV3Aggregator.sol
MultiWordConsumer.sol
UpkeepAutoFunder.sol
UpkeepMock.sol
UpkeepReverter.sol
VRFCoordinatorMock.sol
UpkeepRegistrationRequests.sol
Address.sol
BufferChainlink.sol
CBORChainlink.sol
Context.sol
ENSResolver.sol
Pausable.sol
ReentrancyGuard.sol
SafeMath96.sol
SafeMathChainlink.sol
SignedSafeMath.sol
VRFConsumerBase.sol
VRFRequestIDBase.sol
FeedLookupCompatibleInterface.sol
SCA.sol
SCALibrary.sol
SmartContractAccountFactory.sol
SmartContractAccountHelper.sol
AutomationCompatibleInterface.sol
MercuryUpkeep.sol
ArbSys.sol
Helpers.sol
IAccount.sol
UserOperation.sol
Ownable.sol
Context.sol
ExecutionPrevention.sol
UpkeepFormat.sol
ConfirmedOwner.sol
ConfirmedOwnerWithProposal.sol
AutomationForwarder.sol
AutomationForwarderLogic.sol
AutomationRegistrar2_1.sol
AutomationUtils2_1.sol
Chainable.sol
IAutomationForwarder.sol
IAutomationRegistryConsumer.sol
IKeeperRegistryMaster.sol
ILogAutomation.sol
KeeperRegistry2_1.sol
KeeperRegistryBase2_1.sol
KeeperRegistryLogicA2_1.sol
KeeperRegistryLogicB2_1.sol
MockKeeperRegistry2_1.sol
UpkeepCounter.sol
StructFactory.sol
UpkeepTranscoder4_0.sol
DummyProtocol.sol
LogTriggeredFeedLookup.sol
AccessControllerInterface.sol
AggregatorV3Interface.sol
AutomationRegistryInterface2_0.sol
KeeperCompatibleInterface.sol
MigratableKeeperRegistryInterfaceV2.sol
UpkeepTranscoderInterface.sol
UpkeepTranscoderInterfaceV2.sol
ERC677ReceiverInterface.sol
ITypeAndVersion.sol
LinkTokenInterface.sol
OwnableInterface.sol
TypeAndVersionInterface.sol
IVerifier.sol
IVerifierProxy.sol
ErroredVerifier.sol
ExposedVerifier.sol
Verifier.sol
VerifierProxy.sol
OCR2Abstract.sol
AutomationConsumerBenchmark.sol
VerifiableLoadBase.sol
VerifiableLoadLogTriggerUpkeep.sol
VerifiableLoadMercuryUpkeep.sol
VerifiableLoadUpkeep.sol
ArbGasInfo.sol
OVM_GasPriceOracle.sol
IERC165.sol
Proxy.sol
Address.sol
EnumerableSet.sol
IL1CrossDomainMessenger.sol
IL2CrossDomainMessenger.sol
ICrossDomainMessenger.sol
Lib_OVMCodec.sol
Lib_RLPReader.sol
Lib_RLPWriter.sol
Lib_Bytes32Utils.sol
Lib_BytesUtils.sol
Initializable.sol
AddressUpgradeable.sol
IBeacon.sol
ERC1967Proxy.sol
ERC1967Upgrade.sol
Proxy.sol
ProxyAdmin.sol
TransparentUpgradeableProxy.sol
Pausable.sol
ReentrancyGuard.sol
Address.sol
StorageSlot.sol
EnumerableSet.sol
AggregatorV3Interface.sol
FlagsInterface.sol
AggregatorInterface.sol
AggregatorV2V3Interface.sol
AggregatorV3Interface.sol
FlagsInterface.sol
ArbSys.sol
AuthorizedReceiver.sol
AutomationBase.sol
AutomationCompatible.sol
KeeperBase.sol
KeeperCompatible.sol
ERC20BalanceMonitor.sol
UpkeepTranscoder.sol
Chainlink.sol
ChainlinkClient.sol
ChainSpecificUtil.sol
Denominations.sol
ArbitrumCrossDomainForwarder.sol
ArbitrumCrossDomainGovernor.sol
ArbitrumSequencerUptimeFeed.sol
ArbitrumValidator.sol
CrossDomainDelegateForwarder.sol
CrossDomainForwarder.sol
CrossDomainOwnable.sol
DerivedPriceFeed.sol
Flags.sol
ArbitrumSequencerUptimeFeedInterface.sol
CrossDomainOwnableInterface.sol
DelegateForwarderInterface.sol
FlagsInterface.sol
ForwarderInterface.sol
IArbitrumDelayedInbox.sol
IVRFCoordinatorV2Plus.sol
IVRFCoordinatorV2PlusMigration.sol
IVRFMigratableConsumerV2Plus.sol
IVRFMigratableCoordinatorV2Plus.sol
IVRFSubscriptionV2Plus.sol
OptimismSequencerUptimeFeedInterface.sol
VRFV2PlusWrapperInterface.sol
OCR2Abstract.sol
OCR2Base.sol
OptimismCrossDomainForwarder.sol
OptimismCrossDomainGovernor.sol
OptimismSequencerUptimeFeed.sol
OptimismValidator.sol
Paymaster.sol
Greeter.sol
VRFV2PlusClient.sol
SubscriptionAPI.sol
ExposedVRFCoordinatorV2Plus.sol
VRFConsumerV2PlusUpgradeableExample.sol
VRFCoordinatorV2Plus_V2Example.sol
VRFMaliciousConsumerV2Plus.sol
VRFV2PlusConsumerExample.sol
VRFV2PlusExternalSubOwnerExample.sol
VRFV2PlusRevertingExample.sol
VRFV2PlusSingleConsumerExample.sol
VRFV2PlusWrapperConsumerExample.sol
VRFConsumerBaseV2Plus.sol
VRFCoordinatorV2Plus.sol
VRFV2PlusWrapper.sol
VRFV2PlusWrapperConsumerBase.sol
VRFConsumerBaseV2Upgradeable.sol
Flags.sol
AuthorizedOriginReceiver.sol
AuthorizedOriginReceiverUpgradeable.sol
AuthorizedReceiver.sol
ConfirmedOwnerUpgradeable.sol
IAuthorizedOriginReceiver.sol
IAuthorizedReceiver.sol
FunctionsClientExample.sol
Functions.sol
FunctionsBillingRegistry.sol
FunctionsClient.sol
FunctionsOracle.sol
IFunctionsBillingRegistry.sol
IFunctionsClient.sol
IFunctionsOracle.sol
OCR2Abstract.sol
OCR2Base.sol
OCR2BaseUpgradeable.sol
ITermsOfServiceAllowList.sol
TermsOfServiceAllowList.sol
FunctionsClientExample.sol
Functions.sol
FunctionsBilling.sol
FunctionsClient.sol
FunctionsCoordinator.sol
FunctionsRouter.sol
FunctionsSubscriptions.sol
HasRouter.sol
FulfillResultCodes.sol
IConfigurable.sol
IFunctionsBilling.sol
IFunctionsClient.sol
IFunctionsCoordinator.sol
IFunctionsRouter.sol
IFunctionsSubscriptions.sol
IOwnableRouter.sol
IRouterBase.sol
OCR2Abstract.sol
OCR2Base.sol
RouterBase.sol
AuthorizedOriginReceiverTestHelper.sol
AuthorizedReceiverTestHelper.sol
FunctionsBillingRegistryWithInit.sol
FunctionsClientTestHelper.sol
FunctionsOracleHelper.sol
FunctionsOracleMigrationHelper.sol
FunctionsOracleOriginalHelper.sol
FunctionsOracleUpgradeableHelper.sol
FunctionsOracleWithInit.sol
FunctionsTestHelper.sol
AuthorizedOriginReceiverInterface.sol
AuthorizedOriginReceiverUpgradeable.sol
AuthorizedReceiver.sol
AuthorizedReceiverInterface.sol
ConfirmedOwnerUpgradeable.sol
FunctionsBillingRegistryInterface.sol
FunctionsBillingRegistryMigration.sol
FunctionsBillingRegistryOriginal.sol
FunctionsClientInterface.sol
FunctionsOracleInterface.sol
FunctionsOracleMigration.sol
FunctionsOracleOriginal.sol
OCR2Abstract.sol
OCR2BaseUpgradeable.sol
FunctionsClientTestHelper.sol
FunctionsCoordinatorTestHelper.sol
FunctionsTestHelper.sol
AggregatorInterface.sol
AggregatorV2V3Interface.sol
AggregatorValidatorInterface.sol
AutomationRegistryInterface1_2.sol
KeeperRegistryInterface1_2.sol
AutomationRegistryInterface1_3.sol
MigratableKeeperRegistryInterface.sol
BlockhashStoreInterface.sol
ChainlinkRequestInterface.sol
ENSInterface.sol
FeedRegistryInterface.sol
FlagsInterface.sol
IAuthorizedReceiver.sol
OperatorInterface.sol
OracleInterface.sol
PointerInterface.sol
PoRAddressList.sol
VRFCoordinatorV2Interface.sol
VRFV2WrapperInterface.sol
KeepersVRFConsumer.sol
FunctionsBillingRegistryEventsMock.sol
FunctionsOracleEventsMock.sol
MockAggregatorValidator.sol
MockLinkToken.sol
VRFCoordinatorMock.sol
VRFCoordinatorV2Mock.sol
IAccessController.sol
IOwnable.sol
ITypeAndVersion.sol
SimpleReadAccessController.sol
SimpleWriteAccessController.sol
Broken.sol
ChainlinkClientTestHelper.sol
ChainlinkTestHelper.sol
Counter.sol
FeedConsumer.sol
FlagsTestHelper.sol
Greeter.sol
KeeperCompatibleTestHelper.sol
LogEmitter.sol
MockArbitrumInbox.sol
MockETHLINKAggregator.sol
MockOptimismL1CrossDomainMessenger.sol
MockOptimismL2CrossDomainMessenger.sol
MockV3Aggregator.sol
utils.sol
ValidatorProxy.sol
Buffer.sol
iOVM_CrossDomainMessenger.sol
IBridge.sol
IInbox.sol
IMessageProvider.sol
AddressAliasHelper.sol
BufferChainlink.sol
CBORChainlink.sol
DateTime.sol
ENSResolver.sol
EntryPoint.sol
SenderCreator.sol
StakeManager.sol
IAggregator.sol
IEntryPoint.sol
IPaymaster.sol
IStakeManager.sol
Exec.sol
MockOVMCrossDomainMessenger.sol
MultiSend.sol
Initializable.sol
PausableUpgradeable.sol
AddressUpgradeable.sol
ContextUpgradeable.sol
Pausable.sol
IERC20Permit.sol
IERC20.sol
SafeERC20.sol
Address.sol
Context.sol
Context.sol
EnumerableMap.sol
Pausable.sol
Address.sol
Context.sol
SafeCast.sol
EnumerableSet.sol
CBOR.sol
Strings.sol
VRFConsumer.sol
VRFConsumerV2.sol
VRFConsumerV2UpgradeableExample.sol
VRFCoordinatorV2TestHelper.sol
VRFExternalSubOwnerExample.sol
VRFLoadTestExternalSubOwner.sol
VRFLoadTestOwnerlessConsumer.sol
VRFMaliciousConsumerV2.sol
VRFOwnerlessConsumerExample.sol
VRFRequestIDBaseTestHelper.sol
VRFSingleConsumerExample.sol
VRFTestHelper.sol
VRFV2LoadTestWithMetrics.sol
VRFV2ProxyAdmin.sol
VRFV2RevertingExample.sol
VRFV2TransparentUpgradeableProxy.sol
VRFV2WrapperConsumerExample.sol
VRFV2WrapperOutOfGasConsumerExample.sol
VRFV2WrapperRevertingConsumerExample.sol
VRFV2WrapperUnderFundingConsumer.sol
VRF.sol
VRFConsumerBase.sol
VRFConsumerBaseV2.sol
VRFRequestIDBase.sol
VRFV2Wrapper.sol
VRFV2WrapperConsumerBase.sol
KeeperRegistrar1_2.sol
KeeperRegistry1_2.sol
KeeperRegistryCheckUpkeepGasUsageWrapper1_2.sol
KeeperRegistry1_3.sol
KeeperRegistryBase1_3.sol
KeeperRegistryLogic1_3.sol
KeeperRegistrar2_0.sol
KeeperRegistry2_0.sol
KeeperRegistryBase2_0.sol
KeeperRegistryLogic2_0.sol
HeartbeatRequester.sol
MockAggregator.sol
MockAggregatorProxy.sol
CronUpkeep.sol
CronUpkeepDelegate.sol
CronUpkeepFactory.sol
EthBalanceMonitor.sol
CanaryUpkeep1_2.sol
LogUpkeepCounter.sol
LinkAvailableBalanceMonitor.sol
UpkeepTranscoder3_0.sol
BlockhashStore.sol
BatchVRFCoordinatorV2Plus.sol
VRFSubscriptionBalanceMonitor.sol
Cron.sol
Cron.sol
MockArbSys.sol
MockOffchainAggregator.sol
PermissionedForwardProxy.sol
CronReceiver.sol
CronTestHelper.sol
CronUpkeepTestHelper.sol
ERC20BalanceMonitorExposed.sol
EthBalanceMonitorExposed.sol
MockArbGasInfo.sol
MockOVMGasPriceOracle.sol
ReceiveEmitter.sol
ReceiveFallbackEmitter.sol
ReceiveReverter.sol
OVM_GasPriceOracle.sol
BatchBlockhashStore.sol
BatchVRFCoordinatorV2.sol
VRFSubscriptionBalanceMonitorExposed.sol
VRFOwner.sol
VRFTypes.sol

TVL

$.NaK

133 downloads

Chains

Authors

ChainLink
  • Oracles
  • Protocol
Info
Source
ChefGPT
Expand
Share

Get Cookin'

133 downloads

Chains

Authors


Chainlink logo


GitHub tag (latest SemVer) GitHub license GitHub workflow changelog 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. Resources for Solidity developers can be found in the Chainlink Hardhat Box.

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.21.1, and add your GOPATH's bin directory to your PATH
    • Example Path for macOS export PATH=$GOPATH/bin:$PATH & export GOPATH=/Users/$USER/go
  2. Install NodeJS v16 & pnpm via npm.
    • 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
  3. Install Postgres (>= 11.x and <= 15.x).
    • You should configure Postgres to use SSL connection (or for testing you can set ?sslmode=disable in your Postgres query string).
  4. Ensure you have Python 3 installed (this is required by solc-select which is needed to compile solidity contracts)
  5. Download Chainlink: git clone https://github.com/smartcontractkit/chainlink && cd chainlink
  6. Build and install Chainlink: make install
  7. Run the node: chainlink help

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

Apple Silicon - ARM64

Native builds on the Apple Silicon should work out of the box, but the Docker image requires more consideration.

$ docker build . -t chainlink-develop:latest -f ./core/chainlink.Dockerfile

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.

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.

Development

Running tests

  1. Install pnpm 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. Build contracts:
pushd contracts
pnpm i
pnpm compile:native
popd
  1. Generate and compile static assets:
go generate ./...
  1. Prepare your development environment:
export CL_DATABASE_URL=postgresql://127.0.0.1:5432/chainlink_test?sslmode=disable

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

  1. Drop/Create test database and run migrations:
make testdb

If you do end up modifying the migrations for the database, you will need to rerun

  1. Run tests:
go test ./...

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 interferring 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

Solidity

Inside the contracts/ directory:

  1. Install dependencies:
pnpm i
  1. Run tests:
pnpm test

NOTE: Chainlink is currently in the process of migrating to Foundry and contains both Foundry and Hardhat tests in some versions. More information can be found here: Chainlink Foundry Documentation. Any 't.sol' files associated with Foundry tests, contained within the src directories will be ignored by Hardhat.

Code Generation

Go generate is used to generate mocks in this project. Mocks are generated with mockery and live in core/internal/mocks.

Nix

A shell.nix is provided for use with the Nix package manager, with optional flakes support. It defines a declarative, reproducible development environment. Flakes version use deterministic, frozen (flake.lock) dependencies, while non-flakes shell will use your channel's packages versions.

To use it:

  1. Install nix package manager in your system.
  1. Run nix-shell. You will be put in shell containing all the dependencies.
  • To use the flakes version, run nix develop instead of nix-shell. Optionally, nix develop --command $SHELL will make use of your current shell instead of the default (bash).
  • You can use direnv to enable it automatically when cd-ing into the folder; for that, enable nix-direnv and use nix or use flake on it.
  1. Create a local postgres database:
mkdir -p $PGDATA && cd $PGDATA/
initdb
pg_ctl -l postgres.log -o "--unix_socket_directories='$PWD'" start
createdb chainlink_test -h localhost
createuser --superuser --password chainlink -h localhost
# then type a test password, e.g.: chainlink, and set it in shell.nix CL_DATABASE_URL
  1. When re-entering project, you can restart postgres: cd $PGDATA; pg_ctl -l postgres.log -o "--unix_socket_directories='$PWD'" start Now you can run tests or compile code as usual.
  2. When you're done, stop it: cd $PGDATA; pg_ctl -o "--unix_socket_directories='$PWD'" stop

Tips

For more tips on how to build and test Chainlink, see our development tips page.

Contributing

Contributions are welcome to Chainlink's source code.

Please check out our contributing guidelines for more details.

Thank you!

Chainlink decentralized oracle networks provide tamper-proof inputs, outputs, and computations to support advanced smart contracts on any blockchain.
Aggregator.sol
Chainlink.sol
ChainlinkClient.sol
Chainlinked.sol
ERC677Token.sol
AggregatorInterface.sol
ChainlinkRequestInterface.sol
ENSInterface.sol
ERC20.sol
ERC20Basic.sol
ERC677.sol
ERC677Receiver.sol
LinkTokenInterface.sol
OracleInterface.sol
PointerInterface.sol
LinkToken.sol
Oracle.sol
BasicConsumer.sol
ConcreteChainlink.sol
ConcreteChainlinked.sol
Consumer.sol
EmptyOracle.sol
MaliciousChainlink.sol
MaliciousChainlinked.sol
MaliciousConsumer.sol
MaliciousRequester.sol
UpdatableConsumer.sol
BasicToken.sol
Buffer.sol
CBOR.sol
ENSResolver.sol
Ownable.sol
SafeMathChainlink.sol
SignedSafeMath.sol
StandardToken.sol
Chainlink.sol
ChainlinkClient.sol
Coordinator.sol
CoordinatorInterface.sol
OracleSignaturesDecoder.sol
ServiceAgreementDecoder.sol
ChainlinkRequestInterface.sol
ENSInterface.sol
LinkTokenInterface.sol
OracleInterface.sol
PointerInterface.sol
WithdrawalInterface.sol
LinkTokenReceiver.sol
Median.sol
Oracle.sol
BasicConsumer.sol
ChainlinkTestHelper.sol
Consumer.sol
EmptyAggregator.sol
MaliciousChainlink.sol
MaliciousChainlinkClient.sol
MaliciousConsumer.sol
MaliciousRequester.sol
MeanAggregator.sol
MedianTestHelper.sol
ServiceAgreementConsumer.sol
Buffer.sol
CBOR.sol
ENSResolver.sol
Ownable.sol
SafeMathChainlink.sol
SignedSafeMath.sol
AggregatorFacade.sol
AggregatorProxy.sol
Chainlink.sol
ChainlinkClient.sol
CheckedMath.sol
DeviationFlaggingValidator.sol
EACAggregatorProxy.sol
VRFD20.sol
Flags.sol
FluxAggregator.sol
AccessControllerInterface.sol
AggregatorInterface.sol
AggregatorV2V3Interface.sol
AggregatorV3Interface.sol
AggregatorValidatorInterface.sol
BlockHashStoreInterface.sol
ChainlinkRequestInterface.sol
ENSInterface.sol
FeedRegistryInterface.sol
FlagsInterface.sol
LinkTokenInterface.sol
OracleInterface.sol
PointerInterface.sol
WithdrawalInterface.sol
LinkTokenReceiver.sol
Median.sol
Oracle.sol
Owned.sol
SafeMath128.sol
SafeMath32.sol
SafeMath64.sol
SignedSafeMath.sol
SimpleReadAccessController.sol
SimpleWriteAccessController.sol
AggregatorValidatorMock.sol
BasicConsumer.sol
ChainlinkClientTestHelper.sol
ChainlinkTestHelper.sol
CheckedMathTestHelper.sol
ConcreteSignedSafeMath.sol
Consumer.sol
EmptyOracle.sol
FlagsTestHelper.sol
FluxAggregatorTestHelper.sol
GasGuzzlingConsumer.sol
MaliciousMultiWordConsumer.sol
MedianTestHelper.sol
MockETHLINKAggregator.sol
MockGASAggregator.sol
MockOracle.sol
MockV3Aggregator.sol
MultiWordConsumer.sol
TestAPIConsumer.sol
VRFConsumer.sol
VRFCoordinatorMock.sol
VRFRequestIDBaseTestHelper.sol
VRFTestHelper.sol
BufferChainlink.sol
CBORChainlink.sol
ENSResolver.sol
Ownable.sol
SafeMathChainlink.sol
VRF.sol
VRFConsumerBase.sol
VRFCoordinator.sol
VRFRequestIDBase.sol
AuthorizedForwarder.sol
AuthorizedReceiver.sol
Chainlink.sol
ChainlinkClient.sol
ConfirmedOwner.sol
ConfirmedOwnerWithProposal.sol
AggregatorProxy.sol
CompoundPriceFlaggingValidator.sol
StalenessFlaggingValidator.sol
AggregatorInterface.sol
AggregatorProxyInterface.sol
AggregatorV2V3Interface.sol
AggregatorV3Interface.sol
AuthorizedReceiverInterface.sol
ChainlinkRequestInterface.sol
ENSInterface.sol
FeedRegistryInterface.sol
FlagsInterface.sol
KeeperCompatibleInterface.sol
KeeperRegistryInterface.sol
LinkTokenInterface.sol
OperatorInterface.sol
OracleInterface.sol
OwnableInterface.sol
PointerInterface.sol
TypeAndVersionInterface.sol
UniswapAnchoredView.sol
WithdrawalInterface.sol
KeeperBase.sol
KeeperCompatible.sol
KeeperRegistry1_1.sol
LinkTokenReceiver.sol
Operator.sol
OperatorFactory.sol
ChainlinkClientTestHelper.sol
ChainlinkTestHelper.sol
ConfirmedOwnerTestHelper.sol
Consumer.sol
KeeperCompatibleTestHelper.sol
MockCompoundOracle.sol
MockV2Aggregator.sol
MockV3Aggregator.sol
MultiWordConsumer.sol
UpkeepAutoFunder.sol
UpkeepMock.sol
UpkeepReverter.sol
VRFCoordinatorMock.sol
UpkeepRegistrationRequests.sol
Address.sol
BufferChainlink.sol
CBORChainlink.sol
Context.sol
ENSResolver.sol
Pausable.sol
ReentrancyGuard.sol
SafeMath96.sol
SafeMathChainlink.sol
SignedSafeMath.sol
VRFConsumerBase.sol
VRFRequestIDBase.sol
FeedLookupCompatibleInterface.sol
SCA.sol
SCALibrary.sol
SmartContractAccountFactory.sol
SmartContractAccountHelper.sol
AutomationCompatibleInterface.sol
MercuryUpkeep.sol
ArbSys.sol
Helpers.sol
IAccount.sol
UserOperation.sol
Ownable.sol
Context.sol
ExecutionPrevention.sol
UpkeepFormat.sol
ConfirmedOwner.sol
ConfirmedOwnerWithProposal.sol
AutomationForwarder.sol
AutomationForwarderLogic.sol
AutomationRegistrar2_1.sol
AutomationUtils2_1.sol
Chainable.sol
IAutomationForwarder.sol
IAutomationRegistryConsumer.sol
IKeeperRegistryMaster.sol
ILogAutomation.sol
KeeperRegistry2_1.sol
KeeperRegistryBase2_1.sol
KeeperRegistryLogicA2_1.sol
KeeperRegistryLogicB2_1.sol
MockKeeperRegistry2_1.sol
UpkeepCounter.sol
StructFactory.sol
UpkeepTranscoder4_0.sol
DummyProtocol.sol
LogTriggeredFeedLookup.sol
AccessControllerInterface.sol
AggregatorV3Interface.sol
AutomationRegistryInterface2_0.sol
KeeperCompatibleInterface.sol
MigratableKeeperRegistryInterfaceV2.sol
UpkeepTranscoderInterface.sol
UpkeepTranscoderInterfaceV2.sol
ERC677ReceiverInterface.sol
ITypeAndVersion.sol
LinkTokenInterface.sol
OwnableInterface.sol
TypeAndVersionInterface.sol
IVerifier.sol
IVerifierProxy.sol
ErroredVerifier.sol
ExposedVerifier.sol
Verifier.sol
VerifierProxy.sol
OCR2Abstract.sol
AutomationConsumerBenchmark.sol
VerifiableLoadBase.sol
VerifiableLoadLogTriggerUpkeep.sol
VerifiableLoadMercuryUpkeep.sol
VerifiableLoadUpkeep.sol
ArbGasInfo.sol
OVM_GasPriceOracle.sol
IERC165.sol
Proxy.sol
Address.sol
EnumerableSet.sol
IL1CrossDomainMessenger.sol
IL2CrossDomainMessenger.sol
ICrossDomainMessenger.sol
Lib_OVMCodec.sol
Lib_RLPReader.sol
Lib_RLPWriter.sol
Lib_Bytes32Utils.sol
Lib_BytesUtils.sol
Initializable.sol
AddressUpgradeable.sol
IBeacon.sol
ERC1967Proxy.sol
ERC1967Upgrade.sol
Proxy.sol
ProxyAdmin.sol
TransparentUpgradeableProxy.sol
Pausable.sol
ReentrancyGuard.sol
Address.sol
StorageSlot.sol
EnumerableSet.sol
AggregatorV3Interface.sol
FlagsInterface.sol
AggregatorInterface.sol
AggregatorV2V3Interface.sol
AggregatorV3Interface.sol
FlagsInterface.sol
ArbSys.sol
AuthorizedReceiver.sol
AutomationBase.sol
AutomationCompatible.sol
KeeperBase.sol
KeeperCompatible.sol
ERC20BalanceMonitor.sol
UpkeepTranscoder.sol
Chainlink.sol
ChainlinkClient.sol
ChainSpecificUtil.sol
Denominations.sol
ArbitrumCrossDomainForwarder.sol
ArbitrumCrossDomainGovernor.sol
ArbitrumSequencerUptimeFeed.sol
ArbitrumValidator.sol
CrossDomainDelegateForwarder.sol
CrossDomainForwarder.sol
CrossDomainOwnable.sol
DerivedPriceFeed.sol
Flags.sol
ArbitrumSequencerUptimeFeedInterface.sol
CrossDomainOwnableInterface.sol
DelegateForwarderInterface.sol
FlagsInterface.sol
ForwarderInterface.sol
IArbitrumDelayedInbox.sol
IVRFCoordinatorV2Plus.sol
IVRFCoordinatorV2PlusMigration.sol
IVRFMigratableConsumerV2Plus.sol
IVRFMigratableCoordinatorV2Plus.sol
IVRFSubscriptionV2Plus.sol
OptimismSequencerUptimeFeedInterface.sol
VRFV2PlusWrapperInterface.sol
OCR2Abstract.sol
OCR2Base.sol
OptimismCrossDomainForwarder.sol
OptimismCrossDomainGovernor.sol
OptimismSequencerUptimeFeed.sol
OptimismValidator.sol
Paymaster.sol
Greeter.sol
VRFV2PlusClient.sol
SubscriptionAPI.sol
ExposedVRFCoordinatorV2Plus.sol
VRFConsumerV2PlusUpgradeableExample.sol
VRFCoordinatorV2Plus_V2Example.sol
VRFMaliciousConsumerV2Plus.sol
VRFV2PlusConsumerExample.sol
VRFV2PlusExternalSubOwnerExample.sol
VRFV2PlusRevertingExample.sol
VRFV2PlusSingleConsumerExample.sol
VRFV2PlusWrapperConsumerExample.sol
VRFConsumerBaseV2Plus.sol
VRFCoordinatorV2Plus.sol
VRFV2PlusWrapper.sol
VRFV2PlusWrapperConsumerBase.sol
VRFConsumerBaseV2Upgradeable.sol
Flags.sol
AuthorizedOriginReceiver.sol
AuthorizedOriginReceiverUpgradeable.sol
AuthorizedReceiver.sol
ConfirmedOwnerUpgradeable.sol
IAuthorizedOriginReceiver.sol
IAuthorizedReceiver.sol
FunctionsClientExample.sol
Functions.sol
FunctionsBillingRegistry.sol
FunctionsClient.sol
FunctionsOracle.sol
IFunctionsBillingRegistry.sol
IFunctionsClient.sol
IFunctionsOracle.sol
OCR2Abstract.sol
OCR2Base.sol
OCR2BaseUpgradeable.sol
ITermsOfServiceAllowList.sol
TermsOfServiceAllowList.sol
FunctionsClientExample.sol
Functions.sol
FunctionsBilling.sol
FunctionsClient.sol
FunctionsCoordinator.sol
FunctionsRouter.sol
FunctionsSubscriptions.sol
HasRouter.sol
FulfillResultCodes.sol
IConfigurable.sol
IFunctionsBilling.sol
IFunctionsClient.sol
IFunctionsCoordinator.sol
IFunctionsRouter.sol
IFunctionsSubscriptions.sol
IOwnableRouter.sol
IRouterBase.sol
OCR2Abstract.sol
OCR2Base.sol
RouterBase.sol
AuthorizedOriginReceiverTestHelper.sol
AuthorizedReceiverTestHelper.sol
FunctionsBillingRegistryWithInit.sol
FunctionsClientTestHelper.sol
FunctionsOracleHelper.sol
FunctionsOracleMigrationHelper.sol
FunctionsOracleOriginalHelper.sol
FunctionsOracleUpgradeableHelper.sol
FunctionsOracleWithInit.sol
FunctionsTestHelper.sol
AuthorizedOriginReceiverInterface.sol
AuthorizedOriginReceiverUpgradeable.sol
AuthorizedReceiver.sol
AuthorizedReceiverInterface.sol
ConfirmedOwnerUpgradeable.sol
FunctionsBillingRegistryInterface.sol
FunctionsBillingRegistryMigration.sol
FunctionsBillingRegistryOriginal.sol
FunctionsClientInterface.sol
FunctionsOracleInterface.sol
FunctionsOracleMigration.sol
FunctionsOracleOriginal.sol
OCR2Abstract.sol
OCR2BaseUpgradeable.sol
FunctionsClientTestHelper.sol
FunctionsCoordinatorTestHelper.sol
FunctionsTestHelper.sol
AggregatorInterface.sol
AggregatorV2V3Interface.sol
AggregatorValidatorInterface.sol
AutomationRegistryInterface1_2.sol
KeeperRegistryInterface1_2.sol
AutomationRegistryInterface1_3.sol
MigratableKeeperRegistryInterface.sol
BlockhashStoreInterface.sol
ChainlinkRequestInterface.sol
ENSInterface.sol
FeedRegistryInterface.sol
FlagsInterface.sol
IAuthorizedReceiver.sol
OperatorInterface.sol
OracleInterface.sol
PointerInterface.sol
PoRAddressList.sol
VRFCoordinatorV2Interface.sol
VRFV2WrapperInterface.sol
KeepersVRFConsumer.sol
FunctionsBillingRegistryEventsMock.sol
FunctionsOracleEventsMock.sol
MockAggregatorValidator.sol
MockLinkToken.sol
VRFCoordinatorMock.sol
VRFCoordinatorV2Mock.sol
IAccessController.sol
IOwnable.sol
ITypeAndVersion.sol
SimpleReadAccessController.sol
SimpleWriteAccessController.sol
Broken.sol
ChainlinkClientTestHelper.sol
ChainlinkTestHelper.sol
Counter.sol
FeedConsumer.sol
FlagsTestHelper.sol
Greeter.sol
KeeperCompatibleTestHelper.sol
LogEmitter.sol
MockArbitrumInbox.sol
MockETHLINKAggregator.sol
MockOptimismL1CrossDomainMessenger.sol
MockOptimismL2CrossDomainMessenger.sol
MockV3Aggregator.sol
utils.sol
ValidatorProxy.sol
Buffer.sol
iOVM_CrossDomainMessenger.sol
IBridge.sol
IInbox.sol
IMessageProvider.sol
AddressAliasHelper.sol
BufferChainlink.sol
CBORChainlink.sol
DateTime.sol
ENSResolver.sol
EntryPoint.sol
SenderCreator.sol
StakeManager.sol
IAggregator.sol
IEntryPoint.sol
IPaymaster.sol
IStakeManager.sol
Exec.sol
MockOVMCrossDomainMessenger.sol
MultiSend.sol
Initializable.sol
PausableUpgradeable.sol
AddressUpgradeable.sol
ContextUpgradeable.sol
Pausable.sol
IERC20Permit.sol
IERC20.sol
SafeERC20.sol
Address.sol
Context.sol
Context.sol
EnumerableMap.sol
Pausable.sol
Address.sol
Context.sol
SafeCast.sol
EnumerableSet.sol
CBOR.sol
Strings.sol
VRFConsumer.sol
VRFConsumerV2.sol
VRFConsumerV2UpgradeableExample.sol
VRFCoordinatorV2TestHelper.sol
VRFExternalSubOwnerExample.sol
VRFLoadTestExternalSubOwner.sol
VRFLoadTestOwnerlessConsumer.sol
VRFMaliciousConsumerV2.sol
VRFOwnerlessConsumerExample.sol
VRFRequestIDBaseTestHelper.sol
VRFSingleConsumerExample.sol
VRFTestHelper.sol
VRFV2LoadTestWithMetrics.sol
VRFV2ProxyAdmin.sol
VRFV2RevertingExample.sol
VRFV2TransparentUpgradeableProxy.sol
VRFV2WrapperConsumerExample.sol
VRFV2WrapperOutOfGasConsumerExample.sol
VRFV2WrapperRevertingConsumerExample.sol
VRFV2WrapperUnderFundingConsumer.sol
VRF.sol
VRFConsumerBase.sol
VRFConsumerBaseV2.sol
VRFRequestIDBase.sol
VRFV2Wrapper.sol
VRFV2WrapperConsumerBase.sol
KeeperRegistrar1_2.sol
KeeperRegistry1_2.sol
KeeperRegistryCheckUpkeepGasUsageWrapper1_2.sol
KeeperRegistry1_3.sol
KeeperRegistryBase1_3.sol
KeeperRegistryLogic1_3.sol
KeeperRegistrar2_0.sol
KeeperRegistry2_0.sol
KeeperRegistryBase2_0.sol
KeeperRegistryLogic2_0.sol
HeartbeatRequester.sol
MockAggregator.sol
MockAggregatorProxy.sol
CronUpkeep.sol
CronUpkeepDelegate.sol
CronUpkeepFactory.sol
EthBalanceMonitor.sol
CanaryUpkeep1_2.sol
LogUpkeepCounter.sol
LinkAvailableBalanceMonitor.sol
UpkeepTranscoder3_0.sol
BlockhashStore.sol
BatchVRFCoordinatorV2Plus.sol
VRFSubscriptionBalanceMonitor.sol
Cron.sol
Cron.sol
MockArbSys.sol
MockOffchainAggregator.sol
PermissionedForwardProxy.sol
CronReceiver.sol
CronTestHelper.sol
CronUpkeepTestHelper.sol
ERC20BalanceMonitorExposed.sol
EthBalanceMonitorExposed.sol
MockArbGasInfo.sol
MockOVMGasPriceOracle.sol
ReceiveEmitter.sol
ReceiveFallbackEmitter.sol
ReceiveReverter.sol
OVM_GasPriceOracle.sol
BatchBlockhashStore.sol
BatchVRFCoordinatorV2.sol
VRFSubscriptionBalanceMonitorExposed.sol
VRFOwner.sol
VRFTypes.sol