# DB: <coin>pooldb (nexa为m2pooldb)
```
Table: <coin>_address
Struct:
+-------+--------------+------+-----+---------+----------------+
| Field | Type         | Null | Key | Default | Extra          |
+-------+--------------+------+-----+---------+----------------+
| id    | int          | NO   | UNI | NULL    | auto_increment |
| date  | datetime     | NO   |     | NULL    |                |
| addr  | varchar(128) | NO   | PRI | NULL    |                |
| alias | varchar(128) | YES  |     | NULL    |                |
| valid | tinyint(1)   | YES  |     | NULL    |                |
+-------+--------------+------+-----+---------+----------------+
Create Sql:
CREATE TABLE `<coin>_address` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `date` datetime NOT NULL,
  `addr` varchar(128) NOT NULL,
  `alias` varchar(128) DEFAULT NULL,
  `valid` tinyint(1) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `addr` (`addr`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
```

```
Table: <coin>_miners
Struct:
+--------------+---------------+------+-----+---------+----------------+
| Field        | Type          | Null | Key | Default | Extra          |
+--------------+---------------+------+-----+---------+----------------+
| id           | int           | NO   | PRI | NULL    | auto_increment |
| date         | datetime      | NO   |     | NULL    |                |
| fromip       | varchar(64)   | YES  |     | NULL    |                |
| state        | varchar(64)   | YES  |     | NULL    |                |
| online       | datetime      | YES  |     | NULL    |                |
| offline      | datetime      | YES  |     | NULL    |                |
| retry        | int           | YES  |     | NULL    |                |
| duration     | decimal(12,6) | YES  |     | NULL    |                |
| protocol     | varchar(64)   | YES  |     | NULL    |                |
| user         | varchar(128)  | YES  |     | NULL    |                |
| miner        | varchar(128)  | YES  |     | NULL    |                |
| refindex     | varchar(128)  | YES  |     | NULL    |                |
| diff         | decimal(32,6) | YES  |     | NULL    |                |
| height       | int           | YES  |     | NULL    |                |
| accepts      | decimal(32,6) | YES  |     | NULL    |                |
| rejects      | decimal(32,6) | YES  |     | NULL    |                |
| ratio        | decimal(32,6) | YES  |     | NULL    |                |
| staleds      | decimal(32,6) | YES  |     | NULL    |                |
| lows         | decimal(32,6) | YES  |     | NULL    |                |
| duplicates   | decimal(32,6) | YES  |     | NULL    |                |
| formats      | decimal(32,6) | YES  |     | NULL    |                |
| others       | decimal(32,6) | YES  |     | NULL    |                |
| is_disabled  | tinyint(1)    | YES  |     | NULL    |                |
| last_submit  | datetime      | YES  |     | NULL    |                |
| submits      | int           | YES  |     | NULL    |                |
| blocks       | int           | YES  |     | NULL    |                |
| orphans      | int           | YES  |     | NULL    |                |
| orphan_ratio | decimal(32,6) | YES  |     | NULL    |                |
+--------------+---------------+------+-----+---------+----------------+
Create Sql:
CREATE TABLE `<coin>_miners` (
  `id` INT(10) NOT NULL AUTO_INCREMENT,
  `date` DATETIME NOT NULL,
  `fromip` VARCHAR(64),
  `state` VARCHAR(64),
  `online` DATETIME,
  `offline` DATETIME,
  `retry` INT(10),
  `duration` DECIMAL(12,6),
  `protocol` VARCHAR(64),
  `user` VARCHAR(128),
  `miner` VARCHAR(128),
  `refindex` VARCHAR(128),
  `diff` DECIMAL(32,6),
  `height` INT(10),
  `accepts` DECIMAL(32,6),
  `rejects` DECIMAL(32,6),
  `ratio` DECIMAL(32,6),
  `staleds` DECIMAL(32,6),
  `lows` DECIMAL(32,6),
  `duplicates` DECIMAL(32,6),
  `formats` DECIMAL(32,6),
  `others` DECIMAL(32,6),
  `is_disabled` TINYINT(1),
  `last_submit` DATETIME,
  `submits` INT(10),
  `blocks` INT(10),
  `orphans` INT(10),
  `orphan_ratio` DECIMAL(32,6),
  PRIMARY KEY (`id`)
);
```

