Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
blockdb
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blockchain
blockdb
Commits
92f734a0
Commit
92f734a0
authored
4 years ago
by
Robert Martin-Legene
Browse files
Options
Downloads
Patches
Plain Diff
Current status commit
parent
6d97db99
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
docker-compose.yml
+7
-6
7 additions, 6 deletions
docker-compose.yml
postgres/10-postgres.sql
+61
-114
61 additions, 114 deletions
postgres/10-postgres.sql
postgres/90-add-db-user.sh
+6
-0
6 additions, 0 deletions
postgres/90-add-db-user.sh
with
74 additions
and
120 deletions
docker-compose.yml
+
7
−
6
View file @
92f734a0
...
...
@@ -37,7 +37,7 @@ services:
driver
:
"
json-file"
options
:
max-file
:
"
5"
max-size
:
"
1
0m"
max-size
:
"
5
0m"
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
:
...
...
This diff is collapsed.
Click to expand it.
postgres/10-postgres.sql
+
61
−
114
View file @
92f734a0
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
postgres/90-add-db-user.sh
+
6
−
0
View file @
92f734a0
...
...
@@ -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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment