Does websocket work?

Hey @duc,

I hope you are the correct person for this question, too :slight_smile: I’m trying to use websocket interface to subscribe something but even I couldn’t create the connection. After some research in the source code, I reach to this point for its address ws://mainnet.incognito.org:19334/fullnode/. It didn’t work (i.e. connection timeout) , and I tried many different ports/schemes/paths but no way. Does it really work? Or is it under maintenance?

Thanks.

2 Likes

Hi @abduraman, where did you get that ws: so far?

1 Like

I concatenated it using NodeList.py

Hi @abduraman,

Websocket connections work well on some nodes:

wscat --connect ws://fullnode.incognito.best:19334
Connected (press CTRL+C to quit)

Send this subscription for example:

{“request”:{“jsonrpc”:“1.0”,“method”:“subcribenewshardblock”,“params”:[0],“id”:1},“subcription”:“11”,“type”:0}

And you’ll receive the stream of all new blocks of shard 0.

2 Likes

It works. Thanks @inccry. Until I install my full node, could you provide an alternative websocket server if exists? @Peter

Reminder :arrow_up: :slight_smile: @Peter

Hi @abduraman, it’s worked. Thanks to @inccry to confirm and give some example. Actually this is a very simple version of websocket. We haven’t provide any library to connect to incognito websocket in any kind of programming language. Therefore anyone who wish to use websocket connection must have an exact script with URL and body requested. If you try to access to a none exist method or an invalid request, node will just terminate your connection and return an error, which might be very difficult to understand. At first the websocket purpose is for QC and local debug only. Building a better websocket connection will be in our plan to support Incognito User. Thanks for you patient.

By the way, if you intent to use the websocket, please let me know what kind of information you want. We can help you with that

2 Likes

No problem with the scripts. I’ve already found them from github. I needed to get all transactions. Since I saw websocket methods there, I wanted to use them instead of polling the blockchain via RPC calls. As of now, I have enough tools.

As for the websocket server, I’m confused a little :slight_smile: Could you confirm me? Your fullnode does not have any websocket endpoint currently, is it? If not, could you give its url? If so and I want to install my own full node, should I do something else from here (How to run Incognito Chain Full Node on Mainnet) to enable websocket support? Thanks.

@abduraman yeah, our fullnode doesn’t provide websocket connection. We limit the access to fullnode to keep it safe.

2 Likes

@abduraman

I updated Step6 of method1 to enable websocket:

method2 required a code update from our dev team, which couldn’t do by now.

2 Likes

just update step1 of method2.

Let me know if it not working …

1 Like

Sure. After I install, I’ll update here. Probably within a week.

Hey @khanhj,

I installed the full node 2 days ago but I think it is still syncing. What is the size of a current full node? Mine is around 24G as of now.

To confirm syncing, I sent curl command you wrote. Either it fails by writing “curl: (56) Recv failure: Connection reset by peer” or sends an empty reply by writing “curl: (52) Empty reply from server”.

what method you tried to run Fullnode?
show me docker ps -a
or few line of latest log in your tmux: tmux a -t mainnet_fullnode

============
@abduraman i just update step6 of method1. you dont need to delete fullnode data, just ctrl+C and rerun the new command

here is my fullnode log (local chain)
image

1 Like

Since you wrote this, I thought that method2 was fixed for websocket connection.

However, as I understand from your previous message, you thought that I applied method1. Should I cancel method2 and go with method1?

Btw, this is the result of tail -100 "./-2020-10-29.log" :