```
Table: <coin>_miners_stats
Struct:
+------------+---------------+------+-----+---------+----------------+
| Field      | Type          | Null | Key | Default | Extra          |
+------------+---------------+------+-----+---------+----------------+
| id         | int           | NO   | PRI | NULL    | auto_increment |
| date       | datetime      | NO   |     | NULL    |                |
| user       | varchar(128)  | YES  |     | NULL    |                |
| miner      | varchar(128)  | YES  |     | NULL    |                |
| refindex   | varchar(128)  | YES  |     | NULL    |                |
| shares5m   | decimal(32,6) | YES  |     | NULL    |                |
| shares15m  | decimal(32,6) | YES  |     | NULL    |                |
| shares30m  | decimal(32,6) | YES  |     | NULL    |                |
| shares1h   | decimal(32,6) | YES  |     | NULL    |                |
| shares3h   | decimal(32,6) | YES  |     | NULL    |                |
| shares6h   | decimal(32,6) | YES  |     | NULL    |                |
| shares12h  | decimal(32,6) | YES  |     | NULL    |                |
| shares24h  | decimal(32,6) | YES  |     | NULL    |                |
| shares48h  | decimal(32,6) | YES  |     | NULL    |                |
| rejects5m  | decimal(32,6) | YES  |     | NULL    |                |
| rejects15m | decimal(32,6) | YES  |     | NULL    |                |
| rejects30m | decimal(32,6) | YES  |     | NULL    |                |
| rejects1h  | decimal(32,6) | YES  |     | NULL    |                |
| rejects3h  | decimal(32,6) | YES  |     | NULL    |                |
| rejects6h  | decimal(32,6) | YES  |     | NULL    |                |
| rejects12h | decimal(32,6) | YES  |     | NULL    |                |
| rejects24h | decimal(32,6) | YES  |     | NULL    |                |
| rejects48h | decimal(32,6) | YES  |     | NULL    |                |
| mhs5m      | decimal(32,6) | YES  |     | NULL    |                |
| mhs15m     | decimal(32,6) | YES  |     | NULL    |                |
| mhs30m     | decimal(32,6) | YES  |     | NULL    |                |
| mhs1h      | decimal(32,6) | YES  |     | NULL    |                |
| mhs3h      | decimal(32,6) | YES  |     | NULL    |                |
| mhs6h      | decimal(32,6) | YES  |     | NULL    |                |
| mhs12h     | decimal(32,6) | YES  |     | NULL    |                |
| mhs24h     | decimal(32,6) | YES  |     | NULL    |                |
| mhs48h     | decimal(32,6) | YES  |     | NULL    |                |
| ratio5m    | decimal(32,6) | YES  |     | NULL    |                |
| ratio15m   | decimal(32,6) | YES  |     | NULL    |                |
| ratio30m   | decimal(32,6) | YES  |     | NULL    |                |
| ratio1h    | decimal(32,6) | YES  |     | NULL    |                |
| ratio3h    | decimal(32,6) | YES  |     | NULL    |                |
| ratio6h    | decimal(32,6) | YES  |     | NULL    |                |
| ratio12h   | decimal(32,6) | YES  |     | NULL    |                |
| ratio24h   | decimal(32,6) | YES  |     | NULL    |                |
| ratio48h   | decimal(32,6) | YES  |     | NULL    |                |
+------------+---------------+------+-----+---------+----------------+
Create Sql:
CREATE TABLE `<coin>_miners_stats` (
  `id` INT(10) NOT NULL AUTO_INCREMENT,
  `date` DATETIME NOT NULL,
  `user` VARCHAR(128),
  `miner` VARCHAR(128),
  `refindex` VARCHAR(128),
  `shares5m` DECIMAL(32,6),
  `shares15m` DECIMAL(32,6),
  `shares30m` DECIMAL(32,6),
  `shares1h` DECIMAL(32,6),
  `shares3h` DECIMAL(32,6),
  `shares6h` DECIMAL(32,6),
  `shares12h` DECIMAL(32,6),
  `shares24h` DECIMAL(32,6),
  `shares48h` DECIMAL(32,6),
  `rejects5m` DECIMAL(32,6),
  `rejects15m` DECIMAL(32,6),
  `rejects30m` DECIMAL(32,6),
  `rejects1h` DECIMAL(32,6),
  `rejects3h` DECIMAL(32,6),
  `rejects6h` DECIMAL(32,6),
  `rejects12h` DECIMAL(32,6),
  `rejects24h` DECIMAL(32,6),
  `rejects48h` DECIMAL(32,6),
  `mhs5m` DECIMAL(32,6),
  `mhs15m` DECIMAL(32,6),
  `mhs30m` DECIMAL(32,6),
  `mhs1h` DECIMAL(32,6),
  `mhs3h` DECIMAL(32,6),
  `mhs6h` DECIMAL(32,6),
  `mhs12h` DECIMAL(32,6),
  `mhs24h` DECIMAL(32,6),
  `mhs48h` DECIMAL(32,6),
  `ratio5m` DECIMAL(32,6),
  `ratio15m` DECIMAL(32,6),
  `ratio30m` DECIMAL(32,6),
  `ratio1h` DECIMAL(32,6),
  `ratio3h` DECIMAL(32,6),
  `ratio6h` DECIMAL(32,6),
  `ratio12h` DECIMAL(32,6),
  `ratio24h` DECIMAL(32,6),
  `ratio48h` DECIMAL(32,6),
  PRIMARY KEY (`id`)
);
```

