Skip to main content

Multicall batching middleware for asynchronous scripts using web3.py

Project description

Dank Mids

Dank Mids is a EVM RPC batching library that helps reduce the number of HTTP requests to a node, saving time and resources. It automatically collects eth_call calls into multicalls and bundles all RPC calls together in jsonrpc batch calls. tl;dr: its fast as fuck.

image

The goal of this tool is to reduce the workload on RPC nodes and allow users to make calls to their preferred node more efficiently. This optimization is especially useful for developers writing scripts that perform large-scale blockchain analysis, as it can save development time and resources.

Installation

To install Dank Mids, use pip:

pip install dank-mids

Usage with web3.py

The primary function you need to use Dank Mids is setup_dank_w3_from_sync. This function takes a sync Web3 instance and wraps it for async use. If using dank_mids with eth-brownie, you can just import the premade dank_web3 object as well

Example usage of Dank Mids with web3py:

from dank_mids.helpers import setup_dank_w3_from_sync
dank_web3 = setup_dank_w3_from_sync(w3)
# OR
from dank_mids.helpers import dank_web3

# Then:
random_block = await dank_web3.eth.get_block(123)

Usage with eth-brownie

Usage with ape

  • COMING SOON: Dank Mids will also work with ape.

Testimonials

Yearn big brain Tonkers Kuma had this to say:

image

Notes

You can also set DANK_MIDS_DEMO_MODE=True to see a visual representation of the batching in real time on your console.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dank_mids-4.20.94.tar.gz (42.2 kB view details)

Uploaded Source

Built Distribution

dank_mids-4.20.94-py3-none-any.whl (53.5 kB view details)

Uploaded Python 3

File details

Details for the file dank_mids-4.20.94.tar.gz.

File metadata

  • Download URL: dank_mids-4.20.94.tar.gz
  • Upload date:
  • Size: 42.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.9.19 Linux/5.15.0-1064-azure

File hashes

Hashes for dank_mids-4.20.94.tar.gz
Algorithm Hash digest
SHA256 2b5247fcaf6aea29b38c95b73e28480e657a5be00d59080a835e9f65f4d176c3
MD5 d26314c3143a17b33ada7719d78f3c2e
BLAKE2b-256 eb0615c88d9b3ed47780ad02c9053bede711f43c6223e4fa552f770cfd0ec9d6

See more details on using hashes here.

File details

Details for the file dank_mids-4.20.94-py3-none-any.whl.

File metadata

  • Download URL: dank_mids-4.20.94-py3-none-any.whl
  • Upload date:
  • Size: 53.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.9.19 Linux/5.15.0-1064-azure

File hashes

Hashes for dank_mids-4.20.94-py3-none-any.whl
Algorithm Hash digest
SHA256 0e97b5dfff80c734e3ce31fefb76244d1e0cfc9ed0ab6f38a7eb9ae14b15a08d
MD5 f14fbaa3714f05b01a026191ae388231
BLAKE2b-256 3116ccf19e9982eb0226b64d9a3cac747c40399d993b78f864fe2f77709dbd52

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page