2020-10-29 09:58:31.662 salary.go:171 [CRT] BlockChain log: Add Committee Reward ShardCommitteeReward, Public Key 1qxz5KoX4t7aE2rfkK9EP5qmeTBb6Wg7ZkQFFynMku1pywQGDM, reward 0, token c01e7dc1d1aba995c19b257412340b057f8ad1482ccb6a9bb0adce61afbf05d4
2020-10-29 09:58:31.662 salary.go:171 [CRT] BlockChain log: Add Committee Reward ShardCommitteeReward, Public Key 1tj7Se3qfHEHAC4Tef6LCMz9p454GHG2FWTbNaC4giqsmhZBSp, reward 11044794721, token 0000000000000000000000000000000000000000000000000000000000000004
2020-10-29 09:58:31.663 salary.go:171 [CRT] BlockChain log: Add Committee Reward ShardCommitteeReward, Public Key 1tj7Se3qfHEHAC4Tef6LCMz9p454GHG2FWTbNaC4giqsmhZBSp, reward 0, token c01e7dc1d1aba995c19b257412340b057f8ad1482ccb6a9bb0adce61afbf05d4
2020-10-29 09:58:31.663 salary.go:171 [CRT] BlockChain log: Add Committee Reward ShardCommitteeReward, Public Key 1Ts1ZPGTFBBNhdw8787txDFrgLfW1jGKqd1KFuWzsQSxo3VArK, reward 11044794721, token 0000000000000000000000000000000000000000000000000000000000000004
2020-10-29 09:58:31.663 salary.go:171 [CRT] BlockChain log: Add Committee Reward ShardCommitteeReward, Public Key 1Ts1ZPGTFBBNhdw8787txDFrgLfW1jGKqd1KFuWzsQSxo3VArK, reward 0, token c01e7dc1d1aba995c19b257412340b057f8ad1482ccb6a9bb0adce61afbf05d4
2020-10-29 09:58:31.663 salary.go:171 [CRT] BlockChain log: Add Committee Reward ShardCommitteeReward, Public Key 12r8sHn8AhtKDbi4F7k3Nt2j1pMMdS7QcN2MfS76tYJDimfjKZU, reward 11044794721, token 0000000000000000000000000000000000000000000000000000000000000004
2020-10-29 09:58:31.663 salary.go:171 [CRT] BlockChain log: Add Committee Reward ShardCommitteeReward, Public Key 12r8sHn8AhtKDbi4F7k3Nt2j1pMMdS7QcN2MfS76tYJDimfjKZU, reward 0, token c01e7dc1d1aba995c19b257412340b057f8ad1482ccb6a9bb0adce61afbf05d4
2020-10-29 09:58:31.663 salary.go:171 [CRT] BlockChain log: Add Committee Reward ShardCommitteeReward, Public Key 1y6EeDNKVbJbxMdK8noHzz4woCgeyJQZsNqnsC4Qh4GgN5QskV, reward 11138394649, token 0000000000000000000000000000000000000000000000000000000000000004
2020-10-29 09:58:31.664 salary.go:171 [CRT] BlockChain log: Add Committee Reward ShardCommitteeReward, Public Key 1y6EeDNKVbJbxMdK8noHzz4woCgeyJQZsNqnsC4Qh4GgN5QskV, reward 1, token ffd8d42dc40a8d166ea4848baf8b5f6e912ad79875f4373070b59392b1756c8f
2020-10-29 09:58:31.664 salary.go:171 [CRT] BlockChain log: Add Committee Reward ShardCommitteeReward, Public Key 1yuKbnw1adMBsvFMAFuqQMByDbGaUt7f6dCdGBW4vpHMY3sTzx, reward 11138394649, token 0000000000000000000000000000000000000000000000000000000000000004
2020-10-29 09:58:31.664 salary.go:171 [CRT] BlockChain log: Add Committee Reward ShardCommitteeReward, Public Key 1yuKbnw1adMBsvFMAFuqQMByDbGaUt7f6dCdGBW4vpHMY3sTzx, reward 1, token ffd8d42dc40a8d166ea4848baf8b5f6e912ad79875f4373070b59392b1756c8f
2020-10-29 09:58:31.664 shardprocess.go:193 [INF] BlockChain log: SHARD 0 | Store New Shard Block And Update Data, block height 622710 with hash 33eeaacfbd0ffd3f0e7ad7cea0fa3f47510192d70fafbf043e62f769ee26b019

