• This repository has been archived on 08/Jun/2022
  • Stars
    star
    157
  • Rank 238,399 (Top 5 %)
  • Language
    Ruby
  • License
    MIT License
  • Created about 8 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Easily connect your applications to blockchains

ChainLink Code Climate Join the chat at https://gitter.im/smartcontractkit-chainlink/Lobby

API

See the API documentation for more details about the API.

Overview

Assignments

Assignments are the main model for defining work to be done by ChainLink. An Assignment specifies a series of processing steps, Subtasks, which form a processing pipeline. Assignments include up front configuration for the Subtask pipeline, as well as instructions on when and how the Assignment can be triggered to run.

Snapshots

Whenever an Assignment is triggered to run, a Snapshot is created. The Snapshot is the record of the work that was done, and the steps taken along the way to reach the final Snapshot result.

Snapshots can be triggered either through upfront scheduling of the Assignment and/or by on demand requests through any of the Adapters.

Subtasks

Assignments are made up of a sequence of Subtasks. Subtasks are small specialized processes, designed to be modular and reusable with many other types of Subtasks.

Every time a Snapshot is created it starts by processing the first Subtask. The result of each Subtask is fed into the next Subtask, until the final Subtask is processed. The result of the final Subtask becomes the result of the entire Snapshot.

Data is passed between Subtasks as a JSON payload. By convention the main field that information is read from is stored as the top level key value, but other keys can be used and additional information can be stored in their payload.

Subtasks are initially configured when an assignment is defined, but they can also be dynamically configured with the data passed in from previous Subtasks.

Adapters

The processing work for each Subtask is handled by its Adapter. Adapters are where the processing and communication with external services happens. Subtasks are specific configurations of how work is to be handled by an Adapter.

ChainLink ships with a few adapters built in, but additional External Adapters can be created to add custom functionality. External Adapters are external services, which are communicated with via HTTP. External Adapters allow for functionality of ChainLink to be easily extended and can be written in which ever language is best suited. Conforming to a minimal HTTP interface is the only requirement for creating your custom External Adapters.

The Adapters that ship with ChainLink core are:

  • bitcoinComparisonJSON Returns a signed Bitcoin transaction. Signs either a completion transaction or a failure transaction based on a value comparison of the input.
  • ethereumBytes32 Formats the input as Ethereum bytes32 value and writes it into the specified contract. Returns the unformatted value that was provided as input.
  • ethereumInt256 Formats the input as Ethereum int256 value and writes it into the specified contract. Returns the unformatted value that was provided as input.
  • ethereumUint256 Formats the input as Ethereum uint256 value and writes it into the specified contract. Returns the unformatted value that was provided as input.
  • ethereumFormatted Writes a preformatted Ethereum hexadecimal value into the blockchain as configured. Returns the preformatted value that was provided as input.
  • ethereumLogWatcher Returns the data field of an Ethereum event log, if one is provided. Otherwise, returns the value that was provided as the input. (Requires WeiWatchers integration.)
  • httpGetJSON Retrieves JSON and returns the specific field selected in the configuration.
  • jsonReceiver Generates a URL for the oracle to receive JSON push notifications. Parses the pushed JSON and returns the specific field selected in the configuration.

If you are interested in other types of Adapters feel free to reach out.

Adapter Schemas

Adapter Schemas allow for Adapters to be modular enough to be used with many types of Adapters, but still remain reliable when used with other Adapters that may not even be defined yet. Adapter Schemas are JSON Schemas that specify the input requirements and output formats of each adapter. For more information on the various schemas used by ChainLink check out the Schemas repo.

Development

Requirements

  • ruby(v2.0.0+)
  • postgres(v9.3+)

Install

git clone https://github.com/oraclekit/chainlink && cd chainlink
gem install bundler && bundle
rake db:create db:migrate

Start

foreman start

Testing

To run the full test suite, including integration tests, you need an instance of DevNet running on your machine. This requires first installing Parity. Once Parity is installed, run the following commands:

git clone https://github.com/oraclekit/devnet.git
cd devnet
./start

Then to run the full test suite run:

rake

Or test a specific test:

rspec spec/models/assignment_spec.rb:57

More Repositories

1

full-blockchain-solidity-course-js

Learn Blockchain, Solidity, and Full Stack Web3 Development with Javascript
12,549
star
2

full-blockchain-solidity-course-py

Ultimate Solidity, Blockchain, and Smart Contract - Beginner to Expert Full Course | Python Edition
10,703
star
3

chainlink

node of the decentralized oracle network, bridging on and off-chain computation
Go
6,990
star
4

hardhat-starter-kit

A repo for boilerplate code for testing, deploying, and shipping chainlink solidity code.
JavaScript
1,203
star
5

chainlink-mix

Working with smart contracts with eth-brownie, python, and Chainlink.
Solidity
484
star
6

defi-minimal

This repo is dedicated to making minimal repos of existing defi primatives.
JavaScript
473
star
7

documentation

https://docs.chain.link The Chainlink developer documentation website for Smart Contract Devs and Node Operators
MDX
406
star
8

foundry-starter-kit

Solidity
331
star
9

external-adapters-js

Monorepo containing JavaScript implementation of external adapters
TypeScript
270
star
10

truffle-starter-kit

An example smart contract utilizing Chainlink
JavaScript
258
star
11

starter-kits

A repo of starter kits for working with various languages and frameworks across the smart contract ecosystem.
238
star
12

foundry-starter-kit-old

Solidity
204
star
13

smart-contract-examples

Example and sample projects
Solidity
188
star
14

solana-starter-kit

Example code for using Chainlink on Solana
JavaScript
172
star
15

chainlink-brownie-contracts

A repository for automatically using the latest chainlink repo from the core chainlink repo.
Solidity
168
star
16

Web3_tutorial_Chinese

Solidity
152
star
17

functions-hardhat-starter-kit

JavaScript
148
star
18

chainlink-polkadot

Go
139
star
19

LinkToken

LINK Token Contracts for the Chainlink Network
Solidity
132
star
20

ccip

Cross Chain Interoperability Protocol
Go
122
star
21

huff-starter-kit

A template repo to work with huff smart contracts and learn about low level EVM opcodes. Also Horse β™˜.
Solidity
101
star
22

apeworx-starter-kit

A repo dedicated to showing how to make smart contracts in a purely pythonic environment
Python
90
star
23

chainlink-solana

Go
81
star
24

blockchain-developer-hub

Dive into blockchain and smart contract development.
JavaScript
80
star
25

ccip-starter-kit-foundry

This project demonstrates a couple of basic Chainlink CCIP use cases
Solidity
75
star
26

chainlink-fullstack

Full stack starter project showcasing Chainlink products on Ethereum (EVM)
TypeScript
68
star
27

libocr

libocr consists of a Go library and a set of Solidity smart contracts that implement the Chainlink Offchain Reporting Protocol
Go
68
star
28

hardhat-chainlink

Integrates Chainlink into Hardhat projects. This package is currently in the BETA testing phase and is not recommended for production usage yet.
TypeScript
65
star
29

solidity-cborutils

A library for encoding CBOR in Solidity.
Solidity
64
star
30

dapptools-starter-kit

Solidity
63
star
31

ccip-cross-chain-nft

This project demonstrates how to mint an NFT on one blockchain from another blockchain using Chainlink CCIP
Solidity
62
star
32

ccip-read

TypeScript
60
star
33

chainlink-testing-framework

A testing framework for smart contracts and Chainlink nodes
Go
60
star
34

foundry-chainlink-toolkit

A plugin to use Chainlink products/services in Foundry
Solidity
59
star
35

chainlink-starknet

Go
58
star
36

ccip-starter-kit-hardhat

This project demonstrates a couple of basic Chainlink CCIP use cases
TypeScript
58
star
37

prediction-game

Rugby prediction game using Chainlink Functions, Automation, and CCIP.
TypeScript
56
star
38

chainlink-local

The Chainlink CCIP Local Simulator, visit documentation by clicking the link below:
Solidity
49
star
39

ccip-defi-lending

CCIP Launch Defi Demo
JavaScript
46
star
40

smart-contract-db

This repository is an archive. This project has been superseded by blockchain.education https://github.com/smartcontractkit/blockchain-developer-hub
TypeScript
44
star
41

external-initiator

Initiate Chainlink job runs from external sources
Go
39
star
42

chainlink-solana-demo

Showing how to deploy a Solana program using Chainlink Price Feeds
TypeScript
37
star
43

chainlink-automation-templates

Real-world sample projects using Chainlink Automation
Solidity
35
star
44

usechainlinkfunctions

TypeScript
31
star
45

functions-toolkit

An NPM package with collection of tools that can be used for working with Chainlink Functions.
TypeScript
26
star
46

