db

package
v1.58.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2024 License: GPL-3.0 Imports: 63 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_FAMILY                        = "f"
	VALIDATOR_BALANCES_FAMILY             = "vb"
	VALIDATOR_HIGHEST_ACTIVE_INDEX_FAMILY = "ha"
	ATTESTATIONS_FAMILY                   = "at"
	PROPOSALS_FAMILY                      = "pr"
	SYNC_COMMITTEES_FAMILY                = "sc"
	INCOME_DETAILS_COLUMN_FAMILY          = "id"
	STATS_COLUMN_FAMILY                   = "stats"
	MACHINE_METRICS_COLUMN_FAMILY         = "mm"
	SERIES_FAMILY                         = "series"

	SUM_COLUMN = "sum"

	MAX_CL_BLOCK_NUMBER = 1000000000 - 1
	MAX_EL_BLOCK_NUMBER = 1000000000
	MAX_EPOCH           = 1000000000 - 1

	MAX_BATCH_MUTATIONS   = 100000
	DEFAULT_BATCH_INSERTS = 10000

	REPORT_TIMEOUT = time.Second * 10
)
View Source
const (
	DATA_COLUMN                    = "d"
	INDEX_COLUMN                   = "i"
	DEFAULT_FAMILY_BLOCKS          = "default"
	METADATA_UPDATES_FAMILY_BLOCKS = "blocks"
	ACCOUNT_METADATA_FAMILY        = "a"
	CONTRACT_METADATA_FAMILY       = "c"
	ERC20_METADATA_FAMILY          = "erc20"
	ERC721_METADATA_FAMILY         = "erc721"
	ERC1155_METADATA_FAMILY        = "erc1155"
	TX_PER_BLOCK_LIMIT             = 10_000
	ITX_PER_TX_LIMIT               = 100_000
	MAX_INT                        = 9223372036854775807
	MIN_INT                        = -9223372036854775808
)
View Source
const (
	ACCOUNT_COLUMN_NAME = "NAME"
	ACCOUNT_IS_CONTRACT = "ISCONTRACT"

	CONTRACT_NAME = "CONTRACTNAME"
	CONTRACT_ABI  = "ABI"

	ERC20_COLUMN_DECIMALS    = "DECIMALS"
	ERC20_COLUMN_TOTALSUPPLY = "TOTALSUPPLY"
	ERC20_COLUMN_SYMBOL      = "SYMBOL"

	ERC20_COLUMN_PRICE = "PRICE"

	ERC20_COLUMN_NAME           = "NAME"
	ERC20_COLUMN_DESCRIPTION    = "DESCRIPTION"
	ERC20_COLUMN_LOGO_FORMAT    = "LOGOFORMAT"
	ERC20_COLUMN_LINK           = "LINK"
	ERC20_COLUMN_OGIMAGE        = "OGIMAGE"
	ERC20_COLUMN_OGIMAGE_FORMAT = "OGIMAGEFORMAT"
)
View Source
const (
	// see https://cloud.google.com/bigtable/docs/using-filters#timestamp-range
	TIMESTAMP_GBT_SCALE = 1000
	// tests showed it's possible to have 36900+ subcalls per tx, but very unlikely - save a bit
	TIMESTAMP_TRACE_SCALE = 1 << 15
	// 30m gas / 21.000 gas per transfer = 1428
	TIMESTAMP_TX_SCALE = 1 << 11
	// 64 - (10 bits for TIMESTAMP_GBT_SCALE + TIMESTAMP_TRACE_SCALE + TIMESTAMP_TX_SCALE)
	// = 28 bits left; with a block time of 12s, that's enough for 50+ years
	TIMESTAMP_BLOCK_SCALE = 1 << (64 - (10 + 15 + 11))
)
View Source
const BlsChangeQueryLimit = 10000
View Source
const DefaultInfScrollRows = 25
View Source
const (
	ECR20TokensPerAddressLimit = uint64(200) // when changing this, you will have to update the swagger docu for func ApiEth1Address too

)
View Source
const MaxSqlInteger = 2147483647
View Source
const WithdrawalsQueryLimit = 10000

Variables

View Source
var (
	ERC20TOPIC   []byte
	ERC721TOPIC  []byte
	ERC1155Topic []byte
)
View Source
var (
	GASNOW_RAPID_COLUMN    = "RAPI"
	GASNOW_FAST_COLUMN     = "FAST"
	GASNOW_STANDARD_COLUMN = "STAN"
	GASNOW_SLOW_COLUMN     = "SLOW"
)
View Source
var DBPGX *pgxpool.Conn
View Source
var EmbedMigrations embed.FS
View Source
var ErrBlockNotFound = errors.New("block not found")
View Source
var ErrNoStats = errors.New("no stats available")
View Source
var FrontendReaderDB *sqlx.DB

FrontendWriterDB is a pointer to the auth-database

View Source
var FrontendWriterDB *sqlx.DB
View Source
var ReaderDb *sqlx.DB
View Source
var WriterDb *sqlx.DB

DB is a pointer to the explorer-database

View Source
var ZERO_ADDRESS []byte = []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}

Functions

func AddAuthorizeCode

func AddAuthorizeCode(userId uint64, code, clientId string, appId uint64) error

AddAuthorizeCode registers a code that can be used in exchange for an access token

func AddSubscription

func AddSubscription(userID uint64, network string, eventName types.EventName, eventFilter string, eventThreshold float64) error

AddSubscription adds a new subscription to the database.

func AddSubscriptionBatch

func AddSubscriptionBatch(userID uint64, network string, eventName types.EventName, eventFilter []string, eventThreshold float64) error

AddSubscription adds a new subscription to the database.

func AddToWatchlist

func AddToWatchlist(watchlist []WatchlistEntry, network string) error

func ApplyEmbeddedDbSchema

func ApplyEmbeddedDbSchema(version int64) error

func CalculateMevFromBlock

func CalculateMevFromBlock(block *types.Eth1Block) *big.Int

func CalculateTxFeeFromTransaction

func CalculateTxFeeFromTransaction(tx *types.Eth1Transaction, blockBaseFee *big.Int) *big.Int

func CalculateTxFeesFromBlock

func CalculateTxFeesFromBlock(block *types.Eth1Block) *big.Int

func ChangeProductIDFromStripe

func ChangeProductIDFromStripe(tx *sql.Tx, stripeSubscriptionID string, productID string) error

func CheckIfDayIsFinalized

func CheckIfDayIsFinalized(day uint64) error

func CountSentMail

func CountSentMail(email string) error

CountSentMail increases the count of sent mails in the table `mails_sent` for this day.

func CreateAPIKey

func CreateAPIKey(userID uint64) error

CreateAPIKey creates an API key for the user and saves it to the database

func CreateBLSToExecutionChangesNodeJob

func CreateBLSToExecutionChangesNodeJob(nj *types.NodeJob) (*types.NodeJob, error)

func CreateNodeJob

func CreateNodeJob(data []byte) (*types.NodeJob, error)

func CreateVoluntaryExitNodeJob

func CreateVoluntaryExitNodeJob(nj *types.NodeJob) (*types.NodeJob, error)

func DeleteAdConfiguration

func DeleteAdConfiguration(id string) error

delete ad configuration

func DeleteAllSubscription

func DeleteAllSubscription(userID uint64, network string, eventName types.EventName) error

func DeleteSubscription

func DeleteSubscription(userID uint64, network string, eventName types.EventName, eventFilter string) error

DeleteSubscription removes a subscription from the database.

func DeleteSubscriptionBatch

func DeleteSubscriptionBatch(userID uint64, network string, eventName types.EventName, eventFilter []string) error

func DeleteUserByEmail

func DeleteUserByEmail(email string) error

DeleteUserByEmail deletes a user.

func DeleteUserById

func DeleteUserById(id uint64) error

DeleteUserById deletes a user.

func DisableAllSubscriptionsFromStripeUser

func DisableAllSubscriptionsFromStripeUser(stripeCustomerID string) error

func GatherStatisticsForDay

func GatherStatisticsForDay(day int64) ([]*types.ValidatorStatsTableDbRow, error)

func GatherValidatorSyncDutiesForDay

func GatherValidatorSyncDutiesForDay(validators []uint64, day uint64, data []*types.ValidatorStatsTableDbRow, mux *sync.Mutex) error

func GetActiveValidatorCount

