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

getBlockByNumber() throws Exception #27

Closed
gagarin55 opened this issue Nov 30, 2016 · 1 comment
Closed

getBlockByNumber() throws Exception #27

gagarin55 opened this issue Nov 30, 2016 · 1 comment

Comments

@gagarin55
Copy link

I've just installed geth:
$ geth version Geth Version: 1.5.4-stable Git Commit: b70acf3c5bd335d8dedc2a5aa6eff05c4c32105e Protocol Versions: [63 62] Network Id: 1 Go Version: go1.7.3 OS: linux GOPATH= GOROOT=/usr/lib/go-1.7

web3j 1.0.8

The call web3.ethGetBlockByNumber(DefaultBlockParameter.valueOf(BigInteger.valueOf(1)), true).send() throws exception:

Can not deserialize value of type byte from String "0x1b": not a valid Byte value at [Source: org.apache.http.conn.EofSensorInputStream@18a35f13; line: 1, column: 2024] (through reference chain: org.web3j.protocol.core.methods.response.TransactionObject["v"]) (through reference chain: org.web3j.protocol.core.methods.response.EthBlock["result"]->org.web3j.protocol.core.methods.response.Block["transactions"]) com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize value of type byte from String "0x1b": not a valid Byte value at [Source: org.apache.http.conn.EofSensorInputStream@18a35f13; line: 1, column: 2024] (through reference chain: org.web3j.protocol.core.methods.response.TransactionObject["v"]) (through reference chain: org.web3j.protocol.core.methods.response.EthBlock["result"]->org.web3j.protocol.core.methods.response.Block["transactions"]) at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:379) at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:339) at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.wrapAndThrow(BeanDeserializerBase.java:1589) at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:278) at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:140) at com.fasterxml.jackson.databind.ObjectReader._bind(ObjectReader.java:1579) at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:961) at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:978) at org.web3j.protocol.core.methods.response.EthBlock$ResponseDeserialiser.deserialize(EthBlock.java:458) at org.web3j.protocol.core.methods.response.EthBlock$ResponseDeserialiser.deserialize(EthBlock.java:449) at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:490) at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:95) at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:276) at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:140) at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3789) at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2899) at org.web3j.protocol.http.HttpService.lambda$getResponseHandler$9(HttpService.java:91) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:222) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:164) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:139) at org.web3j.protocol.http.HttpService.send(HttpService.java:69) at org.web3j.protocol.core.Request.send(Request.java:68)

I've checked geth rpc itself, it works like a charm

Thank you for advice

@conor10
Copy link
Contributor

conor10 commented Dec 1, 2016

The issue here is Parity & Geth differing in the v field type in their transaction response messages. Parity returns a byte, Geth returns a hex encoded string. See here for details.

Workaround has gone out with release v1.0.9.

@conor10 conor10 closed this as completed Dec 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants