BuilderHub is the central data source for BuilderNet builder registration and configuration.
Docs here: https://buildernet.org/docs/flashbots-infra
BuilderHub has these responsibilities:
- Builder identity management
- Provisioning of secrets and configuration
- Peer discovery
System context diagram:
Start the database and the server:
# Start a Postgres database container
docker run -d --name postgres-test -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=postgres postgres
# Apply the DB migrations
for file in schema/*.sql; do psql "postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable" -f $file; done
# Start the server
go run cmd/httpserver/main.go
Query a few endpoints:
# Public endpoints
curl localhost:8080/api/l1-builder/v1/measurements
# client-aTLS secured endpoints
curl localhost:8080/api/l1-builder/v1/builders
curl localhost:8080/api/l1-builder/v1/configuration
curl -X POST localhost:8080/api/l1-builder/v1/register_credentials/rbuilder
Run database tests>
RUN_DB_TESTS=1 make test
Stop the database:
docker rm -f postgres-test
Install dev dependencies
go install mvdan.cc/[email protected]
go install honnef.co/go/tools/cmd/[email protected]
go install github.com/golangci/golangci-lint/cmd/[email protected]
go install go.uber.org/nilaway/cmd/[email protected]
go install github.com/daixiang0/[email protected]
Lint, test, format
make lint
make test
make fmt
BuilderHub
exposes a JSON+REST API with these methods:
API | Exposure | Authentication | Requested by | Served by |
---|---|---|---|---|
Get Secrets + Config | TDX Node | IP + Client-ATLS Attestation | Builder (via cvm-proxy) | cvm-proxy → BuilderHub |
Register Credentials | TDX Node | IP + Client-ATLS Attestation | Builder (via cvm-proxy) | cvm-proxy → BuilderHub |
Get Active Builders | TDX Node | IP + Client-ATLS Attestation | Builder (via cvm-proxy) | cvm-proxy → BuilderHub |
Get Active Builders | Internal | HTTP Basic Auth | MEV-Share, block processor, … | BuilderHub |
Get Allowed Measurements | Internal | HTTP Basic Auth | Users, Builders | nginx → BuilderHub |
Admin Endpoints | Internal | HTTP Basic Auth |
GET /api/l1-builder/v1/configuration
Auth:
- IP + Client-ATLS Attestation
Response: testdata/get-configuration.json
POST /api/l1-builder/v1/register_credentials/<SERVICE>
Auth:
- IP + Client-ATLS Attestation
Request:
-
[service:
orderflow_proxy
]:- TLS cert + ECDSA pubkey address (for orderflow)
{ "tls_cert": string (\n instead of newlines) "ecdsa_pubkey_address": string }
-
[service:
rbuilder
]: ECDSA pubkey address (for bids){ "ecdsa_pubkey_address": string }
Response: 200 OK
GET /api/l1-builder/v1/builders
(external, requests from builder via cvm-proxy)
GET /api/internal/l1-builder/v1/builders
(internal, no auth)
Response: testdata/get-builders.json
Auth: public
GET /api/l1-builder/v1/measurements
Response: Array with currently allowed measurement JSONs
testdata/get-measurements.json
(created disabled by default)
POST /api/admin/v1/measurements
Payload
{
"measurement_id": "v1.2.3-20241010-rc1",
"attestation_type": "azure-tdx",
"measurements": {
"11": {
"expected": "efa43e0beff151b0f251c4abf48152382b1452b4414dbd737b4127de05ca31f7"
},
}
}
Note that only the measurements given are expected, and any non-present will be ignored.
To allow any measurement, use an empty measurements field:
"measurements": {}
.
{
"measurement_id": "test-blanket-allow",
"attestation_type": "azure-tdx",
"measurements": {}
}
POST /api/admin/v1/measurements/activation/{measurement_id}
{
"enabled": true
}
(created inactive by default)
POST /api/admin/v1/builders/
Payload
{
"name": string,
"ip_address": string
}
POST /api/admin/v1/builders/activation/{builder_name}
{
"enabled": true
}
Errors:
- if no active configuration available
GET /api/admin/v1/builders/configuration/{builder_name}/active
gets always the latest/active configuration
GET /api/admin/v1/builders/configuration/{builder_name}/full
gets always the latest/active configuration
if valid JSON, will create a new active configuration and disable the old configuration
POST /api/admin/v1/builders/configuration/{builder_name}
{
...
}
POST /api/admin/v1/builders/secrets/{builderName}
Payload: JSON with secrets, both flattened/unflattened
{
...
}