背景
官方rpc服务禁用了通过http/https方式调用rpc filter相关方法。原因:rpc filter相关方法的工作机制是在一个节点中生成一个filter,接口把filter id返回,后续客户端使用filter id再次进行交互查filter的变化。由于官方rpc服务后面有多个节点负载均衡,同一个客户端每次调用可能不会都分配到同一个节点上,所以filter方法在官方rpc服务中无法正常工作。
禁用的方法如下:
eth_newFilter
eth_newBlockFilter
eth_newPendingTransactionFilter
eth_getFilterChanges
问题
无法通过http/https方式调用filter相关方法,报错:the method is not allowed
解决方案
可以通过wss服务来调用filter方法,传入参数和通过http/https方式调用的参数一样。官方wss服务地址是:wss://exchainws.okex.org:8443