func GetActiveValidatorCount() (uint64, error)

GetActiveValidatorCount will return the total-validator-count

func GetAdConfigurations

func GetAdConfigurations() ([]*types.AdConfig, error)

get all ad configurations

func GetAdConfigurationsForTemplate

func GetAdConfigurationsForTemplate(ids []string, noAds bool) ([]*types.AdConfig, error)

get the ad configuration for a specific template that are active

func GetAddressForEnsName

func GetAddressForEnsName(name string) (address *common.Address, err error)

func GetAddressWithdrawalTableData

func GetAddressWithdrawalTableData(address []byte, pageToken string, currency string) (*types.DataTableResponse, error)

GetAddressWithdrawalTableData returns the withdrawal data for an address

func GetAddressWithdrawalsTotal

func GetAddressWithdrawalsTotal(address []byte) (uint64, error)

GetAddressWithdrawalsTotal returns the total withdrawals for an address

func GetAllAppSubscriptions

func GetAllAppSubscriptions() ([]*types.PremiumData, error)

func GetAllSlots

func GetAllSlots(tx *sqlx.Tx) ([]uint64, error)

func GetAppDataFromRedirectUri

func GetAppDataFromRedirectUri(callback string) (*types.OAuthAppData, error)

GetAppNameFromRedirectUri receives an oauth redirect_url and returns the registered app name, if exists

func GetAppSubscriptionCount

func GetAppSubscriptionCount(userID uint64) (int64, error)

func GetBLSChangeCount

func GetBLSChangeCount() (uint64, error)

func GetBLSChanges

func GetBLSChanges(query string, length, start uint64, orderBy, orderDir string) ([]*types.BLSChange, error)

func GetBLSChangesCountForQuery

func GetBLSChangesCountForQuery(query string) (uint64, error)

func GetBlockNumber

func GetBlockNumber(slot uint64) (block uint64, err error)

func GetBlockStatus

func GetBlockStatus(block int64, latestFinalizedEpoch uint64, epochInfo *types.EpochInfo) error

func GetByRefreshToken

func GetByRefreshToken(claimUserID, claimAppID, claimDeviceID uint64, hashedRefreshToken string) (uint64, error)

GetByRefreshToken basically used to confirm the claimed user id with the refresh token. Returns the userId if successful

func GetCurrentDayClIncome

func GetCurrentDayClIncome(validator_indices []uint64) (map[uint64]int64, error)

func GetDashboardWithdrawals

func GetDashboardWithdrawals(validators []uint64, limit uint64, offset uint64, orderBy string, orderDir string) ([]*types.Withdrawals, error)

func GetDataTablesState

func GetDataTablesState(user uint64, key string) (*types.DataTableSaveState, error)

GetDataTablesState retrieves the state for a given user and table

func GetEnsExpiration

func GetEnsExpiration(client *ethclient.Client, name string) (time.Time, error)

func GetEnsNameForAddress

func GetEnsNameForAddress(address common.Address) (name string, err error)

func GetEnsNamesForAddress

func GetEnsNamesForAddress(addressMap map[string]string) error

func GetEpochWithdrawals

func GetEpochWithdrawals(epoch uint64) ([]*types.WithdrawalsNotification, error)

func GetEpochWithdrawalsTotal

func GetEpochWithdrawalsTotal(epoch uint64) (total uint64, err error)

func GetEth1DepositsJoinEth2Deposits

func GetEth1DepositsJoinEth2Deposits(query string, length, start uint64, orderBy, orderDir string, latestEpoch, validatorOnlineThresholdSlot uint64) ([]*types.EthOneDepositsData, uint64, error)

func GetEth1DepositsLeaderboard

func GetEth1DepositsLeaderboard(query string, length, start uint64, orderBy, orderDir string) ([]*types.EthOneDepositLeaderboardData, uint64, error)

func GetEth2Deposits

func GetEth2Deposits(query string, length, start uint64, orderBy, orderDir string) ([]*types.EthTwoDepositData, uint64, error)

func GetExplorerConfigurations

func GetExplorerConfigurations() ([]*types.ExplorerConfig, error)

get all explorer configurations

func GetFirstActivationEpoch

func GetFirstActivationEpoch(validators []uint64, firstActivationEpoch *uint64) error

func GetHistoricalPrice

func GetHistoricalPrice(chainId uint64, currency string, day uint64) (float64, error)

func GetLastExportedStatisticDay

func GetLastExportedStatisticDay() (uint64, error)

func GetLastWithdrawalEpoch

func GetLastWithdrawalEpoch(validators []uint64) (map[uint64]uint64, error)

func GetLatestEpoch

func GetLatestEpoch() (uint64, error)

GetLatestEpoch will return the latest epoch from the database

func GetLatestFinalizedEpoch

func GetLatestFinalizedEpoch() (uint64, error)

Get latest finalized epoch

func GetMailsSentCount

func GetMailsSentCount(email string, t time.Time) (int, error)

GetMailsSentCount returns the number of sent mails for the day of the passed time.

func GetMissedSlots

func GetMissedSlots(slots []uint64) ([]uint64, error)

func GetMissedSlotsMap

func GetMissedSlotsMap(slots []uint64) (map[uint64]bool, error)

func GetMostRecentWithdrawalValidator

func GetMostRecentWithdrawalValidator() (uint64, error)

func GetNodeJob

func GetNodeJob(id string) (*types.NodeJob, error)

func GetNodeJobValidatorInfos

func GetNodeJobValidatorInfos(job *types.NodeJob) ([]types.NodeJobValidatorInfo, error)

func GetOrphanedSlots

func GetOrphanedSlots(slots []uint64) ([]uint64, error)

func GetOrphanedSlotsMap

func GetOrphanedSlotsMap(slots []uint64) (map[uint64]bool, error)

func GetPendingBLSChangeValidatorCount

func GetPendingBLSChangeValidatorCount() (uint64, error)

func GetPendingValidatorCount

func GetPendingValidatorCount() (uint64, error)

GetPendingValidatorCount queries the pending validators currently in the queue

func GetQueueAheadOfValidator

func GetQueueAheadOfValidator(validatorIndex uint64) (uint64, error)

func GetRelayDataForIndexedBlocks

func GetRelayDataForIndexedBlocks(blocks []*types.Eth1BlockIndexed) (map[common.Hash]types.RelaysData, error)

func GetSlashingCount

func GetSlashingCount() (uint64, error)

func GetSlotBLSChange

func GetSlotBLSChange(slot uint64) ([]*types.BLSChange, error)

func GetSlotVizData

func GetSlotVizData(latestEpoch uint64) ([]*types.SlotVizEpochs, error)

func GetSlotWithdrawals

func GetSlotWithdrawals(slot uint64) ([]*types.Withdrawals, error)

func GetSubsForEventFilter

func GetSubsForEventFilter(eventName types.EventName) ([][]byte, map[string][]types.Subscription, error)

func GetSubscriptions

func GetSubscriptions(filter GetSubscriptionsFilter) ([]*types.Subscription, error)

GetSubscriptions returns the subscriptions filtered by the provided filter.

func GetSyncParticipationBySlotRange

func GetSyncParticipationBySlotRange(startSlot, endSlot uint64) (map[uint64]uint64, error)

Returns the participation rate for every slot between startSlot and endSlot (both inclusive) as a map with the slot as key

If a slot is missed, the map will not contain an entry for it

func GetTaggedValidators

func GetTaggedValidators(filter WatchlistFilter) ([]*types.TaggedValidators, error)

GetTaggedValidators returns validators that were tagged by a user

func GetTotalAmountDeposited

func GetTotalAmountDeposited() (uint64, error)

func GetTotalAmountWithdrawn

func GetTotalAmountWithdrawn() (sum uint64, count uint64, err error)

func GetTotalBLSChanges

func GetTotalBLSChanges() (uint64, error)

func GetTotalEligibleEther

func GetTotalEligibleEther() (uint64, error)

func GetTotalValidatorDeposits

func GetTotalValidatorDeposits(validators []uint64, totalDeposits *uint64) error

func GetTotalValidatorsCount

func GetTotalValidatorsCount() (uint64, error)

GetTotalValidatorsCount will return the total-validator-count

func GetTotalWithdrawals

func GetTotalWithdrawals() (total uint64, err error)

func GetTotalWithdrawalsCount