2020-10-29 09:58:31.664 shardprocess.go:1013 [INF] BlockChain log: SHARD 0 | Process store block height 622710 at hash 33eeaacfbd0ffd3f0e7ad7cea0fa3f47510192d70fafbf043e62f769ee26b019
2020-10-29 09:58:31.699 accessor_transaction.go:573 [CRT] BlockChain log: Fetch Cross transaction map[]
2020-10-29 09:58:31.699 estimatefee.go:261 [INF] Mempool log: RegisterBlock: Not in observed 0 8a91781fddcb7b2a2c0a52fd7a4a6bc162308f2e6559a5a29123728336ba0d95
debug BackupShardViews 2
2020-10-29 09:58:31.711 shardprocess.go:203 [INF] BlockChain log: SHARD 0 | Finish Insert new block 622710, with hash 33eeaacfbd0ffd3f0e7ad7cea0fa3f47510192d70fafbf043e62f769ee26b019 🔗
2020-10-29 09:58:31.711 shardprocess.go:113 [INF] BlockChain log: SHARD 0 | InsertShardBlock 622711 with hash e343b68bafb0188534de25cd3c61e239a3afe9031ed913cd0dc2906ea90a2969
Prev hash: 33eeaacfbd0ffd3f0e7ad7cea0fa3f47510192d70fafbf043e62f769ee26b019
2020-10-29 09:58:31.736 shardprocess.go:150 [INF] BlockChain log: SHARD 0 | SKIP Verify Pre Processing, block height 622711 with hash e343b68bafb0188534de25cd3c61e239a3afe9031ed913cd0dc2906ea90a2969

2020-10-29 09:58:31.741 shardprocess.go:173 [INF] BlockChain log: SHARD 0 | Update NumOfBlocksByProducers, block height 622711 with hash e343b68bafb0188534de25cd3c61e239a3afe9031ed913cd0dc2906ea90a2969

2020-10-29 09:58:31.741 shardprocess.go:185 [INF] BlockChain log: SHARD 0 | SKIP Verify Post Processing, block height 622711 with hash e343b68bafb0188534de25cd3c61e239a3afe9031ed913cd0dc2906ea90a2969

2020-10-29 09:58:31.741 shardprocess.go:188 [INF] BlockChain log: SHARD 0 | Update Beacon Instruction, block height 622711 with hash e343b68bafb0188534de25cd3c61e239a3afe9031ed913cd0dc2906ea90a2969

2020-10-29 09:58:31.741 shardprocess.go:193 [INF] BlockChain log: SHARD 0 | Store New Shard Block And Update Data, block height 622711 with hash e343b68bafb0188534de25cd3c61e239a3afe9031ed913cd0dc2906ea90a2969

2020-10-29 09:58:31.742 shardprocess.go:1013 [INF] BlockChain log: SHARD 0 | Process store block height 622711 at hash e343b68bafb0188534de25cd3c61e239a3afe9031ed913cd0dc2906ea90a2969
2020-10-29 09:58:31.742 shardprocess.go:1015 [CRT] BlockChain log: processStoreShardBlock/CrossTransactions	 map[6:[{625809 297520b8cf63561a16d0d75f3cb4d545895430f9176dc96f8cf5376d9fffc7c2 [{[{0xc0132d75e0 <nil>}] ffd8d42dc40a8d166ea4848baf8b5f6e912ad79875f4373070b59392b1756c8f Ethereum pETH 2 false 0}] []}]]
2020-10-29 09:58:31.748 accessor_transaction.go:573 [CRT] BlockChain log: Fetch Cross transaction map[6:[{625809 297520b8cf63561a16d0d75f3cb4d545895430f9176dc96f8cf5376d9fffc7c2 [{[{0xc0132d75e0 <nil>}] ffd8d42dc40a8d166ea4848baf8b5f6e912ad79875f4373070b59392b1756c8f Ethereum pETH 2 false 0}] []}]]
2020-10-29 09:58:31.798 estimatefee.go:261 [INF] Mempool log: RegisterBlock: Not in observed 0 5c0b39f77058ef86d288ec75e5adb6a4ef0c09259f30633556615533bafa9cf5
debug BackupShardViews 2
2020-10-29 09:58:31.804 shardprocess.go:203 [INF] BlockChain log: SHARD 0 | Finish Insert new block 622711, with hash e343b68bafb0188534de25cd3c61e239a3afe9031ed913cd0dc2906ea90a2969 🔗
2020-10-29 09:58:31.805 shardprocess.go:113 [INF] BlockChain log: SHARD 0 | InsertShardBlock 622712 with hash 18110c4f556e4fe6976bcb9ddd92bbc84a6a3303967c81277351d57cd387e880
Prev hash: e343b68bafb0188534de25cd3c61e239a3afe9031ed913cd0dc2906ea90a2969
2020-10-29 09:58:31.829 shardprocess.go:150 [INF] BlockChain log: SHARD 0 | SKIP Verify Pre Processing, block height 622712 with hash 18110c4f556e4fe6976bcb9ddd92bbc84a6a3303967c81277351d57cd387e880

2020-10-29 09:58:31.832 shardprocess.go:173 [INF] BlockChain log: SHARD 0 | Update NumOfBlocksByProducers, block height 622712 with hash 18110c4f556e4fe6976bcb9ddd92bbc84a6a3303967c81277351d57cd387e880

2020-10-29 09:58:31.832 shardprocess.go:185 [INF] BlockChain log: SHARD 0 | SKIP Verify Post Processing, block height 622712 with hash 18110c4f556e4fe6976bcb9ddd92bbc84a6a3303967c81277351d57cd387e880

2020-10-29 09:58:31.832 shardprocess.go:188 [INF] BlockChain log: SHARD 0 | Update Beacon Instruction, block height 622712 with hash 18110c4f556e4fe6976bcb9ddd92bbc84a6a3303967c81277351d57cd387e880

2020-10-29 09:58:31.832 shardprocess.go:193 [INF] BlockChain log: SHARD 0 | Store New Shard Block And Update Data, block height 622712 with hash 18110c4f556e4fe6976bcb9ddd92bbc84a6a3303967c81277351d57cd387e880

2020-10-29 09:58:31.832 shardprocess.go:1013 [INF] BlockChain log: SHARD 0 | Process store block height 622712 at hash 18110c4f556e4fe6976bcb9ddd92bbc84a6a3303967c81277351d57cd387e880
2020-10-29 09:58:31.832 accessor_transaction.go:573 [CRT] BlockChain log: Fetch Cross transaction map[]
debug BackupShardViews 2
2020-10-29 09:58:31.835 shardprocess.go:203 [INF] BlockChain log: SHARD 0 | Finish Insert new block 622712, with hash 18110c4f556e4fe6976bcb9ddd92bbc84a6a3303967c81277351d57cd387e880 🔗
2020-10-29 09:58:31.835 shardprocess.go:113 [INF] BlockChain log: SHARD 0 | InsertShardBlock 622713 with hash f1e162cd5c3313f7c360cd3fc2ad37ace1c13a56845fc7c6b77216feb00aa539
Prev hash: 18110c4f556e4fe6976bcb9ddd92bbc84a6a3303967c81277351d57cd387e880
2020-10-29 09:58:31.837 shardprocess.go:150 [INF] BlockChain log: SHARD 0 | SKIP Verify Pre Processing, block height 622713 with hash f1e162cd5c3313f7c360cd3fc2ad37ace1c13a56845fc7c6b77216feb00aa539

2020-10-29 09:58:31.841 shardprocess.go:173 [INF] BlockChain log: SHARD 0 | Update NumOfBlocksByProducers, block height 622713 with hash f1e162cd5c3313f7c360cd3fc2ad37ace1c13a56845fc7c6b77216feb00aa539

2020-10-29 09:58:31.841 shardprocess.go:185 [INF] BlockChain log: SHARD 0 | SKIP Verify Post Processing, block height 622713 with hash f1e162cd5c3313f7c360cd3fc2ad37ace1c13a56845fc7c6b77216feb00aa539

2020-10-29 09:58:31.841 shardprocess.go:188 [INF] BlockChain log: SHARD 0 | Update Beacon Instruction, block height 622713 with hash f1e162cd5c3313f7c360cd3fc2ad37ace1c13a56845fc7c6b77216feb00aa539

2020-10-29 09:58:31.841 shardprocess.go:193 [INF] BlockChain log: SHARD 0 | Store New Shard Block And Update Data, block height 622713 with hash f1e162cd5c3313f7c360cd3fc2ad37ace1c13a56845fc7c6b77216feb00aa539

2020-10-29 09:58:31.841 shardprocess.go:1013 [INF] BlockChain log: SHARD 0 | Process store block height 622713 at hash f1e162cd5c3313f7c360cd3fc2ad37ace1c13a56845fc7c6b77216feb00aa539
2020-10-29 09:58:31.945 accessor_transaction.go:573 [CRT] BlockChain log: Fetch Cross transaction map[]
2020-10-29 09:58:31.945 estimatefee.go:261 [INF] Mempool log: RegisterBlock: Not in observed 0 de78a79a72b166da6cb9d174b58c906a2a3840ca4eb6c42b42360bbe3013b0bd
debug BackupShardViews 2
2020-10-29 09:58:31.951 shardprocess.go:203 [INF] BlockChain log: SHARD 0 | Finish Insert new block 622713, with hash f1e162cd5c3313f7c360cd3fc2ad37ace1c13a56845fc7c6b77216feb00aa539 🔗
2020-10-29 09:58:31.952 shardprocess.go:113 [INF] BlockChain log: SHARD 0 | InsertShardBlock 622714 with hash 2f28a88b298aaa9217ab0f8e924992319a1ecc6e4a76870bb987e8bf794b380a
Prev hash: f1e162cd5c3313f7c360cd3fc2ad37ace1c13a56845fc7c6b77216feb00aa539
2020-10-29 09:58:31.953 shardprocess.go:150 [INF] BlockChain log: SHARD 0 | SKIP Verify Pre Processing, block height 622714 with hash 2f28a88b298aaa9217ab0f8e924992319a1ecc6e4a76870bb987e8bf794b380a

2020-10-29 09:58:31.957 shardprocess.go:173 [INF] BlockChain log: SHARD 0 | Update NumOfBlocksByProducers, block height 622714 with hash 2f28a88b298aaa9217ab0f8e924992319a1ecc6e4a76870bb987e8bf794b380a

2020-10-29 09:58:31.957 shardprocess.go:185 [INF] BlockChain log: SHARD 0 | SKIP Verify Post Processing, block height 622714 with hash 2f28a88b298aaa9217ab0f8e924992319a1ecc6e4a76870bb987e8bf794b380a

2020-10-29 09:58:31.957 shardprocess.go:188 [INF] BlockChain log: SHARD 0 | Update Beacon Instruction, block height 622714 with hash 2f28a88b298aaa9217ab0f8e924992319a1ecc6e4a76870bb987e8bf794b380a

2020-10-29 09:58:31.957 shardprocess.go:193 [INF] BlockChain log: SHARD 0 | Store New Shard Block And Update Data, block height 622714 with hash 2f28a88b298aaa9217ab0f8e924992319a1ecc6e4a76870bb987e8bf794b380a

