Skip to main content

Web3Gateway - A Restful Web3 Gateway Service

Project description

🌐 Web3 Restful Gateway

A multi-chain Web3 gateway service that provides unified RESTful APIs for blockchain interaction.

Python 3.10+ FastAPI Web3.py License: MIT

🚀 Features

  • 🔗 Multi-Chain Support: Seamlessly interact with multiple EVM-compatible blockchains
  • 🔄 Real-time Data: Live blockchain data through Infura and Etherscan V2 API
  • 🛡️ Battle-tested Security: Basic auth + rate limiting
  • 🎯 High Performance: Redis caching for frequently accessed data
  • 📊 Gas Optimization: Smart gas estimation and transaction cost prediction

🛠️ Tech Stack

  • FastAPI: High-performance async web framework
  • Web3.py: Ethereum interaction library
  • Etherscan V2: Multi-chain data queries
  • Redis: Query result caching
  • Pydantic: Data validation and settings management

🔧 Quick Start

# Clone the repo
git clone https://github.com/daboooooo/web3gateway.git
# setup the environment
cd web3_restful_gateway
./setup.sh -i
# start the server
web3gateway
# Clone the repo
git clone https://github.com/yourusername/web3_restful_gateway.git

# Install dependencies
pip install -r requirements.txt

# Set up configuration
cp config.json.example config.json
# Edit config.json with your credentials

# Start the server
uvicorn web3gateway.main:app --reload

🔥 Core APIs

Transaction Operations

POST /transaction/assemble
POST /transaction/send
POST /transaction/get_receipt

Account Operations

POST /account/balance
POST /account/token_balance
POST /account/txlist

System Operations

GET /ping

🎮 API Example

# Get account balance
curl -X POST "http://localhost:8000/account/balance" \
  -H "Content-Type: application/json" \
  -u "username:password" \
  -d '{
    "chain_id": 1,
    "address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"
  }'

🔌 Supported Networks

  • Ethereum Mainnet (ChainID: 1)
  • Binance Smart Chain (ChainID: 56)
  • Polygon (ChainID: 137)
  • Arbitrum (ChainID: 42161)
  • Optimism (ChainID: 10)
  • And more...

⚡️ Performance

  • Response Time: < 100ms (cached)
  • Throughput: 1000+ TPS
  • Cache Hit Ratio: ~80%

🔒 Security Features

  • Basic Authentication
  • Rate Limiting
  • Input Validation
  • Error Handling
  • Response Sanitization

🤝 Contributing

PRs are welcome! Check out our contribution guidelines.

📜 License

MIT License - fork, modify and use as you wish.

⚠️ Disclaimer

This is a production-ready gateway but use at your own risk. Always verify transactions before signing.

Project details


Download files

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

Source Distribution

web3gateway-0.1.1.tar.gz (29.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

web3gateway-0.1.1-py3-none-any.whl (32.5 kB view details)

Uploaded Python 3

File details

Details for the file web3gateway-0.1.1.tar.gz.

File metadata

  • Download URL: web3gateway-0.1.1.tar.gz
  • Upload date:
  • Size: 29.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for web3gateway-0.1.1.tar.gz
Algorithm Hash digest
SHA256 24e33f614f8a6390201e912cfd6891be0f0c235b281868e53c61267dd69c592b
MD5 e9de9bd00377816189699d718875d40e
BLAKE2b-256 6aa47850ff8f1726685bfc74a20f6c8e482c76f5d5cbea0e7846585901984257

See more details on using hashes here.

File details

Details for the file web3gateway-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: web3gateway-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 32.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for web3gateway-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b7df6cf0a2c5de393f4574f455b00bce80720f83234eeb934828df0005e82ee3
MD5 5253fa4a4a92e66db8b8cce60105de5e
BLAKE2b-256 1f790018168b1a177e7fdeaa8e8480f59d1901d6cf32b6ba0db15d68dc295ed7

See more details on using hashes here.

Supported by

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