Setting up the bridge server

As the name suggests, the bridge server will 'bridge' the operations carried out by the federation server, the compliance server, the Horizon client-server and the Stellar Core. The requestor will submit payment requests to the bridge server and it will interface between these four components to ensure compliance checks are carried out and the transaction is submitted to the blockchain. Follow these steps to set up the bridge server:

  1. Download the bridge server release from the Stellar website here (https://github.com/stellar-deprecated/bridge-server/releases). Select the binary corresponding to your OS version.
  2. Extract the binary file and copy the extracted folder. Paste and create two copies of the extracted folder labeled bridgeA and bridgeB.
  3. Create a file called bridge.cfg inside the extracted folders and open it in a text editor. Configure it like so for the bridge server for Bank A:
 port = 8006
horizon = "http://localhost:8000"
network_passphrase = 'Standalone Network ; February 2017'

compliance = "http://banka.com:8004"

[[assets]]
code="USD"
issuer="GAIHBCB57M2SDFQYUMANDBHW4YYMD3FJVK2OGHRKKCNF2HBZIRBKRX6E"

[database]
type = "postgres"
url = "postgres://bankauser:bankauser@localhost/bridgea?sslmode=disable"

[accounts]
base_seed = "SDSQ5MJALF7VWDFEFETPGGWJK2UEQ5HU6HJBKMT5M5YDJ3WYKMC5RC3O"

receiving_account_id = "GDW3IXTH3UFCU2KD6REURTLK7XVSUC4P4WDATMFPTW6YZFEAV7RWATAD"

authorizing_seed = "SAEEE4UUP3DRYTEFHNFKCVB4ZCQT2W2KPFW7FLE6VLE7QABAAZATFZFD"

issuing_account_id = "GAIHBCB57M2SDFQYUMANDBHW4YYMD3FJVK2OGHRKKCNF2HBZIRBKRX6E"

[callbacks]

receive = "http://localhost:5000/receive"

From the preceding code, we can make the following observations:

  • port indicates the port that requests need to be submitted to on the bridge server.
  • Horizon and network passphrases indicate the location of the Horizon client server and the network passphrase for our Stellar network.
  • The compliance server is set to the internal port we set up while installing the compliance server in the previous section.
  • asset indicates the assets we'll be listening for in our received payments. It is set to the USD asset we issued earlier.
  • The database is set to the bridgeA database we set up when we were setting up our internal databases.
  • The accounts tag specifies the default secret key that's used to sign transactions that are submitted from the bridge server, the receiving account for payments that the bridge server will listen to, the authorizing seed for the USD asset, and the issuing account for the USD asset.
  • Lastly, we have set the callbacks server for receiving payments. This endpoint will be called whenever the bridge server receives a payment. We will look at this endpoint in more detail when we build our callbacks server.
  1. Update the bridge.cfg file for Bank B's bridge server as well. Navigate to the bridgeB directory and make the following changes:
port = 8007
horizon = "http://localhost:8000"
network_passphrase = 'Standalone Network ; February 2017'

compliance = "http://bankb.com:8009"

[[assets]]
code="USD"
issuer="GAIHBCB57M2SDFQYUMANDBHW4YYMD3FJVK2OGHRKKCNF2HBZIRBKRX6E"

[database]
type = "postgres"
url = "postgres://bankbuser:bankbuser@localhost/bridgeb?sslmode=disable"

[accounts]
base_seed = "SB6HTLWBKVY6KOGKFZE2EKH3ZFSIYHYXJOORGKIOHSMPHBCX4SS4PU6G"

receiving_account_id = "GBETQAVAWJJIQ7CZPXWLXKZO6BELLACNR3E7BRD4WTYEANAGGR62VP6Q"

authorizing_seed = "SAEEE4UUP3DRYTEFHNFKCVB4ZCQT2W2KPFW7FLE6VLE7QABAAZATFZFD"

issuing_account_id = "GAIHBCB57M2SDFQYUMANDBHW4YYMD3FJVK2OGHRKKCNF2HBZIRBKRX6E"

[callbacks]

receive = "http://localhost:5100/receive"

From the preceding code, we can make the following observations:

  • We update the client port to 8007 for our bridge server.
  • We also update the compliance server port and the bridge server's database URL. Lastly, we update the signing key to the secret key for Bank B and the receiving account to the Stellar account ID for Bank B.
  • Lastly, we set the callbacks server endpoint to 5100 where we will be hosting the callbacks server for Bank B.
  1. Before we can bring the bridge server online, we need to set up the database. Navigate to the bridgeA directory and run the following command to set up the bridge database for Bank A:
./bridge --migrate-db
  1. Next, run the following command to bring the bridge server online:
./bridge

Repeat the preceding steps for the bridge server for Bank B as well. Navigate to the bridgeB directory and run the last two commands. Now, we have set up the bridge servers for our remittance platform. We'll set up the callbacks server next.

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

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