Created
January 4, 2019 16:22
-
-
Save ivandru/e6d08f503caf8c59e77857e870e65450 to your computer and use it in GitHub Desktop.
Simple Ether Transfer on Ropsten
This file contains 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