https://github.com/varugasu/ether-simple_raw_tx
Simple raw transaction in Rinkeby Test Network
https://github.com/varugasu/ether-simple_raw_tx
Last synced: 2 months ago
JSON representation
Simple raw transaction in Rinkeby Test Network
- Host: GitHub
- URL: https://github.com/varugasu/ether-simple_raw_tx
- Owner: varugasu
- License: mit
- Created: 2018-10-24T16:38:10.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-04-01T10:49:02.000Z (about 3 years ago)
- Last Synced: 2024-12-27T06:10:00.424Z (4 months ago)
- Language: Python
- Size: 2.93 KB
- Stars: 0
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- License: LICENSE
Awesome Lists containing this project
README
# Simple Raw Transaction in Web3.py
## Sending ether in Rinkeby Test Network through Infura API
### Requirements:
- web3.py 4.7.2
- API Key from [infura.io](https://infura.io)
- Source account and its private key
- Destination account```
infuraApi = 'API'
account = 'SRC ACCOUNT'
key = 'PRIVATE KEY'
destinationAccount = 'DST ACCOUNT'
```#### Transaction:
```python
tx = {
'to': destinationAccount,
'value': Web3.toWei('1', 'ether'),
'gas': 210000,
'gasPrice': w3.eth.gasPrice,
'nonce': w3.eth.getTransactionCount(account),
'chainId': 4 # Rinkeby Test Network
}
```#### Signing the transaction with source account's private key:
```python
signed = w3.eth.account.signTransaction(tx, key)
```