func GetTotalWithdrawalsCount(validators []uint64) (uint64, error)

func GetUserAPIKeyStatistics

func GetUserAPIKeyStatistics(apikey *string) (*types.ApiStatistics, error)

func GetUserApiKeyById

func GetUserApiKeyById(id uint64) (string, error)

func GetUserAuthDataByAuthorizationCode

func GetUserAuthDataByAuthorizationCode(code string) (*types.OAuthCodeData, error)

GetUserAuthDataByAuthorizationCode checks an oauth code for validity, consumes the code and returns the userId on success

func GetUserDevicesByUserID

func GetUserDevicesByUserID(userID uint64) ([]types.PairedDevice, error)

func GetUserEmailById

func GetUserEmailById(id uint64) (string, error)

GetUserEmailById returns the email of a user.

func GetUserEmailsByIds

func GetUserEmailsByIds(ids []uint64) (map[uint64]string, error)

GetUserEmailsByIds returns the emails of users.

func GetUserIdByApiKey

func GetUserIdByApiKey(apiKey string) (*types.UserWithPremium, error)

func GetUserMonitorSharingSetting

func GetUserMonitorSharingSetting(userID uint64) (bool, error)

func GetUserPremiumSubscription

func GetUserPremiumSubscription(id uint64) (types.UserPremiumSubscription, error)

func GetUserPushTokenByIds

func GetUserPushTokenByIds(ids []uint64) (map[uint64][]string, error)

func GetUserSubscriptionIDByStripe

func GetUserSubscriptionIDByStripe(stripeSubscriptionID string) (uint64, error)

func GetValidatorActivationBalance

func GetValidatorActivationBalance(validators []uint64, balance *uint64) error

func GetValidatorAttestationHistoryForNotifications

func GetValidatorAttestationHistoryForNotifications(startEpoch uint64, endEpoch uint64) (map[types.Epoch]map[types.ValidatorIndex]bool, error)

Should be used when retrieving data for a very large amount of validators (for the notifications process)

func GetValidatorBLSChange

func GetValidatorBLSChange(validatorindex uint64) (*types.BLSChange, error)

func GetValidatorBalanceForDay

func GetValidatorBalanceForDay(validators []uint64, day uint64, balance *uint64) error

func GetValidatorDeposits

func GetValidatorDeposits(publicKey []byte) (*types.ValidatorDeposits, error)

GetValidatorDeposits will return eth1- and eth2-deposits for a public key from the database

func GetValidatorDepositsForSlots

func GetValidatorDepositsForSlots(validators []uint64, fromSlot uint64, toSlot uint64, deposits *uint64) error

func GetValidatorIncomeHistory

func GetValidatorIncomeHistory(validatorIndices []uint64, lowerBoundDay uint64, upperBoundDay uint64, lastFinalizedEpoch uint64) ([]types.ValidatorIncomeHistory, error)

func GetValidatorIncomeHistoryChart

func GetValidatorIncomeHistoryChart(validatorIndices []uint64, currency string, lastFinalizedEpoch uint64, lowerBoundDay uint64) ([]*types.ChartDataPoint, error)

func GetValidatorIncomePerformance

func GetValidatorIncomePerformance(validators []uint64, incomePerformance *types.ValidatorIncomePerformance) error

GetValidatorIncomePerformance gets all rewards of a validator in WEI for 1d, 7d, 365d and total

func GetValidatorIndex

func GetValidatorIndex(publicKey []byte) (uint64, error)

GetValidatorIndex will return the validator-index for a public key from the database

func GetValidatorIndices

func GetValidatorIndices() ([]uint64, error)

GetValidatorIndices will return the total-validator-indices

func GetValidatorNames

func GetValidatorNames() (map[uint64]string, error)

func GetValidatorPropsosals

func GetValidatorPropsosals(validators []uint64, proposals *[]types.ValidatorProposalInfo) error

func GetValidatorPublicKeys

func GetValidatorPublicKeys(indices []uint64, keys [][]byte) ([][]byte, error)

GetValidatorPublicKeys will return the public key for a list of validator indices and or public keys

func GetValidatorWithdrawals

func GetValidatorWithdrawals(validator uint64, limit uint64, offset uint64, orderBy string, orderDir string) ([]*types.Withdrawals, error)

func GetValidatorWithdrawalsForSlots

func GetValidatorWithdrawalsForSlots(validators []uint64, fromSlot uint64, toSlot uint64, withdrawals *uint64) error

func GetValidatorsBLSChange

func GetValidatorsBLSChange(validators []uint64) ([]*types.ValidatorsBLSChange, error)

GetValidatorsBLSChange returns the BLS change for a list of validators

func GetValidatorsGotSlashed

func GetValidatorsGotSlashed(epoch uint64) ([]struct {
	Epoch                  uint64 `db:"epoch"`
	SlasherIndex           uint64 `db:"slasher"`
	SlasherPubkey          string `db:"slasher_pubkey"`
	SlashedValidatorIndex  uint64 `db:"slashedvalidator"`
	SlashedValidatorPubkey []byte `db:"slashedvalidator_pubkey"`
	Reason                 string `db:"reason"`
}, error)

GetValidatorsGotSlashed returns the validators that got slashed after `epoch` either by an attestation violation or a proposer violation

func GetValidatorsWithdrawals

func GetValidatorsWithdrawals(validators []uint64, fromEpoch uint64, toEpoch uint64) ([]*types.Withdrawals, error)

func GetValidatorsWithdrawalsByEpoch

func GetValidatorsWithdrawalsByEpoch(validator []uint64, startEpoch uint64, endEpoch uint64) ([]*types.WithdrawalsByEpoch, error)

func GetWithdrawableValidatorCount

func GetWithdrawableValidatorCount(epoch uint64) (uint64, error)

func GetWithdrawals

func GetWithdrawals(query string, length, start uint64, orderBy, orderDir string) ([]*types.Withdrawals, error)

func GetWithdrawalsCountForQuery

func GetWithdrawalsCountForQuery(query string) (uint64, error)

func InitBigtableSchema

func InitBigtableSchema() error

func InsertAdConfigurations

func InsertAdConfigurations(adConfig types.AdConfig) error

insert new ad configuration

func InsertMobileSubscription

func InsertMobileSubscription(tx *sql.Tx, userID uint64, paymentDetails types.MobileSubscription, store, receipt string, expiration int64, rejectReson string, extSubscriptionId string) error

func InsertUserDevice

func InsertUserDevice(userID uint64, hashedRefreshToken string, name string, appID uint64) (uint64, error)

InsertUserDevice Insert user device and return device id

func MobileDeviceDelete

func MobileDeviceDelete(userID, deviceID uint64) error

func MobileDeviceSettingsSelect

func MobileDeviceSettingsSelect(userID, deviceID uint64) (*sql.Rows, error)

func MobileDeviceSettingsUpdate

func MobileDeviceSettingsUpdate(userID, deviceID uint64, notifyEnabled, active string) (*sql.Rows, error)

func MobileNotificatonTokenUpdate

func MobileNotificatonTokenUpdate(userID, deviceID uint64, notifyToken string) error

func MustInitDB

func MustInitDB(writer *types.DatabaseConfig, reader *types.DatabaseConfig, driverName string, databaseBrand string)

func MustInitFrontendDB

func MustInitFrontendDB(writer *types.DatabaseConfig, reader *types.DatabaseConfig, driverName string, databaseBrand string)

func NewTransaction

func NewTransaction() (*sql.Tx, error)

func RemoveFromWatchlist

func RemoveFromWatchlist(userId uint64, validator_publickey string, network string) error

RemoveFromWatchlist removes a validator for a given user from the users_validators_tag table It also deletes any subscriptions for that bookmarked validator

func RemoveFromWatchlistBatch

func RemoveFromWatchlistBatch(userId uint64, validator_publickeys []string, network string) error

func SaveBlock

func SaveBlock(block *types.Block, forceSlotUpdate bool, tx *sqlx.Tx) error

func SaveChartSeriesPoint

func SaveChartSeriesPoint(date time.Time, indicator string, value any) error

func SaveDataTableState

func SaveDataTableState(user uint64, key string, state types.DataTableSaveState) error

SaveDataTableState saves the state of the current datatable state update

func SaveEpoch

func SaveEpoch(epoch uint64, validators []*types.Validator, client rpc.Client, tx *sqlx.Tx) error

