squeaknode/init.sql
Jonathan Zernik ce6991214a
Use bytea postgres type for key (#65)
* Use bytea type for storing decryption key in postgres

* Use bytea type for encryption key

* Use bytea type for scrippubkey and scriptsig

* Remove content field from postgres db
2020-07-04 16:00:05 -07:00

22 lines
768 B
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,
scriptPubKey bytea NOT NULL,
encryptionKey bytea NOT NULL,
encDatakey CHAR(256) NOT NULL,
vchIv 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).
scriptSig bytea NOT NULL,
address VARCHAR(35) NOT NULL, -- Maximum length of a bitcoin address is 35.
vchDecryptionKey bytea
);
CREATE INDEX IF NOT EXISTS idx_squeak_address
ON squeak(address);