[Ethereum] Public Nodes that Work with web3 Filters

nodespythonweb3js

I am attempting to connect to the Ethereum blockchain and monitor transactions as they are broadcasted. I don't have the capability to run a full node on my computer, so I am relying on "third party" nodes to connect to the blockchain. The two that I have been trying are "https://mainnet.infura.io/ [MY PRIVATE KEY]" and "https://api.myetherapi.com/eth". To retrieve newest transactions I am using the web3 python module filters. However, when I execute this code, as inspired by here and here:

from web3 import Web3, HTTPProvider
import time

node = #DEPENDS
connection = Web3(HTTPProvider(node))

block_filter = connection.eth.filter('latest')

time.sleep(60) #OR LONGER
print(block_filter.get_all_entries())

If my node is the infuria one, I get the error "requests.exceptions.HTTPError: 405 Client Error: Method Not Allowed for url: https://mainnet.infura.io/ [MY PRIVATE KEY]". If I use the myetherapi one, the result is simply an empty list.

Are there any other HTTP nodes that I could use to connect to the blockchain? Or is the problem with my code?

Best Answer

It seems that problem is not in your code. I have the same issue: tried to use infura and Filter() on Python. Unfortunately, infura don't provide this method at the moment, but it will be in the future as they said.

What you can do:

1) trying another public node (google it or look here https://www.ethernodes.org/)

2) create your own node (as I decided to do) — simpliest way to do it here https://geth.ethereum.org/downloads/

Related Topic