From 549e9260d76659194ab554435e46cd5b74488977 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 27 May 2016 15:45:34 +0200 Subject: add DB schema, fixing #4067 --- impl-exchange.rst | 149 +----------------------------------------------------- 1 file changed, 2 insertions(+), 147 deletions(-) (limited to 'impl-exchange.rst') diff --git a/impl-exchange.rst b/impl-exchange.rst index 680519cc..0460e106 100644 --- a/impl-exchange.rst +++ b/impl-exchange.rst @@ -33,7 +33,7 @@ SEPA accounts The command line tool `taler-exchange-sepa` is used to create a file with the JSON response to /wire/sepa requests using the exchange's offline -master key. This file needs to be created and added to the configuration under SEPA_RESPONSE_FILE in section [exchange-wire-sepa] when the +master key. This file needs to be created and added to the configuration under SEPA_RESPONSE_FILE in section [exchange-wire-sepa] when the `wireformat` option in the configuration file allows SEPA transactions. @@ -77,152 +77,7 @@ The command line tool `taler-exchange-reservemod` allows create and add money to Database Scheme ------------------- - .. note:: - - This documentation is outdated (no bug number yet either). - - -.. sourcecode:: postgres - - CREATE TABLE purses ( - -- The customer's withdraw public key for the purse. - withdraw_pub BYTEA PRIMARY KEY, - - -- Purse balance (value part). - balance_value INT4 NOT NULL, - - -- Purse balance (fractional part). - balance_fraction INT4 NOT NULL, - - -- Purse balance (fractional). - balance_currency VARCHAR(4), - - -- Expiration time stamp for the purse. - expiration INT8, - - -- The blinding key (public part) for the purse, can be NULL - -- if funds are insufficient or the exchange has not - -- generated it yet. - blinding_pub BYTEA, - - -- The blinding key (private part). - blinding_priv BYTEA, - - -- Key that was used to create the last signature on the - -- purse status - status_sign_pub BYTEA, - - -- Cached status signature - status_sig BYTEA - ); - - -.. sourcecode:: postgres - - CREATE TABLE collectable_blindcoins ( - -- The public part of the blinding key. - -- Note that this is not a foreign key, - -- as the blinding key is removed from the purse - -- table once a coin has been requested with it. - -- Furthermore, the private part is not required - -- anymore. - blind_pub bytea PRIMARY KEY, - - -- The coin blank provided by the customer. - blind_blank_coin BYTEA, - - -- Signature over the exchangeing request by the customer. - customer_sig BYTEA, - - -- The signed blind blank coin. - blind_signed_coin BYTEA, - - -- The denomination public key used to sign the - -- blind signed coin. - denom_pub BYTEA, - - -- The purse that requested the exchangeing of this - -- coin. - withdraw_pub BYTEA REFERENCES purses(withdraw_pub) - ); - - -The table `coins` stores information about coins known to the exchange. - -.. sourcecode:: postgres - - CREATE TABLE coins ( - denom_pub BYTEA NOT NULL, - denom_sig BYTEA NOT NULL, - coin_pub BYTEA NOT NULL, - - -- melting session, or NULL if not melted - melt_session BYTEA, - - -- remaining value of the coin - balance_currency int4, - balance_value int4, - balance_fraction int4, - - -- lock id, not NULL if not locked - lock int - ); - -The following tables are used for refreshing. - -.. sourcecode:: postgres - - CREATE TABLE refresh_sessions ( - session_pub BYTEA, - order_sig BYTEA, - index_reveal INT2, - ); - - CREATE TABLE refresh_melt ( - session_pub BYTEA REFERENCES refresh_sessions (session_pub), - session_sig BYTEA, - denom_pub BYTEA, - denom_sig BYTEA, - coin_pub BYTEA, - coin_sig BYTEA, - ); - - -- create links to old coins - CREATE TABLE refresh_link_commits ( - session_pub BYTEA, - session_sig BYTEA, - coin_pub BYTEA, - transfer_pub BYTEA, - link_secret_enc BYTEA, - link_secret_hash BYTEA, - idx INTEGER - ); - - CREATE TABLE refresh_order ( - -- EdDSA public key of the melting session - session_pub BYTEA REFERENCES refresh_sessions (session_pub), - -- denomination key for the newly ordered coin - denom_pub BYTEA, - -- signature from session key over coin order - session_sig BYTEA, - ); - - CREATE TABLE refresh_coin_commits ( - session_pub BYTEA, - idx INTEGER, - coin_link_enc BYTEA, - -- The blinding key (public part) for the purse, can be NULL - -- if funds are insufficient or the exchange has not - -- generated it yet. - blinding_pub BYTEA, - - -- The blinding key (private part). - blinding_priv BYTEA, - -- The coin blank provided by the customer. - blind_blank_coin BYTEA, - -- encrypted stuff - coin_link_enc BYTEA, - ); +.. image:: exchange-db.png ------------------ -- cgit v1.2.3