1 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
2 /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
3 /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
4 /*!40101 SET NAMES utf8 */;
5 /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
6 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
7 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
9 DROP DATABASE `federation`;
11 CREATE SCHEMA IF NOT EXISTS `federation`;
16 # Dump of table chains
17 # ------------------------------------------------------------
19 CREATE TABLE `chains` (
20 `id` tinyint(1) NOT NULL AUTO_INCREMENT,
21 `name` varchar(64) NOT NULL,
22 `block_height` int(11) DEFAULT '0',
23 `block_hash` char(64) NOT NULL,
24 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
25 `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
27 UNIQUE KEY `name` (`name`),
28 UNIQUE KEY `block_hash` (`block_hash`)
29 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
31 LOCK TABLES `chains` WRITE;
32 /*!40000 ALTER TABLE `chains` DISABLE KEYS */;
35 (`id`, `name`, `block_height`, `block_hash`, `created_at`, `updated_at`)
37 (1,'bytom',0,'a75483474799ea1aa6bb910a1a5025b4372bf20bef20f246a2c2dc5e12e8a053','2018-09-13 05:10:43','2018-11-27 09:42:06');
39 /*!40000 ALTER TABLE `chains` ENABLE KEYS */;
43 # Dump of table cross_transactions
44 # ------------------------------------------------------------
46 CREATE TABLE `cross_transactions` (
47 `id` int(11) NOT NULL AUTO_INCREMENT,
48 `chain_id` tinyint(1) NOT NULL,
49 `source_block_height` int(11) NOT NULL,
50 `source_block_timestamp` int(11) NOT NULL,
51 `source_block_hash` char(64) NOT NULL,
52 `source_tx_index` int(11) NOT NULL,
53 `source_mux_id` char(64) NOT NULL,
54 `source_tx_hash` char(64) NOT NULL,
55 `source_raw_transaction` mediumtext NOT NULL,
56 `dest_block_height` int(11) DEFAULT NULL,
57 `dest_block_timestamp` int(11) DEFAULT NULL,
58 `dest_block_hash` char(64) DEFAULT NULL,
59 `dest_tx_index` int(11) DEFAULT NULL,
60 `dest_tx_hash` char(64) DEFAULT NULL,
61 `status` tinyint(1) DEFAULT '0',
62 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
63 `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
65 UNIQUE KEY `source_mux_id` (`chain_id`,`source_mux_id`),
66 UNIQUE KEY `source_tx_hash` (`chain_id`,`source_tx_hash`),
67 UNIQUE KEY `source_blockhash_txidx` (`chain_id`,`source_block_hash`,`source_tx_index`),
68 UNIQUE KEY `source_blockheight_txidx` (`chain_id`,`source_block_height`,`source_tx_index`),
69 UNIQUE KEY `dest_tx_hash` (`chain_id`,`dest_tx_hash`),
70 UNIQUE KEY `dest_blockhash_txidx` (`chain_id`,`dest_block_hash`,`dest_tx_index`),
71 UNIQUE KEY `dest_blockheight_txidx` (`chain_id`,`dest_block_height`,`dest_tx_index`),
72 CONSTRAINT `cross_transactions_ibfk_1` FOREIGN KEY (`chain_id`) REFERENCES `chains` (`id`)
73 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
75 LOCK TABLES `cross_transactions` WRITE;
79 # Dump of table cross_transaction_reqs
80 # ------------------------------------------------------------
81 CREATE TABLE `cross_transaction_reqs` (
82 `id` int(11) NOT NULL AUTO_INCREMENT,
83 `cross_transaction_id` int(11) NOT NULL,
84 `source_pos` int(11) NOT NULL,
85 `asset_id` int(11) NOT NULL,
86 `asset_amount` bigint(20) DEFAULT '0',
87 `script` varchar(128) NOT NULL,
88 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
89 `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
91 UNIQUE KEY `req_id` (`cross_transaction_id`,`source_pos`),
92 CONSTRAINT `cross_transaction_reqs_ibfk_1` FOREIGN KEY (`cross_transaction_id`) REFERENCES `cross_transactions` (`id`),
93 CONSTRAINT `cross_transaction_reqs_ibfk_2` FOREIGN KEY (`asset_id`) REFERENCES `assets` (`id`)
94 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
96 LOCK TABLES `cross_transaction_reqs` WRITE;
100 # Dump of table assets
101 # ------------------------------------------------------------
103 CREATE TABLE `assets` (
104 `id` int(11) NOT NULL AUTO_INCREMENT,
105 `asset_id` varchar(64) NOT NULL,
106 `issuance_program` varchar(64) NOT NULL,
107 `vm_version` int(11) NOT NULL DEFAULT '1',
108 `raw_definition_byte` text,
109 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
110 `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
112 UNIQUE KEY `asset_id` (`asset_id`)
113 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
115 LOCK TABLES `assets` WRITE;
116 /*!40000 ALTER TABLE `assets` DISABLE KEYS */;
118 INSERT INTO `assets` (`id`, `asset_id`, `issuance_program`, `vm_version`, `raw_definition_byte`, `created_at`, `updated_at`)
120 (1,'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff','',1,'7b0a202022646563696d616c73223a20382c0a2020226465736372697074696f6e223a20224279746f6d204f6666696369616c204973737565222c0a2020226e616d65223a202242544d222c0a20202273796d626f6c223a202242544d220a7d','2018-09-13 05:10:43','2018-11-27 09:43:35');
122 /*!40000 ALTER TABLE `assets` ENABLE KEYS */;