-
-
Save mayeaux/10c5939be79f2f90695bde5c08300859 to your computer and use it in GitHub Desktop.
Simple Ether Transfer on Ropsten
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import web3 | |
import json | |
from eth_account import Account | |
from web3 import Web3 | |
w3 = Web3(Web3.HTTPProvider('https://ropsten.infura.io/v3/apiKey')) | |
acct = Account.privateKeyToAccount('private key') | |
nonce = w3.eth.getTransactionCount(acct.address) | |
transaction = { | |
'to' : toAccount, | |
'value': 1, | |
'gas': 21000, | |
'gasPrice': w3.eth.gasPrice, | |
'nonce': nonce, | |
'chainId': 3 | |
} | |
key = acct.privateKey | |
signed = w3.eth.account.signTransaction(transaction, key) | |
w3.eth.sendRawTransaction(signed.rawTransaction) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment