str4d / insight-ui-zcash

A bitcoin blockchain web browser user interface
https://bitcore.io/guides/full-node
30 stars 21 forks source link

Zcash Bitcore doesn't send notifications on bitcoind/addresstxid #1

Closed karelbilek closed 7 years ago

karelbilek commented 8 years ago

Bitcore at https://explorer.testnet.z.cash doesn't send any notifications on bitcoind/addresstxid.

I am not sure if it's an issue with the code itself or with your deployment. (I am leaving the issue here, since it's the only insight/bitcore repo, that has issue tracking.)

A simple code, that works in bitcoin testnet and doesn't work with your server. (I wrote it for browser but it should probably work for node too.)

Bitcoin Testnet:

<script src="https://cdn.socket.io/socket.io-1.4.5.js"></script>
<script>
var endpoint = 'https://testnet.blockexplorer.com';
var connectionType = 'polling';
var address = 'mgswWyysmViMqYmn5XEj1pVz7rVUftVEBP';
var socket = io(endpoint, {transports: [connectionType]})

socket.on('bitcoind/addresstxid', function() {alert('Saw a transaction!');});
socket.emit('subscribe', 'bitcoind/addresstxid', [address]);
</script>

Use your own address, send a testnet transaction there and it works.

Zcash testnet:

<script src="https://cdn.socket.io/socket.io-1.4.5.js"></script>
<script>
var endpoint = 'https://explorer.testnet.z.cash';
var connectionType = 'polling';
var address = 'tmHyHq7Ec5oPXBDdyfDHAuqWphwEXxK5yZ9';
var socket = io(endpoint, {transports: [connectionType]})

socket.on('bitcoind/addresstxid', function() {alert('Saw a transaction!');});
socket.emit('subscribe', 'bitcoind/addresstxid', [address]);
</script>

Doesn't work.

Note that notifications in general work. This will alert at each block.

<script src="https://cdn.socket.io/socket.io-1.4.5.js"></script>
<script>
var endpoint = 'https://explorer.testnet.z.cash';
var connectionType = 'polling';
var socket = io(endpoint, {transports: [connectionType]})

socket.on('bitcoind/hashblock', function() {alert('Saw a block!');});
socket.emit('subscribe', 'bitcoind/hashblock');
</script>
karelbilek commented 8 years ago

(This is currently blocking mytrezor integration, since we use these notifications.)

karelbilek commented 8 years ago

as I wrote to slack - my bet is it's some combination of multibyte prefixes and zmq (that are used by notifications)

str4d commented 8 years ago

Looking at this now.

karelbilek commented 8 years ago

For what it's worth, I just tried the same thing with waterhole.io and their zcash bitcore (and livenet zcash), and it seems there is the same issue there.

So it is 90% with the code and not with the deployment.

karelbilek commented 8 years ago

It's fixed here - I tested it on my private server, it fixes the issue and notifications arrive

https://github.com/str4d/bitcore-lib-zcash/pull/1