Web3j Event subscription error: "could not unmarshal parameter 0"

Hello, I’m writing a java application to subscribe events from the blockchain. I am using web3j this is the code:

     web3j.ethLogFlowable(createEthFilter(userAddress)).doOnError(throwable -> {
        log.warn("Error on item {} ",userAddress, throwable);
    }).subscribe(info -> {
        log.info("Ethereum event: {}", info);
        // SAME DO
        Thread.sleep(12000);
    });

The request I make to Infura is the following:

curl --location --request POST 'https://rinkeby.infura.io/v3/11896460999c43fc84b1ae243603d70a' \
--header 'Content-Type: application/json' \
--data-raw '{
   "jsonrpc":"2.0",
   "method":"eth_newFilter",
   "params":[
      {
         "topics":[
            "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d",
            [
               "0x12a5B6b9aaC3a1AaD49e29E4Ab8d81be85064F6D"
            ]
         ],
         "fromBlock":"latest",
         "toBlock":"latest",
         "address":[
            "0xb6C9232F9350e6f37a22f3Fa6A53fd9468cC777b"
         ]
      }
   ],
   "id":2
}'

Below is the error response:

{
"jsonrpc": "2.0",
"id": 2,
"error": {
    "code": -32602,
    "message": "could not unmarshal parameter 0"
}

}

Am I doing something wrong? Thanks

Hey Ivan,

I’m not sure that this^ is needed, try this:

curl --location --request POST ‘https://rinkeby.infura.io/v3/11896460999c43fc84b1ae243603d70a
–header ‘Content-Type: application/json’
–data-raw ‘{
“jsonrpc”:“2.0”,
“method”:“eth_newFilter”,
“params”:[
{
“topics”:[
“0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d”
],
“fromBlock”:“latest”,
“toBlock”:“latest”,
“address”:[
“0xb6C9232F9350e6f37a22f3Fa6A53fd9468cC777b”
]
}
],
“id”:2
}’

Btw please don’t forget to rotate this key later on since it was exposed on the public forum. :slight_smile: