Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Graph Service

The Graph Service manages the social graphs, including follow/unfollow actions, blocking users, and other social interactions. It allows applications to maintain and query the social connections between users on the Frequency network.

API Reference

Configuration

â„šī¸ Feel free to adjust your environment variables to taste. This application recognizes the following environment variables:

NameDescriptionRange/TypeRequired?Default
API_BODY_JSON_LIMITApi json body size limit in string (some examples: 100kb or 5mb or etc)string1mb
API_PORTHTTP port that the application listens on1025 - 655353000
API_TIMEOUT_MSOverall API timeout limit in milliseconds. This is the maximum time allowed for any API request to complete. Any HTTP_RESPONSE_TIMEOUT_MS value must be less than this value> 030000
AT_REST_ENCRYPTION_KEY_SEEDThis secret seed is used for generating an encryption/decryption key for encrypted sensitive data at reststringY
BLOCKCHAIN_SCAN_INTERVAL_SECONDSHow many seconds to delay between successive scans of the chain (after end of chain is reached)> 0180
CACHE_KEY_PREFIXPrefix to use for Redis cache keysstringcontent-watcher:
CAPACITY_LIMITMaximum amount of provider capacity this app is allowed to use (per epoch) type: 'percentage' 'amount' value: number (may be percentage, ie '80', or absolute amount of capacity)JSON (example)Y
DEBOUNCE_SECONDSNumber of seconds to retain pending graph updates in the Redis cache to avoid redundant fetches from the chain>= 0
DEBUGEnable additional logging'true' for debug logs, 'verbose' for debug + verbose logsNfalse
FREQUENCY_API_WS_URLBlockchain API Websocket URLws(s): URLY
FREQUENCY_TIMEOUT_SECSFrequency chain connection timeout limit; app will terminate if disconnected longerinteger10
GRAPH_ENVIRONMENT_TYPEGraph environment type.Mainnet|TestnetPaseoY
PROVIDER_ACCOUNT_SEED_PHRASESeed phrase for provider MSA control keystringY
PROVIDER_IDProvider MSA IdintegerY
QUEUE_HIGH_WATERMax number of jobs allowed on the 'graphUpdateQueue' before blockchain scan will be paused to allow queue to drain>= 1001000
REDIS_OPTIONSAdditional Redis options.
See ioredis configuration
JSON stringY
(either this or REDIS_URL)
'{"commandTimeout":10000}'
REDIS_URLConnection URL for RedisURLY
(either this or REDIS_OPTIONS)
VERBOSE_LOGGINGEnable 'verbose' log levelbooleanNfalse
WEBHOOK_FAILURE_THRESHOLDNumber of retry attempts to make when sending a webhook notification> 03
WEBHOOK_RETRY_INTERVAL_SECONDSNumber of seconds between provider webhook retry attempts when failing> 010
HTTP_RESPONSE_TIMEOUT_MSTimeout in milliseconds to wait for a response as part of a request to an HTTP endpoint. Must be less than API_TIMEOUT_MS> 0 and < API_TIMEOUT_MS3000

Best Practices

  • Data Integrity: Ensure the integrity of social graph data by implementing robust validation checks.
  • Efficient Queries: Optimize queries to handle large social graphs efficiently.
  • User Privacy: Protect user privacy by ensuring that graph data is only accessible to authorized entities.