Database

System Requirement

  • A separate database system is required in the use of enclave management

  • MySQL, PostgreSQL, MSSQL, and Oracle DBMS are supported.

  • MySQL is recommended.

Table Description

  • Basically, You need to create 4 tables.

    • verifications : A table to store the requests/responses of user verification API.

    • counter_party_keys : A table to store the public key of the beneficiary VASP.

    • own_keys : A table to store the public key of the originating VASP.

    • commands : A table to store the intermediate requests of asynchronous APIs.

  • Additionally, You need to create more tables depending on the features you want to use.

    • chainalysis_sanction_results : A table to store the histories of risk assessment with Chainalysis Sanction API.

    • chainalysis_kyt_results : A table to store the histories of risk assessment with Chainalysis KYT API.

    • chainalysis_kyt_alerts : A table to store KYT alerts generated by risk assessment with Chainalysis KYT API.

    • refinitiv_wco_results : A table to store the histories of risk assessment with Refinitiv World Check One API.

Backup, Restore, and Recover Policies

  • verifications table is recommended to be backed up every day as it manages the verification history of Travel Rules in it.

  • own_keys is recommended to be backed up regularly.

  • chainalysis_sanction_results, chainalysis_kyt_results, chainalysis_kyt_alerts, refinitiv_wco_results are recommended to be backed up regularly.

  • counter_party_keys table is used for the caching purpose, thus it does not require to be restored.

  • commands table does not require to be backed up or restored as only intermediate processing data for temporary use are in it.

Storage Size Considerations

  • verifications table: approximately 4-5 KB per request

  • counter_party_keys table: approximately 1 KB per beneficiary address

  • own_keys: approximately 1 KB per request if PerVerification key type is used

  • commands: approximately 1-5 KB per asynchronous request

  • chainalysis_sanction_results : approximately 1-2 KB per request

  • chainalysis_kyt_results : approximately 2-3 KB per request

  • chainalysis_kyt_alerts : approximately 0-3 KB per request

  • refinitiv_wco_results : approximately 2-3 KB per request

Table Definition

verifications table (Required)

  • In withdrawal request processing, the pre-screening result from the Travel Rules is stored in this table.

  • When POST /verifications API is called, the request/response result will be recorded in the verifications table.

  • Following columns are encrypted.

    • ivms101_originator

    • ivms101_originating_vasp

    • ivms101_beneficiary

    • ivms101_beneficiary_vasp

Table Creation Query

