2017-10-25 21:42:59 +00:00
|
|
|
--
|
|
|
|
-- PostgreSQL database dump
|
|
|
|
--
|
|
|
|
|
2017-12-07 15:58:06 +00:00
|
|
|
-- Dumped from database version 10.1
|
|
|
|
-- Dumped by pg_dump version 10.1
|
2017-10-25 21:42:59 +00:00
|
|
|
|
|
|
|
SET statement_timeout = 0;
|
|
|
|
SET lock_timeout = 0;
|
|
|
|
SET idle_in_transaction_session_timeout = 0;
|
|
|
|
SET client_encoding = 'UTF8';
|
|
|
|
SET standard_conforming_strings = on;
|
|
|
|
SET check_function_bodies = false;
|
|
|
|
SET client_min_messages = warning;
|
|
|
|
SET row_security = off;
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
|
|
|
|
|
|
|
|
|
|
|
|
SET search_path = public, pg_catalog;
|
|
|
|
|
|
|
|
SET default_tablespace = '';
|
|
|
|
|
|
|
|
SET default_with_oids = false;
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: blocks; Type: TABLE; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE blocks (
|
2017-10-25 22:24:38 +00:00
|
|
|
block_number bigint,
|
|
|
|
block_gaslimit double precision,
|
|
|
|
block_gasused double precision,
|
2017-10-30 19:39:00 +00:00
|
|
|
block_time double precision,
|
2017-11-02 14:36:53 +00:00
|
|
|
id integer NOT NULL,
|
|
|
|
block_difficulty bigint,
|
|
|
|
block_hash character varying(66),
|
|
|
|
block_nonce character varying(20),
|
|
|
|
block_parenthash character varying(66),
|
|
|
|
block_size bigint,
|
2017-12-07 19:32:16 +00:00
|
|
|
uncle_hash character varying(66),
|
2017-12-20 20:06:22 +00:00
|
|
|
node_id integer NOT NULL,
|
|
|
|
is_final boolean
|
2017-10-25 21:42:59 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
2017-10-30 19:39:00 +00:00
|
|
|
--
|
|
|
|
-- Name: blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE SEQUENCE blocks_id_seq
|
|
|
|
START WITH 1
|
|
|
|
INCREMENT BY 1
|
|
|
|
NO MINVALUE
|
|
|
|
NO MAXVALUE
|
|
|
|
CACHE 1;
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER SEQUENCE blocks_id_seq OWNED BY blocks.id;
|
|
|
|
|
|
|
|
|
2017-12-12 21:55:26 +00:00
|
|
|
--
|
|
|
|
-- Name: logs; Type: TABLE; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE logs (
|
|
|
|
id integer NOT NULL,
|
|
|
|
block_number bigint,
|
|
|
|
address character varying(66),
|
|
|
|
tx_hash character varying(66),
|
|
|
|
index bigint,
|
|
|
|
topic0 character varying(66),
|
|
|
|
topic1 character varying(66),
|
|
|
|
topic2 character varying(66),
|
|
|
|
topic3 character varying(66),
|
|
|
|
data text
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: logs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE SEQUENCE logs_id_seq
|
|
|
|
START WITH 1
|
|
|
|
INCREMENT BY 1
|
|
|
|
NO MINVALUE
|
|
|
|
NO MAXVALUE
|
|
|
|
CACHE 1;
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: logs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER SEQUENCE logs_id_seq OWNED BY logs.id;
|
|
|
|
|
|
|
|
|
2017-12-07 19:32:16 +00:00
|
|
|
--
|
|
|
|
-- Name: nodes; Type: TABLE; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE nodes (
|
|
|
|
id integer NOT NULL,
|
|
|
|
genesis_block character varying(66),
|
|
|
|
network_id numeric
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE SEQUENCE nodes_id_seq
|
|
|
|
START WITH 1
|
|
|
|
INCREMENT BY 1
|
|
|
|
NO MINVALUE
|
|
|
|
NO MAXVALUE
|
|
|
|
CACHE 1;
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER SEQUENCE nodes_id_seq OWNED BY nodes.id;
|
|
|
|
|
|
|
|
|
2017-10-25 21:42:59 +00:00
|
|
|
--
|
|
|
|
-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE schema_migrations (
|
|
|
|
version bigint NOT NULL,
|
|
|
|
dirty boolean NOT NULL
|
|
|
|
);
|
|
|
|
|
|
|
|
|
2017-10-31 13:58:04 +00:00
|
|
|
--
|
|
|
|
-- Name: transactions; Type: TABLE; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE transactions (
|
|
|
|
id integer NOT NULL,
|
|
|
|
tx_hash character varying(66),
|
|
|
|
tx_nonce numeric,
|
|
|
|
tx_to character varying(66),
|
|
|
|
tx_gaslimit numeric,
|
|
|
|
tx_gasprice numeric,
|
2017-10-31 15:36:37 +00:00
|
|
|
tx_value numeric,
|
2017-11-08 20:55:35 +00:00
|
|
|
block_id integer NOT NULL,
|
|
|
|
tx_from character varying(66)
|
2017-10-31 13:58:04 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: transactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE SEQUENCE transactions_id_seq
|
|
|
|
START WITH 1
|
|
|
|
INCREMENT BY 1
|
|
|
|
NO MINVALUE
|
|
|
|
NO MAXVALUE
|
|
|
|
CACHE 1;
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: transactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER SEQUENCE transactions_id_seq OWNED BY transactions.id;
|
|
|
|
|
|
|
|
|
2017-10-30 19:39:00 +00:00
|
|
|
--
|
2017-11-13 16:11:27 +00:00
|
|
|
-- Name: watched_contracts; Type: TABLE; Schema: public; Owner: -
|
2017-10-30 19:39:00 +00:00
|
|
|
--
|
|
|
|
|
2017-11-13 16:11:27 +00:00
|
|
|
CREATE TABLE watched_contracts (
|
|
|
|
contract_id integer NOT NULL,
|
2017-12-04 20:13:15 +00:00
|
|
|
contract_hash character varying(66),
|
|
|
|
contract_abi json
|
2017-11-13 16:11:27 +00:00
|
|
|
);
|
2017-10-30 19:39:00 +00:00
|
|
|
|
|
|
|
|
2017-11-09 19:59:12 +00:00
|
|
|
--
|
2017-11-13 16:11:27 +00:00
|
|
|
-- Name: watched_contracts_contract_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
2017-11-09 19:59:12 +00:00
|
|
|
--
|
|
|
|
|
2017-11-13 16:11:27 +00:00
|
|
|
CREATE SEQUENCE watched_contracts_contract_id_seq
|
|
|
|
START WITH 1
|
|
|
|
INCREMENT BY 1
|
|
|
|
NO MINVALUE
|
|
|
|
NO MAXVALUE
|
|
|
|
CACHE 1;
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: watched_contracts_contract_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER SEQUENCE watched_contracts_contract_id_seq OWNED BY watched_contracts.contract_id;
|
|
|
|
|
|
|
|
|
2017-10-30 19:39:00 +00:00
|
|
|
--
|
|
|
|
-- Name: blocks id; Type: DEFAULT; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER TABLE ONLY blocks ALTER COLUMN id SET DEFAULT nextval('blocks_id_seq'::regclass);
|
|
|
|
|
|
|
|
|
2017-12-12 21:55:26 +00:00
|
|
|
--
|
|
|
|
-- Name: logs id; Type: DEFAULT; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER TABLE ONLY logs ALTER COLUMN id SET DEFAULT nextval('logs_id_seq'::regclass);
|
|
|
|
|
|
|
|
|
2017-12-07 19:32:16 +00:00
|
|
|
--
|
|
|
|
-- Name: nodes id; Type: DEFAULT; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER TABLE ONLY nodes ALTER COLUMN id SET DEFAULT nextval('nodes_id_seq'::regclass);
|
|
|
|
|
|
|
|
|
2017-10-31 13:58:04 +00:00
|
|
|
--
|
|
|
|
-- Name: transactions id; Type: DEFAULT; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER TABLE ONLY transactions ALTER COLUMN id SET DEFAULT nextval('transactions_id_seq'::regclass);
|
|
|
|
|
|
|
|
|
2017-10-30 19:39:00 +00:00
|
|
|
--
|
2017-11-13 16:11:27 +00:00
|
|
|
-- Name: watched_contracts contract_id; Type: DEFAULT; Schema: public; Owner: -
|
2017-10-30 19:39:00 +00:00
|
|
|
--
|
|
|
|
|
2017-11-13 16:11:27 +00:00
|
|
|
ALTER TABLE ONLY watched_contracts ALTER COLUMN contract_id SET DEFAULT nextval('watched_contracts_contract_id_seq'::regclass);
|
2017-10-30 19:39:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: blocks blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER TABLE ONLY blocks
|
|
|
|
ADD CONSTRAINT blocks_pkey PRIMARY KEY (id);
|
|
|
|
|
|
|
|
|
2017-12-07 15:58:06 +00:00
|
|
|
--
|
|
|
|
-- Name: watched_contracts contract_hash_uc; Type: CONSTRAINT; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER TABLE ONLY watched_contracts
|
|
|
|
ADD CONSTRAINT contract_hash_uc UNIQUE (contract_hash);
|
|
|
|
|
|
|
|
|
2017-12-12 21:55:26 +00:00
|
|
|
--
|
|
|
|
-- Name: logs log_uc; Type: CONSTRAINT; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER TABLE ONLY logs
|
|
|
|
ADD CONSTRAINT log_uc UNIQUE (block_number, index);
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: logs logs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER TABLE ONLY logs
|
|
|
|
ADD CONSTRAINT logs_pkey PRIMARY KEY (id);
|
|
|
|
|
|
|
|
|
2017-12-20 20:06:22 +00:00
|
|
|
--
|
|
|
|
-- Name: blocks node_id_block_number_uc; Type: CONSTRAINT; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER TABLE ONLY blocks
|
|
|
|
ADD CONSTRAINT node_id_block_number_uc UNIQUE (block_number, node_id);
|
|
|
|
|
|
|
|
|
2017-12-07 19:32:16 +00:00
|
|
|
--
|
|
|
|
-- Name: nodes node_uc; Type: CONSTRAINT; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER TABLE ONLY nodes
|
|
|
|
ADD CONSTRAINT node_uc UNIQUE (genesis_block, network_id);
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER TABLE ONLY nodes
|
|
|
|
ADD CONSTRAINT nodes_pkey PRIMARY KEY (id);
|
|
|
|
|
|
|
|
|
2017-10-25 21:42:59 +00:00
|
|
|
--
|
|
|
|
-- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER TABLE ONLY schema_migrations
|
|
|
|
ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
|
|
|
|
|
|
|
|
|
2017-10-31 13:58:04 +00:00
|
|
|
--
|
|
|
|
-- Name: transactions transactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER TABLE ONLY transactions
|
|
|
|
ADD CONSTRAINT transactions_pkey PRIMARY KEY (id);
|
|
|
|
|
|
|
|
|
2017-11-13 16:11:27 +00:00
|
|
|
--
|
|
|
|
-- Name: watched_contracts watched_contracts_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER TABLE ONLY watched_contracts
|
|
|
|
ADD CONSTRAINT watched_contracts_pkey PRIMARY KEY (contract_id);
|
|
|
|
|
|
|
|
|
2017-12-20 20:06:22 +00:00
|
|
|
--
|
|
|
|
-- Name: block_id_index; Type: INDEX; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE INDEX block_id_index ON transactions USING btree (block_id);
|
|
|
|
|
|
|
|
|
2017-11-01 13:52:04 +00:00
|
|
|
--
|
|
|
|
-- Name: block_number_index; Type: INDEX; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE INDEX block_number_index ON blocks USING btree (block_number);
|
|
|
|
|
|
|
|
|
2017-12-20 20:06:22 +00:00
|
|
|
--
|
|
|
|
-- Name: node_id_index; Type: INDEX; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE INDEX node_id_index ON blocks USING btree (node_id);
|
|
|
|
|
|
|
|
|
2017-12-20 22:58:37 +00:00
|
|
|
--
|
|
|
|
-- Name: tx_from_index; Type: INDEX; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE INDEX tx_from_index ON transactions USING btree (tx_from);
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Name: tx_to_index; Type: INDEX; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE INDEX tx_to_index ON transactions USING btree (tx_to);
|
|
|
|
|
|
|
|
|
2017-10-31 15:36:37 +00:00
|
|
|
--
|
2017-12-19 20:14:41 +00:00
|
|
|
-- Name: transactions blocks_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2017-10-31 15:36:37 +00:00
|
|
|
--
|
|
|
|
|
|
|
|
ALTER TABLE ONLY transactions
|
2017-12-19 20:14:41 +00:00
|
|
|
ADD CONSTRAINT blocks_fk FOREIGN KEY (block_id) REFERENCES blocks(id) ON DELETE CASCADE;
|
2017-10-31 15:36:37 +00:00
|
|
|
|
|
|
|
|
2017-12-07 19:32:16 +00:00
|
|
|
--
|
|
|
|
-- Name: blocks node_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
|
|
--
|
|
|
|
|
|
|
|
ALTER TABLE ONLY blocks
|
2017-12-19 20:14:41 +00:00
|
|
|
ADD CONSTRAINT node_fk FOREIGN KEY (node_id) REFERENCES nodes(id) ON DELETE CASCADE;
|
2017-12-07 19:32:16 +00:00
|
|
|
|
|
|
|
|
2017-10-25 21:42:59 +00:00
|
|
|
--
|
|
|
|
-- PostgreSQL database dump complete
|
|
|
|
--
|
2017-10-31 15:36:37 +00:00
|
|
|
|