Advertisement
Doze0809

Untitled

May 5th, 2023 (edited)
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PostgreSQL 2.35 KB | Source Code | 0 0
  1. -- based on https://collective.flashbots.net/t/do-you-want-to-run-a-builder/212/17
  2. -- https://github.com/flashbots/builder/blob/main/flashbotsextra/database_types.go
  3. -- https://github.com/flashbots/builder/blob/main/flashbotsextra/database_test.go
  4.  
  5. CREATE TABLE built_blocks (
  6.     block_id              BIGINT PRIMARY KEY,
  7.     block_number          BIGINT NOT NULL,
  8.     profit                VARCHAR NOT NULL,
  9.     slot                  BIGINT NOT NULL,
  10.     hash                  VARCHAR NOT NULL,
  11.     gas_limit             BIGINT NOT NULL,
  12.     gas_used              BIGINT NOT NULL,
  13.     base_fee              BIGINT NOT NULL,
  14.     parent_hash           VARCHAR NOT NULL,
  15.     proposer_pubkey       VARCHAR NOT NULL,
  16.     proposer_fee_recipient VARCHAR NOT NULL,
  17.     builder_pubkey        VARCHAR NOT NULL,
  18.     timestamp             BIGINT NOT NULL,
  19.     timestamp_datetime    TIMESTAMP NOT NULL,
  20.     orders_closed_at      TIMESTAMP NOT NULL,
  21.     sealed_at             TIMESTAMP NOT NULL
  22. );
  23.  
  24. CREATE TABLE bundles (
  25.     id                    BIGSERIAL PRIMARY KEY,
  26.     bundle_hash           VARCHAR NOT NULL,
  27.  
  28.     param_signed_txs      VARCHAR NOT NULL,
  29.     param_block_number    BIGINT NOT NULL,
  30.     param_timestamp       BIGINT,
  31.     received_timestamp    TIMESTAMP NOT NULL,
  32.     param_reverting_tx_hashes VARCHAR,
  33.  
  34.     coinbase_diff         VARCHAR NOT NULL,
  35.     total_gas_used        BIGINT NOT NULL,
  36.     state_block_number    BIGINT NOT NULL,
  37.     gas_fees              VARCHAR NOT NULL,
  38.     eth_sent_to_coinbase  VARCHAR NOT NULL,
  39.     is_high_prio          BOOLEAN NOT NULL DEFAULT false
  40. );
  41.  
  42. CREATE TABLE built_blocks_bundles (
  43.     block_id     BIGINT NOT NULL,
  44.     bundle_id    BIGINT,
  45.     block_number BIGINT NOT NULL,
  46.     bundle_hash  VARCHAR NOT NULL,
  47.  
  48.     FOREIGN KEY (block_id) REFERENCES built_blocks(block_id),
  49.     FOREIGN KEY (bundle_id) REFERENCES bundles(id)
  50. );
  51.  
  52. CREATE TABLE built_blocks_all_bundles (
  53.     block_id     BIGINT NOT NULL,
  54.     bundle_id    BIGINT,
  55.     block_number BIGINT NOT NULL,
  56.     bundle_hash  VARCHAR NOT NULL,
  57.  
  58.     FOREIGN KEY (block_id) REFERENCES built_blocks(block_id),
  59.     FOREIGN KEY (bundle_id) REFERENCES bundles(id)
  60. );
  61.  
  62. CREATE TABLE latest_uuid_bundle (
  63.     replacement_uuid UUID PRIMARY KEY,
  64.     signing_address  VARCHAR NOT NULL,
  65.     bundle_hash      VARCHAR NOT NULL,
  66.     target_block_number BIGINT
  67. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement