테이블-create-for-syncscan copy.sql 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. drop table if exists eth_block;
  2. CREATE TABLE `eth_block` (
  3. `id` int(11) NOT NULL AUTO_INCREMENT,
  4. `created_on` bigint(20) DEFAULT 0,
  5. `block_no` int(11) DEFAULT 0,
  6. `block_hash` varchar(68) DEFAULT NULL,
  7. `txn_cnt` int(11) DEFAULT 0 COMMENT '트랜잭션 갯수',
  8. `uncle_cnt` int(11) DEFAULT 0 COMMENT '엉클블록 갯수',
  9. `miner` varchar(50) DEFAULT NULL COMMENT '채굴 Account Address',
  10. `gas_used` decimal(11,0) DEFAULT NULL COMMENT '개스 사용여부 0:아님, 1.:사용',
  11. `gas_limit` decimal(11,0) DEFAULT NULL,
  12. `trfee_sum` decimal(32,0) DEFAULT NULL COMMENT '트랜잭션 fee 합계',
  13. `reward` decimal(32,0) DEFAULT NULL COMMENT '블록 보상액',
  14. `uncle_reward` decimal(32,0) DEFAULT 0 COMMENT '엉클블록 보상액',
  15. `status` smallint(6) DEFAULT 0 COMMENT '비정상:0, 정상:1',
  16. PRIMARY KEY (`id`),
  17. UNIQUE KEY `idx_block_no` (`block_no`,`block_hash`),
  18. KEY `idx_block_hash` (`block_hash`)
  19. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
  20. drop table if exists eth_cntr_member;
  21. CREATE TABLE `eth_cntr_member` (
  22. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  23. `created_on` bigint(20) DEFAULT NULL,
  24. `updated_on` bigint(20) DEFAULT NULL,
  25. `token_name` varchar(128) DEFAULT NULL,
  26. `cntr_addr` varchar(64) DEFAULT NULL,
  27. `member_id` int(11) NOT NULL,
  28. `status` char(16) NOT NULL DEFAULT '0' COMMENT '0:미정, 1:인증',
  29. `ip` varchar(16) DEFAULT NULL,
  30. PRIMARY KEY (`id`)
  31. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
  32. drop table if exists eth_circul_sum;
  33. CREATE TABLE `eth_circul_sum` (
  34. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  35. `created_on` bigint(20) NOT NULL COMMENT '해당일-Unixtime',
  36. `sum_date` char(8) DEFAULT '' COMMENT '집계일자:sum_date+erc_type+cntr_addr->uniqueKey',
  37. `erc_type` varchar(10) NOT NULL DEFAULT 0 COMMENT 'main, erc20, erc721, erc1155',
  38. `cntr_addr` varchar(64) NOT NULL DEFAULT '' COMMENT 'main 또는 컨트렉트 주소',
  39. `daily_circul_sum` decimal(34,0) NOT NULL DEFAULT 0 COMMENT '일유통량',
  40. `add_block_cnt` bigint(20) DEFAULT 0 COMMENT '추가된 블록수',
  41. `reward_sum` decimal(23,7) DEFAULT 0.0000000 COMMENT '보상합계',
  42. `acc_reward_sum` decimal(23,7) DEFAULT 0.0000000 COMMENT '계정별 보상합계',
  43. `txn_cnt` int(11) DEFAULT 0 COMMENT '트랜잭션 갯수',
  44. `txn_fail_cnt` int(11) DEFAULT 0 COMMENT '실패한트랜잭션 갯수',
  45. PRIMARY KEY (`id`)
  46. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
  47. drop table if exists eth_contract;
  48. CREATE TABLE `eth_contract` (
  49. `id` int(11) NOT NULL AUTO_INCREMENT,
  50. `created_on` bigint(20) DEFAULT 0,
  51. `txn_hash` varchar(66) DEFAULT NULL,
  52. `block_no` bigint(11) DEFAULT NULL,
  53. `cntr_addr` varchar(64) DEFAULT NULL COMMENT 'main or 컨트랙트 주소',
  54. `creator_addr` varchar(64) DEFAULT NULL,
  55. `balance` decimal(16,0) DEFAULT 0,
  56. `txn_cnt` int(11) DEFAULT 0,
  57. `order_by` tinyint(4) NOT NULL DEFAULT 0 COMMENT '리스트 순서',
  58. PRIMARY KEY (`id`),
  59. UNIQUE KEY `idx_tx_hash` (`txn_hash`),
  60. UNIQUE KEY `idx_contract_addr` (`cntr_addr`)
  61. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
  62. drop table if exists eth_contract_abi;
  63. CREATE TABLE `eth_contract_abi` (
  64. `id` int(11) NOT NULL AUTO_INCREMENT,
  65. `created_on` bigint(20) DEFAULT 0,
  66. `cntr_addr` varchar(64) DEFAULT NULL COMMENT '컨트랙트 주소',
  67. `cntr_id` int(11) NOT NULL,
  68. `member_id` int(11) DEFAULT NULL,
  69. `cntr_name` varchar(64) NOT NULL,
  70. `compiler` varchar(64) DEFAULT NULL,
  71. `version` varchar(64) DEFAULT NULL,
  72. `veried` varchar(64) DEFAULT NULL,
  73. `license` varchar(64) DEFAULT NULL COMMENT '소유자 입력',
  74. `abi_code` mediumtext DEFAULT NULL COMMENT '사용abi 코드 입력',
  75. `create_code` mediumtext NOT NULL COMMENT '사용코드 입력',
  76. `ip` varchar(20) DEFAULT NULL,
  77. PRIMARY KEY (`id`)
  78. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
  79. drop table if exists eth_contract_sol;
  80. CREATE TABLE `eth_contract_sol` (
  81. `id` int(11) NOT NULL AUTO_INCREMENT,
  82. `created_on` bigint(20) DEFAULT 0,
  83. `cntr_addr` varchar(64) DEFAULT NULL,
  84. `cntr_id` int(11) NOT NULL,
  85. `member_id` int(11) DEFAULT NULL,
  86. `file_name` varchar(256) DEFAULT NULL,
  87. `sol_code` mediumtext DEFAULT NULL COMMENT '솔리디티 코드',
  88. `ip` varchar(20) DEFAULT NULL,
  89. PRIMARY KEY (`id`)
  90. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
  91. drop table if exists eth_last_sync;
  92. CREATE TABLE `eth_last_sync` (
  93. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  94. `created_on` bigint(11) NOT NULL,
  95. `updated_on` bigint(11) NOT NULL,
  96. `sync_type` varchar(32) NOT NULL,
  97. `last_no` varchar(32) NOT NULL DEFAULT '1' COMMENT '마지막 싱크블록 번호를 넣음',
  98. `sync_range` varchar(64) NOT NULL,
  99. `sync_cnt` int(11) NOT NULL,
  100. PRIMARY KEY (`id`)
  101. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
  102. drop table if exists eth_token;
  103. CREATE TABLE `eth_token` (
  104. `id` int(11) NOT NULL AUTO_INCREMENT,
  105. `created_on` bigint(20) DEFAULT 0,
  106. `update_on` bigint(20) NOT NULL DEFAULT 0,
  107. `cntr_addr` varchar(64) DEFAULT NULL,
  108. `token_name` varchar(20) DEFAULT NULL,
  109. `wei_decimals` smallint(10) DEFAULT NULL COMMENT 'wei단위 적용 소숫점',
  110. `curr_bal_qty` decimal(32,0) DEFAULT NULL COMMENT '현재 잔량',
  111. `symbol` varchar(21) DEFAULT '' COMMENT '토큰 심볼',
  112. `total_circul_qty` decimal(30,0) NOT NULL DEFAULT 0 COMMENT '총공급량',
  113. PRIMARY KEY (`id`),
  114. UNIQUE KEY `idx_cntr_addr` (`cntr_addr`)
  115. ) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
  116. drop table if exists eth_token_add;
  117. CREATE TABLE `eth_token_add` (
  118. `id` int(11) NOT NULL AUTO_INCREMENT,
  119. `created_on` bigint(20) DEFAULT 0,
  120. `updated_on` bigint(20) DEFAULT 0,
  121. `cntr_addr` varchar(64) DEFAULT NULL,
  122. `icon_image` varchar(500) DEFAULT NULL,
  123. `unit_point` tinyint(4) NOT NULL DEFAULT 0,
  124. `decimal_point` tinyint(4) NOT NULL DEFAULT 0,
  125. `fee_point` tinyint(4) NOT NULL DEFAULT 0,
  126. `token_desc` tinytext DEFAULT NULL,
  127. `site_url` varchar(256) DEFAULT NULL,
  128. `sns_url` varchar(256) DEFAULT NULL,
  129. `token_tracker` varchar(128) DEFAULT NULL,
  130. `ip` varchar(20) DEFAULT NULL,
  131. PRIMARY KEY (`id`)
  132. ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
  133. drop table if exists eth_token_holder;
  134. CREATE TABLE `eth_token_holder` (
  135. `id` int(11) NOT NULL AUTO_INCREMENT,
  136. `created_on` bigint(20) DEFAULT 0,
  137. `cntr_addr` varchar(66) DEFAULT NULL,
  138. `holder_addr` varchar(66) DEFAULT NULL,
  139. `total_sum` decimal(30,0) DEFAULT NULL,
  140. `last_sum` decimal(30,0) DEFAULT 0,
  141. PRIMARY KEY (`id`),
  142. UNIQUE KEY `idx_token_holder` (`cntr_addr`,`holder_addr`)
  143. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
  144. drop table if exists eth_trans_inter;
  145. CREATE TABLE `eth_trans_inter` (
  146. `id` int(11) NOT NULL AUTO_INCREMENT,
  147. `created_on` bigint(20) DEFAULT 0,
  148. `block_no` int(11) DEFAULT NULL,
  149. `block_hash` varchar(68) DEFAULT NULL,
  150. `parent_txn_hash` varchar(66) DEFAULT NULL,
  151. `cntr_addr` varchar(66) DEFAULT NULL,
  152. `txn_hash` varchar(66) DEFAULT NULL,
  153. `from_addr` varchar(66) DEFAULT NULL,
  154. `to_addr` varchar(66) DEFAULT NULL,
  155. `txn_type` varchar(50) DEFAULT NULL,
  156. `value` decimal(32,0) DEFAULT 0,
  157. `gas_used` decimal(32,0) DEFAULT 0,
  158. `gas` decimal(32,0) DEFAULT 0,
  159. `input` blob DEFAULT NULL,
  160. `err` varchar(500) DEFAULT '',
  161. `status` int(11) DEFAULT 0,
  162. PRIMARY KEY (`id`),
  163. UNIQUE KEY `idx_block_no` (`block_no`,`block_hash`,`parent_txn_hash`),
  164. KEY `idx_hash` (`txn_hash`)
  165. ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
  166. drop table if exists eth_trans_inter;
  167. CREATE TABLE `eth_tranxn` (
  168. `id` int(11) NOT NULL AUTO_INCREMENT,
  169. `created_on` bigint(20) DEFAULT 0,
  170. `block_no` int(11) DEFAULT NULL,
  171. `block_hash` varchar(66) DEFAULT NULL,
  172. `txn_hash` varchar(66) DEFAULT NULL,
  173. `cntr_addr` varchar(66) DEFAULT NULL,
  174. `from_addr` varchar(66) DEFAULT NULL,
  175. `to_addr` varchar(66) DEFAULT NULL,
  176. `txn_type` varchar(50) DEFAULT NULL,
  177. `txn_symbol` varchar(120) NOT NULL DEFAULT '',
  178. `value` decimal(32,0) DEFAULT 0,
  179. `input_value` decimal(32,0) NOT NULL DEFAULT 0,
  180. `txn_fee` decimal(16,8) DEFAULT 0.00000000,
  181. `input` blob DEFAULT NULL,
  182. `gas_used` decimal(11,0) NOT NULL DEFAULT 0,
  183. `status` int(11) NOT NULL DEFAULT -1,
  184. PRIMARY KEY (`id`),
  185. UNIQUE KEY `idx_hash` (`txn_hash`),
  186. KEY `cntr_addr` (`cntr_addr`)
  187. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
  188. drop table if exists eth_txn_transfer;
  189. CREATE TABLE `eth_txn_transfer` (
  190. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  191. `block_no` bigint(20) DEFAULT 0,
  192. `block_hash` varchar(66) DEFAULT NULL,
  193. `txn_hash` varchar(66) DEFAULT '',
  194. `tx_index` int(11) DEFAULT 0,
  195. `index` int(11) DEFAULT 0,
  196. `from_addr` varchar(66) DEFAULT '',
  197. `to_addr` varchar(66) DEFAULT '',
  198. `input_value` decimal(32,0) DEFAULT 0,
  199. `topic` blob DEFAULT NULL,
  200. `removed` smallint(6) DEFAULT 0,
  201. `cntr_addr` varchar(64) DEFAULT NULL,
  202. `log_cntr_addr` varchar(64) DEFAULT NULL,
  203. PRIMARY KEY (`id`),
  204. UNIQUE KEY `txn_idx` (`txn_hash`,`tx_index`,`index`)
  205. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
  206. drop table if exists eth_uncle_block;
  207. CREATE TABLE `eth_uncle_block` (
  208. `id` int(11) NOT NULL AUTO_INCREMENT,
  209. `created_on` bigint(20) DEFAULT 0,
  210. `block_no` int(11) DEFAULT 0,
  211. `block_hash` varchar(68) DEFAULT NULL,
  212. `uncle_no` int(11) DEFAULT 0,
  213. `uncle_hash` varchar(68) DEFAULT NULL,
  214. `uncle_position` int(11) DEFAULT 0,
  215. `miner` varchar(50) DEFAULT NULL,
  216. `gas_used` decimal(11,0) DEFAULT NULL,
  217. `gas_limit` decimal(11,0) DEFAULT NULL,
  218. `uncle_reward` decimal(32,0) DEFAULT 0,
  219. PRIMARY KEY (`id`),
  220. UNIQUE KEY `idx_uncle_no` (`uncle_no`,`uncle_hash`),
  221. KEY `idx_block_no` (`block_no`,`block_hash`)
  222. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;