chainlink: github.com/smartcontractkit/chainlink/core/cmd Index | Files

package cmd

import "github.com/smartcontractkit/chainlink/core/cmd"

Package cmd is the front-end interface for the application as a command-line utility.

KeyStoreAuthenticator

KeyStoreAuthenticator prompts the user for their password, which is used to unlock their keystore file to interact with the Ethereum blockchain. Since multiple keystore files can exist at the configured directory, the KeyStoreAuthenticator will try the password on all keystore files present.

Client

Client is how the application is invoked from the command line. When you run the binary, for example `./chainlink n`, client.RunNode is called to start the Chainlink core. Similarly, running `./chainlink j` returns information on all jobs in the node, and `./chainlink s` with another argument as a JobID gives information specific to that job.

Renderer

Renderer helps format and display data (based on the kind of data it is) to the command line.

Index

Package Files

app.go client.go doc.go enclave.go key_store_authenticator.go local_client.go local_client_vrf.go prompter.go remote_client.go renderer.go

Variables

var (
    // ErrorNoAPICredentialsAvailable is returned when not run from a terminal
    // and no API credentials have been provided
    ErrorNoAPICredentialsAvailable = errors.New("API credentials must be supplied")
)

func InitEnclave Uses

func InitEnclave() error

InitEnclave is a stub in non SGX enabled builds.

func NewApp Uses

func NewApp(client *Client) *cli.App

NewApp returns the command-line parser/function-router for the given client

type APIInitializer Uses

type APIInitializer interface {
    // Initialize creates a new user for API access, or does nothing if one exists.
    Initialize(store *store.Store) (models.User, error)
}

APIInitializer is the interface used to create the API User credentials needed to access the API. Does nothing if API user already exists.

func NewFileAPIInitializer Uses

func NewFileAPIInitializer(file string) APIInitializer

NewFileAPIInitializer creates a concrete instance of APIInitializer that pulls API user credentials from the passed file path.

func NewPromptingAPIInitializer Uses

func NewPromptingAPIInitializer(prompter Prompter) APIInitializer

NewPromptingAPIInitializer creates a concrete instance of APIInitializer that uses the terminal to solicit credentials from the user.

type AppFactory Uses

type AppFactory interface {
    NewApplication(*orm.Config, ...func(chainlink.Application)) chainlink.Application
}

AppFactory implements the NewApplication method.

type ChainlinkAppFactory Uses

type ChainlinkAppFactory struct{}

ChainlinkAppFactory is used to create a new Application.

func (ChainlinkAppFactory) NewApplication Uses

func (n ChainlinkAppFactory) NewApplication(config *orm.Config, onConnectCallbacks ...func(chainlink.Application)) chainlink.Application

NewApplication returns a new instance of the node with the given config.

type ChainlinkRunner Uses

type ChainlinkRunner struct{}

ChainlinkRunner is used to run the node application.

func (ChainlinkRunner) Run Uses

func (n ChainlinkRunner) Run(app chainlink.Application) error

Run sets the log level based on config and starts the web router to listen for input and return data.

type ChangePasswordPrompter Uses

type ChangePasswordPrompter interface {
    Prompt() (models.ChangePasswordRequest, error)
}

ChangePasswordPrompter is an interface primarily used for DI to obtain a password change request from the User.

func NewChangePasswordPrompter Uses

func NewChangePasswordPrompter() ChangePasswordPrompter

NewChangePasswordPrompter returns the production password change request prompter

type Client Uses

type Client struct {
    Renderer
    Config                         *orm.Config
    AppFactory                     AppFactory
    KeyStoreAuthenticator          KeyStoreAuthenticator
    FallbackAPIInitializer         APIInitializer
    Runner                         Runner
    HTTP                           HTTPClient
    CookieAuthenticator            CookieAuthenticator
    FileSessionRequestBuilder      SessionRequestBuilder
    PromptingSessionRequestBuilder SessionRequestBuilder
    ChangePasswordPrompter         ChangePasswordPrompter
    PasswordPrompter               PasswordPrompter
}

Client is the shell for the node, local commands and remote commands.

func (*Client) ArchiveJobSpec Uses

func (cli *Client) ArchiveJobSpec(c *clipkg.Context) error

ArchiveJobSpec soft deletes a job and its associated runs.

func (*Client) CancelJobRun Uses

func (cli *Client) CancelJobRun(c *clipkg.Context) error

CancelJob cancels a running job