SaveEpoch will save the epoch data into the database

func SaveExplorerConfiguration

func SaveExplorerConfiguration(configs []types.ExplorerConfig) error

save current configurations

func SaveValidatorQueue

func SaveValidatorQueue(validators *types.ValidatorQueue, tx *sqlx.Tx) error

SaveValidatorQueue will save the validator queue into the database

func SaveValidators

func SaveValidators(epoch uint64, validators []*types.Validator, client rpc.Client, activationBalanceBatchSize int, tx *sqlx.Tx) error

func SetBlockStatus

func SetBlockStatus(blocks []*types.CanonBlock) error

func SetSlotFinalizationAndStatus

func SetSlotFinalizationAndStatus(slot uint64, finalized bool, status string, tx *sqlx.Tx) error

func SetSubscriptionToExpired

func SetSubscriptionToExpired(tx *sql.Tx, id uint64) error

func SetUserMonitorSharingSetting

func SetUserMonitorSharingSetting(userID uint64, share bool) error

func StripeCreateSubscription

func StripeCreateSubscription(tx *sql.Tx, customerID, priceID, subscriptionID string, payload json.RawMessage) error

StripeCreateSubscription inserts a new subscription

func StripeGetCustomerEmail

func StripeGetCustomerEmail(customerID string) (string, error)

StripeGetCustomerEmail returns a customers email given their customerID

func StripeGetCustomerUserId

func StripeGetCustomerUserId(customerID string) (uint64, error)

func StripeGetSubscription

func StripeGetSubscription(id string) (*types.StripeSubscription, error)

StripeGetSubscription returns a subscription given a subscription_id

func StripeGetUserSubscription

func StripeGetUserSubscription(id uint64, purchaseGroup string) (types.UserSubscription, error)

StripeGetUserAPISubscription returns a users current subscription

func StripeGetUserSubscriptions

func StripeGetUserSubscriptions(id uint64, purchaseGroup string) ([]types.UserSubscription, error)

StripeGetUserAPISubscriptions returns a users current subscriptions

func StripeRemoveCustomer

func StripeRemoveCustomer(customerID string) error

StripeRemoveCustomer removes the stripe customer and sets all subscriptions to inactive

func StripeUpdateCustomerID

func StripeUpdateCustomerID(email, customerID string) error

StripeUpdateCustomerID adds a stripe customer id to a user. It checks if the user already has a stripe customer id.

func StripeUpdateSubscription

func StripeUpdateSubscription(tx *sql.Tx, priceID, subscriptionID string, payload json.RawMessage) error

StripeUpdateSubscription inserts a new subscription

func StripeUpdateSubscriptionStatus

func StripeUpdateSubscriptionStatus(tx *sql.Tx, id string, status bool, payload *json.RawMessage) error

StripeUpdateSubscriptionStatus sets the status of a subscription

func SubmitBLSToExecutionChangesNodeJob

func SubmitBLSToExecutionChangesNodeJob(job *types.NodeJob) error

func SubmitBLSToExecutionChangesNodeJobs

func SubmitBLSToExecutionChangesNodeJobs() error

func SubmitNodeJobs

func SubmitNodeJobs() error

func SubmitVoluntaryExitNodeJob

func SubmitVoluntaryExitNodeJob(job *types.NodeJob) error

func SubmitVoluntaryExitNodeJobs

func SubmitVoluntaryExitNodeJobs() error

func TimestampToBigtableTimeDesc

func TimestampToBigtableTimeDesc(ts time.Time) string

func UpdateAdConfiguration

func UpdateAdConfiguration(adConfig types.AdConfig) error

update exisiting ad configuration

func UpdateBLSToExecutionChangesNodeJob

func UpdateBLSToExecutionChangesNodeJob(job *types.NodeJob) error

func UpdateBLSToExecutionChangesNodeJobs

func UpdateBLSToExecutionChangesNodeJobs() error

func UpdateCanonicalBlocks

func UpdateCanonicalBlocks(startEpoch, endEpoch uint64, blocks []*types.MinimalBlock) error

UpdateCanonicalBlocks will update the blocks for an epoch range in the database

func UpdateEpochStatus

func UpdateEpochStatus(stats *types.ValidatorParticipation, tx *sqlx.Tx) error

UpdateEpochStatus will update the epoch status in the database

func UpdateNodeJobs

func UpdateNodeJobs() error

func UpdatePassword

func UpdatePassword(userId uint64, cleartextPassword string) error

UpdatePassword updates the password of a user.

func UpdateQueueDeposits

func UpdateQueueDeposits(tx *sqlx.Tx) error

func UpdateSubscriptionLastSent

func UpdateSubscriptionLastSent(tx *sqlx.Tx, ts uint64, epoch uint64, subID uint64) error

UpdateSubscriptionLastSent updates `last_sent_ts` column of the `users_subscriptions` table.

func UpdateSubscriptionsLastSent

func UpdateSubscriptionsLastSent(subscriptionIDs []uint64, sent time.Time, epoch uint64, useDB *sqlx.DB) error

UpdateSubscriptionsLastSent updates `last_sent_ts` column of the `users_subscriptions` table.

func UpdateUserSubscription

func UpdateUserSubscription(tx *sql.Tx, id uint64, valid bool, expiration int64, rejectReason string) error

func UpdateUserSubscriptionProduct

func UpdateUserSubscriptionProduct(tx *sql.Tx, id uint64, productID string) error

func UpdateVoluntaryExitNodeJob

func UpdateVoluntaryExitNodeJob(job *types.NodeJob) error

func UpdateVoluntaryExitNodeJobs

func UpdateVoluntaryExitNodeJobs() error

func WriteChartSeriesForDay

func WriteChartSeriesForDay(day int64) error

func WriteConsensusChartSeriesForDay

func WriteConsensusChartSeriesForDay(day int64) error

func WriteExecutionChartSeriesForDay

func WriteExecutionChartSeriesForDay(day int64) error

func WriteGraffitiStatisticsForDay

func WriteGraffitiStatisticsForDay(day int64) error

func WriteValidatorStatisticsForDay

func WriteValidatorStatisticsForDay(day uint64, client rpc.Client) error

func WriteValidatorStatsExported

func WriteValidatorStatsExported(day uint64, tx pgx.Tx) error

func WriteValidatorTotalPerformance

func WriteValidatorTotalPerformance(day uint64, tx pgx.Tx) error

Types

type Bigtable

type Bigtable struct {
	LastAttestationCache    map[uint64]uint64
	LastAttestationCacheMux *sync.Mutex
	// contains filtered or unexported fields
}
var BigtableClient *Bigtable

func InitBigtable

func InitBigtable(project, instance, chainId, redisAddress string) (*Bigtable, error)

func (*Bigtable) CheckForGapsInBlocksTable

func (bigtable *Bigtable) CheckForGapsInBlocksTable(lookback int) (gapFound bool, start int, end int, err error)

func (*Bigtable) CheckForGapsInDataTable

func (bigtable *Bigtable) CheckForGapsInDataTable(lookback int) error

func (*Bigtable) ClearByPrefix

func (bigtable *Bigtable) ClearByPrefix(table string, family, columns, prefix string, dryRun bool) error

func (*Bigtable) Close

func (bigtable *Bigtable) Close()

func (*Bigtable) DeleteBlock

func (bigtable *Bigtable) DeleteBlock(blockNumber uint64, blockHash []byte) error

Deletes all block data from bigtable

func (*Bigtable) DeleteEpoch

func (bigtable *Bigtable) DeleteEpoch(epoch uint64) error

Deletes all block data from bigtable

func (*Bigtable) GetAddressBlobTableData

func (bigtable *Bigtable) GetAddressBlobTableData(address []byte, pageToken string) (*types.DataTableResponse, error)

func (*Bigtable) GetAddressBlocksMinedTableData

func (bigtable *Bigtable) GetAddressBlocksMinedTableData(address string, pageToken string) (*types.DataTableResponse, error)

func (*Bigtable) GetAddressContractInteractionsAt

func (bigtable *Bigtable) GetAddressContractInteractionsAt(requests []contractInteractionAtRequest) ([]types.ContractInteractionType, error)

returns account state after the given execution state -1 is latest (e.g. "txIdx" = -1 returns the contract state after execution of "block", "block" = -1 returns the state at chain head)

