B4J Question Web3x - Truffle/Ganache

Mark Turney

Active Member
Licensed User
Longtime User
Starting this as a new thread (originated here):

I set up Truffle/Ganache and ran the Project created by @Erel (here). But, for the life of me, I can't figure out why the 'Send' button remains 'not visible'. I've entered the private key of one account, and trying to test send 1 ETH to a different account. 'Send' stays grayed out. No errors in the log, and logging is enabled.

I am going to try a different PC later today, just to make sure something isn't occurring that has nothing to do with B4x.

Thanks!
 
Solution
Fixed 😁!!

I realized fairly early on that the issue was related to something in the HTTP format. Through some manual trial and error, I was getting a 400 Bad Request message. I figured that maybe Windows was causing an issue in an attempt to protect, although I was pretty sure I had turned off all AV and firewalls. No luck, so I broke out an old 'Vista' computer and imaged it to Windows 10 Home, but without letting Windows do any updates and no AV or firewall active. Installed B4J, libraries, dependencies, jdk, etc. You can likely imaging my red face when I got the same blank window when running SendFunds .... no errors ... just nothing. So anyway, I thought, let me look back at the libraries. I realized that @Erel points out in...

Mark Turney

Active Member
Licensed User
Longtime User
I think it's a localhost connection issue on Windows 10. I'm going to test on a barebones setup this weekend.
 
Upvote 0

Mark Turney

Active Member
Licensed User
Longtime User
It appears to @Erel ... screenshot attached. I will try on my actual development laptop this weekend. I'm on an older PC in the corner of my work office that runs headless (I remote to it with Zoho from my work laptop, to fill in any dead-time with B4x fun ;)).
1644585653736.png
 
Upvote 0

Mark Turney

Active Member
Licensed User
Longtime User
If I put the breakpoint on line 40, I get the form properly, but the 'Send' button remains gray. And line 40 remains red.
1644586325545.png
 
Upvote 0

Mark Turney

Active Member
Licensed User
Longtime User
Tried another Windows 10 machine and a newer Windows 11 machine. Same issue that it doesn’t seem to connect to the Ganache server running locally. I tried different permutations of localhost, 127.0.0.1 and the actual IP. Also tried different ports, always matching the Ganache settings in the B4j code. Netstat shows port 7545 waiting as well as any other port I use. Ping to localhost or IP works. I’m at a loss :oops:?!
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. Make sure to use latest version of Web3X. Currently it is 0.87
2. I'm running the example now, without starting ganache. It more or less immediately shows these logs:
Error code: -1
Error message: Failed to connect to /127.0.0.1:7545

Try it with ganache stopped.

3. I've started it now and it shows:
Chain id: 1337
GasPrice: 20 gwei

Worth making some tests with infura.
 
Upvote 0

Mark Turney

Active Member
Licensed User
Longtime User
1. Make sure to use latest version of Web3X. Currently it is 0.87
2. I'm running the example now, without starting ganache. It more or less immediately shows these logs:
Error code: -1
Error message: Failed to connect to /127.0.0.1:7545

Try it with ganache stopped.

3. I've started it now and it shows:
Chain id: 1337
GasPrice: 20 gwei

Worth making some tests with infura.
I appreciate the testing @Erel. I still get nothing lol. I must have something configured wrong or blocking. Although, I have completely turned off real-time AV and the Windows firewall. I'm going to go back to testing some of the Infura examples in earlier Web3x posts on my new laptop, as those did work on my older machine.
 
Upvote 0

Mark Turney

Active Member
Licensed User
Longtime User
Reply to @Waldemar Lima (from other thread) - "Can u share your code?"

No change to Erel's code as linked above ... project.zip file in the Ganache posting. The only changes were different IP's, ports, etc while troubleshooting. I even completely uninstalled B4j, its directory and all preferences, then reinstalled from scratch to rule out perhaps a problem with my installation of the IDE. All libraries are up to date, including Web3x (0.87). All dependencies are in the correct folders as instructed. Additionally, I turned off AV and all firewalls for testing. My two Win 10 and one Win 11 installations are completely up to date .... hopefully not something in Windows. I may try to set up an old Win 7 machine later, just for testing.

Thanks!
 
Upvote 0

Mark Turney

Active Member
Licensed User
Longtime User
Fixed 😁!!

I realized fairly early on that the issue was related to something in the HTTP format. Through some manual trial and error, I was getting a 400 Bad Request message. I figured that maybe Windows was causing an issue in an attempt to protect, although I was pretty sure I had turned off all AV and firewalls. No luck, so I broke out an old 'Vista' computer and imaged it to Windows 10 Home, but without letting Windows do any updates and no AV or firewall active. Installed B4J, libraries, dependencies, jdk, etc. You can likely imaging my red face when I got the same blank window when running SendFunds .... no errors ... just nothing. So anyway, I thought, let me look back at the libraries. I realized that @Erel points out in the very first posting on Web3 that OkHttp is a required library. In the post, it says (internal library) after the link, and when I clicked on the link (many times), nothing happened ... so, I assumed internal library meant I don't have to update it ... my bad. What was happening is Windows was actually blocking the download of the OkHttp 1.5 download link, so I right-clicked it and then I got the 'protective' message from Windows asking if I want to 'keep' or continue blocking the download. I of course downloaded it, then expanded the zip into the Libraries folder. Restarted my testing and everything works as it should. I went back to my new Surface laptop with Windows 11 and the process worked there as well.

🙌🤟👍
 
Last edited:
Upvote 1
Solution
Top