func (*Client) ChangePassword Uses

func (cli *Client) ChangePassword(c *clipkg.Context) error

ChangePassword prompts the user for the old password and a new one, then posts it to Chainlink to change the password.

func (*Client) CreateAndExportWeakVRFKey Uses

func (cli *Client) CreateAndExportWeakVRFKey(c *clipkg.Context) error

CreateAndExportWeakVRFKey creates a key in the VRF keystore, protected by the password in the password file, but with weak key-derivation-function parameters, which makes it cheaper for testing, but also more vulnerable to bruteforcing of the encyrpted key material. For testing purposes only!

The key is only stored at the specified file location, not stored in the DB.

func (*Client) CreateBridge Uses

func (cli *Client) CreateBridge(c *clipkg.Context) error

CreateBridge adds a new bridge to the chainlink node

func (*Client) CreateExternalInitiator Uses

func (cli *Client) CreateExternalInitiator(c *clipkg.Context) error

CreateExternalInitiator adds an external initiator

func (*Client) CreateExtraKey Uses

func (cli *Client) CreateExtraKey(c *clipkg.Context) error

CreateExtraKey creates a new ethereum key with the same password as the one used to unlock the existing key.

func (*Client) CreateJobRun Uses

func (cli *Client) CreateJobRun(c *clipkg.Context) error

CreateJobRun creates job run based on SpecID and optional JSON

func (*Client) CreateJobSpec Uses

func (cli *Client) CreateJobSpec(c *clipkg.Context) error

CreateJobSpec creates a JobSpec based on JSON input

func (*Client) CreateServiceAgreement Uses

func (cli *Client) CreateServiceAgreement(c *clipkg.Context) error

CreateServiceAgreement creates a ServiceAgreement based on JSON input

func (*Client) CreateVRFKey Uses

func (cli *Client) CreateVRFKey(c *clipkg.Context) error

CreateVRFKey creates a key in the VRF keystore, protected by the password in the password file

func (*Client) DeleteExternalInitiator Uses

func (cli *Client) DeleteExternalInitiator(c *clipkg.Context) error

DeleteExternalInitiator removes an external initiator

func (*Client) DeleteUser Uses

func (cli *Client) DeleteUser(c *clipkg.Context) error

DeleteUser is run locally to remove the User row from the node's database.

func (*Client) DeleteVRFKey Uses

func (cli *Client) DeleteVRFKey(c *clipkg.Context) error

DeleteVRFKey deletes the VRF key with given public key from the db

Since this runs in an independent process from any chainlink node, it cannot cause running nodes to forget the key, if they already have it unlocked.

func (*Client) DisplayAccountBalance Uses

func (cli *Client) DisplayAccountBalance(c *clipkg.Context) error

DisplayAccountBalance renders a table containing the active account address with it's ETH & LINK balance

func (*Client) ExportVRFKey Uses

func (cli *Client) ExportVRFKey(c *clipkg.Context) error

ExportVRFKey saves encrypted copy of VRF key with given public key to requested file path.

func (*Client) GetConfiguration Uses

func (cli *Client) GetConfiguration(c *clipkg.Context) error

GetConfiguration gets the nodes environment variables

func (*Client) ImportKey Uses

func (cli *Client) ImportKey(c *clipkg.Context) error

ImportKey imports a key to be used with the chainlink node

func (*Client) ImportVRFKey Uses

func (cli *Client) ImportVRFKey(c *clipkg.Context) error

ImportVRFKey reads a file into an EncryptedSecretKey in the db

func (*Client) IndexBridges Uses

func (cli *Client) IndexBridges(c *clipkg.Context) error

IndexBridges returns all bridges.

func (*Client) IndexJobRuns Uses

func (cli *Client) IndexJobRuns(c *clipkg.Context) error

IndexJobRuns returns the list of all job runs for a specific job if no jobid is passed, defaults to returning all jobruns

func (*Client) IndexJobSpecs Uses

func (cli *Client) IndexJobSpecs(c *clipkg.Context) error

IndexJobSpecs returns all job specs.

func (*Client) IndexTransactions Uses

func (cli *Client) IndexTransactions(c *clipkg.Context) error

IndexTransactions returns the list of transactions in descending order, taking an optional page parameter

func (*Client) IndexTxAttempts Uses

func (cli *Client) IndexTxAttempts(c *clipkg.Context) error

IndexTxAttempts returns the list of transactions in descending order, taking an optional page parameter

