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

ERR_INVALID_URL #5

Closed
manseth opened this issue Oct 28, 2020 · 7 comments
Closed

ERR_INVALID_URL #5

manseth opened this issue Oct 28, 2020 · 7 comments

Comments

@manseth
Copy link

manseth commented Oct 28, 2020

Hi. I just tried to use your bot but when i run the node run-arbitrage.js i get this error. I assume i need to put my web3 infura URL but i can't find where. Could you please help me ?

`~/Defi-Arb-Bot$ node run-arbitrage.js
internal/url.js:257
throw new ERR_INVALID_URL(input);
^

TypeError [ERR_INVALID_URL]: Invalid URL: undefined
at onParseError (internal/url.js:257:9)
at new URL (internal/url.js:333:5)
at Object.helpers [as parseURL] (/home/volrod/Defi-Arb-Bot/node_modules/web3-providers-ws/src/helpers.js:14:20)
at new WebsocketProvider (/home/volrod/Defi-Arb-Bot/node_modules/web3-providers-ws/src/index.js:70:29)
at Object. (/home/volrod/Defi-Arb-Bot/run-arbitrage.js:9:3)
at Module._compile (internal/modules/cjs/loader.js:1015:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
at Module.load (internal/modules/cjs/loader.js:879:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47 {
input: 'undefined',
code: 'ERR_INVALID_URL'
`

@manseth
Copy link
Author

manseth commented Oct 30, 2020

When i run the command "truffle migrate --network mainnet --reset" i get this

`Compiling your contracts...

Everything is up to date, there is nothing to compile.

Migrations dry-run (simulation)

Network name: 'mainnet-fork'
Network id: 1
Block gas limit: 12487759 (0xbe8c4f)

1_initial_migration.js

Deploying 'Migrations'

block number: 11157205
block timestamp: 1604047996
account: 0xcE3C76F91Ca359A6D6379E409E490DfB9d83E756
balance: 0.009407028
gas used: 176931 (0x2b323)
gas price: 92 gwei
value sent: 0 ETH
total cost: 0.016277652 ETH


Total cost: 0.016277652 ETH

2_deploy_contracts.js

Replacing 'Flashloan'

Error: *** Deployment Failed ***

"Flashloan" could not deploy due to insufficient funds

  • Account: 0xcE3C76F91Ca359A6D6379E409E490DfB9d83E756
  • Balance: 6891932000000000 wei
  • Message: sender doesn't have enough funds to send tx. The upfront cost is: 252456372000000000 and the sender's account only has: 6891932000000000
  • Try:
    • Using an adequately funded account
    • If you are using a local Geth node, verify that your node is synced.
at /usr/local/lib/node_modules/truffle/build/webpack:/packages/deployer/src/deployment.js:364:1
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at Migration._deploy (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:68:1)
at Migration._load (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:55:1)
at Migration.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:171:1)
at Object.runMigrations (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:150:1)
at Object.runFrom (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:110:1)
at Object.runAll (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:114:1)
at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:79:1)
at runMigrations (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:269:1)
at setupDryRunEnvironmentThenRunMigrations (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:257:1)
at /usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:220:1

Truffle v5.1.50 (core: 5.1.50)
Node v12.19.0`

then i run the "node run-arbitrage.js" and i get the same "ERR_INVALID_URL".
I have already create a .env like this in the root folder and still get the same error

INFURA_URL=wss://mainnet.infura.io/ws/***************************** PRIVATE_KEY=ac**********************************************

You can notice i get a ""Flashloan" could not deploy due to insufficient funds" but the total cost is 0.016277652 ETH since i have a lot more than that in my wallet.

@olegmitrakhovich
Copy link
Owner

hey man, sorry for the late reply. but look at this line here:
https://github.com/olegmitrakhovich/Defi-Arb-Bot/blob/master/run-arbitrage.js#L8

you need to make a ".env" file and inside that file just write "INFURA_URL="

@olegmitrakhovich
Copy link
Owner

as for your gas issue, 0.016277652 ETH is way too cheap.. I had to pay 90$ bucks to deploy this thing, keep playing with the gas fee and make you have atleast 1 ETH in your account.

@manseth
Copy link
Author

manseth commented Oct 30, 2020

No worries, okay that's what i have done i have create a .env file and i have put inside my infura url + private key and and i still get the error when i run the node run-arbitrage.js :( but when i run truffle migrate --network mainnet --reset the only error it's for the gas.

How can i change the gas fee ? On the script or on my wallet ?

Sorry if my questions seem dumb but i'm "new" to this.

EDIT:
OKAAAY i understand let me explain

The problem of fees is due to the fact that "truffle migrate --network mainnet --reset" could not finish because I do not have enough ETH on my wallet so the 0.016277652 is only a part of the total amount to deploy the contract the total amount being about $ 90 as you said.

@olegmitrakhovich
Copy link
Owner

lol not a problem, no such thing as a dumb questions. its kinda cool that people are trying to make this code work, so I'm flattered. Also check this line again : https://github.com/olegmitrakhovich/Defi-Arb-Bot/blob/master/run-arbitrage.js#L8

make sure the variable you are using is right, because I switched to QUICK_NODE recently. Make sure you are using the right name for your variable.

@manseth
Copy link
Author

manseth commented Oct 30, 2020

Okay i will replace infura by quick node. Thank you for your answer !
And one last question, when the contract is deployed (i assume you done it) did you make any profit from it ? If yes that's very good but if no what should we for make profit from it ?

@olegmitrakhovich
Copy link
Owner

olegmitrakhovich commented Oct 30, 2020

no I didn't make any money, if anything I lost money lol. That's why I posted the code here to see if someone can tell me what's going on. The prices I am getting are wrong for some reason...wrong or my bot is not fast enough to do the transaction ... take a look at other issues. People forked this code multiple times so I'm hoping to through their stuff soon and see if I find anything.

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