OSDN Git Service

fix config & update mysql dump (#306)
[bytom/vapor.git] / docs / federation / federation.sql
index b2613c5..447fc88 100644 (file)
@@ -12,21 +12,6 @@ CREATE SCHEMA IF NOT EXISTS `federation`;
 
 USE `federation`;
 
-# Dump of table warders
-# ------------------------------------------------------------
-
-CREATE TABLE `warders` (
-  `id` tinyint(1) NOT NULL AUTO_INCREMENT,
-  `pubkey` varchar(64) NOT NULL,
-  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
-  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-  PRIMARY KEY (`id`),
-  UNIQUE KEY `pubkey` (`pubkey`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
-LOCK TABLES `warders` WRITE;
-UNLOCK TABLES;
-
 
 # Dump of table chains
 # ------------------------------------------------------------
@@ -40,16 +25,29 @@ CREATE TABLE `chains` (
   `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
   PRIMARY KEY (`id`),
   UNIQUE KEY `name` (`name`),
-  UNIQUE KEY `block_hash` (`block_hash`)
+  UNIQUE KEY `block_hash` (`id`,`block_hash`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
 LOCK TABLES `chains` WRITE;
 /*!40000 ALTER TABLE `chains` DISABLE KEYS */;
 
+------------------------------------ bytom consensus --------------------------------------
+-- chain name should be the same as BytomChainName in toolbar/federation/common/const.go --
+-------------------------------------------------------------------------------------------
+-- bytom mainnet consensus start--
+-- INSERT INTO `chains`
+-- (`id`, `name`, `block_height`, `block_hash`, `created_at`, `updated_at`)
+-- VALUES
+-- (1,'btm',0,'a75483474799ea1aa6bb910a1a5025b4372bf20bef20f246a2c2dc5e12e8a053','2018-09-13 05:10:43','2018-11-27 09:42:06');
+-- bytom mainnet consensus end--
+
+-- bytom testnet&solonet consensus start--
 INSERT INTO `chains`
 (`id`, `name`, `block_height`, `block_hash`, `created_at`, `updated_at`)
 VALUES
-(1,'bytom',0,'a75483474799ea1aa6bb910a1a5025b4372bf20bef20f246a2c2dc5e12e8a053','2018-09-13 05:10:43','2018-11-27 09:42:06');
+(1,'btm',0,'ce4fe9431cd0225b3a811f8f8ec922f2b07a921bb12a8dddae9a85540072c770','2018-09-13 05:10:43','2018-11-27 09:42:06');
+-- bytom testnet&solonet consensus end--
+
 
 /*!40000 ALTER TABLE `chains` ENABLE KEYS */;
 UNLOCK TABLES;
@@ -62,12 +60,14 @@ CREATE TABLE `cross_transactions` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `chain_id` tinyint(1) NOT NULL,
   `source_block_height` int(11) NOT NULL,
+  `source_block_timestamp` int(11) NOT NULL,
   `source_block_hash` char(64) NOT NULL,
   `source_tx_index` int(11) NOT NULL,
   `source_mux_id` char(64) NOT NULL,
   `source_tx_hash` char(64) NOT NULL,
   `source_raw_transaction` mediumtext NOT NULL,
   `dest_block_height` int(11) DEFAULT NULL,
+  `dest_block_timestamp` int(11) DEFAULT NULL,
   `dest_block_hash` char(64) DEFAULT NULL,
   `dest_tx_index` int(11) DEFAULT NULL,
   `dest_tx_hash` char(64) DEFAULT NULL,
@@ -98,6 +98,8 @@ CREATE TABLE `cross_transaction_reqs` (
   `asset_id` int(11) NOT NULL,
   `asset_amount` bigint(20) DEFAULT '0',
   `script` varchar(128) NOT NULL,
+  `from_address` varchar(128) NOT NULL DEFAULT '',
+  `to_address` varchar(128) NOT NULL DEFAULT '',
   `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
   `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
   PRIMARY KEY (`id`),
@@ -110,35 +112,15 @@ LOCK TABLES `cross_transaction_reqs` WRITE;
 UNLOCK TABLES;
 
 
-# Dump of table cross_transaction_signs
-# ------------------------------------------------------------
-CREATE TABLE `cross_transaction_signs` (
-  `id` int(11) NOT NULL AUTO_INCREMENT,
-  `cross_transaction_id` int(11) NOT NULL,
-  `warder_id` tinyint(1) NOT NULL,
-  `signatures` text NOT NULL,
-  `status` tinyint(1) NOT NULL,
-  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
-  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-  PRIMARY KEY (`id`),
-  UNIQUE KEY `sign_id` (`cross_transaction_id`,`warder_id`),
-  CONSTRAINT `cross_transaction_signs_ibfk_1` FOREIGN KEY (`warder_id`) REFERENCES `warders` (`id`),
-  CONSTRAINT `cross_transaction_signs_ibfk_2` FOREIGN KEY (`cross_transaction_id`) REFERENCES `cross_transactions` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
-LOCK TABLES `cross_transaction_signs` WRITE;
-UNLOCK TABLES;
-
-
 # Dump of table assets
 # ------------------------------------------------------------
 
 CREATE TABLE `assets` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `asset_id` varchar(64) NOT NULL,
-  `issuance_program` varchar(64) NOT NULL,
+  `issuance_program` varchar(128) NOT NULL,
   `vm_version` int(11) NOT NULL DEFAULT '1',
-  `raw_definition_byte` text,
+  `definition` text,
   `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
   `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
   PRIMARY KEY (`id`),
@@ -148,9 +130,16 @@ CREATE TABLE `assets` (
 LOCK TABLES `assets` WRITE;
 /*!40000 ALTER TABLE `assets` DISABLE KEYS */;
 
-INSERT INTO `assets` (`id`, `asset_id`, `issuance_program`, `vm_version`, `raw_definition_byte`, `created_at`, `updated_at`)
+INSERT INTO `assets` (`id`, `asset_id`, `issuance_program`, `vm_version`, `definition`, `created_at`, `updated_at`)
 VALUES
-  (1,'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff','',1,'7b0a202022646563696d616c73223a20382c0a2020226465736372697074696f6e223a20224279746f6d204f6666696369616c204973737565222c0a2020226e616d65223a202242544d222c0a20202273796d626f6c223a202242544d220a7d','2018-09-13 05:10:43','2018-11-27 09:43:35');
+  (1,'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff','',1,
+  '{
+    "decimals": 8,
+    "description": "Bytom Official Issue",
+    "name": "BTM",
+    "symbol": "BTM"
+  }',
+  '2018-09-13 05:10:43','2018-11-27 09:43:35');
 
 /*!40000 ALTER TABLE `assets` ENABLE KEYS */;
 UNLOCK TABLES;
\ No newline at end of file