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.
CallerSubscriberClient ¶
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
- func PromUpdateEthBalance(balance *assets.Eth, from common.Address)
- type HeadTrackable
- type InMemoryKeyStore
- type KeyStore
- func (ks *KeyStore) GetAccountByAddress(address common.Address) (accounts.Account, error)
- func (ks *KeyStore) GetAccounts() []accounts.Account
- func (ks *KeyStore) GetFirstAccount() (accounts.Account, error)
- func (ks *KeyStore) HasAccounts() bool
- func (ks *KeyStore) NewAccount(passphrase string) (accounts.Account, error)
- func (ks *KeyStore) SignHash(hash common.Hash) (models.Signature, error)
- func (ks *KeyStore) SignTx(account accounts.Account, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)
- func (ks *KeyStore) Unlock(phrase string) error
- type KeyStoreInterface
- type NotifyNewEthTx
- type Store
- type VRFKeyStore
- func (ks *VRFKeyStore) Archive(key vrfkey.PublicKey) (err error)
- func (ks *VRFKeyStore) CreateKey(phrase string) (vrfkey.PublicKey, error)
- func (ks *VRFKeyStore) CreateWeakInMemoryEncryptedKeyXXXTestingOnly(phrase string) (*vrfkey.EncryptedVRFKey, error)
- func (ks *VRFKeyStore) Delete(key vrfkey.PublicKey) (err error)
- func (ks *VRFKeyStore) Forget(k vrfkey.PublicKey) error
- func (ks *VRFKeyStore) GenerateProof(k vrfkey.PublicKey, i vrf.PreSeedData) (vrf.MarshaledOnChainResponse, error)
- func (ks *VRFKeyStore) Get(k ...vrfkey.PublicKey) ([]*vrfkey.EncryptedVRFKey, error)
- func (ks *VRFKeyStore) GetSpecificKey(k vrfkey.PublicKey) (*vrfkey.EncryptedVRFKey, error)
- func (ks *VRFKeyStore) Import(keyjson []byte, auth string) error
- func (ks *VRFKeyStore) ListKeys() (publicKeys []*vrfkey.PublicKey, err error)
- func (ks *VRFKeyStore) Store(key *vrfkey.PrivateKey, phrase string, scryptParams utils.ScryptParams) error
- func (ks *VRFKeyStore) StoreInMemoryXXXTestingOnly(key *vrfkey.PrivateKey)
- func (ks *VRFKeyStore) Unlock(phrase string) (keysUnlocked []vrfkey.PublicKey, merr error)
Constants ¶
const (
// AutoMigrate is a flag that automatically migrates the DB when passed to initializeORM
AutoMigrate = "auto_migrate"
)
const EthereumMessageHashPrefix = "\x19Ethereum Signed Message:\n32"
EthereumMessageHashPrefix is a Geth-originating message prefix that seeks to prevent arbitrary message data to be representable as a valid Ethereum transaction For more information, see: https://github.com/ethereum/go-ethereum/issues/3731
Variables ¶
var AttemptToDeleteNonExistentKeyFromDB = errors.New("key is not present in DB")
AttemptToDeleteNonExistentKeyFromDB is returned when Delete is asked to delete a key it can't find in the DB.
var MatchingVRFKeyError = errors.New(
`key with matching public key already stored in DB`)
MatchingVRFKeyError is returned when Import attempts to import key with a PublicKey matching one already in the database
var Sha = "unset"
Sha string "unset"
var Version = "unset"
Version the version of application
Functions ¶
Types ¶
type HeadTrackable ¶
type HeadTrackable interface { Connect(head *models.Head) error Disconnect() OnNewLongestChain(ctx context.Context, head models.Head) }
HeadTrackable represents any object that wishes to respond to ethereum events, after being attached to HeadTracker.
type InMemoryKeyStore ¶
type InMemoryKeyStore = map[vrfkey.PublicKey]vrfkey.PrivateKey
type KeyStore ¶
KeyStore manages a key storage directory on disk.
func NewInsecureKeyStore ¶
NewInsecureKeyStore creates an *INSECURE* keystore for the given directory. NOTE: Should only be used for testing!
func NewKeyStore ¶
func NewKeyStore(keyDir string, scryptParams utils.ScryptParams) *KeyStore
NewKeyStore creates a keystore for the given directory.
func (*KeyStore) GetAccountByAddress ¶
GetAccountByAddress returns the account matching the address provided, or an error if it is missing
func (*KeyStore) GetAccounts ¶
GetAccounts returns all accounts
func (*KeyStore) GetFirstAccount ¶
GetFirstAccount 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) NewAccount ¶
NewAccount adds an account to the keystore
func (*KeyStore) SignHash ¶
SignHash signs a precomputed digest, using the first account's private key This method adds an ethereum message prefix to the message before signing it, invalidating any would-be valid Ethereum transactions
type KeyStoreInterface ¶
type KeyStoreInterface interface { Accounts() []accounts.Account Wallets() []accounts.Wallet GetFirstAccount() (accounts.Account, error) HasAccounts() bool Unlock(phrase string) error NewAccount(passphrase string) (accounts.Account, error) SignHash(hash common.Hash) (models.Signature, error) Import(keyJSON []byte, passphrase, newPassphrase string) (accounts.Account, error) Export(a accounts.Account, passphrase, newPassphrase string) ([]byte, error) GetAccounts() []accounts.Account GetAccountByAddress(common.Address) (accounts.Account, error) SignTx(account accounts.Account, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error) }
type NotifyNewEthTx ¶
type NotifyNewEthTx interface {
Trigger()
}
NotifyNewEthTx allows to notify the ethBroadcaster of a new transaction
type Store ¶
type Store struct { *orm.ORM Config *orm.Config Clock utils.AfterNower KeyStore KeyStoreInterface VRFKeyStore *VRFKeyStore OCRKeyStore *offchainreporting.KeyStore EthClient eth.Client NotifyNewEthTx NotifyNewEthTx AdvisoryLocker postgres.AdvisoryLocker // contains filtered or unexported fields }
Store contains fields for the database, Config, and KeyStore for keeping the application state in sync with the database.
func NewInsecureStore ¶
func NewInsecureStore(config *orm.Config, ethClient eth.Client, advisoryLocker postgres.AdvisoryLocker, shutdownSignal gracefulpanic.Signal) *Store
NewInsecureStore creates a new store with the given config using an insecure keystore. NOTE: Should only be used for testing!
func NewStore ¶
func NewStore(config *orm.Config, ethClient eth.Client, advisoryLock postgres.AdvisoryLocker, shutdownSignal gracefulpanic.Signal) *Store
NewStore will create a new store
func (*Store) AuthorizedUserWithSession ¶
AuthorizedUserWithSession will return the one API user if the Session ID exists and hasn't expired, and update session's LastUsed field.
func (*Store) SyncDiskKeyStoreToDB ¶
SyncDiskKeyStoreToDB writes all keys in the keys directory to the underlying orm.
type VRFKeyStore ¶
type VRFKeyStore struct {
// contains filtered or unexported fields
}
VRFKeyStore tracks auxiliary VRF secret keys, and generates their VRF proofs
VRF proofs need access to the actual secret key, which geth does not expose. Similar to the way geth's KeyStore exposes signing capability, VRFKeyStore exposes VRF proof generation without the caller needing explicit knowledge of the secret key.
func NewVRFKeyStore ¶
func NewVRFKeyStore(store *Store) *VRFKeyStore
NewVRFKeyStore returns an empty VRFKeyStore
func (*VRFKeyStore) Archive ¶
func (ks *VRFKeyStore) Archive(key vrfkey.PublicKey) (err error)
Archive soft-deletes keys with this public key from the keystore and the DB, if present.
func (*VRFKeyStore) CreateKey ¶
func (ks *VRFKeyStore) CreateKey(phrase string) (vrfkey.PublicKey, error)
CreateKey returns a public key which is immediately unlocked in memory, and saved in DB encrypted with phrase. If p is given, its parameters are used for key derivation from the phrase.
func (*VRFKeyStore) CreateWeakInMemoryEncryptedKeyXXXTestingOnly ¶
func (ks *VRFKeyStore) CreateWeakInMemoryEncryptedKeyXXXTestingOnly(phrase string) (*vrfkey.EncryptedVRFKey, error)
CreateWeakInMemoryEncryptedKeyXXXTestingOnly is for testing only! It returns an encrypted key which is fast to unlock, but correspondingly easy to brute force. It is not persisted to the DB, because no one should be keeping such keys lying around.
func (*VRFKeyStore) Delete ¶
func (ks *VRFKeyStore) Delete(key vrfkey.PublicKey) (err error)
Delete removes keys with this public key from the keystore and the DB, if present.
func (*VRFKeyStore) GenerateProof ¶
func (ks *VRFKeyStore) GenerateProof(k vrfkey.PublicKey, i vrf.PreSeedData) ( vrf.MarshaledOnChainResponse, error)
GenerateProof is marshaled randomness proof given k and VRF input seed computed from the SeedData
Key must have already been unlocked in ks, as constructing the VRF proof requires the secret key.
func (*VRFKeyStore) Get ¶
func (ks *VRFKeyStore) Get(k ...vrfkey.PublicKey) ([]*vrfkey.EncryptedVRFKey, error)
Get retrieves all EncryptedVRFKey's associated with k, or all encrypted keys if k is nil, or errors
func (*VRFKeyStore) GetSpecificKey ¶
func (ks *VRFKeyStore) GetSpecificKey( k vrfkey.PublicKey) (*vrfkey.EncryptedVRFKey, error)
func (*VRFKeyStore) Import ¶
func (ks *VRFKeyStore) Import(keyjson []byte, auth string) error
Import adds this encrypted key to the DB and unlocks it in in-memory store with passphrase auth, and returns any resulting errors
func (*VRFKeyStore) ListKeys ¶
func (ks *VRFKeyStore) ListKeys() (publicKeys []*vrfkey.PublicKey, err error)
ListKeys lists the public keys contained in the db
func (*VRFKeyStore) Store ¶
func (ks *VRFKeyStore) Store(key *vrfkey.PrivateKey, phrase string, scryptParams utils.ScryptParams) error
Store saves key to ks (in memory), and to the DB, encrypted with phrase
func (*VRFKeyStore) StoreInMemoryXXXTestingOnly ¶
func (ks *VRFKeyStore) StoreInMemoryXXXTestingOnly(key *vrfkey.PrivateKey)
StoreInMemoryXXXTestingOnly memorizes key, only in in-memory store.
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. |
vrfkey
Package vrfkey tracks the secret keys associated with VRF proofs.
|
Package vrfkey tracks the secret keys associated with VRF proofs. |
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. |