I am using web3j library with an Infura Websocket connection. I set up a subscribe method where I listen to transfer events of my custom ERC20 Token. When a transfer event occurs on the blockchain I get the information in the subscribe body and send it to my eventListener. In my eventListener I try to fetch the details of the Token from the Blockchain (over the same Infura websocket connection)


web3j.logsNotifications(List.of(customToken.getContractAddress()), List.of(EventEncoder.encode(CustomToken.TRANSFER_EVENT)))
                        .subscribe(logNotification -> {
                            Log transferEventLog = logNotification.getParams().getResult();
                        }, throwable -> {
                            logger.error("Error in subscription", throwable);
                        }, () -> {
                            logger.info("Complete transfer event subscription");


public void transferEventListener(Log transferEvent) {
        // code to parse log -> to get id of token
        Tuple2<String, BigInteger> response= customToken._tokens(id).send();

        // Further code to handle response

The call in my listener always fails with Exception: Request with id # timed out
and then my Websocket connection gets closed.

If I make the same request to tokens which are minted in the past, everything works as expected!

Is it generally possible to fetch a custom token from Infura directly after they are mined? What I am doing wrong here?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.