简体   繁体   English

如何更快地从智能合约中获取数据

[英]How to get data from smart contract faster

I am currently using Nethereum, which is a C# wrapper to web3 where it makes about 1.2k requests within an hour on one thread.我目前正在使用 Nethereum,它是 web3 的 C# 包装器,它在一小时内在一个线程上发出大约 1.2k 请求。 I need to make about 30k requests within 1 hour.我需要在 1 小时内发出大约 30k 个请求。

How can I quickly retrieve data from smart contracts?如何快速从智能合约中检索数据? Is it possible to use a proxy?是否可以使用代理? When writing a proxy, I mean sending a request to an intermediary server that will send a request to the target smart contract on my behalf.在编写代理时,我的意思是向中间服务器发送请求,该服务器将代表我向目标智能合约发送请求。 Or is there any other path that can help to solve this problem?或者有没有其他途径可以帮助解决这个问题?

I am considering setting up my own node, but if there is any other way, I would rather avoid it.我正在考虑建立自己的节点,但如果有任何其他方式,我宁愿避免它。

Setting up your own node is the easiest to get data out from smart contract fastest .建立自己的节点是最容易从智能合约中最快获取数据的方法 Because any IO to your node is local, it is tens or hundreds of times faster than with a remote node.因为到您的节点的任何 IO 都是本地的,所以它比远程节点快数十或数百倍。 Any other trick does not come even close to this.任何其他技巧都无法接近这一点。

You can also parallelize queries.您还可以并行化查询。 Here is an example Python script that uses a thread pool to extract eth_getLogs over JSON-RPC . 这是一个示例 Python 脚本,它使用线程池通过 JSON-RPC 提取 eth_getLogs

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM