bitpay / bitcore

A full stack for bitcoin and blockchain-based applications
https://bitcore.io/
MIT License
4.86k stars 2.09k forks source link

Error syncing ETH testnet #2636

Open Fedyano opened 4 years ago

Fedyano commented 4 years ago

Hi! getting an error {"message":"2019-12-13 10:41:32.404 GMT+3 | Syncing... | Chain: ETH | Network: testnet | 7500.00 blocks/min | Height: 704166","level":"info"} {"level":"error","message":"Error syncing ETH testnet"}

OS Ubuntu 18.04 node -v 10.17.0 ETH Wallet: parity --chain kovan --jsonrpc-apis personal ЕTH Syncing snapshot 326/1859 #14239655

What could be wrong?

Fedyano commented 4 years ago

Now found a place of error

at EthP2pWorker.convertBlock (/var/www/bitcore8130-1/packages/bitcore-node/src/modules/ethereum/p2p/p2p.ts:311:39)

And all stack

{ Error: insufficient data for uint256 type (arg="", coderType="uint256", value="0x000000000005150ac4c39a6f3f0000") at Object.throwError (/var/www/bitcore8130-1/packages/bitcore-node/node_modules/ethers/utils/errors.js:68:17) at CoderNumber.decode (/var/www/bitcore8130-1/packages/bitcore-node/node_modules/ethers/utils/abi-coder.js:363:20) at /var/www/bitcore8130-1/packages/bitcore-node/node_modules/ethers/utils/abi-coder.js:648:32 at Array.forEach () at unpack (/var/www/bitcore8130-1/packages/bitcore-node/node_modules/ethers/utils/abi-coder.js:640:12) at CoderTuple.decode (/var/www/bitcore8130-1/packages/bitcore-node/node_modules/ethers/utils/abi-coder.js:767:22) at AbiCoder.decode (/var/www/bitcore8130-1/packages/bitcore-node/node_modules/ethers/utils/abi-coder.js:912:61) at ABICoder.decodeParameters (/var/www/bitcore8130-1/packages/bitcore-node/node_modules/web3-eth-abi/src/index.js:229:30) at Object._decodeMethod [as decodeMethod] (/var/www/bitcore8130-1/packages/bitcore-node/node_modules/abi-decoder/index.js:86:32) at EthTransactionModel.abiDecode (/var/www/bitcore8130-1/packages/bitcore-node/src/modules/ethereum/models/transaction.ts:199:41) at EthP2pWorker.convertTx (/var/www/bitcore8130-1/packages/bitcore-node/src/modules/ethereum/p2p/p2p.ts:355:36) at EthP2pWorker.convertTx (/var/www/bitcore8130-1/packages/bitcore-node/src/modules/ethereum/p2p/p2p.ts:384:30) at transactions.map.t (/var/www/bitcore8130-1/packages/bitcore-node/src/modules/ethereum/p2p/p2p.ts:311:53) at Array.map () at EthP2pWorker.convertBlock (/var/www/bitcore8130-1/packages/bitcore-node/src/modules/ethereum/p2p/p2p.ts:311:39) at EthP2pWorker.sync (/var/www/bitcore8130-1/packages/bitcore-node/src/modules/ethereum/p2p/p2p.ts:226:61) at process._tickCallback (internal/process/next_tick.js:68:7) reason: 'insufficient data for uint256 type', code: 'INVALID_ARGUMENT', arg: '', coderType: 'uint256', value: '0x000000000005150ac4c39a6f3f0000' }

micahriggan commented 4 years ago

Oh nice! Could you console log the tx.data that is failing in convertTx? If you put a try catch around abiDecode and log the data there

I ran into this issue, but I need the data to create a unit test.

The solution to this issue is https://github.com/bitpay/bitcore/pull/2634

Fedyano commented 4 years ago

Awesome!!! Thanks for the answer!

Here is the data or something else is needed? { Error: insufficient data for uint256 type (arg="", coderType="uint256", value="0x000000000005150ac4c39a6f3f0000")

try-catch block in bitcore/packages/bitcore-node/src/modules/ethereum/p2p/p2p.ts

try catch

and err

err

and by the way ... sync continued))

and here is the problem block

Снимок экрана 2019-12-14 в 16 43 46
micahriggan commented 4 years ago

No problem , glad that worked for you. The problem block should be enough for me to get what I need, thanks 😊

Fedyano commented 4 years ago

Height of problem block in the first message. Maybe needs some other data? I'm new in cryptocurrencies and may not know something

Fedyano commented 4 years ago

