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

TypeError: Cannot read property '0' of undefined #437

Open
d3r3k2010 opened this issue Feb 12, 2021 · 5 comments
Open

TypeError: Cannot read property '0' of undefined #437

d3r3k2010 opened this issue Feb 12, 2021 · 5 comments

Comments

@d3r3k2010
Copy link

Trying to make this working on a ubuntu 18.04, also tested on 20.04 and 16.04, and also tryed on mongo 3.2, 3.6 and 4.2 with node 8, 10 and 12. In almost all of them it gives me same error, detailed on next lines. Some times it gaves other, but could solve changing node version or ubuntu. Basically it throws me this error when I use the command "node scripts/sync.js index reindex"

Seems the problem is in async.js? -Don't know npm

/home/user/explorer/node_modules/bluebird/js/release/async.js:49
fn = function () { throw arg; };
^

TypeError: Cannot read property '0' of undefined
at /home/user/explorer/lib/explorer.js:503:74
at Object.next (/home/user/explorer/lib/explorer.js:360:18)
at Object.syncLoop (/home/user/explorer/lib/explorer.js:376:10)
at Object.prepare_vout (/home/user/explorer/lib/explorer.js:497:20)
at /home/user/explorer/lib/database.js:117:13
at /home/user/explorer/lib/explorer.js:605:14
at Object.next (/home/user/explorer/lib/explorer.js:365:24)
at /home/user/explorer/lib/explorer.js:591:22
at Object.convert_to_satoshi (/home/user/explorer/lib/explorer.js:40:12)
at /home/user/explorer/lib/explorer.js:589:30
at /home/user/explorer/lib/explorer.js:476:14
at Object.next (/home/user/explorer/lib/explorer.js:365:24)
at Object.syncLoop (/home/user/explorer/lib/explorer.js:376:10)
at Object.is_unique (/home/user/explorer/lib/explorer.js:465:20)
at /home/user/explorer/lib/explorer.js:587:26
at /home/user/explorer/lib/explorer.js:552:16
at Object.next (/home/user/explorer/lib/explorer.js:365:24)
at /home/user/explorer/lib/explorer.js:549:16
at Object.next (/home/user/explorer/lib/explorer.js:360:18)
at Object.syncLoop (/home/user/explorer/lib/explorer.js:376:10)
at Object.get_input_addresses (/home/user/explorer/lib/explorer.js:546:22)
at /home/user/explorer/lib/explorer.js:584:22

Any help to solve this will be apreciated, if somnone need more details, just ask and I'll post them here.
Thanks you in advance.

@joeuhren
Copy link
Contributor

It seems to be dying in the prepare_vout function so my first guess is the blockchain you are trying to sync has some non-standard elements such as private transactions or something similar and isn't compatible with iquidus without some custom changes.

Questions:

  1. Which coin are you trying to sync?
  2. Is this the first time you are trying to sync this coin or was it working with iquidus at some time earlier?

@d3r3k2010
Copy link
Author

d3r3k2010 commented Feb 13, 2021

Thanks you for you reply.

Q1-
Trying to sync is Bitcoin with the bitcoin-core.
Daemon and txindex=1 activated.
Just tryed also stack_size increased to 50k.

Maybe is a problem with my rpc?
This command doesnt work:
curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332
This command worked:
curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockchaininfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332
Otherwise, this works:
curl --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"getblockchaininfo","params":[]}' -H 'content-type:text/plain;' http://myusername:[email protected]:8332

Q2- It justn't worked for me, setup are always on a fresh OS install.
Installing ubuntu, installing bitoin-core (copying the full datachain like 400GB, then syncing to last block) and then follow the steps on the readme.

PS Edited, forgot answer Q2.
PS Edited, tested rpc with blockchaininfo

@joeuhren
Copy link
Contributor

It's a little funny to me that after all these years iquidus didn't support bitcoin properly. The oldest bitcoin transactions use a different encoding format called P2PK for some of the transaction data and iquidus was only able to handle the newer P2PKH format. I was able to whip up an update to add support for P2PK which should allow you to get past the "TypeError: Cannot read property '0' of undefined" error.

Keep in mind that it will most likely take a very long time to fully sync the bitcoin blockchain with iquidus because of the sheer amount of blockchain history (I'm guessing it could take many days or weeks to finish). There is an iquidus setting called block_parallel_tasks which can dramatically speed up the sync time by using multiple threads, but it has a known side effect that has no workaround yet which causes the historical address balance data to not always be saved in the correct order, but that might be a small price to pay for getting the data synced faster.

I'm not sure if or how long it will take to get the changes merged, but you can apply these changes yourself to get your copy of the explorer working with bitcoin in the meantime: #440

@d3r3k2010
Copy link
Author

It's a little funny to me that after all these years iquidus didn't support bitcoin properly. The oldest bitcoin transactions use a different encoding format called P2PK for some of the transaction data and iquidus was only able to handle the newer P2PKH format. I was able to whip up an update to add support for P2PK which should allow you to get past the "TypeError: Cannot read property '0' of undefined" error.

Keep in mind that it will most likely take a very long time to fully sync the bitcoin blockchain with iquidus because of the sheer amount of blockchain history (I'm guessing it could take many days or weeks to finish). There is an iquidus setting called block_parallel_tasks which can dramatically speed up the sync time by using multiple threads, but it has a known side effect that has no workaround yet which causes the historical address balance data to not always be saved in the correct order, but that might be a small price to pay for getting the data synced faster.

I'm not sure if or how long it will take to get the changes merged, but you can apply these changes yourself to get your copy of the explorer working with bitcoin in the meantime: #440

Thanks you, thanks you, thanks you so muuuuch!!! Now its working as expected!

I'll say something when it finishes, maybe a few weeks or months... Not using parallel_tasks if it returns historical data errors.

Q1- Is there anyway to send you a private message?

As you can see me, it's my first post on github, and probably on any kind of post.

@joeuhren
Copy link
Contributor

That would definitely be appreciated if you could let us know if and when it finishes syncing so we know approximately how long it takes and to be sure there aren't any other troubles later in the sync process.

Unfortunately there is no way to send private messages on github. Typically you will need to see if the person you wish to contact has left some kind of contact information on their profile that you can use to reach them.

If you are asking about contacting me directly, I prefer to talk over Discord or Telegram:
Discord server: https://discord.gg/dSuGm3y username: Joe [Team Exor]#5573
Telegram: https://t.me/joeuhren

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

2 participants