Changeset 5 for trunk/standards

Show
Ignore:
Timestamp:
12/11/07 16:30:20 (4 years ago)
Author:
ocmathew
Message:

Add messages to the protocol
Add prevention from Bob invalidating Alice's coins

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/standards/protocol.txt

    r3 r5  
    66#1 issuer setup 
    77 
    8 * issuer generates master key pair (pM,sM) 
    9  
    10 * issuer sets up "currency description document" 
     8* issuer generates master key pair (ALG,pM,sM) 
     9 
     10* issuer sets up "currency description document" = CDD (like a root certificate) 
    1111 
    1212   { 
    13      content part: 
    14        opencoin standard version      http://opencoin.org/OpenCoinProtocol/1.0    (accidentally a URL of the Standard) 
    15        currency identifier            http://opencent.net/OpenCent                (accidentally URL of this CDD) 
    16        currency identifier (short)    OC 
    17        issuer service location        opencoin://issuer.opencent.net:8002 
    18        denominations                  1, 2, 5, 10, 20, 50, 100, 200, 500, 1000 
    19        issuer public master key       ....  
    20    + 
    21      signature over the content part, made with the issuers master secret key 
    22    +  
    23      [signature over the content part, made with somebody's secret key, ...] 
     13     standard version             = http://opencoin.org/OpenCoinProtocol/1.0 
     14     currency identifier          = http://opencent.net/OpenCent 
     15     short currency identifier    = OC  
     16     issuer service location      = opencoin://issuer.opencent.net:8002 
     17     denominations                = 1, 2, 5, 10, 20, 50, 100, 200, 500, 1000 
     18     issuer cipher suite          = HASH-ALG, SIGN-ALG, BLINDING-ALG 
     19     issuer public master key     = base64(pM) 
     20      
     21     base64(sig(sM,hash(content part))) 
    2422   } 
    2523 
    26  
    27 * mint (regularily) creates keypairs (p[i],s[i]) for all denominations i,  
    28   sign(sM, (i, id(p[i])), p[i], coin_expires, key_not_before, key_not_after) 
    29    
    30   (id() = hash())      (p herausnehmen???) 
    31  
    32 * issuer fires up issuer service at <opencoin://issuer.opencent.net:8002> 
     24   (question: is the "short currency identifier" needed?) 
     25   (future: add additionial signatures, e.g. from wallet software vendors) 
     26 
     27* issuer publishes CDD at "currency identifier" URL 
     28 
     29* mint (regularily) creates keypairs (p,s) for all denominations and id(p). 
     30  Master key holder generates keys certificate 
     31 
     32  { 
     33    key identifier   = base64(id(p)) 
     34    denomination     = denomination 
     35    not_before       = TIME(...) 
     36    key_not_after    = TIME(...) 
     37    coin_not_after   = TIME(...) 
     38    public key       = base64(p) 
     39 
     40    base64(sig(sM, hash(content part))) 
     41  } 
     42 
     43   
     44  Questions: 
     45  * Time format:  YYYYMMDDHHMMSS  20071211144111 or SecondsSinceEpoch? 
     46  * id() = sha256()? 
     47  * CDD? 
     48 
     49* issuer fires up issuer service (=IS) at <opencoin://issuer.opencent.net:8002> 
    3350 
    3451 
     
    4360* Wallet: fetches current public minting keys for denomination 
    4461 
     62    Wallet:  FETCH_MINITNG_KEY #string(denomination) 
     63    IS:      keycertificate 
     64 
     65    (question: base64 response?) 
     66 
    4567* Wallet: creates blank according to CDD: 
    4668 
    47   blank = { 
    48       standard identifier             http://opencoin.org/OpenCoinProtocol/1.0 
    49       currency identifier             http://opencent.net/OpenCent  
    50       denomination                    10 
    51       key_id                          id(signing key) 
    52       serial                          128bit random number (collision resistant) 
     69  { 
     70      standard identifier = http://opencoin.org/OpenCoinProtocol/1.0 
     71      currency identifier = http://opencent.net/OpenCent  
     72      denomination        = denomination 
     73      key identifier      = key_id(signing key) 
     74      serial              = base64(128bit random number) 
    5375  } 
    5476 
     
    5678* Wallet: create random r, calculate  
    5779 
    58     blind = blinding(r, blank) 
     80    blind = blinding(r, pub_minting_key, hash(blank)) 
    5981  
     82  Calculate a collision-free random request ID (128 bit) 
     83 
    6084  Keep (r, blank, blind) in mind.  
    6185   
     
    6589* Send  
    6690 
    67     request = ( (blind, key_id), [request_id] ) 
     91    REQUEST_MINTING #base64(request_id) #hex_string(number_of_blinds)  
     92             #key_id(blind1) #base64(blind1) 
     93             #key_id(blind2) #base64(blind2)[\r]\n 
    6894 
    6995  to issuer service 
    7096 
    71 * Issuer: checks, if key_id is current, otherwise rejct with "current key is #ID" 
    72  
    73   Decides if request will be minted (e.g., payment not yet received), otherwise rejects 
    74  
    75   Issuer passes (maybe asynchronous) reuest to mint. 
    76  
    77   Mint processes request (sings blind with key_id) 
    78  
    79   Mint passes "signed blind"="blind coin" back to issuer  
     97* Issuer: if key_id is not current: 
     98 
     99    REFUSE_MINTING #hex_string(number_of_rejected_blinds) 
     100              #key_id(blind1) "Bad Key ID" 
     101              #key_id(blind2) "Bad Key ID"[\r]\n 
     102 
     103  Elif request will not be minted (e.g., payment not yet received): 
     104 
     105    REFUSE_MINTING #hex_string(number_of_rejected_blinds) 
     106                #key_id(blind1) "Some error message" 
     107                #key_id(blind2) "Some error message"[\r]\n 
     108   
     109  Else: IS passes (maybe asynchronous) request to mint and: 
     110    ACKNOWLEDGE_MINTING #base64(request_id)[\r]\n 
     111 
     112  Session is terminated. 
     113 
     114 
     115 
     116  Mint processes request (signs blind with key_id) 
     117 
     118  Mint passes "signed blind"="blind coin" back to IS  
    80119 
    81120 
     
    84123* Wallet asks issuer service "fetch_signed_blind request_id" 
    85124 
     125    FETCH_MINTED_BLINDS #base64(request_id) 
     126 
    86127* Issuer passes signed blind to wallet or rejects (temporarily or finally) 
     128 
     129    FETCH_MINTED_FAILED #base64(request_id) "Reason" 
     130    FETCH_MINDED_WAIT   #base64(request_id) "Reason" 
     131  
     132  Possible failures: "Request ID Unknown", "Request ID expired", "Request ID rejected" 
     133  Possible waits:    "Processing request" 
     134 
     135    (question: what about key expiration while request is in mining queue) 
     136 
     137    PASS_MINTED_BLINDS #base64(request_id) #hex_string(number_of_blinds) 
     138                 #base64(signature_of_blind1) 
     139                 #base64(signature_of_blind2)[\r]\n 
     140 
     141 
    87142 
    88143* wallet checks if blind fits request id and if blind was correctly signed.  
     
    95150#6 Wallet to Wallet 
    96151 
    97 Wallet S - sends a coin 
    98 Wallet R - receives the coin 
    99  
    100 * (Wallet S locates Wallet R) 
    101   (S knows how much to send) 
    102  
    103 * S tells Wallet S what sum to send to Wallet R 
    104  
    105 * Wallet S needs to compute a splitting of sum into coins (units) 
    106  
    107 * Wallet S sends blanks of coins (without signature!) to Wallet R  
    108   (Wallet S now needs to wait a while) 
    109  
    110 * Wallet R validates the blanks 
     152Alice - sends a coin 
     153Bob - receives the coin 
     154 
     155* Prerequisites: 
     156  * Wallet Alice locates Wallet Bob and sets up (secure) connection 
     157  * Alice knows how much to send and tells her Wallet 
     158  * Wallet Alice calculates a splitting of sum into coins (units) and 
     159    creates a list of coins to send 
     160 
     161* Wallet Alice sends blanks of coins (without signature!) with the serial 
     162  encrypted for the IS to Wallet Bob  
     163  (Wallet Alice now needs to wait a while) 
     164 
     165     SPEND_COIN #hex_string(number_of_coins) #base64(coin1) #base64(coin2)[\r]\n 
     166 
     167* Wallet Bob validates the blanks 
    111168  - do we have the "currency description document" 
    112169  - do we trust the issuer (do we have a valid public key) 
    113170  - checks blanks against cdd 
    114171 
    115 * If blanks are invalid, the transfer is declined by Wallet R 
     172* If blanks are invalid, the transfer is declined by Wallet Bob 
    116173  (later: cdd transfer between wallets) 
    117174 
    118 * Wallet R shows proposed transfer to user R 
    119  
    120 * user R decides whether to  
     175* Wallet Bob shows proposed transfer to Bob 
     176 
     177* Bob decides whether to  
    121178  - accept transfer 
    122179  - accept transfer without double spending checking 
     
    124181 
    125182 
    126 if dsdb is reuired (normal case): 
    127  
    128     * Wallet R prepares for coin exchange with IS, by creating blanks of same sum (see #3) 
    129  
    130     * Wallet R DSDB lookup 
     183if DSDB is required (normal case): 
     184 
     185    * Wallet Bob prepares for coin exchange with IS, by creating blanks of same sum (see #3) 
     186 
     187    * Wallet Bob DSDB lookup 
    131188      - parse cdd for issuer service location 
    132       - parse blanks for  necessary minting key ids 
     189      - parse blanks for necessary minting key ids 
    133190      - start session with authenticated issuer service (IS) (secured and authenticated by transport layer, e.g. SSL) 
    134191        - get session id (from transport layer) 
    135192        - get all missing minting key certs 
    136193        - IS sends key certs or rejects a key id (unknown, outdated) 
    137         - lock list of coin serial numbers at IS (DSDB)  
     194        - lock list of encrypted coin serial numbers at IS (DSDB)  
    138195        - IS either accepts with locking time or rejects with list of rejected serials + reason (locked, spent)  
    139196 
    140197      (this part pauses, session is kept) 
    141198 
    142 * Wallet R tells Wallet S accept or reject with reason (unknown, outdated, locked, spent) for each rejected blank 
    143   (if one blank is rejected the whole transfer has to be rejected) 
    144  
    145 * Wallet S sends coins to Wallet R (= blanks + signature) 
    146    
    147 * Wallet R checks that the coins match the blanks and that signatures are valid 
    148  
    149 * Wallet R accepts transaction or rejects with reason (unknown, invalid) for each rejected coin 
    150  
    151 * Wallet R terminates session with Wallet S 
    152  
    153     (in case of rejection Wallet S needs to do emergency meassures, quickly trying to exchange coins with IS  
     199* Wallet Bob tells Wallet Alice accept or reject with reason (unknown, outdated, locked, spent) for each rejected blank 
     200  (if one blank is rejected the whole transfer has to be rejected) (future: bob signs receipt) 
     201 
     202* Wallet Alice sends coins to Wallet Bob (this time including their clear serial and signature) 
     203   
     204* Wallet Bob checks that the coins match the blanks and that signatures are valid 
     205 
     206* Wallet Bob accepts transaction or rejects with reason (unknown, invalid) for each rejected coin 
     207 
     208* Wallet Bob terminates session with Wallet Alice 
     209 
     210    (in case of rejection Wallet Alice needs to do emergency meassures, quickly trying to exchange coins with IS  
    154211     itself etc.) 
    155212 
    156213 
    157 if dsdb is reuired (normal case): 
     214if DSDB is required (normal case): 
    158215     
    159216    * in case of reject in the checking phase delete the blanks, otherwise 
    160217     
    161     * Wallet R sends buy request (blanks + coins) (Wallet R continues as in #4 and #8) 
     218    * Wallet Bob sends buy request (blanks + coins) (Wallet Bob continues as in #4 and #8) 
    162219 
    163220    * IS has to check if sum of blanks and coins are equal