Beldex 백서

Beldex

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 5쪽 중 3쪽

d spent using its main address’ view and spend keys. By analogy: an online bank account may have multiple balances corresponding to credit cards and deposits, yet they are all accessible and spendable from the same point of view - the account holder. Subaddresses are convenient for receiving funds to the same place when a user doesn‘t want to link his activities together by publishing/using the same address. As we will see, an observer would have to solve the DLP in order to determine a given subaddress is derived from any particular address. They are also useful for differentiating between received outputs. For example, if Alice wants to buy an apple from Bob on a Tuesday, Bob could write a receipt describing the purchase and make a subaddress for that receipt, then ask Alice to use that subaddress when she sends him the money. This way Bob can associate the money he receives with the apple he sold. We explore another way to distinguish between received outputs in the next section. Bob generates his ith subaddress (i = 1, 2,... ) from his address as a pair of public keys (Kv,i,K s,i): Ks,i =Ks +Hn(kv,i )G Kv,i =kvKs,i So, Kv,i =kv(ks +Hn(kv,i ))G Ks,i = (ks +Hn(kv,i ))G Sending to a subaddress: Let‘s say Alice is going to send Bob money via his subaddress ( Kv,1B ,K s,1B ) simple one- input, one-output transaction. 1. Alice generates a random number r R ← −Zl, and calculates the one-time public key Ko =Hn(rKv,1B )G +Ks,1B 2. Alice sets Ko as the addressee of the payment, adds the value rKs,1B to the trans- action data, submits it to the network. 3. Bob receives the values K 0 and rKs,1B , and he can calculate kvBrKs,1B = rKv,1B . He can then calculate Ks′,1B = Ko−H n(rKv,1B ). When he sees that Ks′,1B = Ks,1B , he knows that the transaction is addressed to him. Bob only needs his private view key kv and public spend key Ks,1B , to find the transaction outputs sent to his subaddress. 19 4. The one-time keys for the output are: Ko =Hn(rKv,1B )G +Ks,1B = (Hn(rKv,1B ) +ks,1B )G ko =Hn(rKv,1B ) +ks,1B Now, Alice’s transaction public keyrKs,1B is particular to Bob (instead ofrG). If she creates a p-output transaction with at least one output intended for a subaddress, Alice needs to make a unique transaction public key for each output∈{ 1, 2,...,p }. In other words, if Alice is sending to Bob‘s subaddress ( Kv,1B ,K s,1B ) and Carol‘s address (KvC,K sC), she will put two transaction public keys ( r1Ks,1B ,r 2G) in the transaction data. 2.5.5 Integrated addresses In order to differentiate between the outputs they receive, a recipient can request senders include a payment ID in transaction data. For example, if Alice wants to buy an apple from Bob on a Tuesday, Bob could write a receipt describing the purchase and ask Alice to include the receipt‘s ID number when she sends him the money. This way Bob can associate the money he receives with the apple he sold. Senders can communicate payment IDs in clear text, but manually including the IDs in transactions is inconvenient for recipients, who might inadvertently expose their activities. In Beldex, recipients can integrate payment IDs into their addresses, and pro- vide those integrated addresses, containing (Kv,K s,paymentID ), to senders. Payment IDs can technically be integrated into any kind of address, including normal addresses, subaddresses, and multisignature addresses. Senders addressing outputs to integrated addresses can encode payment IDs using the shared secret rkvt and a XOR operation, which recipients can then decode with the appropriate transaction public key and another XOR procedure. Encoding payment IDs in this way allows senders to prove they made particular transaction outputs (i.e. for audits, refunds, etc.). 2.5.6 Binary operator XOR The binary operator XOR evaluates two arguments and returns true if one, but not both, of the arguments is true. Here is its truth table: A B A XOR B F F F F T T T F T T T F Table 1: A XOR B In the context of computer science, XOR is equivalent to bit addition modulo 2. For example, the XOR of two bit pairs: 20 XOR({1, 1},{1, 0}) ={1 + 1, 1 + 0} ={0, 1} Examining the previous example, each of these produce the same output:XOR({1, 1},{1, 0}), XOR({0, 0},{0, 1}),XOR ({1, 0},{1, 1}), or XOR({0, 1},{0, 0}). There are 2 b combina- tions of XOR inputs (with b bits each) for the same output, so if input A∈R{1,..., 2}, an observer who learned C =XOR(A,B ) could not gain any information about B. At the same time, anyone who knows two of the elements A,B,C , where C = XOR(A,B ), can calculate the third element, such as A = XOR(B,C ). XOR indi- cates if two elements are different or the same, so knowing C and B is enough to expose A. A careful examination of the truth table reveals this to be true. 2.5.7 Encoding The sender encodes the payment ID for inclusion in transaction data kmask =Hn(rKvt,pid tag) kpayment ID =kmask→reducedtobitlengthof paymentID encodedpaymentID =XOR(kpayment ID,paymentID ) The output of a cryptographic hash functionH is uniformly distributed across the range of possible outputs. In other words, for some input A,H(A)∈DRSH. where, SH is the set of possible outputs from H. We use ∈DR to indicate the function is deterministically random. H(A) produces the same thing every time, but its output is equivalent to a random number. We include pid tag to ensure kmask is different from the component Hn(rKvt,t ) in one-time output addresses. 2.5.8 Decoding Whichever recipientt the payment ID was created for can find it using his view key and the transaction public key rG: kmask =Hn(rKvt,pid tag) kpayment ID =kmask→reducedtobitlengthof paymentID paymentID =XOR(kpayment ID,encodedpaymentID ) Similarly, senders can decode payment IDs they had previously encoded by recalculating the shared secret kmask =Hn(rKvt ). 2.5.9 Transaction types Transaction structures, protocols, and cryptographic schemes are always prone to evolving as new objectives or threats are found. In this report we have focused our attention on Ring Confidential Transactions (RingCT). RingCT is mandatory for all new transactions, so we will not describe any deprecated transaction types, even if they are still partially supported. 21 The transaction types we will describe in this chapter are RCTTypeFull and RCT- TypeSimple. The former category 2.5.10 closely follows the ideas explained by Shen Noether at al. in [NMRL16]. At the time that paper was written, the authors most likely intended to fully replace the original CryptoNote transaction scheme. However, for multi-input transactions, the signature scheme formulated in that paper was thought to entail a risk on traceability. This will become clear when we supply tech- nical details, but in short: if one spent output became identifiable, the rest of the spent outputs would also become identifiable. This would have an impact on the traceability of currency flows, not only for the transaction originator affected, but also for the rest of the blockchain. To mitigate this risk, yet different signature scheme for multi-input transactions was proposed. The transaction type RCTTypeSimple 2.5.17 is used in those situations. The main difference, as we will see later, is that each input is signed independently. 2.5.10 Ring Confidential Transactions of type RCTTypeFull Our perception is that the decision to limit RCTTypeFull transactions to one input was rather hastily taken, and that it might change in the future, perhaps if the algo- rithm to select additional mix-in outputs is improved and ring sizes are increased. Also, Shen Noether‘s original description in Ring Confidential Transactions did not envision constraints of this type. At any rate, it is not a hard constraint. An alternative wallet might choose to sign transactions using either scheme, independently of the number of inputs involved. We have therefore chosen to describe the scheme as if it were meant for multi-input transactions. An actual example of a RCTTypeFull transaction, with all its components, can be inspected in Appendix A. 2.5.11 Amount commitments Recall from Section 2.4.2 that we had defined a commitment to an output‘s amount b as: c(b) =yG +bH In the context of Beldex, output recipients should be able to reconstruct the amount commitments. This means the blinding factor y and amountb must be communicated to the receiver. The solution adopted in Beldex is a Diffie-Hellman shared secret rKvB. For any given transaction in the blockchain, each of its outputst∈{ 1,...,p } has two associated values called mask and amount satisfying maskt =yt +Hn(Hn(rKvB,t )) amountt =bt +Hn(Hn(Hn(rKvB,t ))) The receiver Bob will be able to calculate the blinding factor yt and the amount bt using the transaction public key rG and his view key KvB. He can also check that the commitmentC(yt,bt) provided in the transaction data, henceforth denoted, corresponds to the amount at hand. More generally, any third party with access to Bob‘s view 22 key could decrypt his output amounts, and make sure they agree with their associated commitments. 2.5.12 Commitments to zero Assume a transaction sender has previously received various outputs with amountsa1,...,a m addressed to one-time addressesKoπ,1,...,K oπ,m and with amount commitmentsCaπ,1,...,C aπ,m. This sender knows the private keyskoπ,1,...,k oπ,m corresponding to the one-time addresses (Section 2.5.2). The sender also knows the blinding factors xj used in commitmentsCaπ,j (Section 2.5.11). A transaction consists of inputs a1,...,a m and outputs b1,...,b p such that∑mj=1aj−∑p t=1bt = 0. The sender re-uses the commitments Caπ,1,...,C aπ,m from the previous out- puts, and create commitments forb1,...,b p. Let these new commitments beCbπ,1,...,C bπ,p. As hinted in Section 2.4.2, the sum of the commitments will not be 0, but a curve point zG: ∑ j Caπ,j−∑ t Cbπ,t =zG The sender will know z, allowing him to create a signature on this commitment to zero. Indeed, z follows from the blinding factors if and only if input amounts equal output amounts (recalling Section 2.4.1, we don’t know γ in H =γG). m∑ j=1 Caπ,j− p∑ t=1 Cbπ,t = ∑ j xjG− ∑ t ytG + ( ∑ aj− ∑ bt)H = ∑ j xjG− ∑ t ytG =zG 2.5.13 Signature The sender selects v sets of size m, of additional unrelated addresses and their commit- ments from the blockchain, corresponding to apparently unspent outputs. She mixes the addresses in a ring with her ownm unspent outputs’ addresses, adding false commitments to zero, as follows: 23 R =    { Ko1,1,...,K o1,m, (∑ j C1,j− ∑ t Cbt )} ..., { Koπ,1,...,K oπ,m, (∑ j Caπ,j−∑ t Cbt )} ..., { Kov+1,1,...,K ov+1,m, (∑ j Cv+1,j− ∑ t Cbt )}  Looking at the structure of the key ring, we see that if ∑ j Caπ,j−∑ t Cbt = 0 Then, any observer would recognize the set of addresses { Koπ,1,...,K oπ,m as the ones in use as inputs, and therefore currency flows would be traceable. With this observation made we can see the utility of zG. All commitment terms in R return some EC point, and the πth such term is zG. This allows us to create an MLSAG signature (Section 2.2.4) onR. MLSAG signature for inputs: The private keys for { Koπ,1,...,K oπ,m, (∑ jCaπ,j−∑tCbt )} are koπ,1,...,k oπ,m,z which are known to the sender. MLSAG in this scenario does not use a key image for the com- mitment to zero zG This means building and verifying the signature excludes the term ri,m+1Hp(Ki,m+1) +ci ˜Kz. The message m signed in the input MLSAG is essentially a hash of all transaction information except for the MLSAG signature itself. This ensures transactions are tamper-proof from the perspective of both transaction authors and verifiers. ko is the essence of Beldex’s transaction model. Signing m withko proves you are the a owner/recipient of the amount committed to in Ca. Verifiers can be confident that transaction authors are spending their own funds. Range proofs for outputs: To avoid the amount ambiguity of outputs described in Section 2.4.4, the sender must also employ the Borromean signature scheme to sign amount ranges for each outputt∈{ 1,...,p }. No message m is signed by the Borromean signatures. Range proofs are not needed for input amounts because they are either expressed clearly (as with transaction fees and block rewards), or were proven in range when first created as outputs. In the current version, each amount is expressed as a fixed point num- ber of 64 bits. This means the data for each range proof will contain 64 bit commitments and 2∗ 64 + 1 signature terms. 24 2.5.14 Transaction Fee Typically transaction outputs are lower in total than transaction inputs, in order to provide a fee that will incentivize miners to include the transaction in the blockchain. Transaction fee amounts are stored in clear text in the transaction data transmitted to the network. Miners can create an additional output for themselves with the fee. This fee amount must be converted into a commitment so verifiers can confirm transactions sum to zero. The solution is to calculate the commitment of the fee f without the masking effect of any blinding factor. That is, C(f) =fH , where f is communicated in clear text. The network verifies the MLSAG signature on R by including fH as follows: (∑ j Ci,j− ∑ t Cbt ) −fH This works because this is a commitment to zero: (∑ j Ci,j− ∑ t Cbt ) −fH =zG 2.5.15 Avoiding double-spending An MLSAG signature (Section 2.2.4) contains images ˜Kj of private keyskπ,j. An impor- tant property in any cryptographic signature scheme is that it should be unforgeable with non-negligible probability. Therefore, to all practical effects, we can assume a signature’s key images must have been deterministically produced from legitimate private keys. The network need only verify that key images included in MLSAG signatures (cor- responding to inputs) and calculated as ˜Koj =koπ,jHn(Koπ,j) have not appeared before in other transactions. If they have, then we can be sure we are witnessing an attempt to re-spend an output Caπ,j addressed to Koπ,j. If someone tries to spend Caπ,j twice, they will reveal the indexπ for both transactions where it appears. This has two effects: (1) all outputs at index π in the first transaction are revealed as its real inputs, and (2) all outputs at index π in the second transaction are revealed as not having been spent before. The second is a problem even considering miners would reject the double-spend transaction. These effects could weaken the network benefits of ring signatures, and are part of the reason RCTTypeFull is only used for single-input transactions. The other main reason is that a cryptanalyst would know that, in general, all real inputs share an index. 2.5.16 Space and verification requirements MLSAG signature (inputs) From Section 2.2.4 we recall that an MLSAG signature in this context would be expressed as σ(m) = (c1,r 1,1,...,r 1,m+1,...,r v+1,1,...,r v+1,m+1)with ( ˜Ko1,..., ˜Kom) As a legacy of CryptoNote, the values ˜K 0j are not referred to as part of the signature, but rather as images of the private keys k0π,j. These key images are normally stored sep- arately in the transaction structure, as they are used to detect double-spending attacks. 25 With this in mind and assuming point compression, an MLSAG signature will require ((v + 1).(m + 1) + 1).32 bytes of storage, where v is the mixin level and m is the number of inputs. In other words, a transaction with 1 input and a total ring size of 32 would consume (32.2 + 1).32 = 2080 bytes. To this value we would add 32 bytes to store the key image of each input, for m.32 bytes of storage, and additional space to store the ring member offsets in the blockchain. These offsets are used by verifiers to find each MLSAG signature’s ring members’ output keys and commitments in the blockchain, and are stored as variable length integers, hence we cannot exactly quantify the space needed. Including the computation of (∑ jCi,j−∑tCbt ) −fH , and verifying key images are in G’s subgroup with l ˜K ?= 0, we verify a RCTTypeFull transaction’s MLSAG (Section 2.2.4) with: PA Point addition for some points A,B :A +B[m∗ (v + 1)] PS Point subtraction for some points A,B :A−B[(v + 1)∗ (p + 1)] VBSM Variable-base scalar multiplications for some integer a, and point P :aP [m] KBSM Known-base scalar multiplications for some integer a :aG[1] DVBA Double-variable-base addition for some integersa,b , and pointB :aG+bB[(m+ 1)∗ (v + 1)] VBA Variable-base additions for some integersa,b , and pointsA,B :aA+bB[m∗(v+1)] Range proofs (outputs) We know that, the Borromean signature for range proofs takes the form of an n-tuple σ = (c1,r 0,1,r 0,2,...,r 63,1,r 63,2) Ring keys are considered part of ring signatures. However, in this case it is only necessary to store the commitments Ci , as the ring key counterparts Ci− 2iH can be easily derived (for verification purposes). Respecting this convention, a range proof will require (1 + 64.2 + 64)∗ 32 = 6176 bytes per output. Including ∑ iCi−2iH and checking∑iCi =C , range proofs for p outputs will require this to verify. VRSF Verify range proof special function [p∗ 64] DVBA Double-variable-base addition for some integers a,b , and point B :aG +bB[p∗ 2∗ 64]. 2.5.17 Ring Confidential Transactions of type RCTTypeSimple In the current Beldex code base, transactions with more than one input are signed using a scheme known as RCTTypeSimple. The main characteristic of this approach is that instead of signing the entire set of inputs at once, the sender signs each input separately. Among other things, this means we can’t use commitments to zero in the same way as for RCTTypeFull transactions. It‘s really unlikely that we could match an input amount to an output amount, and in most cases each individual input will be less than the sum of outputs. So, we cannot directly commit inputs−outputs = 0. In more detail, assume that Alice wants to sign input j. Imagine for a moment we could sign an expression like this 26 Caj−∑ t Cbt = ( xj− ∑ t yt ) G + ( aj− ∑ t bt ) H Sinceaj−∑tbt̸= 0, Alice would have to solve the DLP forH =γG in order to obtain the private key of the expression, something we have assumed to be computationally difficult. 2.5.18 Amount commitments As explained, if inputs are decoupled from each other than the sender can’t sign an aggre- gate commitment to zero. On the other hand, signing each input individually implies an intermediate approach. The sender could create new commitments to the input amounts and commit to zero with respect to each of the previous outputs being spent. In this way, the sender could prove the transaction takes as input only the outputs of previous transactions. In other words, assume the amounts being spent are a1,...,a m. These amounts were outputs in previous transactions, in which they had commitments Caj =xjG +ajH The sender can create new commitments to the same amounts but using different blinding factors; that is, C′aj =x′jG +ajH Clearly, she would know the private key of the difference between the two commit- ments: Caj−C′aj = (xj−x′j)G Hence, she would be able to use this value as a commitment to zero for each input. Let us say (xj−x′j) =z , and call each C′aj a pseudo output commitment. Similarly to RCTTypeFull transactions, the sender can include each output’s en- coded blinding factor (mask) for yt and amount for bt in the transaction (see Section 2.4.2), which will allow each receiver t to decode yt and bt using the shared secret r . Before committing a transaction to the blockchain, the network will want to verify that the transaction balances. In the case of RCTTypeFull transactions, this was simple, as the MLSAG signature scheme implies each sender has signed with the private key of a commitment to zero. For RCTTypeSimple transactions, blinding factors for input and output commit- ments are selected such that ∑ j x′j−∑ t yt = 0 This allows us to prove input amounts equal output amounts: ∑ j C′aj −∑ t Cbt−fH = 0 27 Fortunately, choosing such blinding factors is simple. In the current version of Beldex, all bli
프로젝트로 돌아가기