DocsServicesEFP Railway Template

EFP Railway Template

Deploying the EFP-Silo template on Railway will set up all of the aforementioned components with default parameters set.

EFP-Silo Click the link or the button below.

Deploy on Railway

Configuration

The template will run with default values for most of the components but you will need to set primary and secondary rpc urls for all three chains that EFP is using (Base, Optimism and Ethereum Mainnet). Find the section for ‘Indexer-8453’, click the ‘configure’ button and set the rpc endpoint for all six fields accordingly. These can be Alchemy or Infura urls or local ethereum nodes if you’re testing at home.

Indexer Params

Once all sections display ‘Ready to be deployed’ the ‘Deploy’ button at the bottom will be unlocked and you can click it to proceed.

Deployed Environment

Syncing

It should take under an hour to sync all EFP data, you can still call the api but the data will not be up to date.

Setup API URL

Enable public networking for the API by clicking on the API section, then the ‘Settings’ tab and scrolling down to ‘Networking’. Click ‘Generate Domain’ to have Railway create a random public link for you. Or click ‘Custom Domain’ to use an already existing domain name.

Setup API URL

Once your link is generated, you can use it to call your API the same way you would call the official EFP API. Just swap in your new link in the place of ‘api.ethfollow.xyz’

api.ethfollow.xyz/api/v1/stats -> my-generated-api-link.railway.app/api/v1/stats

Generate Link

Call Endpoint

Setup ENS Worker

The API uses V3X Labs’ enstate to provide ENS data. This service is available at https://ens.ethfollow.xyz. EFP is happy to provide use of this endpoint to the community but please do not abuse it.

Enable public networking for the ENS Worker by clicking on the ‘enstate’ section, then the ‘Settings’ tab and scrolling down to ‘Networking’. Click ‘Generate Domain’ to have Railway create a random public link for you. Or click ‘Custom Domain’ to use an already existing domain name.

Once public networking is enabled for the API and ENS Worker, they should be redeployed as well as the service manager. Do this by clicking into each of the services, and clicking the three dot menu on the right hand side of your currently deployed instance. Click ‘Redeploy’ on the menu.

Three dot menu

Service Manager

The services module handles several jobs that run on intervals:

  • Building the list of all addresses in the EFP database
  • Building the Leaderboard Ranking
  • Tracking Mutual follows
  • Shuffling the recommended accounts list
  • Refreshing ENS metadata
  • Building a list of accounts with recent activity

The intervals for running these jobs can be adjusted to suit your needs. Additionally the accounts that appear in the recommended follows can be customized by forking the services repo and editing ‘/src/services/recommended/lists.ts’. Once you’ve edited the file, go to the ‘Settings’ tab on the services module and update the ‘Source Repo’ to point to your forked github repository.

Services Settings

ENV variables

Most of the Environment variables are set appropriately and should not be changed unless you know exactly what you’re doing. However there are a few settings than can be customized to fit your needs. As a general rule, if they’re not listed below then you probably should leave them as is.

Indexers (Indexer-base, Indexer-op, Indexer-eth)

Variable NameDescription
PRIMARY_RPC_BASEPrimary RPC URL for Base chain
PRIMARY_RPC_OPPrimary RPC URL for Optimism chain
PRIMARY_RPC_ETHPrimary RPC URL for Ethereum mainnet
SECONDARY_RPC_BASEFallback RPC URL for Base chain
SECONDARY_RPC_OPFallback RPC URL for Optimism chain
SECONDARY_RPC_ETHFallback RPC URL for Ethereum mainnet
RECOVER_HISTORYBoolean Flag to start the indexer in recovery mode
START_BLOCKBlock number to start recovering history from, if in recovery mode
BATCH_SIZENumber of events to batch before uploading
CHAIN_IDChain id (8453, 10 or 1)
RECORDS_ONLYBoolean flag that specifies whether the indexer should listen for just ListOps

Service Manager

Variable NameDescription
ENS_API_URLURL for the ENS worker to use for lookups
EFP_CACHE_INTERVALInterval (in milliseconds) to update address cache
EFP_MUTUALS_INTERVALInterval (in milliseconds) to update mutual follows
LEADERBOARD_RANKING_INTERVALInterval (in milliseconds) to update leaderboard
RECENT_FOLLOWS_INTERVALInterval (in milliseconds) to update recent activity
RECOMMENDED_INTERVALInterval (in milliseconds) to update recommended accts
ENSMETADATA_INTERVALInterval (in milliseconds) to update ENS metadata cache
HEARTBEAT_INTERVALInterval (in milliseconds) to call heartbeat URL

API

Variable NameDescription
CACHE_TTLAmount of seconds to wait before expiring cache record
POAP_API_TOKENAuth token for POAP.xyz api
ENS_API_URLURL for the ENS worker to use for lookups

PgBouncer

(see PgBouncer Docs for more information)

Variable NameDescription
PGBOUNCER_DEFAULT_POOL_SIZEAmount of connections per pool
PGBOUNCER_MAX_CLIENT_CONNMaximum number of client connections
PGBOUNCER_POOL_MODE’Session’ or ‘Transaction’
PGBOUNCER_QUERY_TIMEOUTAmount of seconds to wait before dropping query