Project Spiderman
17th July → Nirmal
Updates to Design
Let’s have 3 models
Blockchain
name (ex: bitcoin, ethereum)
Provider
name (ex: blockdaemon, tatum, getblock)
domain (ex: getblock.io, tatum.io, blockdaemon.com)
is_enabled (true / false)
ProviderIntegration
This is the existing model that you’ve created, replace text fields with Foreign keys to above models
Add an integer field called priority (1 is highest, 2 is lower and so on)
Use django’s
unique_togetherto ensure records are unique on (blockchain,priority)
https://docs.djangoproject.com/en/4.0/ref/models/options/#unique-togetherThe URL provided in this object must contain provider.domain (data integrity check)
Admin Interfaces
Blockchain ModelAdmin
Show blockchain name
InlineTabularAdmin to show related
ProviderIntegrationobjects. I should be able to add and edit providers from this admin interface, other admin’s are not requiredI can add a new blockchain without adding
providerintegrationobjects
Provider ModelAdmin
Add a provider → This will rarely be used except in the first few days
I can disable a provider from here. When I do this, all providerIntegrations related to this provider will not be used to calculate priority
Functional Changes
In the event, two ProviderIntegrations have the same block_number (and it is the latest block number), you can resolve this clash using priority
Incoming requests must contain an
apikeyGET parameter which can be used to authenticate requests. Something on these linesfrom rest_framework import permissions class IsInternalApiRequest(permissions.BasePermission): def has_permission(self, request, view): if request.GET("X-API-KEY") == config("ETL-API-KEY", cast=str, default="empty"): return True return FalseCODE
Use this permission class to authenticate your request
Store ETL-API-KEY on doppler, it can be a constant
Create a healthcheck endpoint called
/healthcheck/pingwhich will return 200 if the backend service is liveCreate a liveness endpoint called live
/healtcheck/livenesswhich will always return a 200 OK response but in message body also returns (current_time - time_cache_was_last_updated) in seconds. We will use this endpoint to identify if i) sauron is not providing latest blocks ii) if you’re task which updates latest blocks has gone downCould you write docs for local setup + how to use doppler (refer to goldeneye documentation)
https://github.com/merklescience/goldeneyeAdd code linting checks - flake8, black (we have an implementation, check with us)
Deploy to google app engine
Create postman collection
Setup alerts on BetterUptime
Setup monitoring via stitchdata and tableau
Build in CI / CD pipeline
Install new relic
Think about error handling
Setup dev environment
Add unit tests