Skip to content
Snippets Groups Projects
Commit 92f734a0 authored by Robert Martin-Legene's avatar Robert Martin-Legene
Browse files

Current status commit

parent 6d97db99
No related branches found
No related tags found
No related merge requests found
......@@ -37,7 +37,7 @@ services:
driver: "json-file"
options:
max-file: "5"
max-size: "10m"
max-size: "50m"
geth:
#image: bfaar/nodo
......@@ -46,6 +46,7 @@ services:
ports:
- 8545:8545
- 8546:8546
- 30303:30303
volumes:
- geth:/home/bfa/bfa
logging:
......@@ -55,11 +56,11 @@ services:
max-size: "10m"
stop_grace_period: 300s
# adminer:
# image: adminer
# restart: always
# ports:
# - 8080:8080
adminer:
image: adminer
restart: always
ports:
- 8080:8080
volumes:
pgdata:
......
......@@ -12,17 +12,12 @@ CREATE SEQUENCE account_id_seq
START 1000
CACHE 1;
CREATE TABLE "public"."account" (
"id" bigint
DEFAULT nextval('account_id_seq')
NOT NULL,
"address" character(42)
NOT NULL,
"shortname" character varying(16),
"name" character varying(255),
CONSTRAINT "account_id"
PRIMARY KEY ("id"),
CONSTRAINT "account_hash"
UNIQUE ("address")
"id" bigint NOT NULL DEFAULT nextval('account_id_seq'),
"address" character(42) NOT NULL,
"shortname" character varying(16),
"name" character varying(255),
CONSTRAINT "account_id" PRIMARY KEY ("id"),
CONSTRAINT "account_hash" UNIQUE ("address")
) WITH (oids = false);
CREATE SEQUENCE blockhash_id_seq
......@@ -32,116 +27,68 @@ CREATE SEQUENCE blockhash_id_seq
START 1000000
CACHE 1;
CREATE TABLE "public"."blockhash" (
"id" bigint
DEFAULT nextval('blockhash_id_seq')
NOT NULL,
"hash" character(66)
NOT NULL,
CONSTRAINT "blockhash_id"
PRIMARY KEY ("id"),
CONSTRAINT "blockhash_hash"
UNIQUE ("hash")
"id" bigint NOT NULL DEFAULT nextval('blockhash_id_seq'),
"hash" character(66) NOT NULL,
CONSTRAINT "blockhash_id" PRIMARY KEY ("id"),
CONSTRAINT "blockhash_hash" UNIQUE ("hash")
) WITH (oids = false);
CREATE TABLE "public"."block" (
"id" bigint NOT NULL,
"parentBlockhashId" bigint,
"number" bigint NOT NULL,
"sealerAccountId" bigint,
"timestamp" bigint NOT NULL,
"difficulty" smallint NOT NULL,
"gasUsed" numeric(79) NOT NULL,
"gasLimit" numeric(79) NOT NULL,
"size" bigint NOT NULL,
CONSTRAINT "block_id"
PRIMARY KEY ("id"),
CONSTRAINT "block_sealerAccountId_fkey"
FOREIGN KEY ("sealerAccountId")
REFERENCES account(id)
NOT DEFERRABLE,
CONSTRAINT "block_id_fkey"
FOREIGN KEY (id)
REFERENCES blockhash(id)
NOT DEFERRABLE,
CONSTRAINT "block_parentBlockhashId_fkey"
FOREIGN KEY ("parentBlockhashId")
REFERENCES blockhash(id)
NOT DEFERRABLE
"id" bigint NOT NULL,
"parentBlockhashId" bigint,
"number" bigint NOT NULL,
"sealerAccountId" bigint,
"timestamp" bigint NOT NULL,
"difficulty" smallint NOT NULL,
"gasUsed" numeric(79) NOT NULL,
"gasLimit" numeric(79) NOT NULL,
"size" bigint NOT NULL,
CONSTRAINT "block_id" PRIMARY KEY ("id"),
CONSTRAINT "block_sealerAccountId_fkey" FOREIGN KEY ("sealerAccountId") REFERENCES account(id) NOT DEFERRABLE,
CONSTRAINT "block_id_fkey" FOREIGN KEY ("id") REFERENCES blockhash(id) NOT DEFERRABLE,
CONSTRAINT "block_parentBlockhashId_fkey" FOREIGN KEY ("parentBlockhashId") REFERENCES blockhash(id) NOT DEFERRABLE
) WITH (oids = false);
CREATE INDEX "block_parentBlockHashId"
ON "public"."block"
USING btree ("parentBlockhashId");
CREATE INDEX "block_sealerAccountId"
ON "public"."block"
USING btree ("sealerAccountId");
CREATE INDEX "block_number"
ON "public"."block"
USING btree ("number");
CREATE INDEX "block_timestamp"
ON "public"."block"
USING btree ("timestamp");
CREATE INDEX "block_parentBlockHashId" ON "public"."block" ("parentBlockhashId");
CREATE INDEX "block_sealerAccountId" ON "public"."block" ("sealerAccountId");
CREATE INDEX "block_number" ON "public"."block" ("number");
CREATE INDEX "block_timestamp" ON "public"."block" ("timestamp");
CREATE TABLE "public"."transaction" (
"hash" character(66)
NOT NULL,
"blockId" bigint,
"type" transactiontype
DEFAULT 'unknown'
NOT NULL,
"nonce" bigint
NOT NULL,
"gas" numeric(79)
NOT NULL,
"gasPrice" numeric(79)
NOT NULL,
"value" numeric(79)
NOT NULL,
"fromAccountId" bigint
NOT NULL,
"toAccountId" bigint,
"contractaddressAccountId"
bigint,
"status" smallint,
"gasUsed" numeric(79),
"inputlen" integer
NOT NULL,
"input" text
NOT NULL,
CONSTRAINT "transaction_contractaddressAccountId_fkey"
FOREIGN KEY ("contractaddressAccountId")
REFERENCES account(id)
NOT DEFERRABLE,
CONSTRAINT "transaction_fromAccountId_fkey"
FOREIGN KEY ("fromAccountId")
REFERENCES account(id)
NOT DEFERRABLE,
CONSTRAINT "transaction_toAccountId_fkey"
FOREIGN KEY ("toAccountId")
REFERENCES account(id)
NOT DEFERRABLE,
CONSTRAINT "transaction_blockId_fkey"
FOREIGN KEY ("blockId")
REFERENCES block(id)
NOT DEFERRABLE
"hash" character(66) NOT NULL,
"blockId" bigint,
"type" transactiontype NOT NULL DEFAULT 'unknown',
"nonce" bigint NOT NULL,
"gas" numeric(79) NOT NULL,
"gasPrice" numeric(79) NOT NULL,
"value" numeric(79) NOT NULL,
"fromAccountId" bigint NOT NULL,
"toAccountId" bigint,
"contractaddressAccountId" bigint,
"status" smallint,
"gasUsed" numeric(79),
"inputlen" integer NOT NULL,
"input" text NOT NULL,
CONSTRAINT "tx_cntrctaddrAccntId_fkey" FOREIGN KEY ("contractaddressAccountId") REFERENCES account(id) NOT DEFERRABLE,
CONSTRAINT "tx_fromAccountId_fkey" FOREIGN KEY ("fromAccountId") REFERENCES account(id) NOT DEFERRABLE,
CONSTRAINT "tx_toAccountId_fkey" FOREIGN KEY ("toAccountId") REFERENCES account(id) NOT DEFERRABLE,
CONSTRAINT "tx_blockId_fkey" FOREIGN KEY ("blockId") REFERENCES block(id) NOT DEFERRABLE
) WITH (oids = false);
CREATE INDEX "transaction_hash"
ON "public"."transaction"
USING btree ("hash");
CREATE INDEX "transaction_contractaddressAccountId"
ON "public"."transaction"
USING btree ("contractaddressAccountId");
CREATE INDEX "transaction_fromAccountId"
ON "public"."transaction"
USING btree ("fromAccountId");
CREATE INDEX "transaction_toAccountId"
ON "public"."transaction"
USING btree ("toAccountId");
CREATE INDEX "transaction_blockId"
ON "public"."transaction"
USING btree ("blockId");
CREATE INDEX "transaction_gasUsed"
ON "public"."transaction"
USING btree ("gasUsed");
CREATE INDEX "transaction_hash" ON "public"."transaction" ("hash");
CREATE INDEX "transaction_contractaddressAccountId" ON "public"."transaction" ("contractaddressAccountId");
CREATE INDEX "transaction_fromAccountId" ON "public"."transaction" ("fromAccountId");
CREATE INDEX "transaction_toAccountId" ON "public"."transaction" ("toAccountId");
CREATE INDEX "transaction_blockId" ON "public"."transaction" ("blockId");
CREATE INDEX "transaction_gasUsed" ON "public"."transaction" ("gasUsed");
CREATE TABLE "public"."accountsnapshots" (
"accountId" bigint NOT NULL,
"when" TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL,
"wei_balance" numeric(79,0),
"wei_loadamount" numeric(79,0),
CONSTRAINT "accntsnapshots_accntId_fkey" FOREIGN KEY ("accountId") REFERENCES account(id) NOT DEFERRABLE
);
CREATE INDEX "accountsnapshots_when" ON "public"."accountsnapshots" ("when");
CREATE INDEX "accountsnapshots_accountId" ON "public"."accountsnapshots" ("accountId");
CREATE VIEW b
AS
......
......@@ -5,4 +5,10 @@ psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-E
GRANT CONNECT ON DATABASE postgres TO dgsi;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO dgsi;
GRANT UPDATE (shortname,name) ON TABLE public.account TO dgsi;
CREATE USER logparser WITH PASSWORD 'bfa';
GRANT SELECT,INSERT,UPDATE,DELETE,TRUNCATE ON TABLE accountsnapshots TO logparser;
GRANT CONNECT ON DATABASE postgres TO logparser;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO logparser;
GRANT USAGE ON account_id_seq TO logparser;
EOSQL
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment