squeaknode/init.sql
Jonathan Zernik 404772372f
Add btcd credentials to sqkserver config (#81)
* Add btcd credentials and rpc cert to sqkserver configs

* Start the squeak block verifier worker thread on startup

* Btcd request still failing because of cert

* Got btcd client working

* Use valid block hash and height in itest
2020-07-18 17:19:43 -07:00

33 lines
1.1 KiB
SQL

CREATE TABLE IF NOT EXISTS squeak (
hash CHAR(64) PRIMARY KEY,
created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
nVersion INTEGER NOT NULL,
hashEncContent CHAR(64) NOT NULL,
hashReplySqk CHAR(64) NOT NULL,
hashBlock CHAR(64) NOT NULL,
nBlockHeight INTEGER NOT NULL,
vchScriptPubKey bytea NOT NULL,
vchEncryptionKey bytea NOT NULL,
encDatakey CHAR(256) NOT NULL,
iv CHAR(32) NOT NULL,
nTime INTEGER NOT NULL,
nNonce BIGINT NOT NULL,
encContent CHAR(2272) NOT NULL, -- Encrypted content length is always 1136 bytes (2272 hex characters).
vchScriptSig bytea NOT NULL,
address VARCHAR(35) NOT NULL, -- Maximum length of a bitcoin address is 35.
vchDecryptionKey bytea NOT NULL,
block_header bytea
);
CREATE INDEX IF NOT EXISTS idx_squeak_address
ON squeak(address);
CREATE TABLE IF NOT EXISTS profile (
profile_id SERIAL PRIMARY KEY,
created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
profile_name VARCHAR(64) NOT NULL,
private_key bytea,
address VARCHAR(35) UNIQUE NOT NULL, -- Maximum length of a bitcoin address is 35.
sharing BOOLEAN NOT NULL,
following BOOLEAN NOT NULL
);