question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Integration with Alchemy and ChainStack providers

See original GitHub issue

Hi there, I’ve been using Eventeum + Infura for a while without major issues, but since the last Infura WebSocket endpoint degradation (Refs: https://github.com/ConsenSys/eventeum/issues/139) I’m looking for fallback providers without having to run my own node. For that purpose, I’ve used the ropsten network to see if Eventeum will work with other providers. I’ve initially raised a question in Gitter but decided to conduct a bit more detailed investigation and share it with you.

Behaviors

Alchemy

When using Alchemy, the logs don’t show any error but no event is caught, only the new blocks are seeing:

I’ve made a transaction that generates an event (Block 8260883) that is correctly set up but it was ignored (Refs: https://ropsten.etherscan.io/tx/0xfdd24a181068d699031c08cf7e5a6baadaf3849dcc78f57a34f0cbcaeeea5818).

2020-07-09 17:58:36.382 [BLOCK-DEFAULT-0] INFO  net.consensys.eventeum.chain.block.LoggingBlockListener: onBlock - New block mined. Hash: 0x34ad11ddccbb562145a8af25912af299afff34f288a3180c59bd9f46ac47fcd4, Number: 8260879
2020-07-09 17:58:58.533 [BLOCK-DEFAULT-0] INFO  net.consensys.eventeum.chain.block.LoggingBlockListener: onBlock - New block mined. Hash: 0xeda3d9a1ad170cfbc2cdeed7c8addf8f7a4d358bfd178deff3512d0be9bdff1a, Number: 8260880
2020-07-09 17:59:05.073 [BLOCK-DEFAULT-0] INFO  net.consensys.eventeum.chain.block.LoggingBlockListener: onBlock - New block mined. Hash: 0x036f519dc3059600e8f9300f92050babcbc5927fd74955fd558bc335f6f0d42c, Number: 8260881
2020-07-09 17:59:10.781 [BLOCK-DEFAULT-0] INFO  net.consensys.eventeum.chain.block.LoggingBlockListener: onBlock - New block mined. Hash: 0xf1315d8d3189cc5f6ba1953cf88b32c973e046564dec31242120eb1a746bfdf9, Number: 8260882
2020-07-09 17:59:18.605 [BLOCK-DEFAULT-0] INFO  net.consensys.eventeum.chain.block.LoggingBlockListener: onBlock - New block mined. Hash: 0x6b21bd6fd718bb11848f816a5e25557add99ef5512631923c397fcef4199197b, Number: 8260883
2020-07-09 17:59:22.178 [BLOCK-DEFAULT-0] INFO  net.consensys.eventeum.chain.block.LoggingBlockListener: onBlock - New block mined. Hash: 0xfedc331d8253acb1a4d86f69c2ab4d25b0b40bafaf306cc222b15e205d2e9ae7, Number: 8260884
2020-07-09 17:59:47.513 [BLOCK-DEFAULT-0] INFO  net.consensys.eventeum.chain.block.LoggingBlockListener: onBlock - New block mined. Hash: 0x01d1e45e3a6c46c06a4f2676feff3fe0d4b9cebba98f9f2ab382bea410a72756, Number: 8260885
2020-07-09 17:59:59.504 [BLOCK-DEFAULT-0] INFO  net.consensys.eventeum.chain.block.LoggingBlockListener: onBlock - New block mined. Hash: 0x95c68dde8ed19c19b34c7a73f0ca17d90482568795246167790f33e2449993d7, Number: 8260886
2020-07-09 18:00:15.062 [BLOCK-DEFAULT-0] INFO  net.consensys.eventeum.chain.block.LoggingBlockListener: onBlock - New block mined. Hash: 0x880c0f03272a76c063b54182d00d0c8c8193d0f8fbf239b6aed3354726b64329, Number: 8260887
2020-07-09 18:00:18.935 [BLOCK-DEFAULT-0] INFO  net.consensys.eventeum.chain.block.LoggingBlockListener: onBlock - New block mined. Hash: 0x2d01d90ba78bb49ed8613515474f3c7956c0c5a508b8dc8039f8e039964c2c5c, Number: 8260888
2020-07-09 18:00:21.268 [BLOCK-DEFAULT-0] INFO  net.consensys.eventeum.chain.block.LoggingBlockListener: onBlock - New block mined. Hash: 0xd6043a959089847428c075495fa6eb458c63b379ccdf124abff5c1865aa96c2a, Number: 8260889
2020-07-09 18:00:37.535 [BLOCK-DEFAULT-0] INFO  net.consensys.eventeum.chain.block.LoggingBlockListener: onBlock - New block mined. Hash: 0xe28701007420c5ebe72f12845f5d7169aade63d4fa8c1a4722383790139ad393, Number: 8260890
2020-07-09 18:00:50.770 [BLOCK-DEFAULT-0] INFO  net.consensys.eventeum.chain.block.LoggingBlockListener: onBlock - New block mined. Hash: 0x3f47ec3c0a328b6334cbdb16e6a39e963f371b9bd4639ed0d832b9a6275ac8ff, Number: 8260891

Chain Stack

The Eventeum for some reason isn’t able to establish a connection to the Chain Stack. Here are the logs:

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.1.0.RELEASE)

2020-07-09 18:08:57.490 [main] INFO  net.consensys.eventeumserver.Application: logStartupProfileInfo - No active profile set, falling back to default profiles: default
2020-07-09 18:09:00.221 [main] INFO  org.springframework.data.repository.config.RepositoryConfigurationDelegate: multipleStoresDetected - Multiple Spring Data modules found, entering strict repository configuration mode!
2020-07-09 18:09:00.222 [main] INFO  org.springframework.data.repository.config.RepositoryConfigurationDelegate: registerRepositoriesIn - Bootstrapping Spring Data repositories in DEFAULT mode.
2020-07-09 18:09:01.004 [main] INFO  org.springframework.data.repository.config.RepositoryConfigurationDelegate: registerRepositoriesIn - Finished Spring Data repository scanning in 767ms. Found 4 repository interfaces.
2020-07-09 18:09:02.979 [main] ERROR org.springframework.boot.SpringApplication: reportFailure - Application run failed
java.lang.RuntimeException: Unable to connect to eth node websocket
	at net.consensys.eventeum.chain.config.NodeBeanRegistrationStrategy.buildWeb3jService(NodeBeanRegistrationStrategy.java:221) ~[eventeum-core-0.8.1-SNAPSHOT.jar!/:0.8.1-SNAPSHOT]
	at net.consensys.eventeum.chain.config.NodeBeanRegistrationStrategy.register(NodeBeanRegistrationStrategy.java:78) ~[eventeum-core-0.8.1-SNAPSHOT.jar!/:0.8.1-SNAPSHOT]
	at net.consensys.eventeum.chain.config.BlockchainServiceRegistrar.lambda$registerBeanDefinitions$0(BlockchainServiceRegistrar.java:36) ~[eventeum-core-0.8.1-SNAPSHOT.jar!/:0.8.1-SNAPSHOT]
	at java.util.HashMap.forEach(HashMap.java:1289) ~[na:1.8.0_242]
	at net.consensys.eventeum.chain.config.BlockchainServiceRegistrar.registerBeanDefinitions(BlockchainServiceRegistrar.java:35) ~[eventeum-core-0.8.1-SNAPSHOT.jar!/:0.8.1-SNAPSHOT]
	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.lambda$loadBeanDefinitionsFromRegistrars$1(ConfigurationClassBeanDefinitionReader.java:364) ~[spring-context-5.1.2.RELEASE.jar!/:5.1.2.RELEASE]
	at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684) ~[na:1.8.0_242]
	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromRegistrars(ConfigurationClassBeanDefinitionReader.java:363) ~[spring-context-5.1.2.RELEASE.jar!/:5.1.2.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:145) ~[spring-context-5.1.2.RELEASE.jar!/:5.1.2.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:117) ~[spring-context-5.1.2.RELEASE.jar!/:5.1.2.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:327) ~[spring-context-5.1.2.RELEASE.jar!/:5.1.2.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:232) ~[spring-context-5.1.2.RELEASE.jar!/:5.1.2.RELEASE]
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275) ~[spring-context-5.1.2.RELEASE.jar!/:5.1.2.RELEASE]
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:95) ~[spring-context-5.1.2.RELEASE.jar!/:5.1.2.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:691) ~[spring-context-5.1.2.RELEASE.jar!/:5.1.2.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:528) ~[spring-context-5.1.2.RELEASE.jar!/:5.1.2.RELEASE]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.1.0.RELEASE.jar!/:2.1.0.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.0.RELEASE.jar!/:2.1.0.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.0.RELEASE.jar!/:2.1.0.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.0.RELEASE.jar!/:2.1.0.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.0.RELEASE.jar!/:2.1.0.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.0.RELEASE.jar!/:2.1.0.RELEASE]
	at net.consensys.eventeumserver.Application.main(Application.java:29) [classes!/:0.8.1-SNAPSHOT]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_242]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_242]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_242]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_242]
	at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [eventeum-server.jar:0.8.1-SNAPSHOT]
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [eventeum-server.jar:0.8.1-SNAPSHOT]
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [eventeum-server.jar:0.8.1-SNAPSHOT]
	at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [eventeum-server.jar:0.8.1-SNAPSHOT]
Caused by: java.net.ConnectException: Failed to connect to WebSocket
	at org.web3j.protocol.websocket.WebSocketService.connectToWebSocket(WebSocketService.java:124) ~[core-4.5.11.jar!/:na]
	at org.web3j.protocol.websocket.WebSocketService.connect(WebSocketService.java:109) ~[core-4.5.11.jar!/:na]
	at org.web3j.protocol.websocket.WebSocketService.connect(WebSocketService.java:103) ~[core-4.5.11.jar!/:na]
	at net.consensys.eventeum.chain.config.NodeBeanRegistrationStrategy.buildWeb3jService(NodeBeanRegistrationStrategy.java:219) ~[eventeum-core-0.8.1-SNAPSHOT.jar!/:0.8.1-SNAPSHOT]
	... 30 common frames omitted

WebSocket debugging

I’ve decided to use the wscat tool to see if there is something wrong with these services, here are the results:

Infura

First of all, I’ve get the results from Infura to use to compare with the other services.

$ wscat -c wss://ropsten.infura.io/ws/v3/<KEY>

> {"jsonrpc":"2.0","method":"eth_newFilter","params":[{"address": "0xa0940f0388601f96d8885292a711c25665e325c8", "fromBlock": "0x7E0BAF", "toBlock":"0x7E0BAF"}],"id":1}
< {"jsonrpc":"2.0","id":1,"result":"0x8a3143be424bd3700073235a7cb39e09"}
> {"jsonrpc":"2.0","method":"eth_getFilterLogs","params":["0x8a3143be424bd3700073235a7cb39e09"],"id":1}
< {"jsonrpc":"2.0","id":1,"result":[{"address":"0xa0940f0388601f96d8885292a711c25665e325c8","topics":["0xf5ded012f85e38539f7460c4d4f365124b74366f9696002f5d8c96b7ec0afe61","0xe23c3c02fb07202e0631e800db99ba03a1c1a0036c5a8ba116d8a2ac16622bcd"],"data":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120aaaebeba3810b1e6b70781f14b2d72c1cb89c0b2b320c43bb67ff79f562f5ff4000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000003782dace9d90000044944417fd552931d74284c46a8a249d1e9c0cb0d0ca2e73e21084b762df784100000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000001c565046204554482031386d696e202d20302e7272726f33786f796b3200000000000000000000000000000000000000000000000000000000000000000000000d636f696e6d61726b6574636170000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007636f696e617069000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003ffffffffffffffffffffffffffffffffffffffffffffffffffb8f21b207e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000470de4df8200000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000005f0748e0000000000000000000000000000000000000000000000000000000005f074afc000000000000000000000000000000000000000000000000000000005f074d18","blockNumber":"0x7e0baf","transactionHash":"0xd3f3ab37eca17fcb07053844a4873fc0e750628e6f0b5395d8421280eec9480e","transactionIndex":"0x1","blockHash":"0x4034534494c5139a320e60c4ff408811d94e7932cc1c64ece4e05bd1a2194de5","logIndex":"0x4","removed":false}]}

Alchemy

$ wscat -c wss://eth-ropsten.ws.alchemyapi.io/v2/<KEY>

> {"jsonrpc":"2.0","method":"eth_newFilter","params":[{"address": "0xa0940f0388601f96d8885292a711c25665e325c8", "fromBlock": "0x7E0BAF", "toBlock":"0x7E0BAF"}],"id":1}
< {"jsonrpc":"2.0","id":1,"result":"0xbbe5b3d0863d9623b85300dd3edb37be"}
> {"jsonrpc":"2.0","method":"eth_getFilterLogs","params":["0xbbe5b3d0863d9623b85300dd3edb37be"],"id":1}
< {"jsonrpc":"2.0","id":1,"result":[{"address":"0xa0940f0388601f96d8885292a711c25665e325c8","topics":["0xf5ded012f85e38539f7460c4d4f365124b74366f9696002f5d8c96b7ec0afe61","0xe23c3c02fb07202e0631e800db99ba03a1c1a0036c5a8ba116d8a2ac16622bcd"],"data":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120aaaebeba3810b1e6b70781f14b2d72c1cb89c0b2b320c43bb67ff79f562f5ff4000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000003782dace9d90000044944417fd552931d74284c46a8a249d1e9c0cb0d0ca2e73e21084b762df784100000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000001c565046204554482031386d696e202d20302e7272726f33786f796b3200000000000000000000000000000000000000000000000000000000000000000000000d636f696e6d61726b6574636170000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007636f696e617069000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003ffffffffffffffffffffffffffffffffffffffffffffffffffb8f21b207e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000470de4df8200000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000005f0748e0000000000000000000000000000000000000000000000000000000005f074afc000000000000000000000000000000000000000000000000000000005f074d18","blockNumber":"0x7e0baf","transactionHash":"0xd3f3ab37eca17fcb07053844a4873fc0e750628e6f0b5395d8421280eec9480e","transactionIndex":"0x1","blockHash":"0x4034534494c5139a320e60c4ff408811d94e7932cc1c64ece4e05bd1a2194de5","logIndex":"0x4","removed":false}]}

Chain Stack

$ wscat -c wss://<user>:<pass>@ws-nd-011-720-173.p2pify.com

> {"jsonrpc":"2.0","method":"eth_newFilter","params":[{"address": "0xa0940f0388601f96d8885292a711c25665e325c8", "fromBlock": "0x7E0BAF", "toBlock":"0x7E0BAF"}],"id":1}
< {"jsonrpc":"2.0","id":1,"result":"0xbcb9b746594ac99d8aa30a23da8ffbad"}
> {"jsonrpc":"2.0","method":"eth_getFilterLogs","params":["0xbcb9b746594ac99d8aa30a23da8ffbad"],"id":1}
< {"jsonrpc":"2.0","id":1,"result":[{"address":"0xa0940f0388601f96d8885292a711c25665e325c8","topics":["0xf5ded012f85e38539f7460c4d4f365124b74366f9696002f5d8c96b7ec0afe61","0xe23c3c02fb07202e0631e800db99ba03a1c1a0036c5a8ba116d8a2ac16622bcd"],"data":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120aaaebeba3810b1e6b70781f14b2d72c1cb89c0b2b320c43bb67ff79f562f5ff4000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000003782dace9d90000044944417fd552931d74284c46a8a249d1e9c0cb0d0ca2e73e21084b762df784100000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000001c565046204554482031386d696e202d20302e7272726f33786f796b3200000000000000000000000000000000000000000000000000000000000000000000000d636f696e6d61726b6574636170000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007636f696e617069000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003ffffffffffffffffffffffffffffffffffffffffffffffffffb8f21b207e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000470de4df8200000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000005f0748e0000000000000000000000000000000000000000000000000000000005f074afc000000000000000000000000000000000000000000000000000000005f074d18","blockNumber":"0x7e0baf","transactionHash":"0xd3f3ab37eca17fcb07053844a4873fc0e750628e6f0b5395d8421280eec9480e","transactionIndex":"0x1","blockHash":"0x4034534494c5139a320e60c4ff408811d94e7932cc1c64ece4e05bd1a2194de5","logIndex":"0x4","removed":false}]}

Conclusion

From the wscat tool the responses for the eth_getFilterLogs call are pretty the same for the three providers. Can you help me? Please let me know if there is some useful information that I can collect to help in this investigation.

Thanks

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:15

github_iconTop GitHub Comments

2reactions
rishubcommented, Jul 15, 2020

@Ferparishuertas here is the application.yml (changed to txt because github didn’t let me upload yml) that we’re using where we’re not seeing all the events coming through.

Would you be able to look at the alchemy integration in particular? It seems the raw websockets are working correctly but please advise if there is something we can do when using eventeum differently to make it show all events like infura does

application.txt

1reaction
craigwilliams84commented, Aug 31, 2020

Hi @marcelomorgado. Yes the id can be used for this purpose. Its quite long though…I wish I’d hashed it to make it shorter.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Integration with Alchemy and ChainStack providers · Issue #141
Hi there, I've been using Eventeum + Infura for a while without major issues, but since the last Infura WebSocket endpoint degradation ...
Read more >
The 12 Best Blockchain Node Providers in Web3 (2022)
These are the twelve blockchain node providers included in this article: Alchemy; Infura; Quicknode; Pokt Network; Ankr; Chainstack; Blockdaemon ...
Read more >
Alchemy vs. Infura: Which node provider is best?
Compare Infura and Alchemy, node providers that allow remote access to blockchain services so you don't have to run your own node.
Read more >
Alchemy vs. Chainstack Comparison
Compare Alchemy vs. Chainstack using this comparison chart. Compare price, features, and reviews of the software side-by-side to make the best choice for ......
Read more >
Deploy a Smart Contract Using Alchemy - Polygon Wiki
It will walk you through creating and deploying a smart contract on the Polygon Mumbai test network using a cryptocurrency wallet (Metamask), Solidity,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found