Here is still poured into the logs problem blocks: this is what i noticed Height: 6078848 Error: insufficuent data for address type (arg="", coderType="address", value="0x627306090abab3a6e1400e9345bc60c78a8bef57 ") Height: 6078987 Error: insufficuent data for address type (arg="", coderType="address", value="0xf17f52151ebef6c7334fad080c5704d77216b732") Height: 6133761 Error: insufficuent data for address type (arg="", coderType="address", value="0x575484df3f2146705260ec9b51fee8de9c3771c5")

and if you take the first address 0x627306090abab3a6e1400e9345bc60c78a8bef57 , then such data there is a balance but no transaction

Снимок экрана 2019-12-17 в 12 30 51

with second and third such data

todipratik commented 4 years ago

@micahriggan @Fedyano

For ETH, why a transaction created in ETH testnet is not synced in bitcore node? It shows the tx doesn't exists. https://api-eth.bitcore.io/api/ETH/testnet/tx/0x27241f59bb66ccdc4b8bc6141c3d9d061ab2449e61d4ad2343f20ef6845af856

While the transaction is available on Ropsten testnet network: https://ropsten.etherscan.io/tx/0x27241f59bb66ccdc4b8bc6141c3d9d061ab2449e61d4ad2343f20ef6845af856

Fedyano commented 4 years ago

@micahriggan @Fedyano

For ETH, why a transaction created in ETH testnet is not synced in bitcore node? It shows the tx doesn't exists. https://api-eth.bitcore.io/api/ETH/testnet/tx/0x27241f59bb66ccdc4b8bc6141c3d9d061ab2449e61d4ad2343f20ef6845af856

While the transaction is available on Ropsten testnet network: https://ropsten.etherscan.io/tx/0x27241f59bb66ccdc4b8bc6141c3d9d061ab2449e61d4ad2343f20ef6845af856

I don’t understand what you mean

justinkook commented 4 years ago

Our ETH testnet is actually Kovan network instead of the Ropsten network!

Fedyano commented 4 years ago

Our ETH testnet is actually Kovan network instead of the Ropsten network!

Yes, i use Kovan testnet. I don’t understand what the transaction 0x27241f59bb66ccdc4b8bc6141c3d9d061ab2449e61d4ad2343f20ef6845af856 is about

todipratik commented 4 years ago

Got it, thanks! It works using Kovan network. One follow up question: Does BWS supports having multiple addresses for ETH in one single account?

justinkook commented 4 years ago

Got it, thanks! It works using Kovan network. One follow up question: Does BWS supports having multiple addresses for ETH in one single account?

No it only supports a single address using path m/0'/0' per wallet.

todipratik commented 4 years ago

@justinkook Any specific reasons for supporting single address per wallet?

micahriggan commented 4 years ago

Since ETH follows an account style, if you move all of your ETH after each transaction, it doesn't migrate all of your ERC20 tokens with it, which would mean you'd need ETH in the address to move those tokens.

Since ETH is required to move the tokens, we decided it'd be simpler to have wallets with 1 address, and the token wallets would be connected to that address.

You're still able to have multiple addresses, it'll just be multiple accounts :)

todipratik commented 4 years ago

@micahriggan I understand your point. But, for creating multiple wallets, we need to have the 12 word mnemonic on the server. So, the server will have mnemonic and it will generate wallets and hence addresses. Since, BWS doesn't support multi-sig for ethereum wallets, we don't want to have the only co-signer's key on the server (for security reasons).

Also, I am not sure if I can use the same mnemonic for generating multiple wallets (I don't want the user to have control of their wallets and we will hold the mnemonic phrases)

micahriggan commented 4 years ago

If you're doing some sort of custodial wallet thing, you can definitely have each user be an account derivation of one mnemonic.

https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki m / purpose' / coin_type' / account' / change / address_index

Bip44 supports multiple 'accounts', and each account can have multiple addresses and change addresses.

Also, I recommend looking into having the server/db only hold the xPubKeys if you can.

Here's an example where we use the xpub to derive addresses for ETH. https://github.com/bitpay/bitcore/blob/master/packages/crypto-wallet-core/src/derivation/eth/index.ts#L18

That way you can generate addresses on the main server, and have a separate server that has access to the mnemonic for signing, assuming you need the ability to programmatically move funds.

micahriggan commented 4 years ago

If you come up with any ideas related to managing these keys for ETH, like multi-sig or some sort of architecture that integrates with BWS I'd be interested in seeing it, as that's an area that needs a ton of work.