Skip to main content
Version: testnet (v0.76)

Network history

📄️ Export network history as CSV

Export CSV table data from network history between two block heights. The requested block heights must fall on network history segment boundaries, which can be discovered by calling the API to list all network history segments. By default segments contain 1000 blocks. In that case ranges such as (1, 1000), (1001, 2000), (1, 3000) would all fall on segment boundaries and be valid. The generated CSV file is compressed into a ZIP file and returned, with the file name in the following format: `[chain id]-[table name]-[start block]-[end block].zip` In gRPC, results are returned in a chunked stream of base64 encoded data. Through the REST gateway, the base64 data chunks are decoded and streamed as a `content-type: application/zip` HTTP response. The CSV exported data uses a comma as a DELIMITER between fields, and ' for QUOTE-ing fields. If a value contains any of: DELIMITER, QUOTE, carriage return, or line feed then the whole value is prefixed and suffixed by the QUOTE character and any occurrence within the value of a QUOTE character preceded by another QUOTE. A NULL is output as the NULL parameter string and is not quoted, while a non-NULL value matching the NULL parameter string is quoted. For example, with the default settings, a NULL is written as an unquoted empty string, while an empty string data value is written with double quotes. Note that CSV files produced may contain quoted values containing embedded carriage returns and line feeds. Thus the files are not strictly one line per table row like text-format files. The first row of the CSV file is a header that describes the contents of each column in subsequent rows. Usually the ZIP file will contain only a single CSV file. However it is possible that the (from_block, to_block) request spans over a range of blocks in which the underlying schema of the database changes. For example, a column may have been added, removed, or renamed. If this happens, the CSV file will be split at the point of the schema change and the zip file will contain multiple CSV files, with a potentially different set of headers. The 'version' number of the database schema is part of the in the CSV filename: `[chain id]-[table name]-[schema version]-[start block]-[end block].zip` For example, a zip file might be called And contain two CSV files: `mainnet-sometable-1-000001-002000.csv`: timestamp, value 1, foo 2, bar And `mainnet-sometable-2-002001-003000.csv`: timestamp, value, extra_value 3, baz, apple It is worth noting that the schema will not change within a single network history segment. buf:lint:ignore RPC_RESPONSE_STANDARD_NAME buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE