Setting up the federation servers

The federation server will be used by the banks to resolve the customer's friendly IDs into their receiving Stellar account ID and the peripheral information required to process the received transaction. Follow these steps to set up the federation servers:

  1. Download the federation server release from the Stellar website here (https://github.com/stellar/go/releases/tag/federation-v0.2.1).
  2. Select the binary corresponding to your OS version and extract the binary file.
  3. Copy the extracted folder and paste and create two copies of the extracted folders labeled federationA and federationB.
  4. Open the federation.cfg file within the extracted folders in a text editor. Configure it like so for the federation for Bank A:
port = 8001

[database]
type = "postgres"
dsn = "postgres://bankauser:bankauser@localhost/banka?sslmode=disable"

[queries]
federation = "SELECT ' GDW3IXTH3UFCU2KD6REURTLK7XVSUC4P4WDATMFPTW6YZFEAV7RWATAD ' as id, friendlyid as memo, 'text' as memo_type FROM users WHERE friendlyid = ? AND ? = 'banka.com'"

[tls]
certificate-file = "/home/…/mkcert/banka.com.pem"
private-key-file = "/home/…/mkcert/banka.com-key.pem"

As shown in the preceding code, we can make the following observations:

  • Set the port where the federation server will run and set the database connection details. In my case, I'm connecting the banka database using the bankauser user. My password is also bankauser.
  • Next, we set a query to fetch the user's details from the users table in the banka database and select what we will return. Thus, if the request is for johndoe*banka.com to the federation server, it will return the following parameters in the response:
id: GDW3IXTH3UFCU2KD6REURTLK7XVSUC4P4WDATMFPTW6YZFEAV7RWATAD
memo : johndoe
memotype: text
  1. Lastly, set the certificate and the private key file location for encryption. Provide the location of the self-signed certificate for banka.com.
  2. Repeat the steps for the Bank B federation server as well and configure the federaton.cfg file like so:
port = 8002

[database]
type = "postgres"
dsn = "postgres://bankbuser:bankbuser@localhost/bankb?sslmode=disable"

[queries]
federation = "SELECT ' GBETQAVAWJJIQ7CZPXWLXKZO6BELLACNR3E7BRD4WTYEANAGGR62VP6Q ' as id, friendlyid as memo, 'text' as memo_type FROM users WHERE friendlyid = ? AND ? = 'bankb.com'"

[tls]
certificate-file = "/home/…/mkcert/bankb.com.pem"
private-key-file = "/home/…/mkcert/bankb.com-key.pem"

Now, we have our federation server set up.

  1. Start the federation server by running the following command:
./federation
  1. Test whether the server works by submitting a request in the browser:
Request -- https://banka.com:8012/federation?q=johndoe*banka.com&type=name

You should see the following response:

Response –
id: GDW3IXTH3UFCU2KD6REURTLK7XVSUC4P4WDATMFPTW6YZFEAV7RWATAD
memo : johndoe
memotype: text

Now, we will set up the compliance server.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.171.180