func (*Bigtable) GetAddressContractInteractionsAtBlock

func (bigtable *Bigtable) GetAddressContractInteractionsAtBlock(block *types.Eth1Block) ([]types.ContractInteractionType, error)

convenience function to get contract interaction status per transaction of a block

func (*Bigtable) GetAddressContractInteractionsAtITransactions

func (bigtable *Bigtable) GetAddressContractInteractionsAtITransactions(itransactions []*types.Eth1InternalTransactionIndexed, idxs [][2]int64) ([][2]types.ContractInteractionType, error)

convenience function to get contract interaction status per subtransaction of a transaction 2nd parameter specifies [tx_idx, trace_idx] for each internal tx

func (*Bigtable) GetAddressContractInteractionsAtParityTraces

func (bigtable *Bigtable) GetAddressContractInteractionsAtParityTraces(traces []*rpc.ParityTraceResult) ([][2]types.ContractInteractionType, error)

convenience function to get contract interaction status per parity trace

func (*Bigtable) GetAddressContractInteractionsAtTransactions

func (bigtable *Bigtable) GetAddressContractInteractionsAtTransactions(transactions []*types.Eth1TransactionIndexed, idxs []int64) ([]types.ContractInteractionType, error)

convenience function to get contract interaction status per transaction

func (*Bigtable) GetAddressErc1155TableData

func (bigtable *Bigtable) GetAddressErc1155TableData(address []byte, pageToken string) (*types.DataTableResponse, error)

func (*Bigtable) GetAddressErc20TableData

func (bigtable *Bigtable) GetAddressErc20TableData(address []byte, pageToken string) (*types.DataTableResponse, error)

func (*Bigtable) GetAddressErc721TableData

func (bigtable *Bigtable) GetAddressErc721TableData(address []byte, pageToken string) (*types.DataTableResponse, error)

func (*Bigtable) GetAddressInternalTableData

func (bigtable *Bigtable) GetAddressInternalTableData(address []byte, pageToken string) (*types.DataTableResponse, error)

func (*Bigtable) GetAddressLabel

func (bigtable *Bigtable) GetAddressLabel(id string, invoke_overwrite types.ContractInteractionType) string

get a method label for its byte signature with defaults

func (*Bigtable) GetAddressName

func (bigtable *Bigtable) GetAddressName(address []byte) (string, error)

func (*Bigtable) GetAddressNames

func (bigtable *Bigtable) GetAddressNames(addresses map[string]string) error

func (*Bigtable) GetAddressTransactionsTableData

func (bigtable *Bigtable) GetAddressTransactionsTableData(address []byte, pageToken string) (*types.DataTableResponse, error)

func (*Bigtable) GetAddressUnclesMinedTableData

func (bigtable *Bigtable) GetAddressUnclesMinedTableData(address string, pageToken string) (*types.DataTableResponse, error)

func (*Bigtable) GetAddressesNamesArMetadata

func (bigtable *Bigtable) GetAddressesNamesArMetadata(names *map[string]string, inputMetadata *map[string]*types.ERC20Metadata) (map[string]string, map[string]*types.ERC20Metadata, error)

func (*Bigtable) GetAggregatedValidatorIncomeDetailsHistory

func (bigtable *Bigtable) GetAggregatedValidatorIncomeDetailsHistory(validators []uint64, startEpoch uint64, endEpoch uint64) (map[uint64]*itypes.ValidatorEpochIncome, error)

GetAggregatedValidatorIncomeDetailsHistory returns aggregated validator income details startEpoch & endEpoch are inclusive

func (*Bigtable) GetArbitraryTokenTransfersForTransaction

func (bigtable *Bigtable) GetArbitraryTokenTransfersForTransaction(transaction []byte) ([]*types.Transfer, error)

currently only erc20

func (*Bigtable) GetBalanceForAddress

func (bigtable *Bigtable) GetBalanceForAddress(address []byte, token []byte) (*types.Eth1AddressBalance, error)

func (*Bigtable) GetBlockFromBlocksTable

func (bigtable *Bigtable) GetBlockFromBlocksTable(number uint64) (*types.Eth1Block, error)

func (*Bigtable) GetBlockKeys

func (bigtable *Bigtable) GetBlockKeys(blockNumber uint64, blockHash []byte) ([]string, error)

func (*Bigtable) GetBlocksDescending

func (bigtable *Bigtable) GetBlocksDescending(start, limit uint64) ([]*types.Eth1BlockIndexed, error)

GetBlocksDescending gets a given amount of Eth1BlockIndexed starting at block start from tableData

start: highest block number to be returned
limit: amount of blocks to be returned
	- if limit > start + 1, limit will be set to start + 1
	- if limit = start + 1, block 0 will be included as last block (special handling for broken padding is implemented)
	- if limit = start, block 0 will of course not be included

func (*Bigtable) GetBlocksIndexedMultiple

func (bigtable *Bigtable) GetBlocksIndexedMultiple(blockNumbers []uint64, limit uint64) ([]*types.Eth1BlockIndexed, error)

func (*Bigtable) GetClient

func (bigtable *Bigtable) GetClient() *gcp_bigtable.Client

func (*Bigtable) GetContractMetadata

func (bigtable *Bigtable) GetContractMetadata(address []byte) (*types.ContractMetadata, error)

func (*Bigtable) GetERC20MetadataForAddress

func (bigtable *Bigtable) GetERC20MetadataForAddress(address []byte) (*types.ERC20Metadata, error)

func (*Bigtable) GetEth1BlocksForAddress

func (bigtable *Bigtable) GetEth1BlocksForAddress(prefix string, limit int64) ([]*types.Eth1BlockIndexed, string, error)

func (*Bigtable) GetEth1BtxForAddress

func (bigtable *Bigtable) GetEth1BtxForAddress(prefix string, limit int64) ([]*types.Eth1BlobTransactionIndexed, string, error)

func (*Bigtable) GetEth1ERC1155ForAddress

func (bigtable *Bigtable) GetEth1ERC1155ForAddress(prefix string, limit int64) ([]*types.ETh1ERC1155Indexed, string, error)

func (*Bigtable) GetEth1ERC20ForAddress

func (bigtable *Bigtable) GetEth1ERC20ForAddress(prefix string, limit int64) ([]*types.Eth1ERC20Indexed, string, error)

func (*Bigtable) GetEth1ERC721ForAddress

func (bigtable *Bigtable) GetEth1ERC721ForAddress(prefix string, limit int64) ([]*types.Eth1ERC721Indexed, string, error)

func (*Bigtable) GetEth1ItxsForAddress

func (bigtable *Bigtable) GetEth1ItxsForAddress(prefix string, limit int64) ([]*types.Eth1InternalTransactionIndexed, []string, error)

func (*Bigtable) GetEth1TxForToken

func (bigtable *Bigtable) GetEth1TxForToken(prefix string, limit int64) ([]*types.Eth1ERC20Indexed, string, error)

func (*Bigtable) GetEth1TxsForAddress

func (bigtable *Bigtable) GetEth1TxsForAddress(prefix string, limit int64) ([]*types.Eth1TransactionIndexed, []string, error)

func (*Bigtable) GetEth1UnclesForAddress

func (bigtable *Bigtable) GetEth1UnclesForAddress(prefix string, limit int64) ([]*types.Eth1UncleIndexed, string, error)

func (*Bigtable) GetEventLabel

func (bigtable *Bigtable) GetEventLabel(id []byte) string

get an event label for its byte signature with defaults

func (*Bigtable) GetFullBlocksDescending

func (bigtable *Bigtable) GetFullBlocksDescending(stream chan<- *types.Eth1Block, high, low uint64) error

GetFullBlocksDescending streams blocks ranging from high to low (both borders are inclusive) in the correct descending order via a channel.

Special handling for block 0 is implemented.

  • stream: channel the function will use for streaming
  • high: highest (max) block number
  • low: lowest (min) block number

func (*Bigtable) GetGasNowHistory

func (bigtable *Bigtable) GetGasNowHistory(ts, pastTs time.Time) ([]types.GasNowHistory, error)

func (*Bigtable) GetIndexedEth1Transaction

func (bigtable *Bigtable) GetIndexedEth1Transaction(txHash []byte) (*types.Eth1TransactionIndexed, error)

func (*Bigtable) GetInternalTransfersForTransaction

func (bigtable *Bigtable) GetInternalTransfersForTransaction(transaction []byte, from []byte, parityTrace []*rpc.ParityTraceResult, currency string) ([]types.ITransaction, error)

func (*Bigtable) GetLastAttestationSlots

func (bigtable *Bigtable) GetLastAttestationSlots(validators []uint64) (map[uint64]uint64, error)

func (*Bigtable) GetLastBlockInBlocksTable

func (bigtable *Bigtable) GetLastBlockInBlocksTable() (int, error)

func (*Bigtable) GetLastBlockInDataTable

func (bigtable *Bigtable) GetLastBlockInDataTable() (int, error)

func (Bigtable) GetMachineMetricsForNotifications

func (bigtable Bigtable) GetMachineMetricsForNotifications(rowKeys gcp_bigtable.RowList) (map[uint64]map[string]*types.MachineMetricSystemUser, error)

Returns a map[userID]map[machineName]machineData machineData contains the latest machine data in CurrentData and 5 minute old data in fiveMinuteOldData (defined in limit) as well as the insert timestamps of both

func (Bigtable) GetMachineMetricsMachineCount

func (bigtable Bigtable) GetMachineMetricsMachineCount(userID uint64) (uint64, error)

func (Bigtable) GetMachineMetricsMachineNames

func (bigtable Bigtable) GetMachineMetricsMachineNames(userID uint64) ([]string, error)

func (Bigtable) GetMachineMetricsNode

func (bigtable Bigtable) GetMachineMetricsNode(userID uint64, limit, offset int) ([]*types.MachineMetricNode, error)

func (Bigtable) GetMachineMetricsSystem

func (bigtable Bigtable) GetMachineMetricsSystem(userID uint64, limit, offset int) ([]*types.MachineMetricSystem, error)

func (Bigtable) GetMachineMetricsValidator

func (bigtable Bigtable) GetMachineMetricsValidator(userID uint64, limit, offset int) ([]*types.MachineMetricValidator, error)

func (Bigtable) GetMachineRowKey

func (bigtable Bigtable) GetMachineRowKey(userID uint64, process string, machine string) string

func (*Bigtable) GetMaxValidatorindexForEpoch

func (bigtable *Bigtable) GetMaxValidatorindexForEpoch(epoch uint64) (uint64, error)

GetMaxValidatorindexForEpoch returns the higest validatorindex with a balance at that epoch

func (*Bigtable) GetMetadata

func (bigtable *Bigtable) GetMetadata(startToken string, limit int) ([]string, []*types.Eth1AddressBalance, error)

func (*Bigtable) GetMetadataForAddress

func (bigtable *Bigtable) GetMetadataForAddress(address []byte, offset uint64, limit uint64) (*types.Eth1AddressMetadata, error)

func (*Bigtable) GetMetadataUpdates

func (bigtable *Bigtable) GetMetadataUpdates(prefix string, startToken string, limit int) ([]string, []*types.Eth1AddressBalance, error)

func (*Bigtable) GetMethodLabel

func (bigtable *Bigtable) GetMethodLabel(data []byte, interaction types.ContractInteractionType) string

get a method label for its byte signature with defaults

func (*Bigtable) GetMostRecentBlockFromDataTable

func (bigtable *Bigtable) GetMostRecentBlockFromDataTable() (*types.Eth1BlockIndexed, error)

func (*Bigtable) GetRowsByPrefix

func (bigtable *Bigtable) GetRowsByPrefix(prefix string) ([]string, error)

func (*Bigtable) GetSignature

func (bigtable *Bigtable) GetSignature(hex string, st types.SignatureType) (*string, error)

get a signature by it's hex representation

func (*Bigtable) GetSignatureImportStatus

func (bigtable *Bigtable) GetSignatureImportStatus(st types.SignatureType) (*types.SignatureImportStatus, error)

Get the status of the last signature import run

func (*Bigtable) GetTokenTransactionsTableData

func (bigtable *Bigtable) GetTokenTransactionsTableData(token []byte, address []byte, pageToken string) (*types.DataTableResponse, error)

func (*Bigtable) GetTotalValidatorIncomeDetailsHistory

func (bigtable *Bigtable) GetTotalValidatorIncomeDetailsHistory(startEpoch uint64, endEpoch uint64) (map[uint64]*itypes.ValidatorEpochIncome, error)

GetTotalValidatorIncomeDetailsHistory returns the total validator income for a given range of epochs It is considerably faster than fetching the individual income for each validator and aggregating it startEpoch & endEpoch are inclusive

func (*Bigtable) GetValidatorAttestationHistory

func (bigtable *Bigtable) GetValidatorAttestationHistory(validators []uint64, startEpoch uint64, endEpoch uint64) (map[uint64][]*types.ValidatorAttestation, error)

func (*Bigtable) GetValidatorBalanceHistory

func (bigtable *Bigtable) GetValidatorBalanceHistory(validators []uint64, startEpoch uint64, endEpoch uint64) (map[uint64][]*types.ValidatorBalance, error)

func (*Bigtable) GetValidatorBalanceStatistics

func (bigtable *Bigtable) GetValidatorBalanceStatistics(validators []uint64, startEpoch, endEpoch uint64) (map[uint64]*types.ValidatorBalanceStatistic, error)

func (*Bigtable) GetValidatorEffectiveness

func (bigtable *Bigtable) GetValidatorEffectiveness(validators []uint64, epoch uint64) ([]*types.ValidatorEffectiveness, error)

returns the validator attestation effectiveness in %

func (*Bigtable) GetValidatorIncomeDetailsHistory

func (bigtable *Bigtable) GetValidatorIncomeDetailsHistory(validators []uint64, startEpoch uint64, endEpoch uint64) (map[uint64]map[uint64]*itypes.ValidatorEpochIncome, error)

GetValidatorIncomeDetailsHistory returns the validator income details startEpoch & endEpoch are inclusive

func (*Bigtable) GetValidatorMissedAttestationHistory

func (bigtable *Bigtable) GetValidatorMissedAttestationHistory(validators []uint64, startEpoch uint64, endEpoch uint64) (map[uint64]map[uint64]bool, error)

func (*Bigtable) GetValidatorMissedAttestationsCount

func (bigtable *Bigtable) GetValidatorMissedAttestationsCount(validators []uint64, firstEpoch uint64, lastEpoch uint64) (map[uint64]*types.ValidatorMissedAttestationsStatistic, error)

func (*Bigtable) GetValidatorProposalHistory

func (bigtable *Bigtable) GetValidatorProposalHistory(validators []uint64, startEpoch uint64, endEpoch uint64) (map[uint64][]*types.ValidatorProposal, error)

func (*Bigtable) GetValidatorSyncDutiesHistory

func (bigtable *Bigtable) GetValidatorSyncDutiesHistory(validators []uint64, startSlot uint64, endSlot uint64) (map[uint64]map[uint64]*types.ValidatorSyncParticipation, error)

GetValidatorSyncDutiesHistory returns the sync participation status for the given validators ranging from startSlot to endSlot (both inclusive)

The returned map uses the following keys: [validatorIndex][slot]

The function is able to handle both V1 and V2 schema based on the configured v2SchemaCutOffEpoch

func (*Bigtable) GetValidatorSyncDutiesStatistics

func (bigtable *Bigtable) GetValidatorSyncDutiesStatistics(validators []uint64, startEpoch uint64, endEpoch uint64) (map[uint64]*types.ValidatorSyncDutiesStatistic, error)

func (*Bigtable) ImportEnsUpdates

func (bigtable *Bigtable) ImportEnsUpdates(client *ethclient.Client, readBatchSize int64) error

func (*Bigtable) IndexEventsWithTransformers

func (bigtable *Bigtable) IndexEventsWithTransformers(start, end int64, transforms []func(blk *types.Eth1Block, cache *freecache.Cache) (bulkData *types.BulkMutations, bulkMetadataUpdates *types.BulkMutations, err error), concurrency int64, cache *freecache.Cache) error

func (*Bigtable) MigrateIncomeDataV1V2Schema

func (bigtable *Bigtable) MigrateIncomeDataV1V2Schema(epoch uint64) error

func (*Bigtable) SaveAddressName

func (bigtable *Bigtable) SaveAddressName(address []byte, name string) error

func (*Bigtable) SaveAttestationDuties

func (bigtable *Bigtable) SaveAttestationDuties(duties map[types.Slot]map[types.ValidatorIndex][]types.Slot) error