CREATE TABLE `verifications` (
  `verification_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Verification ID',
  `verification_uuid` varchar(40) NOT NULL COMMENT 'Verification UUID',
  `result` enum('WAIT', 'VERIFIED', 'UNKNOWN', 'DENIED', 'ERROR', 'PENDING', 'TRANSFER_ERROR') NOT NULL DEFAULT 'WAIT' COMMENT 'Verification Result',
  `reason` varchar(256) DEFAULT NULL COMMENT 'Reason',
  `message` varchar(1024) DEFAULT NULL COMMENT 'Additional information about the reason',
  `network` varchar(128) DEFAULT NULL COMMENT 'Network for token transfer',
  `symbol` varchar(16) DEFAULT NULL COMMENT 'Symbol',
  `amount` varchar(128) DEFAULT NULL COMMENT 'Amount',
  `trade_price` varchar(128) DEFAULT NULL COMMENT 'Trading Price',
  `trade_currency` varchar(128) DEFAULT NULL COMMENT 'Trading Currency',
  `trade_iso_datetime` datetime DEFAULT NULL COMMENT 'Trading time',
  `is_exceeding_threshold` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Whether the threshold has been exceeded',
  `tx_hash` varchar(128) DEFAULT NULL COMMENT 'Tx hash',
  `vout` varchar(128) DEFAULT NULL COMMENT 'Vout',
  `originating_vasp_id` bigint(20) unsigned DEFAULT NULL COMMENT 'Originating VASP ID',
  `originator_account_number` varchar(256) DEFAULT NULL COMMENT 'Originator Account Address or ID',
  `ivms101_originator` text(65535) DEFAULT NULL COMMENT 'Originator Information',
  `ivms101_originating_vasp` text(65535) DEFAULT NULL COMMENT 'Originating VASP Information',
  `beneficiary_vasp_id` bigint(20) unsigned DEFAULT NULL COMMENT 'Beneficiary VASP ID',
  `beneficiary_account_number` varchar(256) DEFAULT NULL COMMENT 'Beneficiary Account Address or ID',
  `ivms101_beneficiary` text(65535) DEFAULT NULL COMMENT 'Beneficiary Information',
  `ivms101_beneficiary_vasp` text(65535) DEFAULT NULL COMMENT 'Beneficiary VASP Information',
  `verified_at` datetime(3) DEFAULT NULL COMMENT 'Verified at.',
  `ordered_at` datetime(3) DEFAULT NULL COMMENT 'Ordered at.',
  `created_at` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT 'Created at.',
  PRIMARY KEY (`verification_id`),
  UNIQUE KEY `uk_verifications_verification_uuid` (`verification_uuid`),
  INDEX `idx_verifications_originator_account` (`originator_account_number`),
  INDEX `idx_verifications_beneficiary_account` (`beneficiary_account_number`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

counter_party_keys Table (Required)

  • The table stores the public key of the beneficiary VASP, which is used to encrypt personal information in the verification process.

  • According to the key type determined by the originating VASP, the public key of the beneficiary VASP is recorded.

  • When POST /verifications API is called, it is checked whether the public key of the beneficiary VASP is being cashed. If not, an automatic request to the beneficiary VASP is sent and saved in this table.

Table Creation Query

CREATE TABLE `counter_party_keys` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Key ID',
  `type` enum('PerVasp', 'PerAddress', 'PerVerification') NOT NULL COMMENT 'Key types',
  `vasp_id` bigint(20) unsigned NOT NULL COMMENT 'Counter party VASP ID',
  `key_identifier` varchar(256) NOT NULL COMMENT 'Identifier of key (address or vaspId)',
  `public_key` varchar(256) NOT NULL COMMENT 'Public Key of counter party',
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Created at.',
  PRIMARY KEY (`id`),
  UNIQUE KEY `key_uniqueness` (`vasp_id`, `key_identifier`, `type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

own_keys Table (Required)

  • The table stores the public key and private key of the Own VASP - the enclave VASP itself - both of which are used in personal information encryption during the verification process.

  • When the other VASP requests a public key inquiry, the requested type of public key can be returned by being fetched from this table.

  • The private key is saved as encrypted.

Table Creation Query

CREATE TABLE `own_keys` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Key ID',
  `type` enum('PerVasp', 'PerAddress', 'PerVerification') NOT NULL COMMENT 'Key types',
  `key_identifier` varchar(256) NOT NULL COMMENT 'Identifier of key (address or type or public key)',
  `public_key` varchar(256) NOT NULL COMMENT 'Public Key',
  `private_key` varchar(256) NOT NULL COMMENT 'Private Key',
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Created at.',
  PRIMARY KEY (`id`),
  UNIQUE KEY `key_uniqueness` (`key_identifier`, `type`),
  INDEX `public_key` (`public_key`, `private_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

commands Table (Required)

  • The intermediate requests in processing asynchronous API are stored in this table.

  • This table is only used inside the enclave, not by VASP.

Table Creation Query

CREATE TABLE `commands` (
  `command_id` bigint(20) unsigned NOT NULL COMMENT 'Command ID',
  `command_type` varchar(32) NOT NULL COMMENT 'Command type',
  `command_body` text(65535) NOT NULL COMMENT 'Command body',
  `status` enum('CREATED', 'PROCESSING', 'DONE', 'ERROR') NOT NULL DEFAULT 'CREATED' COMMENT 'Command status',
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Created at.',
  `fetched_at` datetime DEFAULT NULL COMMENT 'Fetched at.',
  `finished_at` datetime DEFAULT NULL COMMENT 'Finished at.',
  PRIMARY KEY (`command_id`),
  INDEX `status_id` (`status`, `command_id`),
  INDEX `status_finished_at` (`status`, `finished_at`),
  INDEX `status_fetched_at_created_at` (`status`, `fetched_at`, `created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

chainalysis_sanction_results Table (Optional)

Table Creation Query

CREATE TABLE `chainalysis_sanction_results` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `request_id` varchar(40) NOT NULL,
  `verification_uuid` varchar(40) NOT NULL,
  `counterparty_vasp_id` bigint(20) unsigned NOT NULL,
  `direction` enum('OUTGOING', 'INCOMING') NOT NULL,
  `address` varchar(512) NOT NULL,
  `status` enum('NOHIT', 'SANCTION', 'CLOSED', 'ERROR') NOT NULL,
  `ofac_name` varchar(1024) DEFAULT NULL,
  `ofac_description` varchar(4096) DEFAULT NULL,
  `ofac_url` varchar(1024) DEFAULT NULL,
  `created_at` datetime(3) DEFAULT CURRENT_TIMESTAMP(3),
  `updated_at` datetime(3) DEFAULT CURRENT_TIMESTAMP(3),
  PRIMARY KEY (`id`),
  UNIQUE KEY `uniq_request_id` (`request_id`),
  INDEX `idx_counterparty_vasp_id` (`counterparty_vasp_id`, `created_at`),
  INDEX `idx_address` (`address`, `created_at`),
  INDEX `idx_created_at` (`created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

chainalysis_kyt_results Table (Optional)

Table Creation Query

CREATE TABLE `chainalysis_kyt_results` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `request_id` varchar(40) NOT NULL,
  `verification_uuid` varchar(40) NOT NULL,
  `counterparty_vasp_id` bigint(20) unsigned NOT NULL,
  `api_type` enum('TRANSFER', 'ATTEMPT') NOT NULL,
  `user_id` varchar(128) NOT NULL,
  `direction` enum('OUTGOING', 'INCOMING') NOT NULL,
  `network` varchar(128) DEFAULT NULL,
  `asset` varchar(16) NOT NULL,
  `amount` varchar(128) NOT NULL,
  `usd_price` varchar(128) DEFAULT NULL,
  `transfer_ref` varchar(1024) DEFAULT NULL,
  `output_address` varchar(512) DEFAULT NULL,
  `timestamp` datetime(3) DEFAULT NULL,
  `external_id` varchar(128) DEFAULT NULL,
  `status` enum('ERROR', 'REGISTERED', 'CHECKING', 'PROCESSED') NOT NULL,
  `worker_id` varchar(128) DEFAULT NULL,
  `last_checked_at` datetime(3) DEFAULT NULL,
  `alert_count` int(11) DEFAULT NULL,
  `created_at` datetime(3) DEFAULT CURRENT_TIMESTAMP(3),
  `updated_at` datetime(3) DEFAULT CURRENT_TIMESTAMP(3),
  `assessed_at` datetime(3) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uniq_request_id` (`request_id`),
  INDEX `idx_external_id` (`external_id`),
  INDEX `idx_counterparty_vasp_id` (`counterparty_vasp_id`, `created_at`),
  INDEX `idx_direction` (`direction`, `created_at`),
  INDEX `idx_status_last_checked_at` (`status`, `last_checked_at`),
  INDEX `idx_status_worker_id` (`status`, `worker_id`, `id`),
  INDEX `idx_created_at` (`created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

chainalysis_kyt_alerts Table (Optional)

  • This table is required to use Risk Assessment with Chainalysis KYT API feature.

  • This table stores the KYT alerts generated by Chainalysis KYT API.

  • 1:n correspondence with the record in chainalysis_kyt_results table above.

Table Creation Query

CREATE TABLE `chainalysis_kyt_alerts` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `external_id` varchar(128) NOT NULL,
  `alert_id` varchar(128) NOT NULL,
  `alert_level` enum('LOW', 'MEDIUM', 'HIGH', 'SEVERE') NOT NULL,
  `entity_category` varchar(256) DEFAULT NULL,
  `service_name` varchar(256) DEFAULT NULL,
  `exposure_type` enum('DIRECT', 'INDIRECT') NOT NULL,
  `alert_amount` varchar(128) NOT NULL,
  `created_at` datetime(3) DEFAULT CURRENT_TIMESTAMP(3),
  `updated_at` datetime(3) DEFAULT CURRENT_TIMESTAMP(3),
  PRIMARY KEY (`id`),
  UNIQUE KEY `uniq_alert_id` (`alert_id`),
  INDEX `idx_external_id` (`external_id`),
  INDEX `idx_alert_level` (`alert_level`),
  INDEX `idx_created_at` (`created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

refinitiv_wco_results Table (Optional)

Table Creation Query

CREATE TABLE `refinitiv_wco_results` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `request_id` varchar(40) NOT NULL,
  `verification_uuid` varchar(40) NOT NULL,
  `counterparty_vasp_id` bigint(20) unsigned NOT NULL,
  `direction` enum('OUTGOING', 'INCOMING') NOT NULL,
  `case_system_id` varchar(128) NOT NULL,
  `aggregated_result_summaries` varchar(4096) DEFAULT NULL,
  `worker_id` varchar(128) DEFAULT NULL,
  `status` enum('ERROR', 'REGISTERED', 'CHECKING', 'PROCESSED') NOT NULL,
  `last_checked_at` datetime(3) DEFAULT NULL,
  `created_at` datetime(3) DEFAULT CURRENT_TIMESTAMP(3),
  `updated_at` datetime(3) DEFAULT CURRENT_TIMESTAMP(3),
  `assessed_at` datetime(3) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uniq_request_id` (`request_id`),
  INDEX `idx_counterparty_vasp_id` (`counterparty_vasp_id`, `created_at`),
  INDEX `idx_direction` (`direction`, `created_at`),
  INDEX `idx_status_last_checked_at` (`status`, `last_checked_at`),
  INDEX `idx_status_worker_id` (`status`, `worker_id`, `id`),
  INDEX `idx_created_at` (`created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Last updated