我正在尝试在以太坊 ropsten 测试网中进行交易,我从 ropsten ethereum faucet 接收到以太币,但是当我尝试发送交易时出现此错误:ValueError: {'code': -32000, '消息':'gas * 价格 + 价值的资金不足'}。我该怎么办?
这是我的代码:
from web3 import Web3
def sendTransaction(message):
w3 =
Web3(Web3.HTTPProvider('')) #ropsten provider link
address = '' #address of wallet
privateKey = '' #privatekey
nonce = w3.eth.getTransactionCount(address)
gasPrice = w3.eth.gasPrice
value = w3.toWei(0, 'ether')
signedTx = w3.eth.account.signTransaction(dict(
nonce=nonce,
gasPrice=gasPrice,
gas=100000,
to='0x0000000000000000000000000000000000000000',
value=value,
data=message.encode('utf-8')
), privateKey)
tx = w3.eth.sendRawTransaction(signedTx.rawTransaction)
txId = w3.toHex(tx)
return txId
请谁能解释一下我错在哪里?