2020-10-29 09:58:31.957 shardprocess.go:1013 [INF] BlockChain log: SHARD 0 | Process store block height 622714 at hash 2f28a88b298aaa9217ab0f8e924992319a1ecc6e4a76870bb987e8bf794b380a
2020-10-29 09:58:31.957 accessor_transaction.go:573 [CRT] BlockChain log: Fetch Cross transaction map[]
debug BackupShardViews 2
2020-10-29 09:58:31.959 shardprocess.go:203 [INF] BlockChain log: SHARD 0 | Finish Insert new block 622714, with hash 2f28a88b298aaa9217ab0f8e924992319a1ecc6e4a76870bb987e8bf794b380a 🔗
2020-10-29 09:58:31.959 shardprocess.go:113 [INF] BlockChain log: SHARD 0 | InsertShardBlock 622715 with hash 1dfa84d285d3c16abd1d9ba753d2f211362dc698d6ff26c090eb9f7e864c8383
Prev hash: 2f28a88b298aaa9217ab0f8e924992319a1ecc6e4a76870bb987e8bf794b380a
2020-10-29 09:58:31.979 shardprocess.go:150 [INF] BlockChain log: SHARD 0 | SKIP Verify Pre Processing, block height 622715 with hash 1dfa84d285d3c16abd1d9ba753d2f211362dc698d6ff26c090eb9f7e864c8383

2020-10-29 09:58:31.983 shardprocess.go:173 [INF] BlockChain log: SHARD 0 | Update NumOfBlocksByProducers, block height 622715 with hash 1dfa84d285d3c16abd1d9ba753d2f211362dc698d6ff26c090eb9f7e864c8383

2020-10-29 09:58:31.983 shardprocess.go:185 [INF] BlockChain log: SHARD 0 | SKIP Verify Post Processing, block height 622715 with hash 1dfa84d285d3c16abd1d9ba753d2f211362dc698d6ff26c090eb9f7e864c8383

2020-10-29 09:58:31.983 shardprocess.go:188 [INF] BlockChain log: SHARD 0 | Update Beacon Instruction, block height 622715 with hash 1dfa84d285d3c16abd1d9ba753d2f211362dc698d6ff26c090eb9f7e864c8383

2020-10-29 09:58:31.983 shardprocess.go:193 [INF] BlockChain log: SHARD 0 | Store New Shard Block And Update Data, block height 622715 with hash 1dfa84d285d3c16abd1d9ba753d2f211362dc698d6ff26c090eb9f7e864c8383

2020-10-29 09:58:31.983 shardprocess.go:1013 [INF] BlockChain log: SHARD 0 | Process store block height 622715 at hash 1dfa84d285d3c16abd1d9ba753d2f211362dc698d6ff26c090eb9f7e864c8383
2020-10-29 09:58:32.073 accessor_transaction.go:573 [CRT] BlockChain log: Fetch Cross transaction map[]
2020-10-29 09:58:32.073 estimatefee.go:261 [INF] Mempool log: RegisterBlock: Not in observed 0 fa7d0ae2dc761c7f9268f83b993614e7f76dff6968a133c6768cfc56751f6483

while latest block at shard0 is 780804.
Let wait till your fullnode sync up to date. Then we’ll try to send transaction, then try websocket.

I’m expecting method 2 worked probably.

2 Likes

We’re celebrating the 1 year mainnet today.

4 Likes

Hello @khanhj,

The synch was completed. I checked the logs to confirm it. Yes, all shards and beacon are OK. I kept receiving the messages below. Besides, I sent the same RPC command to my validator nodes to check whether there was any problem with my VPS. They returned the correct responses.

So method2 didn’t work or I did something wrong. I’ll try method1 when I’m available. FYI

@abduraman,

some options so that i can help you debug:

  1. Send me your fullnode IP, I will try to call rpc and websocket

or
2. I assume that your node run on port 9334 (rpc) and 19334 (ws)
try this command to see if your node running properly:

sudo netstat -ntlp | grep 9334

Double check your fullnode rpc:

curl --header "Content-Type: application/json" \
  --request POST \
  --data '{"id": 1,"jsonrpc": "1.0","method": "getblockchaininfo","params": [] }' \
  http://<IP>:<RPC_port>

Try this on your fullnode and send me some pics

wscat -c ws://<IP>:<websocket-port>

image

Hey @khanhj,

The output of sudo netstat -ntlp | grep 9634 is this:

tcp6 0 0 :::9634 :::* LISTEN 4484/docker-proxy

This returns “curl: (56) Recv failure: Connection reset by peer” error.

This works. No problem.

In sum, it seems that RPC does not work but websocket works.