This folder contains a simple Solidity contract LogStore.sol and Python tools to compile, deploy, and interact with it via Web3 and a FastAPI wrapper.
Files added:
LogStore.sol- Solidity contract storing logsdeploy.py- compile & deploy to testnetsend_log.py- sign & send addLog transactionsapp.py- FastAPI app exposing endpoints (needsCONTRACT_ADDRESSset)requirements.txt- Python dependencies.env.example- example env variables
Quick start (PowerShell):
- Create virtual env and install:
python -m venv .venv; .\.venv\Scripts\Activate.ps1; pip install -r requirements.txt-
Copy
.env.example->.envand fillRPC_URLandPRIVATE_KEY. For Sepolia use Infura or Alchemy RPC. -
Deploy contract:
python deploy.pyThis prints the deployed address. Save it to .env as CONTRACT_ADDRESS and also writes ABI file manually if needed.
- Run FastAPI server:
$env:CONTRACT_ADDRESS="0x..."; uvicorn app:app --reload- Send a log via script:
python send_log.py "Test message"Notes:
- Keep your private key secret. For production use a secure signer or a wallet.
- ABI is expected at
LogStore.abi.jsonafter compile; deploy.py prints ABI and address.