myetherapi | ETH / Ropsten / JSON RPC / Web3 | Cryptocurrency library
kandi X-RAY | myetherapi Summary
kandi X-RAY | myetherapi Summary
An API by MyEtherWallet. ETH / Ropsten / JSON RPC / Web3
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of myetherapi
myetherapi Key Features
myetherapi Examples and Code Snippets
Community Discussions
Trending Discussions on myetherapi
QUESTION
class MyEtherApi():
def __init__(self, addr=None, key=None):
self.addr = addr
self.key = key
self.w3 = Web3(HTTPProvider('https://api.myetherapi.com/eth'))
def get_eth_balance(self):
return self.w3.eth.getBalance(self.addr)
def send_eth(self, address, amt, gas):
tx = Transaction(
to=address,
value=Web3.toWei(amt, 'ether'),
nonce=int(time()),
gasprice=self.w3.eth.gasPrice,
startgas=int(gas),
data=b'',
)
tx.sign(self.key)
raw_tx = rlp.encode(tx)
signed = self.w3.toHex(raw_tx)
return self.w3.eth.sendRawTransaction(signed)
...ANSWER
Answered 2018-Mar-12 at 08:15Your nonce
is going to be way too high. The nonce
for an account starts at 0 and increases each time the account makes a transaction. You can get the correct current nonce
for an account by calling eth_getTransactionCount
.
A nonce
that's too high means the transaction can't be mined. It will hang around in the transaction pool for a while until the nonce
becomes valid or too much time passes and it's dropped.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install myetherapi
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page