Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with a new coin - Cannot read property 'scriptPubKey' of undefined #461

Closed
B1ackt34 opened this issue May 6, 2021 · 9 comments
Closed

Comments

@B1ackt34
Copy link

B1ackt34 commented May 6, 2021

Hi, we are developing a new coin and we get a problem with Explorer

10283: 36b8f4e6ba98cb5bbcbf89ff512c57ae8b3218ade1d2f0f49930771674a21886
10284: 760c124c751749f89828f41095515cdbe21097bf2706054394d3d7204216d29b
10284: 98f4bfee66a547cfcc7020e8755175dbc1d8fe3fe46316030889ca2e877b99a2
10285: b906dd8632f668b1e006812806a2be2985e66f8fde60ecc285ac571d37952671
10285: 5fb10f60dc5e0c22f2170c52271f5d7845f914cf78d040e9839e6c22da454e6a
/root/explorer/node_modules/bluebird/js/release/async.js:49
fn = function () { throw arg; };
^

TypeError: Cannot read property 'scriptPubKey' of undefined
at /root/explorer/lib/explorer.js:523:19
at Object.next (/root/explorer/lib/explorer.js:365:24)
at Object.syncLoop (/root/explorer/lib/explorer.js:376:10)
at Object.prepare_vout (/root/explorer/lib/explorer.js:497:20)
at /root/explorer/lib/database.js:117:13
at /root/explorer/lib/explorer.js:605:14
at Object.next (/root/explorer/lib/explorer.js:365:24)
at Object.syncLoop (/root/explorer/lib/explorer.js:376:10)
at Object.prepare_vin (/root/explorer/lib/explorer.js:582:20)
at /root/explorer/lib/database.js:116:11
at /root/explorer/lib/explorer.js:207:16
at Client. (/root/explorer/lib/explorer.js:29:14)
at Client.tryCatcher (/root/explorer/node_modules/bluebird/js/release/util.js:16:23)
at Promise.successAdapter (/root/explorer/node_modules/bluebird/js/release/nodeify.js:23:30)
at Promise._settlePromise (/root/explorer/node_modules/bluebird/js/release/promise.js:601:21)
at Promise._settlePromise0 (/root/explorer/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/root/explorer/node_modules/bluebird/js/release/promise.js:729:18)
at Promise._fulfill (/root/explorer/node_modules/bluebird/js/release/promise.js:673:18)
at Promise._resolveCallback (/root/explorer/node_modules/bluebird/js/release/promise.js:466:57)
at Promise._settlePromiseFromHandler (/root/explorer/node_modules/bluebird/js/release/promise.js:559:17)
at Promise._settlePromise (/root/explorer/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/root/explorer/node_modules/bluebird/js/release/promise.js:649:10)

I have already used tip from issue #56
Any help is appreciated!

@B1ackt34 B1ackt34 changed the title Problem with a new coin - Problem with a new coin - Cannot read property 'scriptPubKey' of undefined May 6, 2021
@joeuhren
Copy link
Contributor

joeuhren commented May 8, 2021

Are you able to post a link to the coin wallet so I can test this myself? Or can you post the raw transaction data for the tx that is causing this problem? It will help a lot to determine WHY this is failing.

What I do see based on the error msg is that the problem transaction is dying on /lib/explorer.js line 523 because there are no vouts (this means there is no recipient for the transaction).