```
Table: <coin>_pool_blkstats
Struct:
+------------+---------------+------+-----+---------+----------------+
| Field      | Type          | Null | Key | Default | Extra          |
+------------+---------------+------+-----+---------+----------------+
| id         | int           | NO   | PRI | NULL    | auto_increment |
| date       | datetime      | NO   |     | NULL    |                |
| height     | int           | YES  |     | NULL    |                |
| hash       | varchar(128)  | YES  |     | NULL    |                |
| pow        | varchar(128)  | YES  |     | NULL    |                |
| net_target | varchar(128)  | YES  |     | NULL    |                |
| submit     | varchar(64)   | YES  |     | NULL    |                |
| success    | tinyint(1)    | YES  |     | NULL    |                |
| accepts    | decimal(32,6) | YES  |     | NULL    |                |
| rejects    | decimal(32,6) | YES  |     | NULL    |                |
| reward     | decimal(32,6) | YES  |     | NULL    |                |
| fee        | decimal(32,6) | YES  |     | NULL    |                |
| nonce      | varchar(64)   | YES  |     | NULL    |                |
| subidx     | int           | YES  |     | NULL    |                |
+------------+---------------+------+-----+---------+----------------+
Create Sql:
CREATE TABLE IF NOT EXISTS `<coin>_pool_blkstats` (
  `id` INT(10) NOT NULL AUTO_INCREMENT,
  `date` DATETIME NOT NULL,
  `height` INT(10),
  `hash` VARCHAR(128),
  `pow` VARCHAR(128),
  `net_target` VARCHAR(128),
  `submit` VARCHAR(64),
  `success` TINYINT(1),
  `accepts` DECIMAL(32,6),
  `rejects` DECIMAL(32,6),
  `reward` DECIMAL(32,6),
  `fee` DECIMAL(32,6),
  `nonce` VARCHAR(64),
  `subidx` INT(10),
  PRIMARY KEY (`id`)
);
```

# DB: <coin>sharesdb (nexa为m2sharesdb)
```
Table: <coin>_blk_detail
Struct:
+------------+---------------+------+-----+---------+----------------+
| Field      | Type          | Null | Key | Default | Extra          |
+------------+---------------+------+-----+---------+----------------+
| id         | int           | NO   | PRI | NULL    | auto_increment |
| date       | datetime      | NO   |     | NULL    |                |
| height     | int           | YES  |     | NULL    |                |
| hash       | varchar(128)  | YES  |     | NULL    |                |
| user       | varchar(128)  | YES  |     | NULL    |                |
| miner      | varchar(128)  | YES  |     | NULL    |                |
| refindex   | varchar(128)  | YES  |     | NULL    |                |
| success    | tinyint(1)    | YES  |     | NULL    |                |
| miner_diff | decimal(32,6) | YES  |     | NULL    |                |
| pool_diff  | decimal(32,6) | YES  |     | NULL    |                |
| nonce      | varchar(64)   | YES  |     | NULL    |                |
| subidx     | int           | YES  |     | NULL    |                |
+------------+---------------+------+-----+---------+----------------+
Create Sql:
CREATE TABLE `<coin>_blk_detail` (
  `id` INT(10) NOT NULL AUTO_INCREMENT,
  `date` DATETIME NOT NULL,
  `height` INT(10),
  `hash` VARCHAR(128),
  `user` VARCHAR(128),
  `miner` VARCHAR(128),
  `refindex` VARCHAR(128),
  `success` TINYINT(1),
  `miner_diff` DECIMAL(32,6),
  `pool_diff` DECIMAL(32,6),
  `nonce` VARCHAR(64),
  `subidx` INT(10),
  PRIMARY KEY (`id`)
);
```

```
Table: <coin>_blk_new
Struct:
+---------+--------------+------+-----+---------+----------------+
| Field   | Type         | Null | Key | Default | Extra          |
+---------+--------------+------+-----+---------+----------------+
| id      | int          | NO   | PRI | NULL    | auto_increment |
| date    | datetime     | NO   |     | NULL    |                |
| height  | int          | YES  |     | NULL    |                |
| hash    | varchar(128) | YES  |     | NULL    |                |
| success | tinyint(1)   | YES  |     | NULL    |                |
| nonce   | varchar(64)  | YES  |     | NULL    |                |
| subidx  | int          | YES  |     | NULL    |                |
+---------+--------------+------+-----+---------+----------------+
Create Sql:
CREATE TABLE `<coin>_blk_new` (
  `id` INT(10) NOT NULL AUTO_INCREMENT,
  `date` DATETIME NOT NULL,
  `height` INT(10),
  `hash` VARCHAR(128),
  `success` TINYINT(1),
  `nonce` VARCHAR(64),
  `subidx` INT(10),
  PRIMARY KEY (`id`)
);
```

```
Table: <coin>_blk_height_detail
Struct:
+-------+----------+------+-----+---------+----------------+
| Field | Type     | Null | Key | Default | Extra          |
+-------+----------+------+-----+---------+----------------+
| id    | int      | NO   | PRI | NULL    | auto_increment |
| date  | datetime | NO   |     | NULL    |                |
| from  | int      | YES  |     | NULL    |                |
| to    | int      | YES  |     | NULL    |                |
+-------+----------+------+-----+---------+----------------+
Create Sql:
CREATE TABLE `<coin>_blk_height_detail` (
  `id` INT(10) NOT NULL AUTO_INCREMENT,
  `date` DATETIME NOT NULL,
  `from` INT(10),
  `to` INT(10),
  PRIMARY KEY (`id`)
);
```