func (*Bigtable) SaveBalances

func (bigtable *Bigtable) SaveBalances(balances []*types.Eth1AddressBalance, deleteKeys []string) error

func (*Bigtable) SaveBlock

func (bigtable *Bigtable) SaveBlock(block *types.Eth1Block) error

func (*Bigtable) SaveBlockKeys

func (bigtable *Bigtable) SaveBlockKeys(blockNumber uint64, blockHash []byte, keys string) error

func (*Bigtable) SaveContractMetadata

func (bigtable *Bigtable) SaveContractMetadata(address []byte, metadata *types.ContractMetadata) error

func (*Bigtable) SaveERC20Metadata

func (bigtable *Bigtable) SaveERC20Metadata(address []byte, metadata *types.ERC20Metadata) error

func (*Bigtable) SaveERC20TokenPrices

func (bigtable *Bigtable) SaveERC20TokenPrices(prices []*types.ERC20TokenPrice) error

func (*Bigtable) SaveGasNowHistory

func (bigtable *Bigtable) SaveGasNowHistory(slow, standard, rapid, fast *big.Int) error

func (*Bigtable) SaveMachineMetric

func (bigtable *Bigtable) SaveMachineMetric(process string, userID uint64, machine string, data []byte) error

func (*Bigtable) SaveProposal

func (bigtable *Bigtable) SaveProposal(block *types.Block) error

func (*Bigtable) SaveProposalAssignments

func (bigtable *Bigtable) SaveProposalAssignments(epoch uint64, assignments map[uint64]uint64) error

func (*Bigtable) SaveSignatureImportStatus

func (bigtable *Bigtable) SaveSignatureImportStatus(status types.SignatureImportStatus, st types.SignatureType) error

Save the status of the last signature import run

func (*Bigtable) SaveSignatures

func (bigtable *Bigtable) SaveSignatures(signatures []types.Signature, st types.SignatureType) error

Save a list of signatures

func (*Bigtable) SaveSyncComitteeDuties

func (bigtable *Bigtable) SaveSyncComitteeDuties(duties map[types.Slot]map[types.ValidatorIndex]bool) error

func (*Bigtable) SaveValidatorBalances

func (bigtable *Bigtable) SaveValidatorBalances(epoch uint64, validators []*types.Validator) error

func (*Bigtable) SaveValidatorIncomeDetails

func (bigtable *Bigtable) SaveValidatorIncomeDetails(epoch uint64, rewards map[uint64]*itypes.ValidatorEpochIncome) error

func (*Bigtable) SearchForAddress

func (bigtable *Bigtable) SearchForAddress(addressPrefix []byte, limit int) ([]*types.Eth1AddressSearchItem, error)

func (*Bigtable) SetLastAttestationSlot

func (bigtable *Bigtable) SetLastAttestationSlot(validator uint64, lastAttestationSlot uint64) error

This method is only to be used for migrating the last attestation slot to bigtable and should not be used for any other purpose

func (*Bigtable) SetLastBlockInBlocksTable

func (bigtable *Bigtable) SetLastBlockInBlocksTable(lastBlock int64) error

func (*Bigtable) SetLastBlockInDataTable

func (bigtable *Bigtable) SetLastBlockInDataTable(lastBlock int64) error

func (*Bigtable) TransformBlobTx

func (bigtable *Bigtable) TransformBlobTx(blk *types.Eth1Block, cache *freecache.Cache) (bulkData *types.BulkMutations, bulkMetadataUpdates *types.BulkMutations, err error)

TransformBlobTx extracts transactions from bigtable more specifically from the table blocks.

func (*Bigtable) TransformBlock

func (bigtable *Bigtable) TransformBlock(block *types.Eth1Block, cache *freecache.Cache) (bulkData *types.BulkMutations, bulkMetadataUpdates *types.BulkMutations, err error)

TransformBlock extracts blocks from bigtable more specifically from the table blocks. It transforms the block and strips any information that is not necessary for a blocks view It writes blocks to table data: Row: <chainID>:B:<reversePaddedBlockNumber> Family: f Column: data Cell: Proto<Eth1BlockIndexed>

It indexes blocks by: Row: <chainID>:I:B:<Miner>:<reversePaddedBlockNumber> Family: f Column: <chainID>:B:<reversePaddedBlockNumber> Cell: nil

func (*Bigtable) TransformContract

func (bigtable *Bigtable) TransformContract(blk *types.Eth1Block, cache *freecache.Cache) (bulkData *types.BulkMutations, bulkMetadataUpdates *types.BulkMutations, err error)

func (*Bigtable) TransformERC1155

func (bigtable *Bigtable) TransformERC1155(blk *types.Eth1Block, cache *freecache.Cache) (bulkData *types.BulkMutations, bulkMetadataUpdates *types.BulkMutations, err error)

TransformERC1155 accepts an eth1 block and creates bigtable mutations for erc1155 transfer events. Example: https://etherscan.io/tx/0xcffdd4b44ba9361a769a559c360293333d09efffeab79c36125bb4b20bd04270#eventlog It transforms the logs contained within a block and writes the transformed logs to bigtable It writes erc1155 events to the table data: Row: <chainID>:ERC1155:<txHash>:<paddedLogIndex> Family: f Column: data Cell: Proto<Eth1ERC1155Indexed> Example scan: "1:ERC1155:cffdd4b44ba9361a769a559c360293333d09efffeab79c36125bb4b20bd04270" returns mainnet erc1155 event(s) for transaction 0xcffdd4b44ba9361a769a559c360293333d09efffeab79c36125bb4b20bd04270

It indexes erc1155 events by: Row: <chainID>:I:ERC1155:<FROM_ADDRESS>:TIME:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC1155:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC1155:<TO_ADDRESS>:TIME:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC1155:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC1155:<TOKEN_ADDRESS>:TIME:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC1155:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC1155:<TO_ADDRESS>:TO:<FROM_ADDRESS>:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC1155:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC1155:<FROM_ADDRESS>:FROM:<TO_ADDRESS>:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC1155:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC1155:<FROM_ADDRESS>:TOKEN_SENT:<TOKEN_ADDRESS>:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC1155:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC1155:<TO_ADDRESS>:TOKEN_RECEIVED:<TOKEN_ADDRESS>:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC1155:<txHash>:<paddedLogIndex> Cell: nil

func (*Bigtable) TransformERC20

func (bigtable *Bigtable) TransformERC20(blk *types.Eth1Block, cache *freecache.Cache) (bulkData *types.BulkMutations, bulkMetadataUpdates *types.BulkMutations, err error)

https://etherscan.io/tx/0xb10588bde42cb8eb14e72d24088bd71ad3903857d23d50b3ba4187c0cb7d3646#eventlog TransformERC20 accepts an eth1 block and creates bigtable mutations for ERC20 transfer events. It transforms the logs contained within a block and writes the transformed logs to bigtable It writes ERC20 events to the table data: Row: <chainID>:ERC20:<txHash>:<paddedLogIndex> Family: f Column: data Cell: Proto<Eth1ERC20Indexed> Example scan: "1:ERC20:b10588bde42cb8eb14e72d24088bd71ad3903857d23d50b3ba4187c0cb7d3646" returns mainnet ERC20 event(s) for transaction 0xb10588bde42cb8eb14e72d24088bd71ad3903857d23d50b3ba4187c0cb7d3646

It indexes ERC20 events by: Row: <chainID>:I:ERC20:<TOKEN_ADDRESS>:TIME:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC20:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC20:<FROM_ADDRESS>:TIME:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC20:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC20:<TO_ADDRESS>:TIME:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC20:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC20:<FROM_ADDRESS>:TO:<TO_ADDRESS>:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC20:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC20:<TO_ADDRESS>:FROM:<FROM_ADDRESS>:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC20:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC20:<FROM_ADDRESS>:TOKEN_SENT:<TOKEN_ADDRESS>:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC20:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC20:<TO_ADDRESS>:TOKEN_RECEIVED:<TOKEN_ADDRESS>:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC20:<txHash>:<paddedLogIndex> Cell: nil

func (*Bigtable) TransformERC721

func (bigtable *Bigtable) TransformERC721(blk *types.Eth1Block, cache *freecache.Cache) (bulkData *types.BulkMutations, bulkMetadataUpdates *types.BulkMutations, err error)

