Running local gas (faucet) url?

When building and installing from the sui ‘main’ branch and then:

sui genesis
sui start

What is the right URL? This worked for devnet binaries:
http://127.0.0.1:9000/gas

But returns a parse error.

9 Likes

Hey @fastfrank, what’s the command that you are sending to faucet, and the full response from it? I’ll try and reproduce locally. Likelihood is that the endpoint you have is correct, but we have changed the RPC schema on main (there’s a lot of change going on at the moment!)

7 Likes

Hello

URL: http://127.0.0.1:9000/gas

Payload: {'FixedAmountRequest': {'recipient': '0xded508371c9aabb6f22b0eb224d9a965ce2acf1dab8eb2696d71de58f4bcbf44'}}

Error: {'code': -32700, 'message': 'Parse error'}

I built binaries from main branch this morning as well… same error

5 Likes

Got it! Your request looks correct, so, I tried things out locally, and by default 9000 is the port for RPC (i.e. fullnode), and sui start does not start a faucet service, so that’s the issue you’re hitting up against. You’ve got a couple of options:

Start your own faucet service

If you’ve built using cargo build on main, the faucet is the sui-faucet binary, and you can run it using:

$ $SUI/target/debug/sui-faucet --write-ahead-log /tmp/faucet.wal

Where $SUI is the location of your Sui repo. By default it runs on port 5003 and it will pull coins from your active-address.

Run sui-test-validator

This runs everything in one process (validator, fullnode and faucet), it’s what we use for our end-to-end tests, so it doesn’t work of your ~/.sui config, it creates a new, isolated environment. It is built with cargo build, and you can run it without any arguments:

$ $SUI/target/debug/sui-test-validator

Its faucet service runs on port 9123, by default.

3 Likes

Wow. Great and thanks for the insight.

Is this documented somewhere? I’m sure others will benefit.

Thanks again!

3 Likes

Haha, I guess you’re now looking at the docs for this :wink: but our technical writing team does check on the forum and port helpful answers into a more permanent home!

4 Likes