-
Notifications
You must be signed in to change notification settings - Fork 18
/
1_schema.sql
97 lines (89 loc) · 2.61 KB
/
1_schema.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
DROP DATABASE IF EXISTS eth;
CREATE DATABASE eth;
USE eth;
CREATE TABLE blocks
(
number BIGINT UNSIGNED,
hash VARCHAR,
parent_hash VARCHAR,
nonce VARCHAR,
sha3_uncles VARCHAR,
logs_bloom VARCHAR,
transactions_root VARCHAR,
state_root VARCHAR,
receipts_root VARCHAR,
difficulty VARCHAR,
total_difficulty VARCHAR,
size BIGINT UNSIGNED,
extra_data VARCHAR,
gas_limit BIGINT UNSIGNED,
gas_used BIGINT UNSIGNED,
timestamp TIMESTAMP,
transaction_count BIGINT UNSIGNED,
base_fee_per_gas BIGINT UNSIGNED
);
CREATE TABLE transactions
(
hash VARCHAR,
nonce VARCHAR,
transaction_index BIGINT UNSIGNED,
from_address VARCHAR,
to_address VARCHAR,
value DECIMAL(36, 18),
gas BIGINT UNSIGNED,
gas_price BIGINT UNSIGNED,
method_id VARCHAR,
input VARCHAR,
max_fee_per_gas BIGINT UNSIGNED,
max_priority_fee_per_gas BIGINT UNSIGNED,
transaction_type BIGINT UNSIGNED,
block_hash VARCHAR,
block_number BIGINT UNSIGNED,
block_timestamp TIMESTAMP
);
CREATE TABLE logs
(
log_index BIGINT UNSIGNED,
transaction_hash VARCHAR,
transaction_index BIGINT UNSIGNED,
block_hash VARCHAR,
block_number BIGINT UNSIGNED,
contract_address VARCHAR,
event_address VARCHAR,
data VARCHAR,
topics VARCHAR
);
CREATE TABLE receipts
(
transaction_hash VARCHAR,
transaction_index BIGINT UNSIGNED,
block_hash VARCHAR,
block_number BIGINT UNSIGNED,
cumulative_gas_used BIGINT UNSIGNED,
gas_used BIGINT UNSIGNED,
contract_address VARCHAR,
root VARCHAR,
status BIGINT UNSIGNED,
effective_gas_price BIGINT UNSIGNED
);
CREATE TABLE token_transfers
(
token_address VARCHAR,
from_address VARCHAR,
to_address VARCHAR,
token_id VARCHAR,
value VARCHAR,
erc_standard VARCHAR,
transaction_hash VARCHAR,
log_index BIGINT UNSIGNED,
block_number BIGINT UNSIGNED
);
CREATE TABLE ens
(
name VARCHAR,
cost DECIMAL(36, 18),
expires TIMESTAMP,
owner VARCHAR,
transaction_hash VARCHAR,
block_number BIGINT UNSIGNED
);