Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/add fetch transactions flag #12

Merged
merged 2 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ OPTIONS:
--log-level value Log level: debug, warn, info, error (default: info) [$LOG_LEVEL]
--workers-num value Number of workers to process API requests (default: 10) [$WORKER_NUM]
--alchemy-url value Alchemy url (default: https://eth-mainnet.g.alchemy.com/v2/KEY) [$ALCHEMY_URL]
--only-deposits Only fetch deposits. If not set, it will fetch all new depositor transactions which can take up to 20 hours (default: false)
--help, -h show help
```

Expand Down Expand Up @@ -187,7 +188,7 @@ Utilizing Alchemy as EL node and API, with a local database, these are the bench
- Total time: 4h 51m
- Total time for the first run: 21h 29m

If running the tool on a weekly basis, expect the tool to take around 16h to run considering that the process of fetching depositors transactions will be done on every run.
If running the tool on a weekly basis, expect the tool to take around 16h to run considering that the process of fetching depositors transactions will be done on every run unless the `--only-deposits` flag is set, in which case the tool will take around 10m to run.

The size of the fully synced database is around 3GB.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (b *BeaconDepositorsTransactions) Run() {
log.Infof("Finished downloading new beacon deposits in %f seconds", duration)

}
if !b.stop {
if !b.stop && !b.iConfig.OnlyDeposits {
initTime := time.Now()
log.Info("Updating depositors transactions...")
b.updateDepositorsTransactions()
Expand Down
4 changes: 4 additions & 0 deletions cmd/beacon-depositors-transactions/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ var BeaconDepositorsTransactionsCommand = &cli.Command{
EnvVars: []string{"ALCHEMY_URL"},
DefaultText: "https://eth-mainnet.g.alchemy.com/v2/KEY",
},
&cli.BoolFlag{
Name: "only-deposits",
Usage: "Only fetch deposits. If not set, it will fetch all new depositor transactions which can take up to 20 hours",
},
},
}

Expand Down
15 changes: 10 additions & 5 deletions config/beacon_depositors_transactions_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import (
)

type BeaconDepositorsTransactionsConfig struct {
LogLevel string `json:"log-level"`
ElEndpoint string `json:"el-endpoint"`
DBUrl string `json:"db-url"`
Workers int `json:"workers-num"`
AlchemyURL string `json:"alchemy-url"`
LogLevel string `json:"log-level"`
ElEndpoint string `json:"el-endpoint"`
DBUrl string `json:"db-url"`
Workers int `json:"workers-num"`
AlchemyURL string `json:"alchemy-url"`
OnlyDeposits bool `json:"only-deposits"`
}

func NewBeaconDepositorsTransactionsConfig() *BeaconDepositorsTransactionsConfig {
Expand Down Expand Up @@ -43,4 +44,8 @@ func (c *BeaconDepositorsTransactionsConfig) Apply(ctx *cli.Context) {
c.AlchemyURL = ctx.String("alchemy-url")
}

if ctx.IsSet("only-deposits") {
c.OnlyDeposits = true
}

}