Response Compression at RPC Edge

Nischit Pradhan

We're excited to announce an important update to our RPC edge infrastructure at thirdweb. This enhancement is designed to improve performance and reduce costs for our users.

🚀 What’s New?

  • Response Compression at RPC Edge:
    We’ve enabled response compression, meaning our RPC endpoints now deliver compressed responses to reduce data size and speed up transmission.
  • Cost Reduction for Users:
    With smaller payloads, users can enjoy reduced bandwidth usage and lower overall costs when interacting with our servers.
  • New Request Requirement:
    To take full advantage of this update, you need to add an Accept-Encoding header to your requests. This tells our servers that your client can handle compressed responses.

🛠️ How to Use the New Feature

Simply include the Accept-Encoding header in your API requests. For instance, if you're calling the eth_blockNumbermethod using our RPC endpoint, you can use the following curl example:

curl -H "Content-Type: application/json" \
-H "Accept-Encoding: gzip" \
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \
https://1.rpc.thirdweb.com

In this example:

  • The Accept-Encoding: gzip header signals that your client accepts gzip-compressed responses.
  • The JSON payload makes a call to eth_blockNumber to retrieve the latest block number.

🎉 Conclusion

This update is part of our continuous effort to enhance performance and efficiency. We’re committed to providing you with the best tools and infrastructure for your development needs. If you have any feedback or questions, please don’t hesitate to reach out.