If you're desperate to get past the error, a hacky fix might be to simply check if any vouts exist first before continuing to check the vout data. I do not recommend this "fix" because it would be better to diagnose WHY your transaction has no recipients and correct that problem, but you could try changing /lib/explorer.js line 523 from:

      if (vout[0].scriptPubKey.type == 'nonstandard') {

to:

      if (typeof vout[0] !== 'undefined' && vout[0].scriptPubKey.type == 'nonstandard') {

If you do try this "fix", please keep in mind that this will likely skew your totals since it's not able to properly read the data and is effectively just skipping the transaction.

@B1ackt34
Copy link
Author

B1ackt34 commented May 8, 2021

Do you need this?

getblock acec023e999d562adf7b51fcac047d94fa8f08da8f833ea62f1466b841ea4236

{ "hash": "acec023e999d562adf7b51fcac047d94fa8f08da8f833ea62f1466b841ea4236", "confirmations": 8806, "size": 2984, "height": 10285, "version": 9, "merkleroot": "87b5fa0d5afd963eb56e429dade912c5eb8cd2bc6e0124640c34d10333984907", "acc_checkpoint": "0000000000000000000000000000000000000000000000000000000000000000", "finalsaplingroot": "6bdaf1f551bbd223d3cfe905f43c4ad0b775b606898b1ebed96ec64712d09b23", "tx": [ "b906dd8632f668b1e006812806a2be2985e66f8fde60ecc285ac571d37952671", "5fb10f60dc5e0c22f2170c52271f5d7845f914cf78d040e9839e6c22da454e6a", "0b53d8bfeb5ccfc2c117168402c6310ce37eb228c4612a98bb0ad88c54b74eba" ], "time": 1619953770, "mediantime": 1619953590, "nonce": 0, "bits": "1c00a2a5", "difficulty": 402.9339289574177, "chainwork": "000000000000000000000000000000000000000000000000004eae361af2c173", "previousblockhash": "78b554c8608f2c6374eb113d868e91959a2d2dbc5971ebd76cecdf279d079fa4", "nextblockhash": "cb21a3684832e350cc82180355a2ad2abd530caa3a36dd309710d6a172e28f33", "stakeModifier": "b52afc5313b2a29c4d442802d863da76801744bf6b3dddd64df095401cf531f7", "hashProofOfStake": "000b6a5a5f33b2de8cb1358c6c385262b3c791be3cdf6cb4bedb153c2030e93a" }

@joeuhren
Copy link
Contributor

joeuhren commented May 8, 2021

Almost, but I don't need the block data, I need the transaction data. Based on what you have shared so far, it looks like block 10285 has three transactions and only two of them synced properly before dying on the 3rd. I think this will reveal the correct data:

getrawtransaction 0b53d8bfeb5ccfc2c117168402c6310ce37eb228c4612a98bb0ad88c54b74eba 1

@B1ackt34
Copy link
Author

B1ackt34 commented May 9, 2021

Here it is !

{ "txid": "0b53d8bfeb5ccfc2c117168402c6310ce37eb228c4612a98bb0ad88c54b74eba", "version": 3, "type": 0, "size": 2365, "locktime": 0, "vin": [ ], "vout": [ ], "valueBalance": "0.02365", "valueBalanceSat": 2365000, "vShieldSpend": [ { "cv": "498114140e918c2a734d244d9f61f4ce7351174bd02d93c5e73eaef2d5b517a3", "anchor": "01c860975452a8dc16dae6659058f82f5d5f5e02b598fa580b5a14272f6a30e7", "nullifier": "a0de0370a426daa29395048c1f6ff1c33a248cb7b833009e240ffa3944549471", "rk": "9589080fad0d4a28df5cb38777d459f702be4254ac36c70efdbaf13308c38902", "proof": "845a685c4fca5dd255b009750513596beab687f4482fefca59ce879b858f63a2eed82dc4892b03fe29049cfee8ff8cb8b7e430bcb6aad5f720efa7e45bd810d151178ed4aa877df8c549b3a8b922688547d8b0485eb8e5599bdd0ab5e6094242129017a5948ac66111d42789219376fbbf8e30656239320c695050b1c6b749e5fc4d44fcca58ea977867fb82162f6fc4a03ab2f71ff5c31046361aa94c6d1ac1dec64bbda8836d8ac4a865ef331c38da9fe1b538288a3ee942f72f739c96a41e", "spendAuthSig": "7d1b63181574d6f5cd1ea77f84b17a5d1d0eae9bb63093360533cf81a053ab42ea6f8c1a545f8b950c9a6a74ff8186a2cbc6c5a71d7b1b5d0113c9c6f3cbed01" } ], "vShieldOutput": [ { "cv": "e263006690e0cb99a8d0aac1a6339b75706c9fb757087f38cda786a3edad8010", "cmu": "5391f48b3650a218c2a249866445e5e73c5aef30fb45ca8c3ad23a30967bb8d3", "ephemeralKey": "c4a815e25e987274bb3b6ee45b1f78ae54e08e042f938a2336e63f47ec4c7cb0", "encCiphertext": "d4d158016ced9e67879113347f10edf9514cc8c9fc29685bc5c97c748493991b086a45d5d01f71725ae75257660f6866515fa8200e4424b9ce04d6c8668d39c30226095e3db3a48159c3b3f98780ce62da6aea7cbce211461e6cd4fd4eed11e4467529a19025042a6f16704654b03d22f031cc6ff1eb8facccc7be59741510e7a69e8866ad17c540cdca26a46331eceaa489bf0b213c50f26c49ebab186997a09ca234799bdaa5f084728ed161c81dd737cb3cfbd3b3c08f6d598493a0b0fd2651f4c8727c947b9699d235a93c9e2fdbcfb1aeba3e9a28bfb07ac84f420e9bf8e1297a84fac961303175303605236554e1c3153cc982986d1c59fe546a735fa4d9419878c044beecf1bd401ce06e4564078df6db27a9ef8245506643b150fd35573e6cb89e921ea0ee18f29316784d85911562d084fbe0f098296f63244e173373ee34224bdda5a4e2af766fc7a83ea032a20b87829a7054261cea20cad020fb0d4e9c579e33f2c65486d8a777b0333587acadaaef62406545003534e3e33a6f46aa40f779c4a4999f741f34fcabda5f64d2a53af811692ac72e596c39f822317a72d6abb8120961cccffdedbbc2b00975441bf19bb85f3fa8b353217bb0b1f88a0685d1ae87e9e73602ce9a88531bb65d90fc1b3faa9f13c1c757af8c8df981adf11539c8bc25986eba49248a5b010d87c85af44eab379ccef2423fee1df230b349960f0958305d11acf11cdc1b9089873f86a672cffcb87ecbb30b945f0a44547081143a9ddde078d796984746665268915eaaedf5d29709bb263ee094bb0f617b63d1", "outCiphertext": "4d61b49f3bd42606a0f5adb2863d58a58d5f39ae0e0716b5c2f8563e2ecfab9c213c3b60578936047a53d9c6af51c11d8168248ef0361634e405cb9a00c5ae9d3418361916f8c3a96b0b8a6c800c669e", "proof": "b27d0cb2cdaa84522612d9e239dcbf9984e8780767081ef73960bbc24f62dba3f1013c6e81c85098572855bb99436329b23868b38985a4cc380a94796e41e9d797a93133eb3781bfe9b5b14e47e6667e432c530cf6f82238cbf2924c5cc5d6db0c2dc72714d18469be728fbdec47e15e4875176484b4f363d8e460d1a14c259dd7b14ec3a5fe193bd297d2c59d29e6d8b3f7a7860f0f58f672889353da7f6eec88c45e2e6a75eeb477829c5ab110c53fd67f5cfcb6efe9c1e16354817320351a" }, { "cv": "b54c1c8ba533ac75f3824285b4d4c08067d3afa26fc773248dd36aaad59d1035", "cmu": "5351e441622f3d81f20a1e86af2813cb37d87f196a3c0911cc63cad60f65abbd", "ephemeralKey": "e7501fd1d7397c8d5315cb1610d810aea5f1402dff7631132c890c6752cf20de", "encCiphertext": "7dfe003ac829b95025f5a4a983d03b0410957e2dcd7e75b2b47eca788216b51cd510ec17723892623bd7624a6ebef22c85d4be9a56f6804599a94bee078730fb6a4f2466d38db8ca28eda63708ba1b960068caf69a2290502ab6d658daea727dc24e6afd90f21724e04c53f352bbf884c1292a620819320f020b420d1f8703eed0d05db946b8c4bd28afc86569c09dabb6548ed6c494e2858019934eb5572042e90527616f57b0f96082e3c6f2eba370e0fba758cdbb88cd90dcf3c913d3085e3eb35da8b28e644eb68fed8a22fb799914b9fd4da3c0eb0e770104bc5bfd37704aaf9e9f153d271de2f620fade748d8e7ca44267bee7c638f78bf975e4b39b37234618f3e02c71ca62e7518562f1cfac097534deec73a2971a4a8207584f778c9412d8ea58201eb0415d6f8f1f98a13b9a7103b5f72b79c1091b89c792512eaadbe287158be692b1f7c55f2682cb7d8ecaba7883918a4b0d42c469c28077e53161d57c145f9d5a3a5d5b5e8a558e4b7f63b44bddb5a1b7ce2a6dab483b4799d9d712bce59d48c7ec2f837667ea7e5d4dc40da0d53ff4624ae24cdf1a5723940d0ac1c6a3a80cc81e0b04da48d528e804bd31fdf15aa35b351bb736edf5c6d79528e4fe446f6f05e341ef370b297378257f0d77c61fc705532a3fb7665a37514d9f0a993b68249f82f754f00d7d973abffdb592133cc2578a42eaaa93a71ab97145a32a41090eaa7ee6555b530d6a197e7aad686195a50a97e2692fe4517f963dc29ca09e74b88660489566eee227ae2e766bfbbe89df9a82e282cff4df4db2ba440a9824", "outCiphertext": "c4c0796f328eda1f4b46549d927196e35ade8b6d33a9fe49b4dee5e98992551b08fb7608bac10ab921cf3ca641ac2f1ff71869133d5f3608538a132f700eb6c022631cc42c5421d76d7cb9d701113e75", "proof": "a083585682f674323366e5abe4cf067a33e8a827a100a10e5e6b6f0408115838eb454ff7117e699870158a4245cd4b96b375b336ea8c363b9875fddf19176ec168003a7d60dc71559a279adc7e0f4a9847427ce4992e81e1582c60d3ff7e41c5114f1da47b1c742a76e92df8c6da08faf767b93e229d7914575c120ac3024c960968d3f2e6553a57cfa291d08359be37b84b155af433881d6d2afde41d9625b2e383c5f6ad9c637bb5b9513e139015afd2900954f364c0feebb16ffb595365ae" } ], "bindingSig": "17de7765cd8fbdf2818968288f0ba2355ccdc6ed27c0b2277698ac119391f2ab1af18fd6bd1b86e3e18883da652fa71a11cabf3d26eab232a19ba792722a6301", "hex": "0300000000000000000001481624000000000001a317b5d5f2ae3ee7c5932dd04b175173cef4619f4d244d732a8c910e14148149e7306a2f27145a0b58fa98b5025e5f5d2ff8589065e6da16dca852549760c8017194544439fa0f249e0033b8b78c243ac3f16f1f8c049593a2da26a47003dea00289c30833f1bafd0ec736ac5442be02f759d47787b35cdf284a0dad0f088995845a685c4fca5dd255b009750513596beab687f4482fefca59ce879b858f63a2eed82dc4892b03fe29049cfee8ff8cb8b7e430bcb6aad5f720efa7e45bd810d151178ed4aa877df8c549b3a8b922688547d8b0485eb8e5599bdd0ab5e6094242129017a5948ac66111d42789219376fbbf8e30656239320c695050b1c6b749e5fc4d44fcca58ea977867fb82162f6fc4a03ab2f71ff5c31046361aa94c6d1ac1dec64bbda8836d8ac4a865ef331c38da9fe1b538288a3ee942f72f739c96a41e7d1b63181574d6f5cd1ea77f84b17a5d1d0eae9bb63093360533cf81a053ab42ea6f8c1a545f8b950c9a6a74ff8186a2cbc6c5a71d7b1b5d0113c9c6f3cbed01021080adeda386a7cd387f0857b79f6c70759b33a6c1aad0a899cbe090660063e2d3b87b96303ad23a8cca45fb30ef5a3ce7e545648649a2c218a250368bf49153b07c4cec473fe636238a932f048ee054ae781f5be46e3bbb7472985ee215a8c4d4d158016ced9e67879113347f10edf9514cc8c9fc29685bc5c97c748493991b086a45d5d01f71725ae75257660f6866515fa8200e4424b9ce04d6c8668d39c30226095e3db3a48159c3b3f98780ce62da6aea7cbce211461e6cd4fd4eed11e4467529a19025042a6f16704654b03d22f031cc6ff1eb8facccc7be59741510e7a69e8866ad17c540cdca26a46331eceaa489bf0b213c50f26c49ebab186997a09ca234799bdaa5f084728ed161c81dd737cb3cfbd3b3c08f6d598493a0b0fd2651f4c8727c947b9699d235a93c9e2fdbcfb1aeba3e9a28bfb07ac84f420e9bf8e1297a84fac961303175303605236554e1c3153cc982986d1c59fe546a735fa4d9419878c044beecf1bd401ce06e4564078df6db27a9ef8245506643b150fd35573e6cb89e921ea0ee18f29316784d85911562d084fbe0f098296f63244e173373ee34224bdda5a4e2af766fc7a83ea032a20b87829a7054261cea20cad020fb0d4e9c579e33f2c65486d8a777b0333587acadaaef62406545003534e3e33a6f46aa40f779c4a4999f741f34fcabda5f64d2a53af811692ac72e596c39f822317a72d6abb8120961cccffdedbbc2b00975441bf19bb85f3fa8b353217bb0b1f88a0685d1ae87e9e73602ce9a88531bb65d90fc1b3faa9f13c1c757af8c8df981adf11539c8bc25986eba49248a5b010d87c85af44eab379ccef2423fee1df230b349960f0958305d11acf11cdc1b9089873f86a672cffcb87ecbb30b945f0a44547081143a9ddde078d796984746665268915eaaedf5d29709bb263ee094bb0f617b63d14d61b49f3bd42606a0f5adb2863d58a58d5f39ae0e0716b5c2f8563e2ecfab9c213c3b60578936047a53d9c6af51c11d8168248ef0361634e405cb9a00c5ae9d3418361916f8c3a96b0b8a6c800c669eb27d0cb2cdaa84522612d9e239dcbf9984e8780767081ef73960bbc24f62dba3f1013c6e81c85098572855bb99436329b23868b38985a4cc380a94796e41e9d797a93133eb3781bfe9b5b14e47e6667e432c530cf6f82238cbf2924c5cc5d6db0c2dc72714d18469be728fbdec47e15e4875176484b4f363d8e460d1a14c259dd7b14ec3a5fe193bd297d2c59d29e6d8b3f7a7860f0f58f672889353da7f6eec88c45e2e6a75eeb477829c5ab110c53fd67f5cfcb6efe9c1e16354817320351a35109dd5aa6ad38d2473c76fa2afd36780c0d4b4854282f375ac33a58b1c4cb5bdab650fd6ca63cc11093c6a197fd837cb1328af861e0af2813d2f6241e45153de20cf52670c892c133176ff2d40f1a5ae10d81016cb15538d7c39d7d11f50e77dfe003ac829b95025f5a4a983d03b0410957e2dcd7e75b2b47eca788216b51cd510ec17723892623bd7624a6ebef22c85d4be9a56f6804599a94bee078730fb6a4f2466d38db8ca28eda63708ba1b960068caf69a2290502ab6d658daea727dc24e6afd90f21724e04c53f352bbf884c1292a620819320f020b420d1f8703eed0d05db946b8c4bd28afc86569c09dabb6548ed6c494e2858019934eb5572042e90527616f57b0f96082e3c6f2eba370e0fba758cdbb88cd90dcf3c913d3085e3eb35da8b28e644eb68fed8a22fb799914b9fd4da3c0eb0e770104bc5bfd37704aaf9e9f153d271de2f620fade748d8e7ca44267bee7c638f78bf975e4b39b37234618f3e02c71ca62e7518562f1cfac097534deec73a2971a4a8207584f778c9412d8ea58201eb0415d6f8f1f98a13b9a7103b5f72b79c1091b89c792512eaadbe287158be692b1f7c55f2682cb7d8ecaba7883918a4b0d42c469c28077e53161d57c145f9d5a3a5d5b5e8a558e4b7f63b44bddb5a1b7ce2a6dab483b4799d9d712bce59d48c7ec2f837667ea7e5d4dc40da0d53ff4624ae24cdf1a5723940d0ac1c6a3a80cc81e0b04da48d528e804bd31fdf15aa35b351bb736edf5c6d79528e4fe446f6f05e341ef370b297378257f0d77c61fc705532a3fb7665a37514d9f0a993b68249f82f754f00d7d973abffdb592133cc2578a42eaaa93a71ab97145a32a41090eaa7ee6555b530d6a197e7aad686195a50a97e2692fe4517f963dc29ca09e74b88660489566eee227ae2e766bfbbe89df9a82e282cff4df4db2ba440a9824c4c0796f328eda1f4b46549d927196e35ade8b6d33a9fe49b4dee5e98992551b08fb7608bac10ab921cf3ca641ac2f1ff71869133d5f3608538a132f700eb6c022631cc42c5421d76d7cb9d701113e75a083585682f674323366e5abe4cf067a33e8a827a100a10e5e6b6f0408115838eb454ff7117e699870158a4245cd4b96b375b336ea8c363b9875fddf19176ec168003a7d60dc71559a279adc7e0f4a9847427ce4992e81e1582c60d3ff7e41c5114f1da47b1c742a76e92df8c6da08faf767b93e229d7914575c120ac3024c960968d3f2e6553a57cfa291d08359be37b84b155af433881d6d2afde41d9625b2e383c5f6ad9c637bb5b9513e139015afd2900954f364c0feebb16ffb595365ae17de7765cd8fbdf2818968288f0ba2355ccdc6ed27c0b2277698ac119391f2ab1af18fd6bd1b86e3e18883da652fa71a11cabf3d26eab232a19ba792722a6301", "shielded_addresses": [ ], "blockhash": "acec023e999d562adf7b51fcac047d94fa8f08da8f833ea62f1466b841ea4236", "confirmations": 9413, "time": 1619953770, "blocktime": 1619953770 }

@joeuhren
Copy link
Contributor

joeuhren commented May 9, 2021

Thanks for posting the transaction data, the problem is very clear now. Transaction 0b53d8bfeb5ccfc2c117168402c6310ce37eb228c4612a98bb0ad88c54b74eba has no vin or vout info (which is normally where the sender and receiver data would be located). Instead, I see some non-standard fields like vShieldSpend, vShieldOutput and shielded_addresses for example. Looks to me like you are trying to sync a blockchain which has some sort of private/shielded transaction options.

Unfortunately, this explorer only supports standard blockchain data which means you will most likely need to add your own implementation of the privacy features.

I'm curious, which coin is this cloned from or what privacy technology is it using? Perhaps you can get lucky and find another explorer that already added support for such privacy tech if you search for it.

@B1ackt34
Copy link
Author

New coin is based on PIVX 5.1, latest version

@joeuhren
Copy link
Contributor

I've never tried this myself but this might be the best explorer to use for your coin until someone adds pivx support to iquidus or another explorer: https://github.com/random-zebra/PIVX-BlockExplorer

@B1ackt34
Copy link
Author

I know that but it requires more powerful server than Iquidus

@uaktags
Copy link
Collaborator

uaktags commented Jul 16, 2021

Unfortunately I doubt there may be much we can do. This would require quite a number of rewrites to block parsing to throw catches in there for this type of usecase (same with other privacy coins like XMR for instance). While I would love to say that we'd just need to edit the same function that's handling #56, I doubt it'd be enough.

I'm going to close this for now, but it's definitely a thing that may need to be revisited if someone else can come up with an implementation idea.

@uaktags uaktags closed this as completed Jul 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants