str4d / bitcore-lib-zcash

A pure and powerful JavaScript Bitcoin library
https://bitcore.io/
Other
11 stars 15 forks source link

Not compatible with zcash's hard fork at height 347500 #3

Open hxzqlh opened 6 years ago

hxzqlh commented 6 years ago

When zcash hard forked at height 347500 on 2018-06-26, bitcore-node-zcash crashed:

[2018-06-26T01:37:34.000Z] info: Zcash Height: 347499 Percentage: 100.00
[2018-06-26T01:38:07.203Z] error: uncaught exception: [Error: number too large to retain precision - use readVarintBN]
[2018-06-26T01:38:07.207Z] error: Error: number too large to retain precision - use readVarintBN
    at BufferReader.readVarintNum (/home/zec/zecnode/node_modules/insight-api-zcash/node_modules/bitcore-lib-zcash/lib/encoding/bufferreader.js:127:15)
    at BufferReader.readVarLengthBuffer (/home/zec/zecnode/node_modules/insight-api-zcash/node_modules/bitcore-lib-zcash/lib/encoding/bufferreader.js:139:18)
    at Function.Input.fromBufferReader (/home/zec/zecnode/node_modules/insight-api-zcash/node_modules/bitcore-lib-zcash/lib/transaction/input/input.js:95:28)
    at Transaction.fromBufferReader (/home/zec/zecnode/node_modules/insight-api-zcash/node_modules/bitcore-lib-zcash/lib/transaction/transaction.js:320:23)
    at Transaction.fromBuffer (/home/zec/zecnode/node_modules/insight-api-zcash/node_modules/bitcore-lib-zcash/lib/transaction/transaction.js:310:15)
    at InsightAPI.transactionEventHandler (/home/zec/zecnode/node_modules/insight-api-zcash/lib/index.js:278:30)
    at emitOne (events.js:77:13)
    at Bitcoin.emit (events.js:169:7)
    at Bitcoin._zmqTransactionHandler (/home/zec/.nvm/versions/node/v4.9.1/lib/node_modules/bitcore-node-zcash/lib/services/bitcoind.js:639:10)
    at null.<anonymous> (/home/zec/.nvm/versions/node/v4.9.1/lib/node_modules/bitcore-node-zcash/lib/services/bitcoind.js:713:12)
[2018-06-26T01:38:07.209Z] info: Beginning shutdown
[2018-06-26T01:38:07.211Z] info: Stopping insight-ui-zcash
[2018-06-26T01:38:07.213Z] info: Stopping insight-api-zcash
[2018-06-26T01:38:07.213Z] info: Stopping web
[2018-06-26T01:38:07.214Z] info: Stopping bitcoind
[2018-06-26T01:38:08.505Z] error: RPCError: Bitcoin JSON-RPC: Request Error: connect ECONNREFUSED 127.0.0.1:8232
    at Bitcoin._wrapRPCError (/home/zec/.nvm/versions/node/v4.9.1/lib/node_modules/bitcore-node-zcash/lib/services/bitcoind.js:449:13)
    at /home/zec/.nvm/versions/node/v4.9.1/lib/node_modules/bitcore-node-zcash/lib/services/bitcoind.js:567:26
    at ClientRequest.<anonymous> (/home/zec/.nvm/versions/node/v4.9.1/lib/node_modules/bitcore-node-zcash/node_modules/bitcoind-rpc/lib/index.js:116:7)
    at emitOne (events.js:77:13)
    at ClientRequest.emit (events.js:169:7)
    at Socket.socketErrorListener (_http_client.js:269:9)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at emitErrorNT (net.js:1272:8)
    at nextTickCallbackWith2Args (node.js:511:9)
[2018-06-26T01:38:08.716Z] warn: ZMQ disconnect: tcp://127.0.0.1:28332
[2018-06-26T01:38:08.716Z] warn: ZMQ connection delay: tcp://127.0.0.1:28332

From zcash official announcement this zcashd version(v1.1.1) is compatible with this hard fork. So I think maybe this error belongs to bitcore-node-zcash itself.

vikoiv commented 6 years ago

I can confirm this issue. Any possible fix found yet?

fdp59 commented 6 years ago

A kludge is available at https://github.com/fdp59/insight-api-zcash

carrie143 commented 6 years ago

I also meet the problem,do you have any idea?

vikoiv commented 6 years ago

Use zcash-hackworks repo.

carrie143 commented 6 years ago

hello,vikoiv:do you mean use the "zcash-hackworks/bitcore-node-zcash"?and I try this,but when I sendrawtransaction,still return "RPCError: 16: tx-overwinter-active"

waliguder commented 6 years ago

@vikoiv zcash-hackworks/bitcore-lib-zcash also can't solve this problem. I try to change the current version of transaction.js, it return "throw new Error('number too large to retain precision - use readVarintBN')"

hxzqlh commented 6 years ago

@ztlovemst11 @vikoiv Me too, I also use "zcash-hackworks/bitcore-node-zcash", and it cannot work on addr api:

$ curl localhost:3001/insight-api-zcash/addr/t1RwbKka1CnktvAJ1cSqdn7c6PXWG4tZqgd/balance
Method not found. Code:-32601
MarkLTZ commented 5 years ago

Hi there!

Where I can find a version 100% compatible with sapling transaction? zcash-hackworks/bitcore-lib-zcas is not able to sign v4 transactions (sapling) but works only with v2 (standard) and v3 (overwinter).

I would like to open an issue on their page, but they disabled this function :(

Thanks