---
title: "How to send $ETH in 19 lines of Python"
description: "Sending ETH between wallets takes about 19 lines of Python using the web3 library connected to an Ethereum node through Infura's HTTPS endpoint."
url: "https://swe.quest/articles/how-to-send-eth-in-19-lines-of-python-dda4b1de254f4342"
canonical: "https://replit.com/blog/eth"
source: "Replit"
published: "2021-05-05"
difficulty: "medium"
kind: "How-to"
reading_minutes: 3
tags: ["python","payments"]
---

# How to send $ETH in 19 lines of Python

A post on [Replit](https://swe.quest/sources/replit.md), published 2021-05-05, 3 min read, How-to. Original: [https://replit.com/blog/eth](https://replit.com/blog/eth)

## Summary

Sending ETH between wallets takes about 19 lines of Python using the web3 library connected to an Ethereum node through Infura's HTTPS endpoint. The steps are: initialize a Web3 object, normalize sender and recipient addresses with toChecksumAddress, fetch the nonce, build a transaction dict with value converted via toWei and a gas price in gwei, sign it with a private key kept in Replit secrets, and broadcast it with sendRawTransaction. The result can then be checked on Etherscan. The private key must never appear in public code.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Python](https://swe.quest/tags/python.md) (Languages)
- [Payments & fintech](https://swe.quest/tags/payments.md) (Domains)

## Prerequisites

- Python basics ([easy posts on Python](https://swe.quest/tags/python.md?difficulty=easy))
- Ethereum wallets

## Keywords

Ethereum, web3.py, Infura, MetaMask, Replit, Etherscan

## Related posts

- [Light Up Your Builds with Render Webhooks](https://swe.quest/articles/light-up-your-builds-with-render-webhooks-cb1958e456f90033.md): Render · 2025-09-16 · Medium · 4 min read · Deployment, Hardware, API design
  A Raspberry Pi Pico W–driven 32×32 LED panel lights up with distinct animations whenever Render webhook events fire for build\_started, build\_ended, deploy\_started and deploy\_ended.
- [How to build and authenticate an AI API using Modal, Neon, and Unkey](https://swe.quest/articles/how-to-build-and-authenticate-an-ai-api-using-modal-neon-and-unkey-83191f2d4ca23270.md): Neon · 2024-02-14 · Medium · 6 min read · Serverless, Identity & auth, API design, Python, PostgreSQL
  An OpenAI Whisper transcription API built with FastAPI and deployed on Modal, which persists transcripts to a Neon serverless Postgres database via psycopg2.
- [Building Private Processing for AI tools on WhatsApp](https://swe.quest/articles/building-private-processing-for-ai-tools-on-whatsapp-0d604d802592db97.md): Meta Engineering · 2025-04-29 · Hard · 12 min read · Security, Cryptography, Privacy, Inference & serving, LLMs
  Private Processing lets WhatsApp users send messages to server-side AI features such as summarization and writing suggestions without Meta or WhatsApp being able to read them.
- [Introducing the commerce payments protocol](https://swe.quest/articles/introducing-the-commerce-payments-protocol-364920964bfb2054.md): Shopify Engineering · 2025-06-12 · Medium · 10 min read · Payments & fintech, System design, Security
  The Commerce Payments Protocol, built by Coinbase and Shopify on Base, brings card-style authorize-and-capture flows onchain using an immutable escrow smart contract between payer and receiver.
- [Save Resend email events to your Turso Database](https://swe.quest/articles/save-resend-email-events-to-your-turso-database-e416b48a04ff4cae.md): Turso · 2024-07-23 · Medium · 7 min read · SQLite, Communications, JavaScript, TypeScript
  Resend email webhook events (sent, delivered, bounced, opened, clicked, etc.) can be persisted to a Turso database through a small Hono/Node.js handler using @libsql/client.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
