Setting up the bank's internal databases

We need to set up the internal databases for both banks. These will be used to store user data and other requisite details. I will be using postgresql, but you can use any database you are comfortable with. Let's get started:

  1. Create two users pertaining to Bank A and Bank B on the database. On my Ubuntu system, I am creating the bankauser and bankbuser users. Run the following commands:
useradd bankauser
useradd bankbuser
  1. Next, set the password for the users with the following commands:
passwd bankauser
passwd bankbuser

At the new password prompt, set the new password.

  1. Log into the postgres user and open the PostgreSQL command line, as follows:
su – postgres
psql
  1. Create a database for banka and bankb by running the following command on the postgresql command line:
CREATE DATABASE banka OWNER bankauser;
CREATE DATABASE bankb OWNER bankbuser;
  1. Next, we need to create the requisite tables in the database and add some test data. Log out from the postgres command line and log in using the bankauser Unix login. Log into the postgresql command line for banka from bankauser, as follows:
su - bankauser
psql banka

First, we'll create the users table with test customer data:

CREATE TABLE users (
name VARCHAR,
address VARCHAR,
dob INTEGER,
friendlyid VARCHAR PRIMARY KEY,
sanction BOOLEAN,
balance INTEGER,
domain VARCHAR,
}

Next, we'll insert the following test data into the table:

INSERT INTO users(name, address, dob, friendlyid, sanction, balance, domain)
VALUES
('John Doe', 'cityA', '01011988', 'johndoe', true, 1000, 'banka.com');

We add the customer's name, their address, date of birth, friendly ID for the account, sanction (true: allowed, false: not allowed), account balance, and the ID domain (banka.com).

  1. Next, create the following sanctions table:
CREATE TABLE sanction (
domain VARCHAR,
bankname VARCHAR,
sanction BOOLEAN
}
  1. Create the following entry for bankb.com in Bank A's sanction database:
INSERT INTO sanction(domain, bankname, sanction)
VALUES('bankb.com', 'Bank B', true);
  1. Lastly, create a transactions database where received transactions will be logged by the bridge server for the banka and bankb databases:
CREATE TABLE transactions (
txid VARCHAR,
sender VARCHAR,
receiver VARCHAR,
amount INTEGER,
currency VARCHAR,
kyc_info VARCHAR,
}
  1. Create the table users, sanctions, and transactions for the bankb database as well. Log out and log in using bankbuser and connect to the bankb database like so:
su - bankbuser
psql bankb
  1. Repeat the preceding steps and create the users, sanctions, and transactions database for bankb as well. Insert test values into the users table for bankb like so:
INSERT INTO users(name, address, dob, friendlyid, sanction, balance, domain)
VALUES
('Jane Smith', 'cityB', '31031991', 'janesmith', true, 2000, 'bankb.com');
  1. Also, insert these details into the sanction table, as follows:
INSERT INTO sanction(domain, bankname, sanction)
VALUES('banka.com', 'Bank A', true);

We also need to create a database so that we can log our compliance requests and a database for all the transactions being handled by the bridge server. 

Log out from bankbuser and log into postgres with the following command:

su – postgres
psql

Create the following databases: 

CREATE DATABASE bridgea OWNER bankauser;
CREATE DATABASE bridgeb OWNER bankbuser;
CREATE DATABASE compliancea OWNER bankauser;
CREATE DATABASE complianceb OWNER bankbuser;

As its name suggests, bridgea corresponds to the bridge module of Bank A, bridgeb corresponds to the bridge module of Bank B, compliancea corresponds to the compliance module of Bank A, and complianceb corresponds to the compliance module of Bank B. We'll set up the individual databases later when we install the bridge and compliance module.

This should take care of the bank's internal database infrastructure. Let's move on to the other components.

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

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