Skip to content

Commit

Permalink
add ref_block field to Block
Browse files Browse the repository at this point in the history
  • Loading branch information
tammo committed Sep 18, 2019
1 parent bc56157 commit 602b318
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions etc/sqlite/queries.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ CREATE TABLE IF NOT EXISTS blockchains (

CREATE TABLE IF NOT EXISTS blocks (
id VARCHAR(64) UNIQUE PRIMARY KEY NOT NULL,
chain_id VARCHAR(64) NOT NULL,
chain_id VARCHAR(64) NOT NULL,
type TEXT NOT NULL,
prev TEXT UNIQUE,
signature TEXT UNIQUE NOT NULL,
payload TEXT,
ref_block TEXT,
commitment_amount TEXT,
commitment_balance TEXT,
rangeproof_amount TEXT,
Expand All @@ -26,7 +27,8 @@ CREATE TABLE IF NOT EXISTS blocks (
sender_balance TEXT,
sender_amount TEXT,
FOREIGN KEY (chain_id) REFERENCES blockchains(id),
FOREIGN KEY (prev) REFERENCES blocks(signature)
FOREIGN KEY (prev) REFERENCES blocks(signature),
FOREIGN KEY (ref_block) REFERENCES blocks(signature)
);

-- example queries
Expand Down
1 change: 1 addition & 0 deletions etc/sqlite/sqlite.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
| prev | FK -> blocks.signature, unique | **TEXT** signature reference to chain blocks |
| signature | unique, not null | **TEXT** own block signature |
| payload | - | **TEXT** encrypted arbitrary data that is stored on the blockchain |
| ref_block | FK -> blocks.signature | **TEXT** signature reference to a block of another chain |
| commitment_amount | - | **TEXT** pedersen amount commitment |
| commitment_balance | - | **TEXT** pedersen balance commitment |
| receiver_amount | - | **TEXT** encrypted amount for the receiving party |
Expand Down
1 change: 1 addition & 0 deletions src/Block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export type Block = {
type: BlockType;
prev: Signature | null;
payload: EncryptedString;
refBlock: Signature | null;
amountCommitment: string;
balanceCommitment: string;
amountRangeProof: string;
Expand Down

0 comments on commit 602b318

Please sign in to comment.