Skip to main content

Getting Started

GraphQL is Basement’s optimized way of getting data off-the-chain into your app. Sometimes, you want a little bit more flexibility. This is where SQL shines.

SQL queries on Basement run against a PostgreSQL database and allow you to do more complex analysis of on-chain data.

Basement SQL 101

  • Queries are run against a PostgreSQL database
  • Queries time out after running for longer than 30 seconds. Try querying a smaller range of block numbers in case of a timeout. Higher limits are available for enterprise customers.
  • Dynamic parameters can be added to your query using curly braces {{parameter_name}}. We automatically detect and cast the type for you.
  • Addresses, Transaction Hashes, and other hexadecimal types are encoded as ‘\xdeadbeef’ whereas parameters can be expressed as you would in an RPC node: 0xdeadbeef.

Creating your first query

You can create queries through the Basement dashboard. Create a free account here: [].

Making a request


SQL queries are counted as requests for a limited introductionary period, to allow everyone to play and experiment. They will be billed by number of rows and execution time later this year. Free rows and execution time will be available across all plans.

Go to the code tab to get a CURL command to run your request. Don’t forget to include your API key, to prevent unexpected behaviour. Query parameters can be supplied through the URL for a GET, or encoded as JSON in the body for a POST request to this query's endpoint.

More reading