near-protocol-contracts

Rust
26
star
47

chainlink-common

SDK for building Chainlink Services and Plugins
Go
25
star
48

chainlink-cosmos

Go
25
star
49

env-enc

TypeScript
25
star
50

ccip-cross-chain-name-service

This project is an educational example of how to create a minimal cross-chain name service using Chainlink CCIP
TypeScript
25
star
51

functions-deepdive-constellation2023

Deepdive Workshop For Constellation 2023 Hackathon
JavaScript
24
star
52

run-functions-dapp

Demo dApp using Chainlink Functions to bring web2 data on-chain.
TypeScript
24
star
53

wasp

Protocol-agnostic load testing library for Go
Go
24
star
54

devnet

An Ethereum development network with preset configs for easy testing.
Makefile
22
star
55

Blockchain-RPC-Exporter

Prometheus exporter for EVM compatible RPC endpoints.
Python
20
star
56

ccip-owner-contracts

A set of smart contracts used for administering Chainlink contracts, most notably CCIP
Solidity
18
star
57

chainlink-functions-demo-app

TypeScript
18
star
58

schemas

specification for offering and requesting off-blockchain services
17
star
59

paypal-adapter

TypeScript
17
star
60

chainlink-github-actions

Common action to run chainlink-testing-framework based tests in github ci
TypeScript
16
star
61

risk-management-network

Rust
16
star
62

wei_watchers

A service for push notifications of Ethereum logs and account balances.
Ruby
15
star
63

chain-selectors

Go
15
star
64

arbitrum-quickstart

JavaScript
14
star
65

ccip-tic-tac-toe

TypeScript
14
star
66

solc-api

minimal Solidity compiler service
JavaScript
14
star
67

chainlink-env

Chainlink k8s environment library
Go
14
star
68

datastreams-demo

Demo dApp using Chainlink Data Streams.
TypeScript
13
star
69

operator-ui

TypeScript
13
star
70

hello_chainlink

chainlink demos
JavaScript
12
star
71

chainlink-staking-v0.2-public-guide

12
star
72

wsrpc

A bi-directional Websockets RPC library
Go
12
star
73

quickstarts-historical-prices-api

TypeScript
12
star
74

functions-lens-eventbrite

Solidity
12
star
75

tdh2

An implementation of the TDH2 protocol by Shoup & Gennaro (paper link https://www.shoup.net/papers/thresh1.pdf)
Go
11
star
76

chainlink-RSK

Solidity
11
star
77

functions-the-graph-uniswap

Solidity
11
star
78

rwa-tokenization

TypeScript
11
star
79

chainlink-automation

Go
10
star
80

chainlink-data-streams

Go
10
star
81

workshop-distributed-news

Solidity
10
star
82

solana-prediction-game

JavaScript
10
star
83

builder

A docker build file for chainlink
Dockerfile
10
star
84

chainlink-vrf

OCR2VRF (in development, do not use in production)
Go
10
star
85

ccip-liquidation-protector

This project demonstrates how to automate preventing DeFi liquidations & optimizing interest rates on multiple blockchains using Chainlink CCIP, Chainlink Automation and Chainlink Functions
TypeScript
10
star
86

cairo-starter-kit

The boilerplate code for getting started with the usage of Chainlink services on Starknet
TypeScript
9
star
87

ea-framework-js

TypeScript
9
star
88

hardhat-network

Deploys a basic hardhat chain for testing
Dockerfile
9
star
89

bq-example-contract

JavaScript
8
star
90

.github

TypeScript
8
star
91

chainlink-node-compose

Docker Compose script for launching multiple chainlink nodes
Shell
8
star
92

substrate-adapter

Go
7
star
93

link-token-sidechain-evm

LINK Token On EVM Sidechains
Solidity
7
star
94

push-gha-metrics-action

Shell
7
star
95

DEVREL-collaborative-nft-tutorial

Solidity
7
star
96

blockchain-ecosystem-map

JavaScript
7
star
97

timelock-worker

Daemon to poll and execute scheduled transactions from a Timelock contract.
Go
7
star
98

chainlink-solhint-rules

CLL custom Solhint rules
JavaScript
7
star
99

functions-google-bigquery

Demonstration of accessing data from Google BigQuery via Chainlink Functions
JavaScript
6
star
100

chainlink-terra-feeds-demo

Showing how to deploy a Terra smart contract which utilizes Chainlink Data Feeds
Rust
6
star