Documentation ¶
Overview ¶
Package store is used to keep application events in sync between the database on the node and the blockchain.
Config ¶
Config contains the local configuration options that the application will adhere to.
EthClient ¶
This makes use of Go-Ethereum's functions to interact with the blockchain. The underlying functions can be viewed here:
go-ethereum/rpc/client.go
KeyStore ¶
KeyStore also utilizes Go-Ethereum's functions to store encrypted keys on the local file system. The underlying functions can be viewed here:
go-ethereum/accounts/keystore/keystore.go
Store ¶
The Store is the persistence layer for the application. It saves the the application state and most interaction with the node needs to occur through the store.
Tx Manager ¶
The transaction manager is used to syncronize interactions on the Ethereum blockchain with the application and database.
Index ¶
- Constants
- Variables
- type AfterNower
- type CallerSubscriber
- type Clock
- type Config
- type EthClient
- func (eth *EthClient) GetBlockNumber() (uint64, error)
- func (eth *EthClient) GetEthBalance(address common.Address) (float64, error)
- func (eth *EthClient) GetNonce(address common.Address) (uint64, error)
- func (eth *EthClient) GetTxReceipt(hash common.Hash) (*TxReceipt, error)
- func (eth *EthClient) GetWeiBalance(address common.Address) (*big.Int, error)
- func (eth *EthClient) SendRawTx(hex string) (common.Hash, error)
- func (eth *EthClient) SubscribeToLogs(channel chan<- types.Log, q ethereum.FilterQuery) (models.EthSubscription, error)
- func (eth *EthClient) SubscribeToNewHeads(channel chan<- models.BlockHeader) (models.EthSubscription, error)
- type KeyStore
- type LogLevel
- type Store
- type TxManager
- type TxReceipt
Constants ¶
const Version string = "0.2.0"
Variables ¶
var Sha string = "unset"
Functions ¶
This section is empty.
Types ¶
type AfterNower ¶
AfterNower is an interface that fulfills the `After()` and `Now()` methods.
type CallerSubscriber ¶
type CallerSubscriber interface { Call(result interface{}, method string, args ...interface{}) error EthSubscribe(context.Context, interface{}, ...interface{}) (models.EthSubscription, error) }
CallerSubscriber implements the Call and EthSubscribe functions. Call performs a JSON-RPC call with the given arguments and EthSubscribe registers a subscription.
type Clock ¶
type Clock struct{}
Clock is a basic type for scheduling events in the application.
type Config ¶
type Config struct { LogLevel LogLevel `env:"LOG_LEVEL" envDefault:"info"` RootDir string `env:"ROOT" envDefault:"~/.chainlink"` Port string `env:"PORT" envDefault:"6688"` BasicAuthUsername string `env:"USERNAME" envDefault:"chainlink"` BasicAuthPassword string `env:"PASSWORD" envDefault:"twochains"` EthereumURL string `env:"ETH_URL" envDefault:"ws://localhost:8546"` ChainID uint64 `env:"ETH_CHAIN_ID" envDefault:"0"` ClientNodeURL string `env:"CLIENT_NODE_URL" envDefault:"http://localhost:6688"` EthMinConfirmations uint64 `env:"ETH_MIN_CONFIRMATIONS" envDefault:"12"` EthGasBumpThreshold uint64 `env:"ETH_GAS_BUMP_THRESHOLD" envDefault:"12"` EthGasBumpWei big.Int `env:"ETH_GAS_BUMP_WEI" envDefault:"5000000000"` EthGasPriceDefault big.Int `env:"ETH_GAS_PRICE_DEFAULT" envDefault:"20000000000"` }
Config holds parameters used by the application which can be overridden by setting environment variables.
type EthClient ¶
type EthClient struct {
CallerSubscriber
}
EthClient holds the CallerSubscriber interface for the Ethereum blockchain.
func (*EthClient) GetBlockNumber ¶
GetBlockNumber returns the block number of the chain head.
func (*EthClient) GetEthBalance ¶
func (*EthClient) GetTxReceipt ¶
GetTxReceipt returns the transaction receipt for the given transaction hash.
func (*EthClient) GetWeiBalance ¶
func (*EthClient) SubscribeToLogs ¶
func (eth *EthClient) SubscribeToLogs( channel chan<- types.Log, q ethereum.FilterQuery, ) (models.EthSubscription, error)
SubscribeToLogs registers a subscription for push notifications of logs from a given address.
func (*EthClient) SubscribeToNewHeads ¶
func (eth *EthClient) SubscribeToNewHeads( channel chan<- models.BlockHeader, ) (models.EthSubscription, error)
SubscribeToNewHeads registers a subscription for push notifications of new blocks.
type KeyStore ¶
KeyStore manages a key storage directory on disk.
func NewKeyStore ¶
NewKeyStore creates a keystore for the given directory.
func (*KeyStore) GetAccount ¶
GetAccount returns the unlocked account in the KeyStore object. The client ensures that an account exists during authentication.
func (*KeyStore) HasAccounts ¶
HasAccounts returns true if there are accounts located at the keystore directory.
func (*KeyStore) SignTx ¶
func (ks *KeyStore) SignTx(tx *types.Transaction, chainID uint64) (*types.Transaction, error)
SignTx uses the unlocked account to sign the given transaction.
type Store ¶
type Store struct { *models.ORM Config Config Clock AfterNower Exiter func(int) KeyStore *KeyStore TxManager *TxManager // contains filtered or unexported fields }
Store contains fields for the database, Config, KeyStore, and TxManager for keeping the application state in sync with the database.
type TxManager ¶
TxManager contains fields for the Ethereum client, the KeyStore, the local Config for the application, and the database.
type TxReceipt ¶
type TxReceipt struct { BlockNumber hexutil.Big `json:"blockNumber"` Hash common.Hash `json:"transactionHash"` }
TxReceipt holds the block number and the transaction hash of a signed transaction that has been written to the blockchain.
func (*TxReceipt) Unconfirmed ¶
Unconfirmed returns true if the transaction is not confirmed.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package models contain the key job components used by the Chainlink application.
|
Package models contain the key job components used by the Chainlink application. |
Package presenters allow for the specification and result of a Job, its associated TaskSpecs, and every JobRun and TaskRun to be returned in a user friendly human readable format.
|
Package presenters allow for the specification and result of a Job, its associated TaskSpecs, and every JobRun and TaskRun to be returned in a user friendly human readable format. |