thetatoken / theta-eth-rpc-adaptor

An adaptor that translates the Theta RPC APIs to the Ethereum RPC APIs
https://docs.thetatoken.org/
24 stars 11 forks source link

Empty reply from server while calling block height 0x1 #28

Open barryz opened 2 years ago

barryz commented 2 years ago

After the guardian node and RPC-adaptor are deployed. I tried to call eth_getBlockByNumber via RPC-adaptor. When I call the latest block number, it's fine:

root@server:/opt/apps/theta/bin# curl -X "POST" "http://127.0.0.1:8545/" -H 'Content-Type: application/json' -d '{"id": 1337, "jsonrpc": "2.0", "method": "eth_getBlockByNumber", "params": ["0xe518e8", false]}'
{"jsonrpc":"2.0","id":1337,"result":{"number":"0xe518e8","hash":"0x593e38309902397f4222c0d94326653fcbd562411bbd40aa591591ee97cfe657","parentHash":"0x198180ec11e8f1fe1b1aa60c2ec77687886a5009bce12d63a983856d2b63d53a","timestamp":"0x625d572b","miner":"0x80eab22e27d4b94511f5906484369b868d6552d2","transactionsRoot":"0xab0e8312f8f4f611000d554a2f176be6f299e89a04f01f01ec9cc5abeab905fa","stateRoot":"0xf631cce5c8267bb6450cbe07cfffc2d7f8820a9c723ca9a8f7163aa245ad2023","receiptsRoot":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x0000000000000000","sha3Uncles":"0x0000000000000000000000000000000000000000000000000000000000000000","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","difficulty":"0x0","totalDifficulty":"0x0","size":"0x3e8","gasLimit":"0x1312d00","gasUsed":"0x0","extraData":"0x","uncles":[],"transactions":[]}}

When I call the very first block number 0x1. It looks like something is wrong:

root@server:/opt/apps/theta/bin# curl -X "POST" "http://127.0.0.1:8545/" -H 'Content-Type: application/json' -d '{"id": 1337, "jsonrpc": "2.0", "method": "eth_getBlockByNumber", "params": ["0x1", false]}'
curl: (52) Empty reply from server

PS: I followed this doc to build and deploy rpc-adaptor and Theta guardian node.

jieyilong commented 2 years ago

This is expected. If you start the guardian node from a snapshot, blocks/transactions before the snapshot height won't be available. Thanks.

barryz commented 2 years ago

This is expected. If you start the guardian node from a snapshot, blocks/transactions before the snapshot height won't be available. Thanks.

The only way I can do was to sync from scratch. And the sync process seems too slow. How can I speed up the sync?

jieyilong commented 2 years ago

Got it, thanks. May I ask what are your use cases that require syncing from the genesis?

barryz commented 2 years ago

Got it, thanks. May I ask what are your use cases that require syncing from the genesis?

We would like to integrate with the theta EVM chain so that users can get access to the historical state of the contract (or price of token).

Our website is https://debank.com

jieyilong commented 2 years ago

I see. Syncing from genesis could take a while. We can look into improve the syncing speed in the future. But if you are OK just going back to a certain height, you can download the latest snapshot before that height from the following link:

http://mainnet-data.thetatoken.org/snapshot?height=HEIGHT

For example: http://mainnet-data.thetatoken.org/snapshot?height=14230301

BTW, if you switch to anther snapshot, you wound need to delete the db folder under your config folder before restarting the Theta node.

0xChupaCabra commented 1 year ago

Hello, how can i sync theta node from genesis? Everytime i start the service it looks for snapshot file. I need to have full transactions and log history on my node. Thanks in advance