BSC websocket 端点延迟
BSC websocket endpoint lantency
我最近在为我的dex限价订单监控BSC链上合约地址的交易,我终于找到了一个稳定的解决方案来监控日志事件--'using web sockect connection'.
bsc = "wss://ws-nd-112-055-480.p2pify.com/xxxxxxxxxxxxxxxxxxx"
web3 = Web3(Web3.WebsocketProvider(bsc))
poolAdd = '0x0eD7e52944161450477ee417DE9Cd3a859b14fD0'
block_filter = web3.eth.filter({'fromBlock': 'latest', 'address': poolAdd, 'topics': [sha128Dic['swap']]})
while 1:
log_new(block_filter)
time.sleep(1)
但是,我尝试更改以下列表中的一些 websokect 端点提供程序,交换事件日志仍然存在一些巨大的时间延迟。其中一些发生在将近一小时前。
wss://bsc-ws-node.nariox.org:443
莫拉利斯:https://moralis.io/speedy-nodes/
链栈:https://chainstack.com/build-better-with-binance-smart-chain/
当我切换回 http 提供商时,如:Web3.HTTPProvider('https://bsc-dataseed.binance.org/')。事件日志几乎是及时的,但有些 'filter not found exception will be found during the time elapse'.
这里是写在BSC websocket介绍上的注释:'You can make eth_getLogs requests with up to a 5K block range. If you need to pull logs frequently, we recommend using WebSockets to push new logs to you when they are available.'
谁能帮忙找到一个更好的方法来及时获取 websocket 端点?
Run your own node 用于最小化延迟。
如果你做不到,打开你的钱包然后browse the list of commercial node providers。
要优化您需要的延迟 运行 您自己的节点需要非常强大的专用服务器
或者您可以从 fastlynode
获取私有节点
我最近在为我的dex限价订单监控BSC链上合约地址的交易,我终于找到了一个稳定的解决方案来监控日志事件--'using web sockect connection'.
bsc = "wss://ws-nd-112-055-480.p2pify.com/xxxxxxxxxxxxxxxxxxx"
web3 = Web3(Web3.WebsocketProvider(bsc))
poolAdd = '0x0eD7e52944161450477ee417DE9Cd3a859b14fD0'
block_filter = web3.eth.filter({'fromBlock': 'latest', 'address': poolAdd, 'topics': [sha128Dic['swap']]})
while 1:
log_new(block_filter)
time.sleep(1)
但是,我尝试更改以下列表中的一些 websokect 端点提供程序,交换事件日志仍然存在一些巨大的时间延迟。其中一些发生在将近一小时前。
wss://bsc-ws-node.nariox.org:443
莫拉利斯:https://moralis.io/speedy-nodes/
链栈:https://chainstack.com/build-better-with-binance-smart-chain/
当我切换回 http 提供商时,如:Web3.HTTPProvider('https://bsc-dataseed.binance.org/')。事件日志几乎是及时的,但有些 'filter not found exception will be found during the time elapse'.
这里是写在BSC websocket介绍上的注释:'You can make eth_getLogs requests with up to a 5K block range. If you need to pull logs frequently, we recommend using WebSockets to push new logs to you when they are available.'
谁能帮忙找到一个更好的方法来及时获取 websocket 端点?
Run your own node 用于最小化延迟。
如果你做不到,打开你的钱包然后browse the list of commercial node providers。
要优化您需要的延迟 运行 您自己的节点需要非常强大的专用服务器 或者您可以从 fastlynode
获取私有节点