web3.py
ValueError: {'code': -32000, 'message': 'transaction underpriced'}
调高gas即可
pancakeswap2_txn = contract.functions.swapExactETHForTokens(
0, # set to 0, or specify minimum amount of tokeny you want to receive - consider decimals!!!
[spend,tokenToBuy],
sender_address,
(int(time.time()) + 10000)
).buildTransaction({
'from': sender_address,
'value': web3.toWei(0.001,'ether'),#This is the Token(BNB) amount you want to Swap from
'gas': 25000000,
'gasPrice': web3.toWei('10','gwei'),
'nonce': nonce,
})