I'm attempting to set up a Federation server, but I don't know how I could point the stellar network to contact a server on local host. Do I provide my ip address and serve at 0.0.0.0 or is there some other way to get Stellar network to communicate with me while I am developing? Would I need to set up my own validator node on local host to get this to work?
You don't need to do anything as complex as editing your /etc/hosts file. There is a well defined mapping between a federation destination address and the underlying query performed on a federation server. For example, when you try to send Lumens to the address
joe*yourdomain.com, you can safely assume that the federation server running at yourdomain.com will be sent a GET request like
If you want to test your federation server locally, all you have to do is run the server and send GET requests to your local server. For example, if your server was running on
localhost:8080, just send some requests to
localhost:8080?q=joe&type=name, and verify that you get the expect results. Some basic unit tests will be able to handle this no problem.
You can read the docs here https://www.stellar.org/developers/guides/concepts/federation.html to see more in depth about the different types of HTTP requests a federation server can receive.
First of all, you do not need your own validator node to setup a federation server. They are independent components within the Stellar ecosystem.
Second, please note that federation is a client-only protocol, which needs to be implemented in wallet / client applications. This means that when you enter for example
joe*yourdomain.com as the destination address for a payment, the client application / wallet will issue an HTTPS request to https://yourdomain.com/.well-known/stellar.toml to obtain the federation URL.
To test a federation server running locally on your computer, you should probably add an entry to the
/etc/hosts file on your computer (see this link for details on how to change it on a Mac and on Windows if needed). This is a file on your computer where you can override what IP address would be resolved by DNS requests. Have
yourdomain.com resolve to
127.0.0.1 and run an HTTP server locally that will serve the
stellar.toml text file at
The request for
https://yourdomain.com/.well-known/stellar.toml will thus end up going to
In case that wasn't obvious, do note that the server must be configured with SSL encryption (
https://) so you'll need a valid SSL certificate for your domain for this to work.
/etc/hosts file is configured to override DNS resolution for your domain and you have a locally running HTTP server with SSL exposing your
stellar.toml file with
FEDERATION_URL set, you should be able to test federation within any Stellar client application that runs locally on your computer (ex: Stellar Desktop Client). You won't be able to test Web-based wallets obviously, everything needs to run on your computer.