Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid bytes string given: 0x when using self hosted geth node #2509

Closed
joeneldeasis opened this issue Mar 15, 2019 · 4 comments
Closed

Invalid bytes string given: 0x when using self hosted geth node #2509

joeneldeasis opened this issue Mar 15, 2019 · 4 comments
Labels
Bug Addressing a bug

Comments

@joeneldeasis
Copy link

Description

We always encounter this error Invalid bytes string given: 0x when performing using our self hosted geth node, but this error is not present when we are using Infura.

Expected behavior

Using Infura the value of bytes on web3-eth-abi.cjs.js line 66 is 0x000000000000000000000000000000000000000000000000006a94d74f430000 and we're able to get the current balance of the erc20 token

Actual behavior

With our self hosted geth, the value of bytes we get is: 0x which causes this error Invalid bytes string given: 0x

Steps to reproduce the behavior

Use this gist which performs balance checking of the erc20 token https://gist.github.com/joeneldeasis/4b72f1923e3a4bdfc356148a79257ede then change the provider to your own Geth node which the error occurs, this code only works when you are using Infura.

Error Logs

Error: Invalid bytes string given: 0x
    at AbiCoder.decodeParameters (Z:\xxxxxx\node_modules\web3-eth-abi\dist\web3-eth-abi.cjs.js:66:15)
    at AbiCoder.decodeParameter (Z:\xxxxxx\node_modules\web3-eth-abi\dist\web3-eth-abi.cjs.js:55:19)
    at CallContractMethod.afterExecution (Z:\xxxxxx\node_modules\web3-eth-contract\dist\web3-eth-contract.cjs.js:743:28)
    at CallContractMethod._callee$ (Z:\xxxxxx\node_modules\web3-core-method\dist\web3-core-method.cjs.js:354:35)
    at tryCatch (Z:\xxxxxx\node_modules\@babel\runtime\node_modules\regenerator-runtime\runtime.js:62:40)
    at Generator.invoke [as _invoke] (Z:\xxxxxx\node_modules\@babel\runtime\node_modules\regenerator-runtime\runtime.js:288:22)
    at Generator.prototype.(anonymous function) [as next] (Z:\xxxxxx\node_modules\@babel\runtime\node_modules\regenerator-runtime\runtime.js:114:21)
    at asyncGeneratorStep (Z:\xxxxxx\node_modules\@babel\runtime\helpers\asyncToGenerator.js:3:24)
    at _next (Z:\xxxxxx\node_modules\@babel\runtime\helpers\asyncToGenerator.js:25:9)
    at process._tickCallback (internal/process/next_tick.js:68:7)

Gists

Versions

  • web3.js: 1.0.0-beta.48
  • nodejs: v10.15.3
  • browser: Brave Version 0.61.51 Chromium: 73.0.3683.75 (Official Build) (64-bit)
  • ethereum node: 1.8.23-stable-c9427004
@nivida nivida added the Bug Addressing a bug label Mar 15, 2019
@russanto
Copy link

russanto commented Mar 15, 2019

May be the two issue linked #2499 ?
@nivida

@nivida
Copy link
Contributor

nivida commented Mar 18, 2019

I've tested it on different nodes with calling the balanceOf directly after the deployment and with a already deployed contract and couldn't reproduce this behavior. There is already an open issue in the infura repository (INFURA/infura#157) about this. I'will close this issue and will watch the issue of infura.

@russanto I will test your issue asap.

@nivida nivida closed this as completed Mar 18, 2019
@joeneldeasis
Copy link
Author

I've tested it on different nodes with calling the balanceOf directly after the deployment and with a already deployed contract and couldn't reproduce this behavior. There is already an open issue in the infura repository (INFURA/infura#157) about this. I'will close this issue and will watch the issue of infura.

@russanto I will test your issue asap.

Hi @nivida this issue only occurs on GETH nodes and it is working fine with INFURA. By the way, have you tried the gist that I've provided? Upon testing the issue still persist on beta 50. Thanks

@tgreco
Copy link

tgreco commented Mar 26, 2019

I'm having this issue too.

UnhandledPromiseRejectionWarning: Error: Invalid bytes string given: 0x at AbiCoder.decodeParameters (/home/api/src/node_modules/web3-eth-abi/dist/web3-eth-abi.cjs.js:64:15) at AbiCoder.decodeParameter (/home/api/src/node_modules/web3-eth-abi/dist/web3-eth-abi.cjs.js:55:19) at CallContractMethod.afterExecution (/home/api/src/node_modules/web3-eth-contract/dist/web3-eth-contract.cjs.js:727:28) at CallContractMethod._callee$ (/home/api/src/node_modules/web3-core-method/dist/web3-core-method.cjs.js:101:35) at tryCatch (/home/api/src/node_modules/regenerator-runtime/runtime.js:45:40) at Generator.invoke [as _invoke] (/home/api/src/node_modules/regenerator-runtime/runtime.js:271:22) at Generator.prototype.(anonymous function) [as next] (/home/api/src/node_modules/regenerator-runtime/runtime.js:97:21) at asyncGeneratorStep (/home/api/src/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24) at _next (/home/api/src/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9) at process._tickCallback (internal/process/next_tick.js:68:7) (node:9990) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:9990) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Addressing a bug
Projects
None yet
Development

No branches or pull requests

4 participants