func (*Client) ListKeys Uses

func (cli *Client) ListKeys(c *clipkg.Context) error

ListKeys Lists the keys in the db

func (*Client) RebroadcastTransactions Uses

func (cli *Client) RebroadcastTransactions(c *clipkg.Context) error

RebroadcastTransactions run locally to force manual rebroadcasting of transactions in a given nonce range. This MUST NOT be run concurrently with the node. Currently the advisory lock in FindAllTxsInNonceRange prevents this.

func (*Client) RemoteLogin Uses

func (cli *Client) RemoteLogin(c *clipkg.Context) error

RemoteLogin creates a cookie session to run remote commands.

func (*Client) RemoveBridge Uses

func (cli *Client) RemoveBridge(c *clipkg.Context) error

RemoveBridge removes a specific Bridge by name.

func (*Client) RunNode Uses

func (cli *Client) RunNode(c *clipkg.Context) error

RunNode starts the Chainlink core.

func (*Client) SendEther Uses

func (cli *Client) SendEther(c *clipkg.Context) error

SendEther transfers ETH from the node's account to a specified address.

func (*Client) SetMinimumGasPrice Uses

func (cli *Client) SetMinimumGasPrice(c *clipkg.Context) error

SetMinimumGasPrice specifies the minimum gas price to use for outgoing transactions

func (*Client) ShowBridge Uses

func (cli *Client) ShowBridge(c *clipkg.Context) error

ShowBridge returns the info for the given Bridge name.

func (*Client) ShowJobRun Uses

func (cli *Client) ShowJobRun(c *clipkg.Context) error

ShowJobRun returns the status of the given Jobrun.

func (*Client) ShowJobSpec Uses

func (cli *Client) ShowJobSpec(c *clipkg.Context) error

ShowJobSpec returns the status of the given JobID.

func (*Client) ShowTransaction Uses

func (cli *Client) ShowTransaction(c *clipkg.Context) error

ShowTransaction returns the info for the given transaction hash

func (*Client) Withdraw Uses

func (cli *Client) Withdraw(c *clipkg.Context) error

Withdraw will withdraw LINK to an address authorized by the node

type CookieAuthenticator Uses

type CookieAuthenticator interface {
    Cookie() (*http.Cookie, error)
    Authenticate(models.SessionRequest) (*http.Cookie, error)
}

CookieAuthenticator is the interface to generating a cookie to authenticate future HTTP requests.

func NewSessionCookieAuthenticator Uses

func NewSessionCookieAuthenticator(config *orm.Config, store CookieStore) CookieAuthenticator

NewSessionCookieAuthenticator creates a SessionCookieAuthenticator using the passed config and builder.

type CookieStore Uses

type CookieStore interface {
    Save(cookie *http.Cookie) error
    Retrieve() (*http.Cookie, error)
}

CookieStore is a place to store and retrieve cookies.

type DiskCookieStore Uses

type DiskCookieStore struct {
    Config *orm.Config
}

DiskCookieStore saves a single cookie in the local cli working directory.

func (DiskCookieStore) Retrieve Uses

func (d DiskCookieStore) Retrieve() (*http.Cookie, error)

Retrieve returns any Saved cookies.

func (DiskCookieStore) Save Uses

func (d DiskCookieStore) Save(cookie *http.Cookie) error

Save stores a cookie.

type HTTPClient Uses

type HTTPClient interface {
    Get(string, ...map[string]string) (*http.Response, error)
    Post(string, io.Reader) (*http.Response, error)
    Put(string, io.Reader) (*http.Response, error)
    Patch(string, io.Reader, ...map[string]string) (*http.Response, error)
    Delete(string) (*http.Response, error)
}

HTTPClient encapsulates all methods used to interact with a chainlink node API.

func NewAuthenticatedHTTPClient Uses

func NewAuthenticatedHTTPClient(config orm.ConfigReader, cookieAuth CookieAuthenticator) HTTPClient

NewAuthenticatedHTTPClient uses the CookieAuthenticator to generate a sessionID which is then used for all subsequent HTTP API requests.

type KeyStoreAuthenticator Uses

type KeyStoreAuthenticator interface {
    Authenticate(*store.Store, string) (string, error)
    AuthenticateVRFKey(*store.Store, string) error
}

KeyStoreAuthenticator implements the Authenticate method for the store and a password string.

type MemoryCookieStore Uses

type MemoryCookieStore struct {
    Cookie *http.Cookie
}

MemoryCookieStore keeps a single cookie in memory

func (*MemoryCookieStore) Retrieve Uses

func (m *MemoryCookieStore) Retrieve() (*http.Cookie, error)

Retrieve returns any Saved cookies.

func (*MemoryCookieStore) Save Uses

func (m *MemoryCookieStore) Save(cookie *http.Cookie) error

Save stores a cookie.

type PasswordPrompter Uses

type PasswordPrompter interface {
    Prompt() string
}

PasswordPrompter is an interface primarily used for DI to obtain a password from the User.

func NewPasswordPrompter Uses

func NewPasswordPrompter() PasswordPrompter

NewPasswordPrompter returns the production password change request prompter

type Prompter Uses

type Prompter interface {
    Prompt(string) string
    PasswordPrompt(string) string
    IsTerminal() bool
}

Prompter implements the Prompt function to be used to display at the console.

func NewTerminalPrompter Uses

func NewTerminalPrompter() Prompter

NewTerminalPrompter prompts the user via terminal.

type Renderer Uses

type Renderer interface {
    Render(interface{}) error
}

Renderer implements the Render method.

type RendererJSON Uses

type RendererJSON struct {
    io.Writer
}

RendererJSON is used to render JSON data.

func (RendererJSON) Render Uses

func (rj RendererJSON) Render(v interface{}) error

Render writes the given input as a JSON string.

type RendererTable Uses

type RendererTable struct {
    io.Writer
}

RendererTable is used for data to be rendered as a table.

func (RendererTable) Render Uses

func (rt RendererTable) Render(v interface{}) error

Render returns a formatted table of text for a given Job or presenter and relevant information.

type Runner Uses

type Runner interface {
    Run(chainlink.Application) error
}

Runner implements the Run method.

type SessionCookieAuthenticator Uses

type SessionCookieAuthenticator struct {
    // contains filtered or unexported fields
}

SessionCookieAuthenticator is a concrete implementation of CookieAuthenticator that retrieves a session id for the user with credentials from the session request.

func (*SessionCookieAuthenticator) Authenticate Uses

func (t *SessionCookieAuthenticator) Authenticate(sessionRequest models.SessionRequest) (*http.Cookie, error)

Authenticate retrieves a session ID via a cookie and saves it to disk.

func (*SessionCookieAuthenticator) Cookie Uses

func (t *SessionCookieAuthenticator) Cookie() (*http.Cookie, error)

Cookie Returns the previously saved authentication cookie.

type SessionRequestBuilder Uses

type SessionRequestBuilder interface {
    Build(flag string) (models.SessionRequest, error)
}

SessionRequestBuilder is an interface that returns a SessionRequest, abstracting how session requests are generated, whether they be from the prompt or from a file.

func NewFileSessionRequestBuilder Uses

func NewFileSessionRequestBuilder() SessionRequestBuilder

NewFileSessionRequestBuilder pulls credentials from a file to generate a SessionRequest.

func NewPromptingSessionRequestBuilder Uses

func NewPromptingSessionRequestBuilder(prompter Prompter) SessionRequestBuilder

NewPromptingSessionRequestBuilder uses a prompter, often via terminal, to solicit information from a user to generate the SessionRequest.

type TerminalKeyStoreAuthenticator Uses

type TerminalKeyStoreAuthenticator struct {
    Prompter Prompter
}

TerminalKeyStoreAuthenticator contains fields for prompting the user and an exit code.

func (TerminalKeyStoreAuthenticator) Authenticate Uses

func (auth TerminalKeyStoreAuthenticator) Authenticate(store *store.Store, pwd string) (string, error)

Authenticate checks to see if there are accounts present in the KeyStore, and if there are none, a new account will be created by prompting for a password. If there are accounts present, the account which is unlocked by the given password will be used.

func (TerminalKeyStoreAuthenticator) AuthenticateVRFKey Uses

func (auth TerminalKeyStoreAuthenticator) AuthenticateVRFKey(store *store.Store,
    password string) error

AuthenticateVRFKey creates an encrypted VRF key protected by password in store's db if db store has no extant keys. It unlocks at least one VRF key with given password, or returns an error. password must be non-trivial, as an empty password signifies that the VRF oracle functionality is disabled.

Package cmd imports 43 packages (graph). Updated 2020-04-01. Refresh now. Tools for package owners.

The go get command cannot install this package because of the following issues: