ExtropyIO / defi-bot

Tutorial for building DeFi arbitrage bots
1.18k stars 467 forks source link

trouble launching bot from root directory #3

Closed thrawn-crypto closed 3 years ago

thrawn-crypto commented 3 years ago

sudo node src/index.js /home/user/Desktop/Crypto Bot/defi-bot-main (copy 1)/defi-bot-main/node_modules/web3-eth-accounts/lib/index.js:408 if (!this[account.address]) { ^

TypeError: Cannot read property 'address' of undefined at Wallet.add (/home/user/Desktop/Crypto Bot/defi-bot-main (copy 1)/defi-bot-main/node_modules/web3-eth-accounts/lib/index.js:408:23) at Object. (/home/user/Desktop/Crypto Bot/defi-bot-main (copy 1)/defi-bot-main/src/index.js:23:26) at Module._compile (node:internal/modules/cjs/loader:1102:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10) at Module.load (node:internal/modules/cjs/loader:967:32) at Function.Module._load (node:internal/modules/cjs/loader:807:14) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12) at node:internal/main/run_main_module:17:47

i get this error everytime i try and launch from the root directory, any suggestions?

codemedici commented 3 years ago

@thrawn-crypto, from the project's root dir, try node src/index.js , or else try to run it from within the src dir, just node index.js - lmk if that works. Have you managed to run that successfully at all?

thrawn-crypto commented 3 years ago

ive been able to run it from the src dir, hasnt had a succesful transaction yet, but it does find trades but runs into gas problems

codemedici commented 3 years ago

@thrawn-crypto that's because the .env file is in /src , try to move it to the root dir. You are not going to make any money by just running it, there are other people using that bot, plus frontrunners who will steal your trade and pay more gas for it once you submit it to the blockchain, so you will lose money on gas. I described that in the articles on medium.