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
2b1c2651
Commit
2b1c2651
authored
4 years ago
by
Robert Martin-Legene
Browse files
Options
Downloads
Patches
Plain Diff
Need bigger integers
parent
37c6c0c5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
postgres/10-postgres.sql
+21
-19
21 additions, 19 deletions
postgres/10-postgres.sql
with
21 additions
and
19 deletions
postgres/10-postgres.sql
+
21
−
19
View file @
2b1c2651
...
...
@@ -4,7 +4,7 @@
CREATE
SEQUENCE
account_id_seq
INCREMENT
1
MINVALUE
1
MAXVALUE
2147483647
START
1000
CACHE
1
;
CREATE
TABLE
"public"
.
"account"
(
"id"
int
eger
DEFAULT
nextval
(
'account_id_seq'
)
NOT
NULL
,
"id"
big
int
DEFAULT
nextval
(
'account_id_seq'
)
NOT
NULL
,
"address"
character
(
42
)
NOT
NULL
,
"shortname"
character
varying
(
16
),
"name"
character
varying
(
255
),
...
...
@@ -14,22 +14,22 @@ CREATE TABLE "public"."account" (
CREATE
SEQUENCE
blockhash_id_seq
INCREMENT
1
MINVALUE
1
MAXVALUE
2147483647
START
1000000
CACHE
1
;
CREATE
TABLE
"public"
.
"blockhash"
(
"id"
int
eger
DEFAULT
nextval
(
'blockhash_id_seq'
)
NOT
NULL
,
"id"
big
int
DEFAULT
nextval
(
'blockhash_id_seq'
)
NOT
NULL
,
"hash"
character
(
66
)
NOT
NULL
,
CONSTRAINT
"blockhash_id"
PRIMARY
KEY
(
"id"
),
CONSTRAINT
"blockhash_hash"
UNIQUE
(
"hash"
)
)
WITH
(
oids
=
false
);
CREATE
TABLE
"public"
.
"block"
(
"id"
int
eger
NOT
NULL
,
"parentBlockhashId"
int
eger
,
"number"
int
eger
NOT
NULL
,
"sealerAccountId"
int
eger
,
"timestamp"
int
eger
NOT
NULL
,
"id"
big
int
NOT
NULL
,
"parentBlockhashId"
big
int
,
"number"
big
int
NOT
NULL
,
"sealerAccountId"
big
int
,
"timestamp"
big
int
NOT
NULL
,
"difficulty"
smallint
NOT
NULL
,
"gasUsed"
int
eger
NOT
NULL
,
"gasLimit"
int
eger
NOT
NULL
,
"size"
int
eger
NOT
NULL
,
"gasUsed"
big
int
NOT
NULL
,
"gasLimit"
big
int
NOT
NULL
,
"size"
big
int
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
,
...
...
@@ -42,16 +42,16 @@ CREATE INDEX "block_timestamp" ON "public"."block" USING btree ("timestamp");
CREATE
TABLE
"public"
.
"transaction"
(
"hash"
character
(
66
)
NOT
NULL
,
"blockId"
int
eger
,
"nonce"
int
eger
NOT
NULL
,
"gas"
int
eger
NOT
NULL
,
"gasPrice"
int
eger
NOT
NULL
,
"value"
int
eger
NOT
NULL
,
"fromAccountId"
int
eger
NOT
NULL
,
"toAccountId"
int
eger
NOT
NULL
,
"contractaddressAccountId"
int
eger
,
"blockId"
big
int
,
"nonce"
big
int
NOT
NULL
,
"gas"
big
int
NOT
NULL
,
"gasPrice"
big
int
NOT
NULL
,
"value"
big
int
NOT
NULL
,
"fromAccountId"
big
int
NOT
NULL
,
"toAccountId"
big
int
NOT
NULL
,
"contractaddressAccountId"
big
int
,
"status"
smallint
NOT
NULL
,
"gasUsed"
int
eger
NOT
NULL
,
"gasUsed"
big
int
NOT
NULL
,
"inputlen"
smallint
NOT
NULL
,
"input"
text
NOT
NULL
,
CONSTRAINT
"transaction_contractaddressAccountId_fkey"
FOREIGN
KEY
(
"contractaddressAccountId"
)
REFERENCES
account
(
id
)
NOT
DEFERRABLE
,
...
...
@@ -64,6 +64,8 @@ CREATE INDEX "transaction_fromAccountId" ON "public"."transaction" USING btree (
CREATE
INDEX
"transaction_toAccountId"
ON
"public"
.
"transaction"
USING
btree
(
"toAccountId"
);
CREATE
INDEX
"transaction_blockId"
ON
"public"
.
"transaction"
USING
btree
(
"blockId"
);
CREATE
VIEW
b
AS
SELECT
b1
.
hash
"hash"
,
b2
.
hash
"parentHash"
,
number
,
account
.
address
sealer
,
timestamp
,
difficulty
,
"gasUsed"
,
"gasLimit"
,
size
FROM
block
,
blockhash
b1
,
blockhash
b2
,
account
WHERE
block
.
id
=
b1
.
id
AND
block
.
"parentBlockhashId"
=
b2
.
id
AND
block
.
"sealerAccountId"
=
account
.
id
;
INSERT
INTO
"account"
(
"id"
,
"address"
,
"shortname"
,
"name"
)
VALUES
(
1
,
'0x377ab0cd00744dbb07b369cd5c0872dcd362c8f0'
,
'UNER'
,
'Universidad Nacional de Entre Rios'
),
(
2
,
'0x2feb6a8876bd9e2116b47834b977506a08ea77bd'
,
'PNA'
,
'Prefectura Nacional Argentina'
),
...
...
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