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 CREATE SCHEMA IF NOT EXISTS `federation`;
13 # Dump of table warders
14 # ------------------------------------------------------------
16 DROP TABLE IF EXISTS `warders`;
18 CREATE TABLE `warders` (
19 `id` tinyint(1) unsigned NOT NULL AUTO_INCREMENT,
20 `pubkey` varchar(64) NOT NULL,
21 `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
22 `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
24 UNIQUE KEY `pubkey` (`pubkey`)
25 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
27 LOCK TABLES `warders` WRITE;
31 # Dump of table chains
32 # ------------------------------------------------------------
34 CREATE TABLE `chains` (
35 `id` tinyint(1) NOT NULL AUTO_INCREMENT,
36 `name` varchar(64) NOT NULL,
37 `block_height` int(11) DEFAULT '0',
38 `block_hash` char(64) NOT NULL,
39 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
40 `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
42 UNIQUE KEY `name` (`name`),
43 UNIQUE KEY `block_hash` (`block_hash`)
44 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
46 LOCK TABLES `chains` WRITE;
47 /*!40000 ALTER TABLE `chains` DISABLE KEYS */;
50 (`id`, `name`, `block_height`, `block_hash`, `created_at`, `updated_at`)
52 (1,'bytom',0,'a75483474799ea1aa6bb910a1a5025b4372bf20bef20f246a2c2dc5e12e8a053','2018-09-13 05:10:43','2018-11-27 09:42:06');
54 /*!40000 ALTER TABLE `chains` ENABLE KEYS */;
58 # Dump of table cross_transactions
59 # ------------------------------------------------------------
61 CREATE TABLE `cross_transactions` (
62 `id` int(11) NOT NULL AUTO_INCREMENT,
63 `chain_id` int(11) NOT NULL,
64 `source_block_height` int(11) NOT NULL,
65 `source_block_hash` char(64) NOT NULL,
66 `source_tx_index` int(11) NOT NULL,
67 `source_mux_id` char(64) NOT NULL,
68 `source_tx_hash` char(64) NOT NULL,
69 `source_raw_transaction` mediumtext NOT NULL,
70 `dest_block_height` int(11) DEFAULT NULL,
71 `dest_block_hash` char(64) DEFAULT NULL,
72 `dest_tx_index` int(11) DEFAULT NULL,
73 `dest_tx_hash` char(64) DEFAULT NULL,
74 `status` tinyint(1) DEFAULT '0',
75 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
76 `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
78 UNIQUE KEY `source_mux_id` (`chain_id`,`source_mux_id`),
79 UNIQUE KEY `source_tx_hash` (`chain_id`,`source_tx_hash`),
80 UNIQUE KEY `source_raw_transaction` (`source_raw_transaction`),
81 UNIQUE KEY `source_blockhash_txidx` (`chain_id`,`source_block_hash`,`tx_index`),
82 UNIQUE KEY `source_blockheight_txidx` (`chain_id`,`source_block_height`,`tx_index`),
83 UNIQUE KEY `dest_tx_hash` (`chain_id`,`dest_tx_hash`),
84 UNIQUE KEY `dest_blockhash_txidx` (`chain_id`,`dest_block_hash`,`tx_index`),
85 UNIQUE KEY `dest_blockheight_txidx` (`chain_id`,`dest_block_height`,`tx_index`),
86 CONSTRAINT `cross_transactions_ibfk_1` FOREIGN KEY (`chain_id`) REFERENCES `chains` (`id`)
87 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
89 LOCK TABLES `cross_transactions` WRITE;
93 # Dump of table cross_transaction_reqs
94 # ------------------------------------------------------------
95 CREATE TABLE `cross_transaction_reqs` (
96 `id` int(11) NOT NULL AUTO_INCREMENT,
97 `cross_transaction_id` int(11) NOT NULL,
98 `source_pos` int(11) NOT NULL,
99 `asset_id` int(11) NOT NULL,
100 `asset_amount` bigint(20) DEFAULT '0',
101 `script` varchar(128) NOT NULL,
102 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
103 `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
105 UNIQUE KEY `req_id` (`cross_transaction_id`,`source_pos`),
106 CONSTRAINT `cross_transaction_reqs_ibfk_1` FOREIGN KEY (`cross_transaction_id`) REFERENCES `cross_transactions` (`id`),
107 CONSTRAINT `cross_transaction_reqs_ibfk_2` FOREIGN KEY (`asset_id`) REFERENCES `assets` (`id`)
108 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
110 LOCK TABLES `cross_transaction_reqs` WRITE;
114 # Dump of table cross_transaction_signs
115 # ------------------------------------------------------------
116 CREATE TABLE `cross_transaction_signs` (
117 `id` int(11) NOT NULL AUTO_INCREMENT,
118 `cross_transaction_id` int(11) NOT NULL,
119 `warder_id` int(11) NOT NULL,
120 `signatures` text NOT NULL,
121 `status` tinyint(1) NOT NULL,
122 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
123 `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
125 UNIQUE KEY `sign_id` (`cross_transaction_id`,`warder_id`),
126 CONSTRAINT `cross_transaction_signs_ibfk_1` FOREIGN KEY (`warder_id`) REFERENCES `warders` (`id`),
127 CONSTRAINT `cross_transaction_signs_ibfk_2` FOREIGN KEY (`cross_transaction_id`) REFERENCES `cross_transactions` (`id`)
128 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
130 LOCK TABLES `cross_transaction_signs` WRITE;
134 # Dump of table assets
135 # ------------------------------------------------------------
137 DROP TABLE IF EXISTS `assets`;
139 CREATE TABLE `assets` (
140 `id` int(11) NOT NULL AUTO_INCREMENT,
141 `asset_id` varchar(64) NOT NULL,
142 `issuance_program` varchar(64) NOT NULL,
143 `vm_version` int(11) NOT NULL DEFAULT '1',
144 `raw_definition_byte` text,
145 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
146 `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
148 UNIQUE KEY `asset_id` (`asset_id`),
149 UNIQUE KEY `asset_meta` (`issuance_program`,`vm_version`,`raw_definition_byte`)
150 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
152 LOCK TABLES `assets` WRITE;
153 /*!40000 ALTER TABLE `assets` DISABLE KEYS */;
155 INSERT INTO `assets` (`id`, `asset_id`, `issuance_program`, `vm_version`, `raw_definition_byte`, `created_at`, `updated_at`)
157 (1,'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff','',1,'7b0a202022646563696d616c73223a20382c0a2020226465736372697074696f6e223a20224279746f6d204f6666696369616c204973737565222c0a2020226e616d65223a202242544d222c0a20202273796d626f6c223a202242544d220a7d','2018-09-13 05:10:43','2018-11-27 09:43:35');
159 /*!40000 ALTER TABLE `assets` ENABLE KEYS */;