example: https://etherscan.io/tx/0x4d3a6c56cecb40637c070601c275df9cc7b599b5dc1d5ac2473c92c7a9e62c64#eventlog TransformERC721 accepts an eth1 block and creates bigtable mutations for erc721 transfer events. It transforms the logs contained within a block and writes the transformed logs to bigtable It writes erc721 events to the table data: Row: <chainID>:ERC721:<txHash>:<paddedLogIndex> Family: f Column: data Cell: Proto<Eth1ERC721Indexed> Example scan: "1:ERC721:4d3a6c56cecb40637c070601c275df9cc7b599b5dc1d5ac2473c92c7a9e62c64" returns mainnet ERC721 event(s) for transaction 0x4d3a6c56cecb40637c070601c275df9cc7b599b5dc1d5ac2473c92c7a9e62c64

It indexes ERC721 events by: Row: <chainID>:I:ERC721:<FROM_ADDRESS>:TIME:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC721:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC721:<TO_ADDRESS>:TIME:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC721:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC721:<TOKEN_ADDRESS>:TIME:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC721:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC721:<FROM_ADDRESS>:TO:<TO_ADDRESS>:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC721:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC721:<TO_ADDRESS>:FROM:<FROM_ADDRESS>:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC721:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC721:<FROM_ADDRESS>:TOKEN_SENT:<TOKEN_ADDRESS>:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC721:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC721:<TO_ADDRESS>:TOKEN_RECEIVED:<TOKEN_ADDRESS>:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC721:<txHash>:<paddedLogIndex> Cell: nil

func (*Bigtable) TransformEnsNameRegistered

func (bigtable *Bigtable) TransformEnsNameRegistered(blk *types.Eth1Block, cache *freecache.Cache) (bulkData *types.BulkMutations, bulkMetadataUpdates *types.BulkMutations, err error)

func (*Bigtable) TransformItx

func (bigtable *Bigtable) TransformItx(blk *types.Eth1Block, cache *freecache.Cache) (bulkData *types.BulkMutations, bulkMetadataUpdates *types.BulkMutations, err error)

TransformItx extracts internal transactions from bigtable more specifically from the table blocks. It transforms the internal transactions contained within a block and strips any information that is not necessary for our frontend views It writes internal transactions to table data: Row: <chainID>:ITX:<TX_HASH>:<paddedITXIndex> Family: f Column: data Cell: Proto<Eth1InternalTransactionIndexed>

It indexes internal transactions by: Row: <chainID>:I:ITX:<FROM_ADDRESS>:TIME:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<paddedITXIndex> Family: f Column: <chainID>:ITX:<HASH>:<paddedITXIndex> Cell: nil Row: <chainID>:I:ITX:<TO_ADDRESS>:TIME:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<paddedITXIndex> Family: f Column: <chainID>:ITX:<HASH>:<paddedITXIndex> Cell: nil Row: <chainID>:I:ITX:<FROM_ADDRESS>:TO:<TO_ADDRESS>:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<paddedITXIndex> Family: f Column: <chainID>:ITX:<HASH>:<paddedITXIndex> Cell: nil Row: <chainID>:I:ITX:<TO_ADDRESS>:FROM:<FROM_ADDRESS>:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<paddedITXIndex> Family: f Column: <chainID>:ITX:<HASH>:<paddedITXIndex> Cell: nil

func (*Bigtable) TransformTx

func (bigtable *Bigtable) TransformTx(blk *types.Eth1Block, cache *freecache.Cache) (bulkData *types.BulkMutations, bulkMetadataUpdates *types.BulkMutations, err error)

TransformTx extracts transactions from bigtable more specifically from the table blocks.

func (*Bigtable) TransformUncle

func (bigtable *Bigtable) TransformUncle(block *types.Eth1Block, cache *freecache.Cache) (bulkData *types.BulkMutations, bulkMetadataUpdates *types.BulkMutations, err error)

TransformUncle accepts an eth1 block and creates bigtable mutations. It transforms the uncles contained within a block, extracts the necessary information to create a view and writes that information to bigtable It writes uncles to table data: Row: <chainID>:U:<reversePaddedNumber> Family: f Column: data Cell: Proto<Eth1UncleIndexed> Example scan: "1:U:" returns mainnet uncles mined in desc order Example scan: "1:U:984886725" returns mainnet uncles mined after block 15113275 (1000000000 - 984886725)

It indexes uncles by: Row: <chainID>:I:U:<Miner>:TIME:<reversePaddedBigtableTimestamp> Family: f Column: <chainID>:U:<reversePaddedNumber> Cell: nil Example lookup: "1:I:U:ea674fdde714fd979de3edf0f56aa9716b898ec8:TIME:" returns mainnet uncles mined by ethermine in desc order

func (*Bigtable) TransformWithdrawals

func (bigtable *Bigtable) TransformWithdrawals(block *types.Eth1Block, cache *freecache.Cache) (bulkData *types.BulkMutations, bulkMetadataUpdates *types.BulkMutations, err error)

TransformWithdrawals accepts an eth1 block and creates bigtable mutations. It transforms the withdrawals contained within a block, extracts the necessary information to create a view and writes that information to bigtable It writes uncles to table data: Row: <chainID>:W:<reversePaddedNumber>:<reversedWithdrawalIndex> Family: f Column: data Cell: Proto<Eth1WithdrawalIndexed> Example scan: "1:W:" returns withdrawals in desc order Example scan: "1:W:984886725" returns mainnet withdrawals included after block 15113275 (1000000000 - 984886725)

It indexes withdrawals by: Row: <chainID>:I:W:<Address>:TIME:<reversePaddedBigtableTimestamp> Family: f Column: <chainID>:W:<reversePaddedNumber> Cell: nil Example lookup: "1:I:W:ea674fdde714fd979de3edf0f56aa9716b898ec8:TIME:" returns withdrawals received by ethermine in desc order

func (*Bigtable) WriteBulk

func (bigtable *Bigtable) WriteBulk(mutations *types.BulkMutations, table *gcp_bigtable.Table, batchSize int) error

type EnsCheckedDictionary

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

type GetAllNonFinalizedSlotsRow

type GetAllNonFinalizedSlotsRow struct {
	Slot      uint64 `db:"slot"`
	BlockRoot []byte `db:"blockroot"`
	Finalized bool   `db:"finalized"`
	Status    string `db:"status"`
}

func GetAllNonFinalizedSlots

func GetAllNonFinalizedSlots() ([]*GetAllNonFinalizedSlotsRow, error)

type GetSubscriptionsFilter

type GetSubscriptionsFilter struct {
	EventNames    *[]types.EventName
	UserIDs       *[]uint64
	EventFilters  *[]string
	Search        string
	Limit         uint64
	Offset        uint64
	JoinValidator bool
}

GetSubscriptionsFilter can be passed to GetSubscriptions() to filter subscriptions.

type IndexFilter

type IndexFilter string
const (
	FILTER_TIME           IndexFilter = "TIME"
	FILTER_TO             IndexFilter = "TO"
	FILTER_FROM           IndexFilter = "FROM"
	FILTER_TOKEN_RECEIVED IndexFilter = "TOKEN_RECEIVED"
	FILTER_TOKEN_SENT     IndexFilter = "TOKEN_SENT"
	FILTER_METHOD         IndexFilter = "METHOD"
	FILTER_CONTRACT       IndexFilter = "CONTRACT"
	FILTER_ERROR          IndexFilter = "ERROR"
)

type IndexKeys

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

type PremiumResult

type PremiumResult struct {
	Package string `db:"product_id"`
	Store   string `db:"store"`
}

func GetUserPremiumPackage

func GetUserPremiumPackage(userID uint64) (PremiumResult, error)

type SortByIndexes

type SortByIndexes IndexKeys

func (SortByIndexes) Len

func (sbi SortByIndexes) Len() int

func (SortByIndexes) Less

func (sbi SortByIndexes) Less(i, j int) bool

func (SortByIndexes) Swap

func (sbi SortByIndexes) Swap(i, j int)

type WatchlistEntry

type WatchlistEntry struct {
	UserId              uint64
	Validator_publickey string
}

type WatchlistFilter

type WatchlistFilter struct {
	Tag            types.Tag
	UserId         uint64
	Validators     *pq.ByteaArray
	JoinValidators bool
	Network        string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL