Commit d5900775 authored by madengji's avatar madengji Committed by vipwzw

debug transfer pass

parent 4073c798
...@@ -245,6 +245,7 @@ function miner() { ...@@ -245,6 +245,7 @@ function miner() {
fi fi
} }
function block_wait() { function block_wait() {
if [ "$#" -lt 2 ]; then if [ "$#" -lt 2 ]; then
echo "wrong block_wait params" echo "wrong block_wait params"
......
...@@ -22,10 +22,9 @@ public: ...@@ -22,10 +22,9 @@ public:
authorizeSpendHash(=hash(spendpub+value+noterandom)) authorizeSpendHash(=hash(spendpub+value+noterandom))
private: private:
spendAmount amount
spendPubKey receiverPubKey
returnPubKey returnPubKey
authorizePubKey
authorizePriKey authorizePriKey
spendFlag spendFlag
noteRandom noteRandom
...@@ -40,10 +39,10 @@ func NewAuth() *frontend.R1CS { ...@@ -40,10 +39,10 @@ func NewAuth() *frontend.R1CS {
// create root constraint system // create root constraint system
circuit := frontend.New() circuit := frontend.New()
spendAmount := circuit.SECRET_INPUT("spendAmount") amount := circuit.SECRET_INPUT("amount")
//spend pubkey //spend pubkey
spendPubKey := circuit.SECRET_INPUT("spendPubKey") receiverPubKey := circuit.SECRET_INPUT("receiverPubKey")
returnPubKey := circuit.SECRET_INPUT("returnPubKey") returnPubKey := circuit.SECRET_INPUT("returnPubKey")
authorizePriKey := circuit.SECRET_INPUT("authorizePriKey") authorizePriKey := circuit.SECRET_INPUT("authorizePriKey")
noteRandom := circuit.SECRET_INPUT("noteRandom") noteRandom := circuit.SECRET_INPUT("noteRandom")
...@@ -63,13 +62,13 @@ func NewAuth() *frontend.R1CS { ...@@ -63,13 +62,13 @@ func NewAuth() *frontend.R1CS {
//spend_flag 0:return_pubkey, 1: spend_pubkey //spend_flag 0:return_pubkey, 1: spend_pubkey
spendFlag := circuit.SECRET_INPUT("spendFlag") spendFlag := circuit.SECRET_INPUT("spendFlag")
circuit.MUSTBE_BOOLEAN(spendFlag) circuit.MUSTBE_BOOLEAN(spendFlag)
targetPubHash := circuit.SELECT(spendFlag, spendPubKey, returnPubKey) targetPubHash := circuit.SELECT(spendFlag, receiverPubKey, returnPubKey)
calcAuthSpendHash := mimc.Hash(&circuit, targetPubHash, spendAmount, noteRandom) calcAuthSpendHash := mimc.Hash(&circuit, targetPubHash, amount, noteRandom)
circuit.MUSTBE_EQ(authSpendHash, calcAuthSpendHash) circuit.MUSTBE_EQ(authSpendHash, calcAuthSpendHash)
//通过merkle tree保证noteHash存在,即便return,auth都是null也是存在的,则可以不经过授权即可消费 //通过merkle tree保证noteHash存在,即便return,auth都是null也是存在的,则可以不经过授权即可消费
// specify note hash constraint // specify note hash constraint
preImage := mimc.Hash(&circuit, spendPubKey, returnPubKey, authPubKey, spendAmount, noteRandom) preImage := mimc.Hash(&circuit, receiverPubKey, returnPubKey, authPubKey, amount, noteRandom)
noteHash := circuit.SECRET_INPUT("noteHash") noteHash := circuit.SECRET_INPUT("noteHash")
circuit.MUSTBE_EQ(noteHash, preImage) circuit.MUSTBE_EQ(noteHash, preImage)
......
...@@ -17,8 +17,8 @@ public: ...@@ -17,8 +17,8 @@ public:
authorizeSpendHash(=hash(spendpub+value+noterandom)) authorizeSpendHash(=hash(spendpub+value+noterandom))
private: private:
spendAmount amount
spendPubKey receiverPubKey
returnPubKey returnPubKey
authorizePriKey authorizePriKey
spendFlag spendFlag
...@@ -41,8 +41,8 @@ func TestAuthorizeSpend(t *testing.T) { ...@@ -41,8 +41,8 @@ func TestAuthorizeSpend(t *testing.T) {
good.Assign(backend.Public, "authorizeHash", "1267825436937766239630340333349685320927256968591056373125946583184548355070") good.Assign(backend.Public, "authorizeHash", "1267825436937766239630340333349685320927256968591056373125946583184548355070")
good.Assign(backend.Public, "authorizeSpendHash", "14468512365438613046028281588661351435476168610934165547900473609197783547663") good.Assign(backend.Public, "authorizeSpendHash", "14468512365438613046028281588661351435476168610934165547900473609197783547663")
good.Assign(backend.Secret, "spendAmount", "28242048") good.Assign(backend.Secret, "amount", "28242048")
good.Assign(backend.Secret, "spendPubKey", "13735985067536865723202617343666111332145536963656464451727087263423649028705") good.Assign(backend.Secret, "receiverPubKey", "13735985067536865723202617343666111332145536963656464451727087263423649028705")
good.Assign(backend.Secret, "returnPubKey", "16067249407809359746114321133992130903102335882983385972747813693681808870497") good.Assign(backend.Secret, "returnPubKey", "16067249407809359746114321133992130903102335882983385972747813693681808870497")
good.Assign(backend.Secret, "authorizePriKey", "17822967620457187568904804290291537271142779717280482398091401115827760898835") good.Assign(backend.Secret, "authorizePriKey", "17822967620457187568904804290291537271142779717280482398091401115827760898835")
good.Assign(backend.Secret, "spendFlag", "1") good.Assign(backend.Secret, "spendFlag", "1")
......
...@@ -4,8 +4,8 @@ public, authorizeHash,1267825436937766239630340333349685320927256968591056373125 ...@@ -4,8 +4,8 @@ public, authorizeHash,1267825436937766239630340333349685320927256968591056373125
public, authorizeSpendHash,14468512365438613046028281588661351435476168610934165547900473609197783547663 public, authorizeSpendHash,14468512365438613046028281588661351435476168610934165547900473609197783547663
secret, spendAmount,28242048 secret, amount,28242048
secret, spendPubKey,13735985067536865723202617343666111332145536963656464451727087263423649028705 secret, receiverPubKey,13735985067536865723202617343666111332145536963656464451727087263423649028705
secret, returnPubKey,16067249407809359746114321133992130903102335882983385972747813693681808870497 secret, returnPubKey,16067249407809359746114321133992130903102335882983385972747813693681808870497
secret, authorizePriKey,17822967620457187568904804290291537271142779717280482398091401115827760898835 secret, authorizePriKey,17822967620457187568904804290291537271142779717280482398091401115827760898835
secret, spendFlag,1 secret, spendFlag,1
......
...@@ -19,7 +19,7 @@ public: ...@@ -19,7 +19,7 @@ public:
amount amount
private: private:
spendPubKey receiverPubKey
returnPubKey returnPubKey
authorizePubKey authorizePubKey
noteRandom noteRandom
...@@ -34,7 +34,7 @@ func NewDeposit() *frontend.R1CS { ...@@ -34,7 +34,7 @@ func NewDeposit() *frontend.R1CS {
amount := circuit.PUBLIC_INPUT("amount") amount := circuit.PUBLIC_INPUT("amount")
//spend pubkey //spend pubkey
spendPubkey := circuit.SECRET_INPUT("spendPubKey") receiverPubKey := circuit.SECRET_INPUT("receiverPubKey")
returnPubkey := circuit.SECRET_INPUT("returnPubKey") returnPubkey := circuit.SECRET_INPUT("returnPubKey")
authPubkey := circuit.SECRET_INPUT("authorizePubKey") authPubkey := circuit.SECRET_INPUT("authorizePubKey")
...@@ -48,7 +48,7 @@ func NewDeposit() *frontend.R1CS { ...@@ -48,7 +48,7 @@ func NewDeposit() *frontend.R1CS {
//preImage=hash(spendPubkey, returnPubkey,AuthPubkey,spendValue,noteRandom) //preImage=hash(spendPubkey, returnPubkey,AuthPubkey,spendValue,noteRandom)
noteHash := circuit.PUBLIC_INPUT("noteHash") noteHash := circuit.PUBLIC_INPUT("noteHash")
// specify note hash constraint // specify note hash constraint
preImage := mimc.Hash(&circuit, spendPubkey, returnPubkey, authPubkey, amount, noteRandom) preImage := mimc.Hash(&circuit, receiverPubKey, returnPubkey, authPubkey, amount, noteRandom)
circuit.MUSTBE_EQ(noteHash, preImage) circuit.MUSTBE_EQ(noteHash, preImage)
r1cs := circuit.ToR1CS() r1cs := circuit.ToR1CS()
......
...@@ -15,7 +15,7 @@ public: ...@@ -15,7 +15,7 @@ public:
amount amount
private: private:
spendPubkey receiverPubKey
returnPubkey returnPubkey
authorizePubkey authorizePubkey
noteRandom noteRandom
...@@ -45,7 +45,7 @@ func TestDeposit(t *testing.T) { ...@@ -45,7 +45,7 @@ func TestDeposit(t *testing.T) {
good.Assign(backend.Public, "noteHash", "16308793397024662832064523892418908145900866571524124093537199035808550255649") good.Assign(backend.Public, "noteHash", "16308793397024662832064523892418908145900866571524124093537199035808550255649")
good.Assign(backend.Public, "amount", "28242048") good.Assign(backend.Public, "amount", "28242048")
good.Assign(backend.Secret, "spendPubKey", "13735985067536865723202617343666111332145536963656464451727087263423649028705") good.Assign(backend.Secret, "receiverPubKey", "13735985067536865723202617343666111332145536963656464451727087263423649028705")
good.Assign(backend.Secret, "returnPubKey", "16067249407809359746114321133992130903102335882983385972747813693681808870497") good.Assign(backend.Secret, "returnPubKey", "16067249407809359746114321133992130903102335882983385972747813693681808870497")
good.Assign(backend.Secret, "authorizePubKey", "13519883267141251871527102103999205179714486518503885909948192364772977661583") good.Assign(backend.Secret, "authorizePubKey", "13519883267141251871527102103999205179714486518503885909948192364772977661583")
good.Assign(backend.Secret, "noteRandom", "2824204835") good.Assign(backend.Secret, "noteRandom", "2824204835")
......
...@@ -2,7 +2,7 @@ public, noteHash,163087933970246628320645238924189081459008665715241240935371990 ...@@ -2,7 +2,7 @@ public, noteHash,163087933970246628320645238924189081459008665715241240935371990
public, amount,28242048 public, amount,28242048
secret, spendPubKey,13735985067536865723202617343666111332145536963656464451727087263423649028705 secret, receiverPubKey,13735985067536865723202617343666111332145536963656464451727087263423649028705
secret, returnPubKey,16067249407809359746114321133992130903102335882983385972747813693681808870497 secret, returnPubKey,16067249407809359746114321133992130903102335882983385972747813693681808870497
secret, authorizePubKey,13519883267141251871527102103999205179714486518503885909948192364772977661583 secret, authorizePubKey,13519883267141251871527102103999205179714486518503885909948192364772977661583
secret, noteRandom,2824204835 secret, noteRandom,2824204835
......
public, treeRootHash,10531321614990797034921282585661869614556487056951485265320464926630499341310 public, treeRootHash,10531321614990797034921282585661869614556487056951485265320464926630499341310
public, commitValueX,14087975867275911077371231345227824611951436822132762463787130558957838320348 public, shieldAmountX,14087975867275911077371231345227824611951436822132762463787130558957838320348
public, commitValueY,15113519960384204624879642069520481336224311978035289236693658603675385299879 public, shieldAmountY,15113519960384204624879642069520481336224311978035289236693658603675385299879
public, authorizeSpendHash,14468512365438613046028281588661351435476168610934165547900473609197783547663 public, authorizeSpendHash,14468512365438613046028281588661351435476168610934165547900473609197783547663
public, nullifierHash,6747518781649068310795677405858353007442326529625450860668944156162052335195 public, nullifierHash,6747518781649068310795677405858353007442326529625450860668944156162052335195
secret, spendAmount,28242048 secret, amount,28242048
secret, spendRandom,35 secret, amountRandom,35
secret, spendPubKey,13735985067536865723202617343666111332145536963656464451727087263423649028705 secret, receiverPubKey,13735985067536865723202617343666111332145536963656464451727087263423649028705
secret, returnPubKey,16067249407809359746114321133992130903102335882983385972747813693681808870497 secret, returnPubKey,16067249407809359746114321133992130903102335882983385972747813693681808870497
secret, authorizePubKey,13519883267141251871527102103999205179714486518503885909948192364772977661583 secret, authorizePubKey,13519883267141251871527102103999205179714486518503885909948192364772977661583
secret, spendPriKey,10190477835300927557649934238820360529458681672073866116232821892325659279502 secret, spendPriKey,10190477835300927557649934238820360529458681672073866116232821892325659279502
......
...@@ -17,15 +17,15 @@ func main() { ...@@ -17,15 +17,15 @@ func main() {
/* /*
public: public:
treeRootHash treeRootHash
commitValueX shieldAmountX
commitValueY shieldAmountY
authorizeHash authorizeSpendHash
nullifierHash nullifierHash
private: private:
spendAmount amount
spendRandom amountRandom
spendPubKey receiverPubKey
returnPubKey returnPubKey
authorizePubKey authorizePubKey
spendPriKey spendPriKey
...@@ -42,10 +42,10 @@ func NewTransferInput() *frontend.R1CS { ...@@ -42,10 +42,10 @@ func NewTransferInput() *frontend.R1CS {
// create root constraint system // create root constraint system
circuit := frontend.New() circuit := frontend.New()
spendValue := circuit.SECRET_INPUT("spendAmount") spendValue := circuit.SECRET_INPUT("amount")
//spend pubkey //spend pubkey
spendPubkey := circuit.SECRET_INPUT("spendPubKey") spendPubkey := circuit.SECRET_INPUT("receiverPubKey")
returnPubkey := circuit.SECRET_INPUT("returnPubKey") returnPubkey := circuit.SECRET_INPUT("returnPubKey")
authPubkey := circuit.SECRET_INPUT("authorizePubKey") authPubkey := circuit.SECRET_INPUT("authorizePubKey")
spendPrikey := circuit.SECRET_INPUT("spendPriKey") spendPrikey := circuit.SECRET_INPUT("spendPriKey")
......
...@@ -12,15 +12,15 @@ import ( ...@@ -12,15 +12,15 @@ import (
/* /*
public: public:
treeRootHash treeRootHash
commitValueX shieldAmountX
commitValueY shieldAmountY
authorizeHash authorizeHash
nullifierHash nullifierHash
private: private:
spendAmount amount
spendRandom amountRandom
spendPubKey receiverPubKey
returnPubKey returnPubKey
authorizePubKey authorizePubKey
spendPriKey spendPriKey
...@@ -41,15 +41,15 @@ func TestTransferInputAuth(t *testing.T) { ...@@ -41,15 +41,15 @@ func TestTransferInputAuth(t *testing.T) {
{ {
good := backend.NewAssignment() good := backend.NewAssignment()
good.Assign(backend.Public, "treeRootHash", "10531321614990797034921282585661869614556487056951485265320464926630499341310") good.Assign(backend.Public, "treeRootHash", "10531321614990797034921282585661869614556487056951485265320464926630499341310")
good.Assign(backend.Public, "commitValueX", "14087975867275911077371231345227824611951436822132762463787130558957838320348") good.Assign(backend.Public, "shieldAmountX", "14087975867275911077371231345227824611951436822132762463787130558957838320348")
good.Assign(backend.Public, "commitValueY", "15113519960384204624879642069520481336224311978035289236693658603675385299879") good.Assign(backend.Public, "shieldAmountY", "15113519960384204624879642069520481336224311978035289236693658603675385299879")
good.Assign(backend.Public, "authorizeSpendHash", "14468512365438613046028281588661351435476168610934165547900473609197783547663") good.Assign(backend.Public, "authorizeSpendHash", "14468512365438613046028281588661351435476168610934165547900473609197783547663")
good.Assign(backend.Public, "nullifierHash", "6747518781649068310795677405858353007442326529625450860668944156162052335195") good.Assign(backend.Public, "nullifierHash", "6747518781649068310795677405858353007442326529625450860668944156162052335195")
good.Assign(backend.Secret, "spendAmount", "28242048") good.Assign(backend.Secret, "amount", "28242048")
good.Assign(backend.Secret, "spendRandom", "35") good.Assign(backend.Secret, "amountRandom", "35")
good.Assign(backend.Secret, "spendPubKey", "13735985067536865723202617343666111332145536963656464451727087263423649028705") good.Assign(backend.Secret, "receiverPubKey", "13735985067536865723202617343666111332145536963656464451727087263423649028705")
good.Assign(backend.Secret, "returnPubKey", "16067249407809359746114321133992130903102335882983385972747813693681808870497") good.Assign(backend.Secret, "returnPubKey", "16067249407809359746114321133992130903102335882983385972747813693681808870497")
good.Assign(backend.Secret, "authorizePubKey", "13519883267141251871527102103999205179714486518503885909948192364772977661583") good.Assign(backend.Secret, "authorizePubKey", "13519883267141251871527102103999205179714486518503885909948192364772977661583")
...@@ -106,15 +106,15 @@ func TestTransferInputReturnKey(t *testing.T) { ...@@ -106,15 +106,15 @@ func TestTransferInputReturnKey(t *testing.T) {
{ {
good := backend.NewAssignment() good := backend.NewAssignment()
good.Assign(backend.Public, "treeRootHash", "10531321614990797034921282585661869614556487056951485265320464926630499341310") good.Assign(backend.Public, "treeRootHash", "10531321614990797034921282585661869614556487056951485265320464926630499341310")
good.Assign(backend.Public, "commitValueX", "14087975867275911077371231345227824611951436822132762463787130558957838320348") good.Assign(backend.Public, "shieldAmountX", "14087975867275911077371231345227824611951436822132762463787130558957838320348")
good.Assign(backend.Public, "commitValueY", "15113519960384204624879642069520481336224311978035289236693658603675385299879") good.Assign(backend.Public, "shieldAmountY", "15113519960384204624879642069520481336224311978035289236693658603675385299879")
good.Assign(backend.Public, "authorizeSpendHash", "6026163592877030954825395224309219861774131411806846860652261047183070579370") good.Assign(backend.Public, "authorizeSpendHash", "6026163592877030954825395224309219861774131411806846860652261047183070579370")
good.Assign(backend.Public, "nullifierHash", "6747518781649068310795677405858353007442326529625450860668944156162052335195") good.Assign(backend.Public, "nullifierHash", "6747518781649068310795677405858353007442326529625450860668944156162052335195")
good.Assign(backend.Secret, "spendAmount", "28242048") good.Assign(backend.Secret, "amount", "28242048")
good.Assign(backend.Secret, "spendRandom", "35") good.Assign(backend.Secret, "amountRandom", "35")
good.Assign(backend.Secret, "spendPubKey", "13735985067536865723202617343666111332145536963656464451727087263423649028705") good.Assign(backend.Secret, "receiverPubKey", "13735985067536865723202617343666111332145536963656464451727087263423649028705")
good.Assign(backend.Secret, "returnPubKey", "16067249407809359746114321133992130903102335882983385972747813693681808870497") good.Assign(backend.Secret, "returnPubKey", "16067249407809359746114321133992130903102335882983385972747813693681808870497")
good.Assign(backend.Secret, "authorizePubKey", "13519883267141251871527102103999205179714486518503885909948192364772977661583") good.Assign(backend.Secret, "authorizePubKey", "13519883267141251871527102103999205179714486518503885909948192364772977661583")
...@@ -172,31 +172,31 @@ func TestTransferInputNoAuthorize(t *testing.T) { ...@@ -172,31 +172,31 @@ func TestTransferInputNoAuthorize(t *testing.T) {
r1csBN256 := backend_bn256.Cast(r1cs) r1csBN256 := backend_bn256.Cast(r1cs)
{ {
good := backend.NewAssignment() good := backend.NewAssignment()
good.Assign(backend.Public, "treeRootHash", "12759256930628441934094267209403003086804595141527597228422519500766117029056") good.Assign(backend.Public, "treeRootHash", "8924377726623516198388981994706612588174229761660626844219523809311621081152")
good.Assign(backend.Public, "commitValueX", "14087975867275911077371231345227824611951436822132762463787130558957838320348") good.Assign(backend.Public, "shieldAmountX", "20026900249169569699397829614948056401416692452575929785554743563301443795984")
good.Assign(backend.Public, "commitValueY", "15113519960384204624879642069520481336224311978035289236693658603675385299879") good.Assign(backend.Public, "shieldAmountY", "11443294504840468048882645872852838384649876010412151915870299030068051779303")
good.Assign(backend.Public, "authorizeSpendHash", "0") good.Assign(backend.Public, "authorizeSpendHash", "0")
good.Assign(backend.Public, "nullifierHash", "6747518781649068310795677405858353007442326529625450860668944156162052335195") good.Assign(backend.Public, "nullifierHash", "4493238794492517147695618716694376637191823831910850819304582851540887491471")
good.Assign(backend.Secret, "spendAmount", "28242048") good.Assign(backend.Secret, "amount", "500000000")
good.Assign(backend.Secret, "spendRandom", "35") good.Assign(backend.Secret, "amountRandom", "103649245823269378598256096359743803233")
good.Assign(backend.Secret, "spendPubKey", "13735985067536865723202617343666111332145536963656464451727087263423649028705") good.Assign(backend.Secret, "receiverPubKey", "7244551457692363731356498279463138379576484998878425864678733206990733443457")
good.Assign(backend.Secret, "returnPubKey", "0") good.Assign(backend.Secret, "returnPubKey", "0")
good.Assign(backend.Secret, "authorizePubKey", "0") good.Assign(backend.Secret, "authorizePubKey", "0")
good.Assign(backend.Secret, "spendPriKey", "10190477835300927557649934238820360529458681672073866116232821892325659279502") good.Assign(backend.Secret, "spendPriKey", "19115616183616714814727844928908633989028519974595353009754871398745087846141")
good.Assign(backend.Secret, "spendFlag", "1") good.Assign(backend.Secret, "spendFlag", "1")
//not need authorize //not need authorize
good.Assign(backend.Secret, "authorizeFlag", "0") good.Assign(backend.Secret, "authorizeFlag", "0")
good.Assign(backend.Secret, "noteRandom", "2824204835") good.Assign(backend.Secret, "noteRandom", "16855817802811010832998322637530013398737002960466904173163094025121554818471")
good.Assign(backend.Secret, "noteHash", "8225571890661960751046682712125507843232543630686326316665478955306869111251") good.Assign(backend.Secret, "noteHash", "4757455985754753449547885621755931629265767091930770913671501411452663313694")
good.Assign(backend.Secret, "path1", "14187514855908861960780770215596905690354960378277143432325960729637725182251") good.Assign(backend.Secret, "path1", "21609869341494920403470153054548069228540665950349313465330160010270609674984")
good.Assign(backend.Secret, "path2", "6182134257436688306324731906502075484313942414837318361329615447955128796497") good.Assign(backend.Secret, "path2", "0")
good.Assign(backend.Secret, "path3", "11546648745105756958663742750618707757021496913774959001736226397442926254652") good.Assign(backend.Secret, "path3", "0")
good.Assign(backend.Secret, "path4", "0") good.Assign(backend.Secret, "path4", "0")
good.Assign(backend.Secret, "path5", "0") good.Assign(backend.Secret, "path5", "0")
good.Assign(backend.Secret, "path6", "0") good.Assign(backend.Secret, "path6", "0")
...@@ -204,7 +204,7 @@ func TestTransferInputNoAuthorize(t *testing.T) { ...@@ -204,7 +204,7 @@ func TestTransferInputNoAuthorize(t *testing.T) {
good.Assign(backend.Secret, "path8", "0") good.Assign(backend.Secret, "path8", "0")
good.Assign(backend.Secret, "path9", "0") good.Assign(backend.Secret, "path9", "0")
good.Assign(backend.Secret, "helper1", "1") good.Assign(backend.Secret, "helper1", "0")
good.Assign(backend.Secret, "helper2", "1") good.Assign(backend.Secret, "helper2", "1")
good.Assign(backend.Secret, "helper3", "1") good.Assign(backend.Secret, "helper3", "1")
good.Assign(backend.Secret, "helper4", "0") good.Assign(backend.Secret, "helper4", "0")
...@@ -215,8 +215,8 @@ func TestTransferInputNoAuthorize(t *testing.T) { ...@@ -215,8 +215,8 @@ func TestTransferInputNoAuthorize(t *testing.T) {
good.Assign(backend.Secret, "helper9", "0") good.Assign(backend.Secret, "helper9", "0")
good.Assign(backend.Secret, "valid1", "1") good.Assign(backend.Secret, "valid1", "1")
good.Assign(backend.Secret, "valid2", "1") good.Assign(backend.Secret, "valid2", "0")
good.Assign(backend.Secret, "valid3", "1") good.Assign(backend.Secret, "valid3", "0")
good.Assign(backend.Secret, "valid4", "0") good.Assign(backend.Secret, "valid4", "0")
good.Assign(backend.Secret, "valid5", "0") good.Assign(backend.Secret, "valid5", "0")
good.Assign(backend.Secret, "valid6", "0") good.Assign(backend.Secret, "valid6", "0")
......
public, commitValueX,14087975867275911077371231345227824611951436822132762463787130558957838320348 public, shieldAmountX,14087975867275911077371231345227824611951436822132762463787130558957838320348
public, commitValueY,15113519960384204624879642069520481336224311978035289236693658603675385299879 public, shieldAmountY,15113519960384204624879642069520481336224311978035289236693658603675385299879
public, noteHash,16308793397024662832064523892418908145900866571524124093537199035808550255649 public, noteHash,16308793397024662832064523892418908145900866571524124093537199035808550255649
secret, spendAmount,28242048 secret, amount,28242048
secret, spendRandom,35 secret, amountRandom,35
secret, spendPubKey,13735985067536865723202617343666111332145536963656464451727087263423649028705 secret, receiverPubKey,13735985067536865723202617343666111332145536963656464451727087263423649028705
secret, returnPubKey,16067249407809359746114321133992130903102335882983385972747813693681808870497 secret, returnPubKey,16067249407809359746114321133992130903102335882983385972747813693681808870497
secret, authorizePubKey,13519883267141251871527102103999205179714486518503885909948192364772977661583 secret, authorizePubKey,13519883267141251871527102103999205179714486518503885909948192364772977661583
secret, noteRandom,2824204835 secret, noteRandom,2824204835
......
...@@ -16,14 +16,14 @@ func main() { ...@@ -16,14 +16,14 @@ func main() {
//spend commit hash the circuit implementing //spend commit hash the circuit implementing
/* /*
public: public:
commitValueX shieldAmountX
commitValueY shieldAmountY
nodeHash noteHash
private: private:
spendAmount amount
spendRandom amountRandom
spendPubKey receiverPubKey
returnPubKey returnPubKey
authorizePubKey authorizePubKey
noteRandom noteRandom
...@@ -34,10 +34,10 @@ func NewTransferOutput() *frontend.R1CS { ...@@ -34,10 +34,10 @@ func NewTransferOutput() *frontend.R1CS {
// create root constraint system // create root constraint system
circuit := frontend.New() circuit := frontend.New()
spendValue := circuit.SECRET_INPUT("spendAmount") spendValue := circuit.SECRET_INPUT("amount")
//spend pubkey //spend pubkey
spendPubkey := circuit.SECRET_INPUT("spendPubKey") spendPubkey := circuit.SECRET_INPUT("receiverPubKey")
returnPubkey := circuit.SECRET_INPUT("returnPubKey") returnPubkey := circuit.SECRET_INPUT("returnPubKey")
authPubkey := circuit.SECRET_INPUT("authorizePubKey") authPubkey := circuit.SECRET_INPUT("authorizePubKey")
......
...@@ -11,14 +11,14 @@ import ( ...@@ -11,14 +11,14 @@ import (
/* /*
public: public:
commitValueX shieldAmountX
commitValueY shieldAmountY
nodeHash noteHash
private: private:
spendAmount amount
spendRandom amountRandom
spendPubKey receiverPubKey
returnPubKey returnPubKey
authorizePubKey authorizePubKey
noteRandom noteRandom
...@@ -32,14 +32,14 @@ func TestTransferOutput(t *testing.T) { ...@@ -32,14 +32,14 @@ func TestTransferOutput(t *testing.T) {
r1csBN256 := backend_bn256.Cast(r1cs) r1csBN256 := backend_bn256.Cast(r1cs)
{ {
good := backend.NewAssignment() good := backend.NewAssignment()
good.Assign(backend.Public, "commitValueX", "14087975867275911077371231345227824611951436822132762463787130558957838320348") good.Assign(backend.Public, "shieldAmountX", "14087975867275911077371231345227824611951436822132762463787130558957838320348")
good.Assign(backend.Public, "commitValueY", "15113519960384204624879642069520481336224311978035289236693658603675385299879") good.Assign(backend.Public, "shieldAmountY", "15113519960384204624879642069520481336224311978035289236693658603675385299879")
good.Assign(backend.Public, "nodeHash", "16308793397024662832064523892418908145900866571524124093537199035808550255649") good.Assign(backend.Public, "noteHash", "16308793397024662832064523892418908145900866571524124093537199035808550255649")
good.Assign(backend.Secret, "spendAmount", "28242048") good.Assign(backend.Secret, "amount", "28242048")
good.Assign(backend.Secret, "spendRandom", "35") good.Assign(backend.Secret, "amountRandom", "35")
good.Assign(backend.Secret, "spendPubKey", "13735985067536865723202617343666111332145536963656464451727087263423649028705") good.Assign(backend.Secret, "receiverPubKey", "13735985067536865723202617343666111332145536963656464451727087263423649028705")
good.Assign(backend.Secret, "returnPubKey", "16067249407809359746114321133992130903102335882983385972747813693681808870497") good.Assign(backend.Secret, "returnPubKey", "16067249407809359746114321133992130903102335882983385972747813693681808870497")
good.Assign(backend.Secret, "authorizePubKey", "13519883267141251871527102103999205179714486518503885909948192364772977661583") good.Assign(backend.Secret, "authorizePubKey", "13519883267141251871527102103999205179714486518503885909948192364772977661583")
...@@ -49,3 +49,55 @@ func TestTransferOutput(t *testing.T) { ...@@ -49,3 +49,55 @@ func TestTransferOutput(t *testing.T) {
} }
} }
func TestTransferOutputTemp(t *testing.T) {
assert := groth16.NewAssert(t)
r1cs := NewTransferOutput()
r1csBN256 := backend_bn256.Cast(r1cs)
{
good := backend.NewAssignment()
good.Assign(backend.Public, "shieldAmountX", "3403754862862244121869403834818720211897208891381676574399662060838495940078")
good.Assign(backend.Public, "shieldAmountY", "21401902064308935591303802598664246616585474010691469717860664156067228175223")
good.Assign(backend.Public, "noteHash", "13610259753835165822431524149670478281864477297016371975012414049080268826331")
good.Assign(backend.Secret, "amount", "300000000")
good.Assign(backend.Secret, "amountRandom", "17199160520698273243343882915453578587")
good.Assign(backend.Secret, "receiverPubKey", "18829345085195922012068709111582461121107908772422825655963168999800303848486")
good.Assign(backend.Secret, "returnPubKey", "0")
good.Assign(backend.Secret, "authorizePubKey", "0")
good.Assign(backend.Secret, "noteRandom", "5029847585956946251661044349066579681630691396824473307862642244158835326399")
assert.Solved(&r1csBN256, good, nil)
}
}
func TestTransferOutputChange(t *testing.T) {
assert := groth16.NewAssert(t)
r1cs := NewTransferOutput()
r1csBN256 := backend_bn256.Cast(r1cs)
{
good := backend.NewAssignment()
good.Assign(backend.Public, "shieldAmountX", "10703086269439751873106176219875739041896146845566831131812760688039385779519")
good.Assign(backend.Public, "shieldAmountY", "19139103177181062461420753508628290808191900352948606822559796252948653071734")
good.Assign(backend.Public, "noteHash", "13134546856103113099750783399130805737503059294172727906371169345876474249458")
good.Assign(backend.Secret, "amount", "199900000")
good.Assign(backend.Secret, "amountRandom", "86450085302571105354912213444290224646")
good.Assign(backend.Secret, "receiverPubKey", "7244551457692363731356498279463138379576484998878425864678733206990733443457")
good.Assign(backend.Secret, "returnPubKey", "0")
good.Assign(backend.Secret, "authorizePubKey", "0")
good.Assign(backend.Secret, "noteRandom", "7266395330102686861165120582739238575545854195882356283931287331463151808870")
assert.Solved(&r1csBN256, good, nil)
}
}
...@@ -65,8 +65,8 @@ func leafSum(circuit *frontend.CS, h mimc.MiMCGadget, data *frontend.Constraint) ...@@ -65,8 +65,8 @@ func leafSum(circuit *frontend.CS, h mimc.MiMCGadget, data *frontend.Constraint)
func CommitValuePart(circuit *frontend.CS, spendValue *frontend.Constraint) { func CommitValuePart(circuit *frontend.CS, spendValue *frontend.Constraint) {
//cmt=transfer_value*G + random_value*H //cmt=transfer_value*G + random_value*H
cmtvalueX := circuit.PUBLIC_INPUT("commitValueX") cmtvalueX := circuit.PUBLIC_INPUT("shieldAmountX")
cmtvalueY := circuit.PUBLIC_INPUT("commitValueY") cmtvalueY := circuit.PUBLIC_INPUT("shieldAmountY")
// set curve parameters // set curve parameters
edgadget, _ := twistededwards_gadget.NewEdCurveGadget(gurvy.BN256) edgadget, _ := twistededwards_gadget.NewEdCurveGadget(gurvy.BN256)
...@@ -84,7 +84,7 @@ func CommitValuePart(circuit *frontend.CS, spendValue *frontend.Constraint) { ...@@ -84,7 +84,7 @@ func CommitValuePart(circuit *frontend.CS, spendValue *frontend.Constraint) {
pointGSnark.X.Tag("xg") pointGSnark.X.Tag("xg")
pointGSnark.Y.Tag("yg") pointGSnark.Y.Tag("yg")
transfer_random := circuit.SECRET_INPUT("spendRandom") transfer_random := circuit.SECRET_INPUT("amountRandom")
//circuit.MUSTBE_LESS_OR_EQ(random_value,10000000000,256) //circuit.MUSTBE_LESS_OR_EQ(random_value,10000000000,256)
//H is not G, H should be a point that no one know the prikey //H is not G, H should be a point that no one know the prikey
var baseX_H, baseY_H fr_bn256.Element var baseX_H, baseY_H fr_bn256.Element
......
...@@ -4,7 +4,7 @@ public, nullifierHash,6747518781649068310795677405858353007442326529625450860668 ...@@ -4,7 +4,7 @@ public, nullifierHash,6747518781649068310795677405858353007442326529625450860668
public, amount,28242048 public, amount,28242048
secret, spendPubKey,13735985067536865723202617343666111332145536963656464451727087263423649028705 secret, receiverPubKey,13735985067536865723202617343666111332145536963656464451727087263423649028705
secret, returnPubKey,16067249407809359746114321133992130903102335882983385972747813693681808870497 secret, returnPubKey,16067249407809359746114321133992130903102335882983385972747813693681808870497
secret, authorizePubKey,13519883267141251871527102103999205179714486518503885909948192364772977661583 secret, authorizePubKey,13519883267141251871527102103999205179714486518503885909948192364772977661583
secret, spendPriKey,10190477835300927557649934238820360529458681672073866116232821892325659279502 secret, spendPriKey,10190477835300927557649934238820360529458681672073866116232821892325659279502
......
...@@ -22,7 +22,7 @@ public: ...@@ -22,7 +22,7 @@ public:
amount amount
private: private:
spendPubKey receiverPubKey
returnPubKey returnPubKey
authorizePubKey authorizePubKey
spendPriKey spendPriKey
...@@ -43,7 +43,7 @@ func NewWithdraw() *frontend.R1CS { ...@@ -43,7 +43,7 @@ func NewWithdraw() *frontend.R1CS {
spendValue := circuit.PUBLIC_INPUT("amount") spendValue := circuit.PUBLIC_INPUT("amount")
//spend pubkey //spend pubkey
spendPubkey := circuit.SECRET_INPUT("spendPubKey") receiverPubKey := circuit.SECRET_INPUT("receiverPubKey")
returnPubkey := circuit.SECRET_INPUT("returnPubKey") returnPubkey := circuit.SECRET_INPUT("returnPubKey")
authPubkey := circuit.SECRET_INPUT("authorizePubKey") authPubkey := circuit.SECRET_INPUT("authorizePubKey")
spendPrikey := circuit.SECRET_INPUT("spendPriKey") spendPrikey := circuit.SECRET_INPUT("spendPriKey")
...@@ -57,7 +57,7 @@ func NewWithdraw() *frontend.R1CS { ...@@ -57,7 +57,7 @@ func NewWithdraw() *frontend.R1CS {
// hash function // hash function
mimc, _ := mimc.NewMiMCGadget("seed", gurvy.BN256) mimc, _ := mimc.NewMiMCGadget("seed", gurvy.BN256)
calcPubHash := mimc.Hash(&circuit, spendPrikey) calcPubHash := mimc.Hash(&circuit, spendPrikey)
targetPubHash := circuit.SELECT(spendFlag, spendPubkey, returnPubkey) targetPubHash := circuit.SELECT(spendFlag, receiverPubKey, returnPubkey)
circuit.MUSTBE_EQ(targetPubHash, calcPubHash) circuit.MUSTBE_EQ(targetPubHash, calcPubHash)
//note hash random //note hash random
...@@ -78,7 +78,7 @@ func NewWithdraw() *frontend.R1CS { ...@@ -78,7 +78,7 @@ func NewWithdraw() *frontend.R1CS {
calcReturnPubkey := circuit.SELECT(authFlag, returnPubkey, nullValue) calcReturnPubkey := circuit.SELECT(authFlag, returnPubkey, nullValue)
calcAuthPubkey := circuit.SELECT(authFlag, authPubkey, nullValue) calcAuthPubkey := circuit.SELECT(authFlag, authPubkey, nullValue)
// specify note hash constraint // specify note hash constraint
preImage := mimc.Hash(&circuit, spendPubkey, calcReturnPubkey, calcAuthPubkey, spendValue, noteRandom) preImage := mimc.Hash(&circuit, receiverPubKey, calcReturnPubkey, calcAuthPubkey, spendValue, noteRandom)
circuit.MUSTBE_EQ(noteHash, preImage) circuit.MUSTBE_EQ(noteHash, preImage)
util.MerkelPathPart(&circuit, mimc, preImage) util.MerkelPathPart(&circuit, mimc, preImage)
......
...@@ -17,7 +17,7 @@ public: ...@@ -17,7 +17,7 @@ public:
amount amount
private: private:
spendPubKey receiverPubKey
returnPubKey returnPubKey
authorizePubKey authorizePubKey
spendPriKey spendPriKey
...@@ -42,7 +42,7 @@ func TestWithdraw(t *testing.T) { ...@@ -42,7 +42,7 @@ func TestWithdraw(t *testing.T) {
good.Assign(backend.Public, "nullifierHash", "6747518781649068310795677405858353007442326529625450860668944156162052335195") good.Assign(backend.Public, "nullifierHash", "6747518781649068310795677405858353007442326529625450860668944156162052335195")
good.Assign(backend.Public, "amount", "28242048") good.Assign(backend.Public, "amount", "28242048")
good.Assign(backend.Secret, "spendPubKey", "13735985067536865723202617343666111332145536963656464451727087263423649028705") good.Assign(backend.Secret, "receiverPubKey", "13735985067536865723202617343666111332145536963656464451727087263423649028705")
good.Assign(backend.Secret, "returnPubKey", "16067249407809359746114321133992130903102335882983385972747813693681808870497") good.Assign(backend.Secret, "returnPubKey", "16067249407809359746114321133992130903102335882983385972747813693681808870497")
good.Assign(backend.Secret, "authorizePubKey", "13519883267141251871527102103999205179714486518503885909948192364772977661583") good.Assign(backend.Secret, "authorizePubKey", "13519883267141251871527102103999205179714486518503885909948192364772977661583")
......
...@@ -60,8 +60,8 @@ func addCreateDepositFlags(cmd *cobra.Command) { ...@@ -60,8 +60,8 @@ func addCreateDepositFlags(cmd *cobra.Command) {
cmd.Flags().Uint64P("amount", "m", 0, "deposit amount") cmd.Flags().Uint64P("amount", "m", 0, "deposit amount")
cmd.MarkFlagRequired("amount") cmd.MarkFlagRequired("amount")
cmd.Flags().StringP("secretPayment", "p", "", "secret for payment addr") cmd.Flags().StringP("secretReceiver", "p", "", "secret for receiver addr")
cmd.MarkFlagRequired("secretPayment") cmd.MarkFlagRequired("secretReceiver")
cmd.Flags().StringP("secretAuth", "a", "", "secret for authorize addr") cmd.Flags().StringP("secretAuth", "a", "", "secret for authorize addr")
...@@ -102,7 +102,7 @@ func createDeposit(cmd *cobra.Command, args []string) { ...@@ -102,7 +102,7 @@ func createDeposit(cmd *cobra.Command, args []string) {
paraName, _ := cmd.Flags().GetString("paraName") paraName, _ := cmd.Flags().GetString("paraName")
amount, _ := cmd.Flags().GetUint64("amount") amount, _ := cmd.Flags().GetUint64("amount")
proofsPara, _ := cmd.Flags().GetString("proofs") proofsPara, _ := cmd.Flags().GetString("proofs")
secretPayment, _ := cmd.Flags().GetString("secretPayment") secretReceiver, _ := cmd.Flags().GetString("secretReceiver")
secretAuth, _ := cmd.Flags().GetString("secretAuth") secretAuth, _ := cmd.Flags().GetString("secretAuth")
secretReturn, _ := cmd.Flags().GetString("secretReturn") secretReturn, _ := cmd.Flags().GetString("secretReturn")
...@@ -112,7 +112,7 @@ func createDeposit(cmd *cobra.Command, args []string) { ...@@ -112,7 +112,7 @@ func createDeposit(cmd *cobra.Command, args []string) {
} }
proofInputs.Secrets = &mixTy.DHSecretGroup{ proofInputs.Secrets = &mixTy.DHSecretGroup{
Payment: secretPayment, Receiver: secretReceiver,
Authorize: secretAuth, Authorize: secretAuth,
Returner: secretReturn, Returner: secretReturn,
} }
...@@ -194,8 +194,8 @@ func addCreateTransferFlags(cmd *cobra.Command) { ...@@ -194,8 +194,8 @@ func addCreateTransferFlags(cmd *cobra.Command) {
cmd.Flags().StringP("output", "o", "", "output 'proof-pubinput' pair") cmd.Flags().StringP("output", "o", "", "output 'proof-pubinput' pair")
cmd.MarkFlagRequired("output") cmd.MarkFlagRequired("output")
cmd.Flags().StringP("secretPayment", "p", "", "secret for payment addr") cmd.Flags().StringP("secretReceiver", "p", "", "secret for receiver addr")
cmd.MarkFlagRequired("secretPayment") cmd.MarkFlagRequired("secretReceiver")
cmd.Flags().StringP("secretAuth", "a", "", "secret for authorize addr") cmd.Flags().StringP("secretAuth", "a", "", "secret for authorize addr")
...@@ -204,8 +204,8 @@ func addCreateTransferFlags(cmd *cobra.Command) { ...@@ -204,8 +204,8 @@ func addCreateTransferFlags(cmd *cobra.Command) {
cmd.Flags().StringP("change", "c", "", "output change 'proof-pubinput' pair") cmd.Flags().StringP("change", "c", "", "output change 'proof-pubinput' pair")
cmd.MarkFlagRequired("change") cmd.MarkFlagRequired("change")
cmd.Flags().StringP("changePayment", "t", "", "secret for change payment addr") cmd.Flags().StringP("changeReceiver", "t", "", "secret for change receiver addr")
cmd.MarkFlagRequired("changePayment") cmd.MarkFlagRequired("changeReceiver")
cmd.Flags().StringP("changeAuth", "u", "", "secret for change authorize addr") cmd.Flags().StringP("changeAuth", "u", "", "secret for change authorize addr")
...@@ -218,10 +218,10 @@ func createTransfer(cmd *cobra.Command, args []string) { ...@@ -218,10 +218,10 @@ func createTransfer(cmd *cobra.Command, args []string) {
proofsInput, _ := cmd.Flags().GetString("input") proofsInput, _ := cmd.Flags().GetString("input")
proofsOutput, _ := cmd.Flags().GetString("output") proofsOutput, _ := cmd.Flags().GetString("output")
proofsChange, _ := cmd.Flags().GetString("change") proofsChange, _ := cmd.Flags().GetString("change")
secretPayment, _ := cmd.Flags().GetString("secretPayment") secretReceiver, _ := cmd.Flags().GetString("secretReceiver")
secretAuth, _ := cmd.Flags().GetString("secretAuth") secretAuth, _ := cmd.Flags().GetString("secretAuth")
secretReturn, _ := cmd.Flags().GetString("secretReturn") secretReturn, _ := cmd.Flags().GetString("secretReturn")
changePayment, _ := cmd.Flags().GetString("changePayment") changeReceiver, _ := cmd.Flags().GetString("changeReceiver")
changeAuth, _ := cmd.Flags().GetString("changeAuth") changeAuth, _ := cmd.Flags().GetString("changeAuth")
changeReturn, _ := cmd.Flags().GetString("changeReturn") changeReturn, _ := cmd.Flags().GetString("changeReturn")
...@@ -236,7 +236,7 @@ func createTransfer(cmd *cobra.Command, args []string) { ...@@ -236,7 +236,7 @@ func createTransfer(cmd *cobra.Command, args []string) {
return return
} }
proofOutputs.Secrets = &mixTy.DHSecretGroup{ proofOutputs.Secrets = &mixTy.DHSecretGroup{
Payment: secretPayment, Receiver: secretReceiver,
Returner: secretAuth, Returner: secretAuth,
Authorize: secretReturn, Authorize: secretReturn,
} }
...@@ -247,7 +247,7 @@ func createTransfer(cmd *cobra.Command, args []string) { ...@@ -247,7 +247,7 @@ func createTransfer(cmd *cobra.Command, args []string) {
return return
} }
proofChanges.Secrets = &mixTy.DHSecretGroup{ proofChanges.Secrets = &mixTy.DHSecretGroup{
Payment: changePayment, Receiver: changeReceiver,
Returner: changeAuth, Returner: changeAuth,
Authorize: changeReturn, Authorize: changeReturn,
} }
...@@ -331,7 +331,7 @@ func mixConfigVerifyKeyParaCmd() *cobra.Command { ...@@ -331,7 +331,7 @@ func mixConfigVerifyKeyParaCmd() *cobra.Command {
} }
func addVkConfigFlags(cmd *cobra.Command) { func addVkConfigFlags(cmd *cobra.Command) {
cmd.Flags().Uint32P("circuit", "c", 0, "mix circuit type,0:deposit,1:withdraw,2:payinput,3:payoutput,4:authorize") cmd.Flags().Uint32P("circuit", "c", 0, "mix circuit type,0:deposit,1:withdraw,2:tansferinput,3:transferoutput,4:authorize")
cmd.MarkFlagRequired("circuit") cmd.MarkFlagRequired("circuit")
cmd.Flags().StringP("zkey", "z", "", "zk proof verify key") cmd.Flags().StringP("zkey", "z", "", "zk proof verify key")
...@@ -419,8 +419,8 @@ func mixConfigPaymentPubKeyParaCmd() *cobra.Command { ...@@ -419,8 +419,8 @@ func mixConfigPaymentPubKeyParaCmd() *cobra.Command {
} }
func addPayPubKeyConfigFlags(cmd *cobra.Command) { func addPayPubKeyConfigFlags(cmd *cobra.Command) {
cmd.Flags().StringP("paying", "p", "", "paying key") cmd.Flags().StringP("receiver", "r", "", "receiver key")
cmd.MarkFlagRequired("paying") cmd.MarkFlagRequired("receiver")
cmd.Flags().StringP("keyX", "x", "", "receiving pub key X") cmd.Flags().StringP("keyX", "x", "", "receiving pub key X")
cmd.MarkFlagRequired("keyX") cmd.MarkFlagRequired("keyX")
...@@ -431,16 +431,16 @@ func addPayPubKeyConfigFlags(cmd *cobra.Command) { ...@@ -431,16 +431,16 @@ func addPayPubKeyConfigFlags(cmd *cobra.Command) {
func createConfigPayPubKey(cmd *cobra.Command, args []string) { func createConfigPayPubKey(cmd *cobra.Command, args []string) {
paraName, _ := cmd.Flags().GetString("paraName") paraName, _ := cmd.Flags().GetString("paraName")
paying, _ := cmd.Flags().GetString("paying") receiver, _ := cmd.Flags().GetString("receiver")
keyx, _ := cmd.Flags().GetString("keyX") keyx, _ := cmd.Flags().GetString("keyX")
keyy, _ := cmd.Flags().GetString("keyY") keyy, _ := cmd.Flags().GetString("keyY")
payload := &mixTy.MixConfigAction{} payload := &mixTy.MixConfigAction{}
payload.Ty = mixTy.MixConfigType_PaymentPubKey payload.Ty = mixTy.MixConfigType_PaymentPubKey
receivingKey := &mixTy.PubKey{X: keyx, Y: keyy} secretKey := &mixTy.PubKey{X: keyx, Y: keyy}
payload.Value = &mixTy.MixConfigAction_PaymentKey{PaymentKey: &mixTy.PaymentKey{PayingKey: paying, ReceivingKey: receivingKey}} payload.Value = &mixTy.MixConfigAction_PaymentKey{PaymentKey: &mixTy.PaymentKey{ReceiverKey: receiver, SecretKey: secretKey}}
params := &rpctypes.CreateTxIn{ params := &rpctypes.CreateTxIn{
Execer: getRealExecName(paraName, mixTy.MixX), Execer: getRealExecName(paraName, mixTy.MixX),
...@@ -847,8 +847,8 @@ func EncodeSecretDataCmd() *cobra.Command { ...@@ -847,8 +847,8 @@ func EncodeSecretDataCmd() *cobra.Command {
} }
func encodeSecretCmdFlags(cmd *cobra.Command) { func encodeSecretCmdFlags(cmd *cobra.Command) {
cmd.Flags().StringP("payment", "p", "", "payment key") cmd.Flags().StringP("receiver", "p", "", "receiver key")
cmd.MarkFlagRequired("payment") cmd.MarkFlagRequired("receiver")
cmd.Flags().StringP("return", "r", "", "return key") cmd.Flags().StringP("return", "r", "", "return key")
...@@ -861,13 +861,13 @@ func encodeSecretCmdFlags(cmd *cobra.Command) { ...@@ -861,13 +861,13 @@ func encodeSecretCmdFlags(cmd *cobra.Command) {
func encodeSecret(cmd *cobra.Command, args []string) { func encodeSecret(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr") rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
payment, _ := cmd.Flags().GetString("payment") receiver, _ := cmd.Flags().GetString("receiver")
returnKey, _ := cmd.Flags().GetString("return") returnKey, _ := cmd.Flags().GetString("return")
authorize, _ := cmd.Flags().GetString("authorize") authorize, _ := cmd.Flags().GetString("authorize")
amount, _ := cmd.Flags().GetString("amount") amount, _ := cmd.Flags().GetString("amount")
req := mixTy.SecretData{ req := mixTy.SecretData{
PaymentPubKey: payment, ReceiverPubKey: receiver,
ReturnPubKey: returnKey, ReturnPubKey: returnKey,
AuthorizePubKey: authorize, AuthorizePubKey: authorize,
Amount: amount, Amount: amount,
...@@ -911,7 +911,7 @@ func encryptSecret(cmd *cobra.Command, args []string) { ...@@ -911,7 +911,7 @@ func encryptSecret(cmd *cobra.Command, args []string) {
req := mixTy.EncryptSecretData{ req := mixTy.EncryptSecretData{
Secret: secret, Secret: secret,
ReceivingPk: pubkey, SecretPubKey: pubkey,
} }
var res mixTy.DHSecret var res mixTy.DHSecret
...@@ -958,7 +958,7 @@ func decryptSecret(cmd *cobra.Command, args []string) { ...@@ -958,7 +958,7 @@ func decryptSecret(cmd *cobra.Command, args []string) {
req := mixTy.DecryptSecretData{ req := mixTy.DecryptSecretData{
Secret: secret, Secret: secret,
Epk: pubkey, Epk: pubkey,
ReceivingPriKey: prikey, SecretPriKey: prikey,
} }
var res mixTy.SecretData var res mixTy.SecretData
...@@ -991,10 +991,10 @@ func DepositInputsCmd() *cobra.Command { ...@@ -991,10 +991,10 @@ func DepositInputsCmd() *cobra.Command {
} }
func depositSecretCmdFlags(cmd *cobra.Command) { func depositSecretCmdFlags(cmd *cobra.Command) {
cmd.Flags().StringP("payment", "p", "", "payment addr") cmd.Flags().StringP("receiver", "r", "", "receiver addr")
cmd.MarkFlagRequired("payment") cmd.MarkFlagRequired("receiver")
cmd.Flags().StringP("return", "r", "", "return addr") cmd.Flags().StringP("return", "n", "", "return addr")
cmd.Flags().StringP("authorize", "a", "", "authorize addr") cmd.Flags().StringP("authorize", "a", "", "authorize addr")
...@@ -1005,13 +1005,13 @@ func depositSecretCmdFlags(cmd *cobra.Command) { ...@@ -1005,13 +1005,13 @@ func depositSecretCmdFlags(cmd *cobra.Command) {
func depositSecret(cmd *cobra.Command, args []string) { func depositSecret(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr") rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
payment, _ := cmd.Flags().GetString("payment") receiver, _ := cmd.Flags().GetString("receiver")
returnKey, _ := cmd.Flags().GetString("return") returnKey, _ := cmd.Flags().GetString("return")
authorize, _ := cmd.Flags().GetString("authorize") authorize, _ := cmd.Flags().GetString("authorize")
amount, _ := cmd.Flags().GetUint64("amount") amount, _ := cmd.Flags().GetUint64("amount")
req := &mixTy.DepositProofReq{ req := &mixTy.DepositProofReq{
PaymentAddr: payment, ReceiverAddr: receiver,
ReturnAddr: returnKey, ReturnAddr: returnKey,
AuthorizeAddr: authorize, AuthorizeAddr: authorize,
Amount: amount, Amount: amount,
......
...@@ -6,6 +6,7 @@ package executor ...@@ -6,6 +6,7 @@ package executor
import ( import (
"bytes" "bytes"
dbm "github.com/33cn/chain33/common/db" dbm "github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/types" "github.com/33cn/chain33/types"
"github.com/33cn/plugin/plugin/dapp/mix/executor/merkletree" "github.com/33cn/plugin/plugin/dapp/mix/executor/merkletree"
......
...@@ -187,13 +187,13 @@ func GetPaymentPubKey(db dbm.KV, addr string) (*mixTy.PaymentKey, error) { ...@@ -187,13 +187,13 @@ func GetPaymentPubKey(db dbm.KV, addr string) (*mixTy.PaymentKey, error) {
} }
func (a *action) ConfigPaymentPubKey(paykey *mixTy.PaymentKey) (*types.Receipt, error) { func (a *action) ConfigPaymentPubKey(paykey *mixTy.PaymentKey) (*types.Receipt, error) {
if paykey == nil || len(paykey.PayingKey) == 0 || len(paykey.ReceivingKey.X) == 0 || len(paykey.ReceivingKey.Y) == 0 { if paykey == nil || len(paykey.ReceiverKey) == 0 || len(paykey.SecretKey.X) == 0 || len(paykey.SecretKey.Y) == 0 {
return nil, errors.Wrapf(types.ErrInvalidParam, "pubkey=%v", paykey) return nil, errors.Wrapf(types.ErrInvalidParam, "pubkey=%v", paykey)
} }
//直接覆盖 //直接覆盖
return makeConfigPaymentKeyReceipt(&mixTy.PaymentKey{ return makeConfigPaymentKeyReceipt(&mixTy.PaymentKey{
Addr: a.fromaddr, Addr: a.fromaddr,
PayingKey: paykey.PayingKey, ReceiverKey: paykey.ReceiverKey,
ReceivingKey: paykey.ReceivingKey}), nil SecretKey: paykey.SecretKey}), nil
} }
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
package executor package executor
import ( import (
"github.com/33cn/chain33/common"
log "github.com/33cn/chain33/common/log/log15" log "github.com/33cn/chain33/common/log/log15"
drivers "github.com/33cn/chain33/system/dapp" drivers "github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types" "github.com/33cn/chain33/types"
...@@ -62,10 +63,9 @@ func (m *Mix) CheckTx(tx *types.Transaction, index int) error { ...@@ -62,10 +63,9 @@ func (m *Mix) CheckTx(tx *types.Transaction, index int) error {
// mix隐私交易,只私对私需要特殊签名验证 // mix隐私交易,只私对私需要特殊签名验证
return m.DriverBase.CheckTx(tx, index) return m.DriverBase.CheckTx(tx, index)
} }
minTxFee := m.GetAPI().GetConfig().GInt("wallet.minFee") _, _, err := MixTransferInfoVerify(m.GetAPI().GetConfig(), m.GetStateDB(), action.GetTransfer())
_, _, err := MixTransferInfoVerify(m.GetStateDB(), action.GetTransfer(), minTxFee)
if err != nil { if err != nil {
mlog.Error("checkTx", "err", err) mlog.Error("checkTx", "err", err, "txhash", common.ToHex(tx.Hash()))
return err return err
} }
return nil return nil
......
...@@ -7,6 +7,7 @@ package executor ...@@ -7,6 +7,7 @@ package executor
import ( import (
"encoding/hex" "encoding/hex"
"encoding/json" "encoding/json"
"fmt"
"github.com/33cn/chain33/types" "github.com/33cn/chain33/types"
mixTy "github.com/33cn/plugin/plugin/dapp/mix/types" mixTy "github.com/33cn/plugin/plugin/dapp/mix/types"
...@@ -75,15 +76,15 @@ func VerifyCommitValues(inputs []*mixTy.TransferInputPublicInput, outputs []*mix ...@@ -75,15 +76,15 @@ func VerifyCommitValues(inputs []*mixTy.TransferInputPublicInput, outputs []*mix
var inputPoints, outputPoints []*twistededwards.Point var inputPoints, outputPoints []*twistededwards.Point
for _, in := range inputs { for _, in := range inputs {
var p twistededwards.Point var p twistededwards.Point
p.X.SetString(in.AmountX) p.X.SetString(in.ShieldAmountX)
p.Y.SetString(in.AmountY) p.Y.SetString(in.ShieldAmountY)
inputPoints = append(inputPoints, &p) inputPoints = append(inputPoints, &p)
} }
for _, out := range outputs { for _, out := range outputs {
var p twistededwards.Point var p twistededwards.Point
p.X.SetString(out.AmountX) p.X.SetString(out.ShieldAmountX)
p.Y.SetString(out.AmountY) p.Y.SetString(out.ShieldAmountY)
outputPoints = append(outputPoints, &p) outputPoints = append(outputPoints, &p)
} }
//out value add fee //out value add fee
...@@ -107,7 +108,7 @@ func VerifyCommitValues(inputs []*mixTy.TransferInputPublicInput, outputs []*mix ...@@ -107,7 +108,7 @@ func VerifyCommitValues(inputs []*mixTy.TransferInputPublicInput, outputs []*mix
return false return false
} }
func MixTransferInfoVerify(db dbm.KV, transfer *mixTy.MixTransferAction, minFee int64) ([]*mixTy.TransferInputPublicInput, []*mixTy.TransferOutputPublicInput, error) { func MixTransferInfoVerify(cfg *types.Chain33Config, db dbm.KV, transfer *mixTy.MixTransferAction) ([]*mixTy.TransferInputPublicInput, []*mixTy.TransferOutputPublicInput, error) {
var inputs []*mixTy.TransferInputPublicInput var inputs []*mixTy.TransferInputPublicInput
var outputs []*mixTy.TransferOutputPublicInput var outputs []*mixTy.TransferOutputPublicInput
...@@ -128,7 +129,8 @@ func MixTransferInfoVerify(db dbm.KV, transfer *mixTy.MixTransferAction, minFee ...@@ -128,7 +129,8 @@ func MixTransferInfoVerify(db dbm.KV, transfer *mixTy.MixTransferAction, minFee
} }
outputs = append(outputs, change) outputs = append(outputs, change)
if !VerifyCommitValues(inputs, outputs, minFee) { minTxFee := types.Conf(cfg, "config.wallet").GInt("minFee")
if !VerifyCommitValues(inputs, outputs, minTxFee) {
return nil, nil, errors.Wrap(mixTy.ErrSpendInOutValueNotMatch, "verifyValue") return nil, nil, errors.Wrap(mixTy.ErrSpendInOutValueNotMatch, "verifyValue")
} }
...@@ -141,8 +143,7 @@ func MixTransferInfoVerify(db dbm.KV, transfer *mixTy.MixTransferAction, minFee ...@@ -141,8 +143,7 @@ func MixTransferInfoVerify(db dbm.KV, transfer *mixTy.MixTransferAction, minFee
3. add nullifier to pool 3. add nullifier to pool
*/ */
func (a *action) Transfer(transfer *mixTy.MixTransferAction) (*types.Receipt, error) { func (a *action) Transfer(transfer *mixTy.MixTransferAction) (*types.Receipt, error) {
minTxFee := a.api.GetConfig().GInt("wallet.minFee") inputs, outputs, err := MixTransferInfoVerify(a.api.GetConfig(), a.db, transfer)
inputs, outputs, err := MixTransferInfoVerify(a.db, transfer, minTxFee)
if err != nil { if err != nil {
return nil, errors.Wrap(err, "Transfer.MixTransferInfoVerify") return nil, errors.Wrap(err, "Transfer.MixTransferInfoVerify")
} }
......
...@@ -32,8 +32,8 @@ message AuthPubKeys{ ...@@ -32,8 +32,8 @@ message AuthPubKeys{
message PaymentKey{ message PaymentKey{
string addr = 1; string addr = 1;
string payingKey = 2; string receiverKey = 2;
PubKey receivingKey = 3; PubKey secretKey = 3;
} }
enum MixConfigType{ enum MixConfigType{
...@@ -72,7 +72,7 @@ message DHSecret{ ...@@ -72,7 +72,7 @@ message DHSecret{
//Diff-Helman 加密group, for spender, returner, authorizer to decrypt //Diff-Helman 加密group, for spender, returner, authorizer to decrypt
message DHSecretGroup{ message DHSecretGroup{
string payment = 1; string receiver = 1;
string returner = 2; string returner = 2;
string authorize = 3; string authorize = 3;
} }
...@@ -140,16 +140,16 @@ message WithdrawPublicInput { ...@@ -140,16 +140,16 @@ message WithdrawPublicInput {
message TransferInputPublicInput { message TransferInputPublicInput {
string treeRootHash = 1; string treeRootHash = 1;
string amountX = 2; string shieldAmountX = 2;
string amountY = 3; string shieldAmountY = 3;
string authorizeSpendHash = 4; string authorizeSpendHash = 4;
string nullifierHash = 5; string nullifierHash = 5;
} }
message TransferOutputPublicInput { message TransferOutputPublicInput {
string noteHash = 1; string noteHash = 1;
string amountX = 2; string shieldAmountX = 2;
string amountY = 3; string shieldAmountY = 3;
DHSecretGroup dhSecrets = 4; DHSecretGroup dhSecrets = 4;
} }
...@@ -194,11 +194,10 @@ message TreeListResp{ ...@@ -194,11 +194,10 @@ message TreeListResp{
} }
// mix wallet part // mix wallet part
// payKey = hash(spendKey) for zk-snark note spend // receiverPubKey = hash(spendPriKey) for zk-snark note spend
// 用在note内部的payment key
message PaymentKeyPair { message PaymentKeyPair {
string payKey = 1; string receiverPubKey = 1;
string spendKey = 2; string spendPriKey = 2;
} }
// pub = priv*G for diff-helman crypto // pub = priv*G for diff-helman crypto
...@@ -232,7 +231,7 @@ message WalletAddrPrivacy { ...@@ -232,7 +231,7 @@ message WalletAddrPrivacy {
message SecretData{ message SecretData{
string paymentPubKey = 1; string receiverPubKey = 1;
string returnPubKey = 2; string returnPubKey = 2;
string authorizePubKey = 3; string authorizePubKey = 3;
string amount = 4; string amount = 4;
...@@ -246,19 +245,19 @@ message EncodedSecretData{ ...@@ -246,19 +245,19 @@ message EncodedSecretData{
message EncryptSecretData{ message EncryptSecretData{
string secret = 1; string secret = 1;
PubKey receivingPk = 2; PubKey SecretPubKey = 2;
} }
message DecryptSecretData{ message DecryptSecretData{
string secret = 1; string secret = 1;
PrivKey receivingPriKey = 2; PrivKey SecretPriKey = 2;
PubKey epk = 3; PubKey epk = 3;
} }
//一键式获取加密数据 //一键式获取加密数据
message DepositProofReq{ message DepositProofReq{
string paymentAddr = 1; string receiverAddr = 1;
string returnAddr = 2; string returnAddr = 2;
string authorizeAddr = 3; string authorizeAddr = 3;
uint64 amount = 4; uint64 amount = 4;
...@@ -286,13 +285,13 @@ message WithdrawProofReq{ ...@@ -286,13 +285,13 @@ message WithdrawProofReq{
message WithdrawProofResp{ message WithdrawProofResp{
SecretData proof = 1; SecretData secret = 1;
string nullifierHash = 2; string nullifierHash = 2;
string authSpendHash = 3; string authorizeSpendHash = 3;
string noteHash = 4; string noteHash = 4;
string spendPrivKey = 5; string spendPrivKey = 5;
uint32 spendFlag = 6; uint32 spendFlag = 6;
uint32 authFlag = 7; uint32 authorizeFlag = 7;
TreePathProof treeProof = 8; TreePathProof treeProof = 8;
} }
...@@ -306,7 +305,7 @@ message AuthProofResp{ ...@@ -306,7 +305,7 @@ message AuthProofResp{
string authPubKey = 2; string authPubKey = 2;
string authPrivKey = 3; string authPrivKey = 3;
string authHash = 4; string authHash = 4;
string authSpendHash = 5; string authorizeSpendHash = 5;
string noteHash = 6; string noteHash = 6;
uint32 spendFlag = 7; uint32 spendFlag = 7;
TreePathProof treeProof = 8; TreePathProof treeProof = 8;
...@@ -322,7 +321,7 @@ message TransferProofReq{ ...@@ -322,7 +321,7 @@ message TransferProofReq{
} }
//加密了的input/output amount //加密了的input/output amount
message commitValue{ message ShieldAmount{
string X = 1; string X = 1;
string Y = 2; string Y = 2;
} }
...@@ -330,22 +329,22 @@ message commitValue{ ...@@ -330,22 +329,22 @@ message commitValue{
message TransferInputProof{ message TransferInputProof{
SecretData proof = 1; SecretData proof = 1;
string nullifierHash = 2; string nullifierHash = 2;
string authSpendHash = 3; string authorizeSpendHash = 3;
string noteHash = 4; string noteHash = 4;
string spendPrivKey = 5; string spendPrivKey = 5;
uint32 spendFlag = 6; uint32 spendFlag = 6;
uint32 authFlag = 7; uint32 authorizeFlag = 7;
TreePathProof treeProof = 8; TreePathProof treeProof = 8;
commitValue commitValue = 9; ShieldAmount shieldAmount = 9;
string spendRandom = 10; string amountRandom = 10;
} }
message TransferOutputProof{ message TransferOutputProof{
SecretData proof = 1; SecretData proof = 1;
string noteHash = 2; string noteHash = 2;
DHSecretGroup secrets = 3; DHSecretGroup secrets = 3;
commitValue commitValue = 4; ShieldAmount shieldAmount = 4;
string spendRandom = 5; string amountRandom = 5;
} }
...@@ -357,13 +356,13 @@ message TransferProofResp{ ...@@ -357,13 +356,13 @@ message TransferProofResp{
} }
message CommitValueRst{ message ShieldAmountRst{
string noteRandom = 1; string noteRandom = 1;
string transferRandom = 2; string transferRandom = 2;
string changeRandom = 3; string changeRandom = 3;
commitValue note = 4; ShieldAmount note = 4;
commitValue transfer = 5; ShieldAmount transfer = 5;
commitValue change = 6; ShieldAmount change = 6;
} }
...@@ -377,7 +376,7 @@ enum NoteStatus{ ...@@ -377,7 +376,7 @@ enum NoteStatus{
message WalletIndexInfo { message WalletIndexInfo {
string noteHash = 1; string noteHash = 1;
string nullifier = 2; string nullifier = 2;
string authSpendHash = 3; string authorizeSpendHash = 3;
bool isReturner = 4; bool isReturner = 4;
string account = 5; //账户地址 string account = 5; //账户地址
NoteStatus status = 6; NoteStatus status = 6;
...@@ -394,7 +393,7 @@ message WalletDbMixInfo { ...@@ -394,7 +393,7 @@ message WalletDbMixInfo {
message WalletMixIndexReq { message WalletMixIndexReq {
string noteHash = 1; string noteHash = 1;
string nullifier = 2; string nullifier = 2;
string authSpendHash = 3; string authorizeSpendHash = 3;
string account = 5; string account = 5;
int32 status = 6; int32 status = 6;
int32 count = 7; int32 count = 7;
......
...@@ -303,8 +303,8 @@ func (m *AuthPubKeys) GetData() []string { ...@@ -303,8 +303,8 @@ func (m *AuthPubKeys) GetData() []string {
type PaymentKey struct { type PaymentKey struct {
Addr string `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"` Addr string `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"`
PayingKey string `protobuf:"bytes,2,opt,name=payingKey,proto3" json:"payingKey,omitempty"` ReceiverKey string `protobuf:"bytes,2,opt,name=receiverKey,proto3" json:"receiverKey,omitempty"`
ReceivingKey *PubKey `protobuf:"bytes,3,opt,name=receivingKey,proto3" json:"receivingKey,omitempty"` SecretKey *PubKey `protobuf:"bytes,3,opt,name=secretKey,proto3" json:"secretKey,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
...@@ -342,16 +342,16 @@ func (m *PaymentKey) GetAddr() string { ...@@ -342,16 +342,16 @@ func (m *PaymentKey) GetAddr() string {
return "" return ""
} }
func (m *PaymentKey) GetPayingKey() string { func (m *PaymentKey) GetReceiverKey() string {
if m != nil { if m != nil {
return m.PayingKey return m.ReceiverKey
} }
return "" return ""
} }
func (m *PaymentKey) GetReceivingKey() *PubKey { func (m *PaymentKey) GetSecretKey() *PubKey {
if m != nil { if m != nil {
return m.ReceivingKey return m.SecretKey
} }
return nil return nil
} }
...@@ -519,7 +519,7 @@ func (m *DHSecret) GetSecret() string { ...@@ -519,7 +519,7 @@ func (m *DHSecret) GetSecret() string {
//Diff-Helman 加密group, for spender, returner, authorizer to decrypt //Diff-Helman 加密group, for spender, returner, authorizer to decrypt
type DHSecretGroup struct { type DHSecretGroup struct {
Payment string `protobuf:"bytes,1,opt,name=payment,proto3" json:"payment,omitempty"` Receiver string `protobuf:"bytes,1,opt,name=receiver,proto3" json:"receiver,omitempty"`
Returner string `protobuf:"bytes,2,opt,name=returner,proto3" json:"returner,omitempty"` Returner string `protobuf:"bytes,2,opt,name=returner,proto3" json:"returner,omitempty"`
Authorize string `protobuf:"bytes,3,opt,name=authorize,proto3" json:"authorize,omitempty"` Authorize string `protobuf:"bytes,3,opt,name=authorize,proto3" json:"authorize,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
...@@ -552,9 +552,9 @@ func (m *DHSecretGroup) XXX_DiscardUnknown() { ...@@ -552,9 +552,9 @@ func (m *DHSecretGroup) XXX_DiscardUnknown() {
var xxx_messageInfo_DHSecretGroup proto.InternalMessageInfo var xxx_messageInfo_DHSecretGroup proto.InternalMessageInfo
func (m *DHSecretGroup) GetPayment() string { func (m *DHSecretGroup) GetReceiver() string {
if m != nil { if m != nil {
return m.Payment return m.Receiver
} }
return "" return ""
} }
...@@ -1061,8 +1061,8 @@ func (m *WithdrawPublicInput) GetAmount() string { ...@@ -1061,8 +1061,8 @@ func (m *WithdrawPublicInput) GetAmount() string {
type TransferInputPublicInput struct { type TransferInputPublicInput struct {
TreeRootHash string `protobuf:"bytes,1,opt,name=treeRootHash,proto3" json:"treeRootHash,omitempty"` TreeRootHash string `protobuf:"bytes,1,opt,name=treeRootHash,proto3" json:"treeRootHash,omitempty"`
AmountX string `protobuf:"bytes,2,opt,name=amountX,proto3" json:"amountX,omitempty"` ShieldAmountX string `protobuf:"bytes,2,opt,name=shieldAmountX,proto3" json:"shieldAmountX,omitempty"`
AmountY string `protobuf:"bytes,3,opt,name=amountY,proto3" json:"amountY,omitempty"` ShieldAmountY string `protobuf:"bytes,3,opt,name=shieldAmountY,proto3" json:"shieldAmountY,omitempty"`
AuthorizeSpendHash string `protobuf:"bytes,4,opt,name=authorizeSpendHash,proto3" json:"authorizeSpendHash,omitempty"` AuthorizeSpendHash string `protobuf:"bytes,4,opt,name=authorizeSpendHash,proto3" json:"authorizeSpendHash,omitempty"`
NullifierHash string `protobuf:"bytes,5,opt,name=nullifierHash,proto3" json:"nullifierHash,omitempty"` NullifierHash string `protobuf:"bytes,5,opt,name=nullifierHash,proto3" json:"nullifierHash,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
...@@ -1102,16 +1102,16 @@ func (m *TransferInputPublicInput) GetTreeRootHash() string { ...@@ -1102,16 +1102,16 @@ func (m *TransferInputPublicInput) GetTreeRootHash() string {
return "" return ""
} }
func (m *TransferInputPublicInput) GetAmountX() string { func (m *TransferInputPublicInput) GetShieldAmountX() string {
if m != nil { if m != nil {
return m.AmountX return m.ShieldAmountX
} }
return "" return ""
} }
func (m *TransferInputPublicInput) GetAmountY() string { func (m *TransferInputPublicInput) GetShieldAmountY() string {
if m != nil { if m != nil {
return m.AmountY return m.ShieldAmountY
} }
return "" return ""
} }
...@@ -1132,8 +1132,8 @@ func (m *TransferInputPublicInput) GetNullifierHash() string { ...@@ -1132,8 +1132,8 @@ func (m *TransferInputPublicInput) GetNullifierHash() string {
type TransferOutputPublicInput struct { type TransferOutputPublicInput struct {
NoteHash string `protobuf:"bytes,1,opt,name=noteHash,proto3" json:"noteHash,omitempty"` NoteHash string `protobuf:"bytes,1,opt,name=noteHash,proto3" json:"noteHash,omitempty"`
AmountX string `protobuf:"bytes,2,opt,name=amountX,proto3" json:"amountX,omitempty"` ShieldAmountX string `protobuf:"bytes,2,opt,name=shieldAmountX,proto3" json:"shieldAmountX,omitempty"`
AmountY string `protobuf:"bytes,3,opt,name=amountY,proto3" json:"amountY,omitempty"` ShieldAmountY string `protobuf:"bytes,3,opt,name=shieldAmountY,proto3" json:"shieldAmountY,omitempty"`
DhSecrets *DHSecretGroup `protobuf:"bytes,4,opt,name=dhSecrets,proto3" json:"dhSecrets,omitempty"` DhSecrets *DHSecretGroup `protobuf:"bytes,4,opt,name=dhSecrets,proto3" json:"dhSecrets,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
...@@ -1172,16 +1172,16 @@ func (m *TransferOutputPublicInput) GetNoteHash() string { ...@@ -1172,16 +1172,16 @@ func (m *TransferOutputPublicInput) GetNoteHash() string {
return "" return ""
} }
func (m *TransferOutputPublicInput) GetAmountX() string { func (m *TransferOutputPublicInput) GetShieldAmountX() string {
if m != nil { if m != nil {
return m.AmountX return m.ShieldAmountX
} }
return "" return ""
} }
func (m *TransferOutputPublicInput) GetAmountY() string { func (m *TransferOutputPublicInput) GetShieldAmountY() string {
if m != nil { if m != nil {
return m.AmountY return m.ShieldAmountY
} }
return "" return ""
} }
...@@ -1532,11 +1532,10 @@ func (m *TreeListResp) GetDatas() []string { ...@@ -1532,11 +1532,10 @@ func (m *TreeListResp) GetDatas() []string {
} }
// mix wallet part // mix wallet part
// payKey = hash(spendKey) for zk-snark note spend // receiverPubKey = hash(spendPriKey) for zk-snark note spend
// 用在note内部的payment key
type PaymentKeyPair struct { type PaymentKeyPair struct {
PayKey string `protobuf:"bytes,1,opt,name=payKey,proto3" json:"payKey,omitempty"` ReceiverPubKey string `protobuf:"bytes,1,opt,name=receiverPubKey,proto3" json:"receiverPubKey,omitempty"`
SpendKey string `protobuf:"bytes,2,opt,name=spendKey,proto3" json:"spendKey,omitempty"` SpendPriKey string `protobuf:"bytes,2,opt,name=spendPriKey,proto3" json:"spendPriKey,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
...@@ -1567,16 +1566,16 @@ func (m *PaymentKeyPair) XXX_DiscardUnknown() { ...@@ -1567,16 +1566,16 @@ func (m *PaymentKeyPair) XXX_DiscardUnknown() {
var xxx_messageInfo_PaymentKeyPair proto.InternalMessageInfo var xxx_messageInfo_PaymentKeyPair proto.InternalMessageInfo
func (m *PaymentKeyPair) GetPayKey() string { func (m *PaymentKeyPair) GetReceiverPubKey() string {
if m != nil { if m != nil {
return m.PayKey return m.ReceiverPubKey
} }
return "" return ""
} }
func (m *PaymentKeyPair) GetSpendKey() string { func (m *PaymentKeyPair) GetSpendPriKey() string {
if m != nil { if m != nil {
return m.SpendKey return m.SpendPriKey
} }
return "" return ""
} }
...@@ -1814,7 +1813,7 @@ func (m *WalletAddrPrivacy) GetAddr() string { ...@@ -1814,7 +1813,7 @@ func (m *WalletAddrPrivacy) GetAddr() string {
} }
type SecretData struct { type SecretData struct {
PaymentPubKey string `protobuf:"bytes,1,opt,name=paymentPubKey,proto3" json:"paymentPubKey,omitempty"` ReceiverPubKey string `protobuf:"bytes,1,opt,name=receiverPubKey,proto3" json:"receiverPubKey,omitempty"`
ReturnPubKey string `protobuf:"bytes,2,opt,name=returnPubKey,proto3" json:"returnPubKey,omitempty"` ReturnPubKey string `protobuf:"bytes,2,opt,name=returnPubKey,proto3" json:"returnPubKey,omitempty"`
AuthorizePubKey string `protobuf:"bytes,3,opt,name=authorizePubKey,proto3" json:"authorizePubKey,omitempty"` AuthorizePubKey string `protobuf:"bytes,3,opt,name=authorizePubKey,proto3" json:"authorizePubKey,omitempty"`
Amount string `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount,omitempty"` Amount string `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount,omitempty"`
...@@ -1849,9 +1848,9 @@ func (m *SecretData) XXX_DiscardUnknown() { ...@@ -1849,9 +1848,9 @@ func (m *SecretData) XXX_DiscardUnknown() {
var xxx_messageInfo_SecretData proto.InternalMessageInfo var xxx_messageInfo_SecretData proto.InternalMessageInfo
func (m *SecretData) GetPaymentPubKey() string { func (m *SecretData) GetReceiverPubKey() string {
if m != nil { if m != nil {
return m.PaymentPubKey return m.ReceiverPubKey
} }
return "" return ""
} }
...@@ -1933,7 +1932,7 @@ func (m *EncodedSecretData) GetRawData() *SecretData { ...@@ -1933,7 +1932,7 @@ func (m *EncodedSecretData) GetRawData() *SecretData {
type EncryptSecretData struct { type EncryptSecretData struct {
Secret string `protobuf:"bytes,1,opt,name=secret,proto3" json:"secret,omitempty"` Secret string `protobuf:"bytes,1,opt,name=secret,proto3" json:"secret,omitempty"`
ReceivingPk *PubKey `protobuf:"bytes,2,opt,name=receivingPk,proto3" json:"receivingPk,omitempty"` SecretPubKey *PubKey `protobuf:"bytes,2,opt,name=SecretPubKey,proto3" json:"SecretPubKey,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
...@@ -1971,16 +1970,16 @@ func (m *EncryptSecretData) GetSecret() string { ...@@ -1971,16 +1970,16 @@ func (m *EncryptSecretData) GetSecret() string {
return "" return ""
} }
func (m *EncryptSecretData) GetReceivingPk() *PubKey { func (m *EncryptSecretData) GetSecretPubKey() *PubKey {
if m != nil { if m != nil {
return m.ReceivingPk return m.SecretPubKey
} }
return nil return nil
} }
type DecryptSecretData struct { type DecryptSecretData struct {
Secret string `protobuf:"bytes,1,opt,name=secret,proto3" json:"secret,omitempty"` Secret string `protobuf:"bytes,1,opt,name=secret,proto3" json:"secret,omitempty"`
ReceivingPriKey *PrivKey `protobuf:"bytes,2,opt,name=receivingPriKey,proto3" json:"receivingPriKey,omitempty"` SecretPriKey *PrivKey `protobuf:"bytes,2,opt,name=SecretPriKey,proto3" json:"SecretPriKey,omitempty"`
Epk *PubKey `protobuf:"bytes,3,opt,name=epk,proto3" json:"epk,omitempty"` Epk *PubKey `protobuf:"bytes,3,opt,name=epk,proto3" json:"epk,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
...@@ -2019,9 +2018,9 @@ func (m *DecryptSecretData) GetSecret() string { ...@@ -2019,9 +2018,9 @@ func (m *DecryptSecretData) GetSecret() string {
return "" return ""
} }
func (m *DecryptSecretData) GetReceivingPriKey() *PrivKey { func (m *DecryptSecretData) GetSecretPriKey() *PrivKey {
if m != nil { if m != nil {
return m.ReceivingPriKey return m.SecretPriKey
} }
return nil return nil
} }
...@@ -2035,7 +2034,7 @@ func (m *DecryptSecretData) GetEpk() *PubKey { ...@@ -2035,7 +2034,7 @@ func (m *DecryptSecretData) GetEpk() *PubKey {
//一键式获取加密数据 //一键式获取加密数据
type DepositProofReq struct { type DepositProofReq struct {
PaymentAddr string `protobuf:"bytes,1,opt,name=paymentAddr,proto3" json:"paymentAddr,omitempty"` ReceiverAddr string `protobuf:"bytes,1,opt,name=receiverAddr,proto3" json:"receiverAddr,omitempty"`
ReturnAddr string `protobuf:"bytes,2,opt,name=returnAddr,proto3" json:"returnAddr,omitempty"` ReturnAddr string `protobuf:"bytes,2,opt,name=returnAddr,proto3" json:"returnAddr,omitempty"`
AuthorizeAddr string `protobuf:"bytes,3,opt,name=authorizeAddr,proto3" json:"authorizeAddr,omitempty"` AuthorizeAddr string `protobuf:"bytes,3,opt,name=authorizeAddr,proto3" json:"authorizeAddr,omitempty"`
Amount uint64 `protobuf:"varint,4,opt,name=amount,proto3" json:"amount,omitempty"` Amount uint64 `protobuf:"varint,4,opt,name=amount,proto3" json:"amount,omitempty"`
...@@ -2069,9 +2068,9 @@ func (m *DepositProofReq) XXX_DiscardUnknown() { ...@@ -2069,9 +2068,9 @@ func (m *DepositProofReq) XXX_DiscardUnknown() {
var xxx_messageInfo_DepositProofReq proto.InternalMessageInfo var xxx_messageInfo_DepositProofReq proto.InternalMessageInfo
func (m *DepositProofReq) GetPaymentAddr() string { func (m *DepositProofReq) GetReceiverAddr() string {
if m != nil { if m != nil {
return m.PaymentAddr return m.ReceiverAddr
} }
return "" return ""
} }
...@@ -2255,13 +2254,13 @@ func (m *WithdrawProofReq) GetNoteHash() string { ...@@ -2255,13 +2254,13 @@ func (m *WithdrawProofReq) GetNoteHash() string {
} }
type WithdrawProofResp struct { type WithdrawProofResp struct {
Proof *SecretData `protobuf:"bytes,1,opt,name=proof,proto3" json:"proof,omitempty"` Secret *SecretData `protobuf:"bytes,1,opt,name=secret,proto3" json:"secret,omitempty"`
NullifierHash string `protobuf:"bytes,2,opt,name=nullifierHash,proto3" json:"nullifierHash,omitempty"` NullifierHash string `protobuf:"bytes,2,opt,name=nullifierHash,proto3" json:"nullifierHash,omitempty"`
AuthSpendHash string `protobuf:"bytes,3,opt,name=authSpendHash,proto3" json:"authSpendHash,omitempty"` AuthorizeSpendHash string `protobuf:"bytes,3,opt,name=authorizeSpendHash,proto3" json:"authorizeSpendHash,omitempty"`
NoteHash string `protobuf:"bytes,4,opt,name=noteHash,proto3" json:"noteHash,omitempty"` NoteHash string `protobuf:"bytes,4,opt,name=noteHash,proto3" json:"noteHash,omitempty"`
SpendPrivKey string `protobuf:"bytes,5,opt,name=spendPrivKey,proto3" json:"spendPrivKey,omitempty"` SpendPrivKey string `protobuf:"bytes,5,opt,name=spendPrivKey,proto3" json:"spendPrivKey,omitempty"`
SpendFlag uint32 `protobuf:"varint,6,opt,name=spendFlag,proto3" json:"spendFlag,omitempty"` SpendFlag uint32 `protobuf:"varint,6,opt,name=spendFlag,proto3" json:"spendFlag,omitempty"`
AuthFlag uint32 `protobuf:"varint,7,opt,name=authFlag,proto3" json:"authFlag,omitempty"` AuthorizeFlag uint32 `protobuf:"varint,7,opt,name=authorizeFlag,proto3" json:"authorizeFlag,omitempty"`
TreeProof *TreePathProof `protobuf:"bytes,8,opt,name=treeProof,proto3" json:"treeProof,omitempty"` TreeProof *TreePathProof `protobuf:"bytes,8,opt,name=treeProof,proto3" json:"treeProof,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
...@@ -2293,9 +2292,9 @@ func (m *WithdrawProofResp) XXX_DiscardUnknown() { ...@@ -2293,9 +2292,9 @@ func (m *WithdrawProofResp) XXX_DiscardUnknown() {
var xxx_messageInfo_WithdrawProofResp proto.InternalMessageInfo var xxx_messageInfo_WithdrawProofResp proto.InternalMessageInfo
func (m *WithdrawProofResp) GetProof() *SecretData { func (m *WithdrawProofResp) GetSecret() *SecretData {
if m != nil { if m != nil {
return m.Proof return m.Secret
} }
return nil return nil
} }
...@@ -2307,9 +2306,9 @@ func (m *WithdrawProofResp) GetNullifierHash() string { ...@@ -2307,9 +2306,9 @@ func (m *WithdrawProofResp) GetNullifierHash() string {
return "" return ""
} }
func (m *WithdrawProofResp) GetAuthSpendHash() string { func (m *WithdrawProofResp) GetAuthorizeSpendHash() string {
if m != nil { if m != nil {
return m.AuthSpendHash return m.AuthorizeSpendHash
} }
return "" return ""
} }
...@@ -2335,9 +2334,9 @@ func (m *WithdrawProofResp) GetSpendFlag() uint32 { ...@@ -2335,9 +2334,9 @@ func (m *WithdrawProofResp) GetSpendFlag() uint32 {
return 0 return 0
} }
func (m *WithdrawProofResp) GetAuthFlag() uint32 { func (m *WithdrawProofResp) GetAuthorizeFlag() uint32 {
if m != nil { if m != nil {
return m.AuthFlag return m.AuthorizeFlag
} }
return 0 return 0
} }
...@@ -2401,7 +2400,7 @@ type AuthProofResp struct { ...@@ -2401,7 +2400,7 @@ type AuthProofResp struct {
AuthPubKey string `protobuf:"bytes,2,opt,name=authPubKey,proto3" json:"authPubKey,omitempty"` AuthPubKey string `protobuf:"bytes,2,opt,name=authPubKey,proto3" json:"authPubKey,omitempty"`
AuthPrivKey string `protobuf:"bytes,3,opt,name=authPrivKey,proto3" json:"authPrivKey,omitempty"` AuthPrivKey string `protobuf:"bytes,3,opt,name=authPrivKey,proto3" json:"authPrivKey,omitempty"`
AuthHash string `protobuf:"bytes,4,opt,name=authHash,proto3" json:"authHash,omitempty"` AuthHash string `protobuf:"bytes,4,opt,name=authHash,proto3" json:"authHash,omitempty"`
AuthSpendHash string `protobuf:"bytes,5,opt,name=authSpendHash,proto3" json:"authSpendHash,omitempty"` AuthorizeSpendHash string `protobuf:"bytes,5,opt,name=authorizeSpendHash,proto3" json:"authorizeSpendHash,omitempty"`
NoteHash string `protobuf:"bytes,6,opt,name=noteHash,proto3" json:"noteHash,omitempty"` NoteHash string `protobuf:"bytes,6,opt,name=noteHash,proto3" json:"noteHash,omitempty"`
SpendFlag uint32 `protobuf:"varint,7,opt,name=spendFlag,proto3" json:"spendFlag,omitempty"` SpendFlag uint32 `protobuf:"varint,7,opt,name=spendFlag,proto3" json:"spendFlag,omitempty"`
TreeProof *TreePathProof `protobuf:"bytes,8,opt,name=treeProof,proto3" json:"treeProof,omitempty"` TreeProof *TreePathProof `protobuf:"bytes,8,opt,name=treeProof,proto3" json:"treeProof,omitempty"`
...@@ -2463,9 +2462,9 @@ func (m *AuthProofResp) GetAuthHash() string { ...@@ -2463,9 +2462,9 @@ func (m *AuthProofResp) GetAuthHash() string {
return "" return ""
} }
func (m *AuthProofResp) GetAuthSpendHash() string { func (m *AuthProofResp) GetAuthorizeSpendHash() string {
if m != nil { if m != nil {
return m.AuthSpendHash return m.AuthorizeSpendHash
} }
return "" return ""
} }
...@@ -2563,7 +2562,7 @@ func (m *TransferProofReq) GetAmount() uint64 { ...@@ -2563,7 +2562,7 @@ func (m *TransferProofReq) GetAmount() uint64 {
} }
//加密了的input/output amount //加密了的input/output amount
type CommitValue struct { type ShieldAmount struct {
X string `protobuf:"bytes,1,opt,name=X,proto3" json:"X,omitempty"` X string `protobuf:"bytes,1,opt,name=X,proto3" json:"X,omitempty"`
Y string `protobuf:"bytes,2,opt,name=Y,proto3" json:"Y,omitempty"` Y string `protobuf:"bytes,2,opt,name=Y,proto3" json:"Y,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
...@@ -2571,39 +2570,39 @@ type CommitValue struct { ...@@ -2571,39 +2570,39 @@ type CommitValue struct {
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
} }
func (m *CommitValue) Reset() { *m = CommitValue{} } func (m *ShieldAmount) Reset() { *m = ShieldAmount{} }
func (m *CommitValue) String() string { return proto.CompactTextString(m) } func (m *ShieldAmount) String() string { return proto.CompactTextString(m) }
func (*CommitValue) ProtoMessage() {} func (*ShieldAmount) ProtoMessage() {}
func (*CommitValue) Descriptor() ([]byte, []int) { func (*ShieldAmount) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{42} return fileDescriptor_5c21d519a9be369a, []int{42}
} }
func (m *CommitValue) XXX_Unmarshal(b []byte) error { func (m *ShieldAmount) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CommitValue.Unmarshal(m, b) return xxx_messageInfo_ShieldAmount.Unmarshal(m, b)
} }
func (m *CommitValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *ShieldAmount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CommitValue.Marshal(b, m, deterministic) return xxx_messageInfo_ShieldAmount.Marshal(b, m, deterministic)
} }
func (m *CommitValue) XXX_Merge(src proto.Message) { func (m *ShieldAmount) XXX_Merge(src proto.Message) {
xxx_messageInfo_CommitValue.Merge(m, src) xxx_messageInfo_ShieldAmount.Merge(m, src)
} }
func (m *CommitValue) XXX_Size() int { func (m *ShieldAmount) XXX_Size() int {
return xxx_messageInfo_CommitValue.Size(m) return xxx_messageInfo_ShieldAmount.Size(m)
} }
func (m *CommitValue) XXX_DiscardUnknown() { func (m *ShieldAmount) XXX_DiscardUnknown() {
xxx_messageInfo_CommitValue.DiscardUnknown(m) xxx_messageInfo_ShieldAmount.DiscardUnknown(m)
} }
var xxx_messageInfo_CommitValue proto.InternalMessageInfo var xxx_messageInfo_ShieldAmount proto.InternalMessageInfo
func (m *CommitValue) GetX() string { func (m *ShieldAmount) GetX() string {
if m != nil { if m != nil {
return m.X return m.X
} }
return "" return ""
} }
func (m *CommitValue) GetY() string { func (m *ShieldAmount) GetY() string {
if m != nil { if m != nil {
return m.Y return m.Y
} }
...@@ -2613,14 +2612,14 @@ func (m *CommitValue) GetY() string { ...@@ -2613,14 +2612,14 @@ func (m *CommitValue) GetY() string {
type TransferInputProof struct { type TransferInputProof struct {
Proof *SecretData `protobuf:"bytes,1,opt,name=proof,proto3" json:"proof,omitempty"` Proof *SecretData `protobuf:"bytes,1,opt,name=proof,proto3" json:"proof,omitempty"`
NullifierHash string `protobuf:"bytes,2,opt,name=nullifierHash,proto3" json:"nullifierHash,omitempty"` NullifierHash string `protobuf:"bytes,2,opt,name=nullifierHash,proto3" json:"nullifierHash,omitempty"`
AuthSpendHash string `protobuf:"bytes,3,opt,name=authSpendHash,proto3" json:"authSpendHash,omitempty"` AuthorizeSpendHash string `protobuf:"bytes,3,opt,name=authorizeSpendHash,proto3" json:"authorizeSpendHash,omitempty"`
NoteHash string `protobuf:"bytes,4,opt,name=noteHash,proto3" json:"noteHash,omitempty"` NoteHash string `protobuf:"bytes,4,opt,name=noteHash,proto3" json:"noteHash,omitempty"`
SpendPrivKey string `protobuf:"bytes,5,opt,name=spendPrivKey,proto3" json:"spendPrivKey,omitempty"` SpendPrivKey string `protobuf:"bytes,5,opt,name=spendPrivKey,proto3" json:"spendPrivKey,omitempty"`
SpendFlag uint32 `protobuf:"varint,6,opt,name=spendFlag,proto3" json:"spendFlag,omitempty"` SpendFlag uint32 `protobuf:"varint,6,opt,name=spendFlag,proto3" json:"spendFlag,omitempty"`
AuthFlag uint32 `protobuf:"varint,7,opt,name=authFlag,proto3" json:"authFlag,omitempty"` AuthorizeFlag uint32 `protobuf:"varint,7,opt,name=authorizeFlag,proto3" json:"authorizeFlag,omitempty"`
TreeProof *TreePathProof `protobuf:"bytes,8,opt,name=treeProof,proto3" json:"treeProof,omitempty"` TreeProof *TreePathProof `protobuf:"bytes,8,opt,name=treeProof,proto3" json:"treeProof,omitempty"`
CommitValue *CommitValue `protobuf:"bytes,9,opt,name=commitValue,proto3" json:"commitValue,omitempty"` ShieldAmount *ShieldAmount `protobuf:"bytes,9,opt,name=shieldAmount,proto3" json:"shieldAmount,omitempty"`
SpendRandom string `protobuf:"bytes,10,opt,name=spendRandom,proto3" json:"spendRandom,omitempty"` AmountRandom string `protobuf:"bytes,10,opt,name=amountRandom,proto3" json:"amountRandom,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
...@@ -2665,9 +2664,9 @@ func (m *TransferInputProof) GetNullifierHash() string { ...@@ -2665,9 +2664,9 @@ func (m *TransferInputProof) GetNullifierHash() string {
return "" return ""
} }
func (m *TransferInputProof) GetAuthSpendHash() string { func (m *TransferInputProof) GetAuthorizeSpendHash() string {
if m != nil { if m != nil {
return m.AuthSpendHash return m.AuthorizeSpendHash
} }
return "" return ""
} }
...@@ -2693,9 +2692,9 @@ func (m *TransferInputProof) GetSpendFlag() uint32 { ...@@ -2693,9 +2692,9 @@ func (m *TransferInputProof) GetSpendFlag() uint32 {
return 0 return 0
} }
func (m *TransferInputProof) GetAuthFlag() uint32 { func (m *TransferInputProof) GetAuthorizeFlag() uint32 {
if m != nil { if m != nil {
return m.AuthFlag return m.AuthorizeFlag
} }
return 0 return 0
} }
...@@ -2707,16 +2706,16 @@ func (m *TransferInputProof) GetTreeProof() *TreePathProof { ...@@ -2707,16 +2706,16 @@ func (m *TransferInputProof) GetTreeProof() *TreePathProof {
return nil return nil
} }
func (m *TransferInputProof) GetCommitValue() *CommitValue { func (m *TransferInputProof) GetShieldAmount() *ShieldAmount {
if m != nil { if m != nil {
return m.CommitValue return m.ShieldAmount
} }
return nil return nil
} }
func (m *TransferInputProof) GetSpendRandom() string { func (m *TransferInputProof) GetAmountRandom() string {
if m != nil { if m != nil {
return m.SpendRandom return m.AmountRandom
} }
return "" return ""
} }
...@@ -2725,8 +2724,8 @@ type TransferOutputProof struct { ...@@ -2725,8 +2724,8 @@ type TransferOutputProof struct {
Proof *SecretData `protobuf:"bytes,1,opt,name=proof,proto3" json:"proof,omitempty"` Proof *SecretData `protobuf:"bytes,1,opt,name=proof,proto3" json:"proof,omitempty"`
NoteHash string `protobuf:"bytes,2,opt,name=noteHash,proto3" json:"noteHash,omitempty"` NoteHash string `protobuf:"bytes,2,opt,name=noteHash,proto3" json:"noteHash,omitempty"`
Secrets *DHSecretGroup `protobuf:"bytes,3,opt,name=secrets,proto3" json:"secrets,omitempty"` Secrets *DHSecretGroup `protobuf:"bytes,3,opt,name=secrets,proto3" json:"secrets,omitempty"`
CommitValue *CommitValue `protobuf:"bytes,4,opt,name=commitValue,proto3" json:"commitValue,omitempty"` ShieldAmount *ShieldAmount `protobuf:"bytes,4,opt,name=shieldAmount,proto3" json:"shieldAmount,omitempty"`
SpendRandom string `protobuf:"bytes,5,opt,name=spendRandom,proto3" json:"spendRandom,omitempty"` AmountRandom string `protobuf:"bytes,5,opt,name=amountRandom,proto3" json:"amountRandom,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
...@@ -2778,16 +2777,16 @@ func (m *TransferOutputProof) GetSecrets() *DHSecretGroup { ...@@ -2778,16 +2777,16 @@ func (m *TransferOutputProof) GetSecrets() *DHSecretGroup {
return nil return nil
} }
func (m *TransferOutputProof) GetCommitValue() *CommitValue { func (m *TransferOutputProof) GetShieldAmount() *ShieldAmount {
if m != nil { if m != nil {
return m.CommitValue return m.ShieldAmount
} }
return nil return nil
} }
func (m *TransferOutputProof) GetSpendRandom() string { func (m *TransferOutputProof) GetAmountRandom() string {
if m != nil { if m != nil {
return m.SpendRandom return m.AmountRandom
} }
return "" return ""
} }
...@@ -2847,79 +2846,79 @@ func (m *TransferProofResp) GetChangeOutput() *TransferOutputProof { ...@@ -2847,79 +2846,79 @@ func (m *TransferProofResp) GetChangeOutput() *TransferOutputProof {
return nil return nil
} }
type CommitValueRst struct { type ShieldAmountRst struct {
NoteRandom string `protobuf:"bytes,1,opt,name=noteRandom,proto3" json:"noteRandom,omitempty"` NoteRandom string `protobuf:"bytes,1,opt,name=noteRandom,proto3" json:"noteRandom,omitempty"`
TransferRandom string `protobuf:"bytes,2,opt,name=transferRandom,proto3" json:"transferRandom,omitempty"` TransferRandom string `protobuf:"bytes,2,opt,name=transferRandom,proto3" json:"transferRandom,omitempty"`
ChangeRandom string `protobuf:"bytes,3,opt,name=changeRandom,proto3" json:"changeRandom,omitempty"` ChangeRandom string `protobuf:"bytes,3,opt,name=changeRandom,proto3" json:"changeRandom,omitempty"`
Note *CommitValue `protobuf:"bytes,4,opt,name=note,proto3" json:"note,omitempty"` Note *ShieldAmount `protobuf:"bytes,4,opt,name=note,proto3" json:"note,omitempty"`
Transfer *CommitValue `protobuf:"bytes,5,opt,name=transfer,proto3" json:"transfer,omitempty"` Transfer *ShieldAmount `protobuf:"bytes,5,opt,name=transfer,proto3" json:"transfer,omitempty"`
Change *CommitValue `protobuf:"bytes,6,opt,name=change,proto3" json:"change,omitempty"` Change *ShieldAmount `protobuf:"bytes,6,opt,name=change,proto3" json:"change,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
} }
func (m *CommitValueRst) Reset() { *m = CommitValueRst{} } func (m *ShieldAmountRst) Reset() { *m = ShieldAmountRst{} }
func (m *CommitValueRst) String() string { return proto.CompactTextString(m) } func (m *ShieldAmountRst) String() string { return proto.CompactTextString(m) }
func (*CommitValueRst) ProtoMessage() {} func (*ShieldAmountRst) ProtoMessage() {}
func (*CommitValueRst) Descriptor() ([]byte, []int) { func (*ShieldAmountRst) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{46} return fileDescriptor_5c21d519a9be369a, []int{46}
} }
func (m *CommitValueRst) XXX_Unmarshal(b []byte) error { func (m *ShieldAmountRst) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CommitValueRst.Unmarshal(m, b) return xxx_messageInfo_ShieldAmountRst.Unmarshal(m, b)
} }
func (m *CommitValueRst) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *ShieldAmountRst) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CommitValueRst.Marshal(b, m, deterministic) return xxx_messageInfo_ShieldAmountRst.Marshal(b, m, deterministic)
} }
func (m *CommitValueRst) XXX_Merge(src proto.Message) { func (m *ShieldAmountRst) XXX_Merge(src proto.Message) {
xxx_messageInfo_CommitValueRst.Merge(m, src) xxx_messageInfo_ShieldAmountRst.Merge(m, src)
} }
func (m *CommitValueRst) XXX_Size() int { func (m *ShieldAmountRst) XXX_Size() int {
return xxx_messageInfo_CommitValueRst.Size(m) return xxx_messageInfo_ShieldAmountRst.Size(m)
} }
func (m *CommitValueRst) XXX_DiscardUnknown() { func (m *ShieldAmountRst) XXX_DiscardUnknown() {
xxx_messageInfo_CommitValueRst.DiscardUnknown(m) xxx_messageInfo_ShieldAmountRst.DiscardUnknown(m)
} }
var xxx_messageInfo_CommitValueRst proto.InternalMessageInfo var xxx_messageInfo_ShieldAmountRst proto.InternalMessageInfo
func (m *CommitValueRst) GetNoteRandom() string { func (m *ShieldAmountRst) GetNoteRandom() string {
if m != nil { if m != nil {
return m.NoteRandom return m.NoteRandom
} }
return "" return ""
} }
func (m *CommitValueRst) GetTransferRandom() string { func (m *ShieldAmountRst) GetTransferRandom() string {
if m != nil { if m != nil {
return m.TransferRandom return m.TransferRandom
} }
return "" return ""
} }
func (m *CommitValueRst) GetChangeRandom() string { func (m *ShieldAmountRst) GetChangeRandom() string {
if m != nil { if m != nil {
return m.ChangeRandom return m.ChangeRandom
} }
return "" return ""
} }
func (m *CommitValueRst) GetNote() *CommitValue { func (m *ShieldAmountRst) GetNote() *ShieldAmount {
if m != nil { if m != nil {
return m.Note return m.Note
} }
return nil return nil
} }
func (m *CommitValueRst) GetTransfer() *CommitValue { func (m *ShieldAmountRst) GetTransfer() *ShieldAmount {
if m != nil { if m != nil {
return m.Transfer return m.Transfer
} }
return nil return nil
} }
func (m *CommitValueRst) GetChange() *CommitValue { func (m *ShieldAmountRst) GetChange() *ShieldAmount {
if m != nil { if m != nil {
return m.Change return m.Change
} }
...@@ -2929,7 +2928,7 @@ func (m *CommitValueRst) GetChange() *CommitValue { ...@@ -2929,7 +2928,7 @@ func (m *CommitValueRst) GetChange() *CommitValue {
type WalletIndexInfo struct { type WalletIndexInfo struct {
NoteHash string `protobuf:"bytes,1,opt,name=noteHash,proto3" json:"noteHash,omitempty"` NoteHash string `protobuf:"bytes,1,opt,name=noteHash,proto3" json:"noteHash,omitempty"`
Nullifier string `protobuf:"bytes,2,opt,name=nullifier,proto3" json:"nullifier,omitempty"` Nullifier string `protobuf:"bytes,2,opt,name=nullifier,proto3" json:"nullifier,omitempty"`
AuthSpendHash string `protobuf:"bytes,3,opt,name=authSpendHash,proto3" json:"authSpendHash,omitempty"` AuthorizeSpendHash string `protobuf:"bytes,3,opt,name=authorizeSpendHash,proto3" json:"authorizeSpendHash,omitempty"`
IsReturner bool `protobuf:"varint,4,opt,name=isReturner,proto3" json:"isReturner,omitempty"` IsReturner bool `protobuf:"varint,4,opt,name=isReturner,proto3" json:"isReturner,omitempty"`
Account string `protobuf:"bytes,5,opt,name=account,proto3" json:"account,omitempty"` Account string `protobuf:"bytes,5,opt,name=account,proto3" json:"account,omitempty"`
Status NoteStatus `protobuf:"varint,6,opt,name=status,proto3,enum=types.NoteStatus" json:"status,omitempty"` Status NoteStatus `protobuf:"varint,6,opt,name=status,proto3,enum=types.NoteStatus" json:"status,omitempty"`
...@@ -2978,9 +2977,9 @@ func (m *WalletIndexInfo) GetNullifier() string { ...@@ -2978,9 +2977,9 @@ func (m *WalletIndexInfo) GetNullifier() string {
return "" return ""
} }
func (m *WalletIndexInfo) GetAuthSpendHash() string { func (m *WalletIndexInfo) GetAuthorizeSpendHash() string {
if m != nil { if m != nil {
return m.AuthSpendHash return m.AuthorizeSpendHash
} }
return "" return ""
} }
...@@ -3063,7 +3062,7 @@ func (m *WalletDbMixInfo) GetTxIndex() string { ...@@ -3063,7 +3062,7 @@ func (m *WalletDbMixInfo) GetTxIndex() string {
type WalletMixIndexReq struct { type WalletMixIndexReq struct {
NoteHash string `protobuf:"bytes,1,opt,name=noteHash,proto3" json:"noteHash,omitempty"` NoteHash string `protobuf:"bytes,1,opt,name=noteHash,proto3" json:"noteHash,omitempty"`
Nullifier string `protobuf:"bytes,2,opt,name=nullifier,proto3" json:"nullifier,omitempty"` Nullifier string `protobuf:"bytes,2,opt,name=nullifier,proto3" json:"nullifier,omitempty"`
AuthSpendHash string `protobuf:"bytes,3,opt,name=authSpendHash,proto3" json:"authSpendHash,omitempty"` AuthorizeSpendHash string `protobuf:"bytes,3,opt,name=authorizeSpendHash,proto3" json:"authorizeSpendHash,omitempty"`
Account string `protobuf:"bytes,5,opt,name=account,proto3" json:"account,omitempty"` Account string `protobuf:"bytes,5,opt,name=account,proto3" json:"account,omitempty"`
Status int32 `protobuf:"varint,6,opt,name=status,proto3" json:"status,omitempty"` Status int32 `protobuf:"varint,6,opt,name=status,proto3" json:"status,omitempty"`
Count int32 `protobuf:"varint,7,opt,name=count,proto3" json:"count,omitempty"` Count int32 `protobuf:"varint,7,opt,name=count,proto3" json:"count,omitempty"`
...@@ -3112,9 +3111,9 @@ func (m *WalletMixIndexReq) GetNullifier() string { ...@@ -3112,9 +3111,9 @@ func (m *WalletMixIndexReq) GetNullifier() string {
return "" return ""
} }
func (m *WalletMixIndexReq) GetAuthSpendHash() string { func (m *WalletMixIndexReq) GetAuthorizeSpendHash() string {
if m != nil { if m != nil {
return m.AuthSpendHash return m.AuthorizeSpendHash
} }
return "" return ""
} }
...@@ -3634,11 +3633,11 @@ func init() { ...@@ -3634,11 +3633,11 @@ func init() {
proto.RegisterType((*AuthProofReq)(nil), "types.AuthProofReq") proto.RegisterType((*AuthProofReq)(nil), "types.AuthProofReq")
proto.RegisterType((*AuthProofResp)(nil), "types.AuthProofResp") proto.RegisterType((*AuthProofResp)(nil), "types.AuthProofResp")
proto.RegisterType((*TransferProofReq)(nil), "types.TransferProofReq") proto.RegisterType((*TransferProofReq)(nil), "types.TransferProofReq")
proto.RegisterType((*CommitValue)(nil), "types.commitValue") proto.RegisterType((*ShieldAmount)(nil), "types.ShieldAmount")
proto.RegisterType((*TransferInputProof)(nil), "types.TransferInputProof") proto.RegisterType((*TransferInputProof)(nil), "types.TransferInputProof")
proto.RegisterType((*TransferOutputProof)(nil), "types.TransferOutputProof") proto.RegisterType((*TransferOutputProof)(nil), "types.TransferOutputProof")
proto.RegisterType((*TransferProofResp)(nil), "types.TransferProofResp") proto.RegisterType((*TransferProofResp)(nil), "types.TransferProofResp")
proto.RegisterType((*CommitValueRst)(nil), "types.CommitValueRst") proto.RegisterType((*ShieldAmountRst)(nil), "types.ShieldAmountRst")
proto.RegisterType((*WalletIndexInfo)(nil), "types.WalletIndexInfo") proto.RegisterType((*WalletIndexInfo)(nil), "types.WalletIndexInfo")
proto.RegisterType((*WalletDbMixInfo)(nil), "types.WalletDbMixInfo") proto.RegisterType((*WalletDbMixInfo)(nil), "types.WalletDbMixInfo")
proto.RegisterType((*WalletMixIndexReq)(nil), "types.WalletMixIndexReq") proto.RegisterType((*WalletMixIndexReq)(nil), "types.WalletMixIndexReq")
...@@ -3658,164 +3657,165 @@ func init() { ...@@ -3658,164 +3657,165 @@ func init() {
} }
var fileDescriptor_5c21d519a9be369a = []byte{ var fileDescriptor_5c21d519a9be369a = []byte{
// 2504 bytes of a gzipped FileDescriptorProto // 2515 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x59, 0x4b, 0x93, 0x23, 0x47, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x59, 0xcd, 0x6e, 0x1b, 0xc9,
0x11, 0x56, 0xeb, 0xad, 0xd4, 0x63, 0xa4, 0xda, 0xf5, 0x58, 0x9e, 0xc0, 0x66, 0x28, 0xaf, 0x97, 0x11, 0xd6, 0xf0, 0x57, 0x2c, 0x91, 0x12, 0xd5, 0xf6, 0x6a, 0x69, 0x21, 0xeb, 0x28, 0xbd, 0x5e,
0xf1, 0x98, 0x18, 0xcc, 0xec, 0xe2, 0x30, 0x07, 0xec, 0x10, 0x2b, 0xcd, 0x4a, 0xde, 0x1d, 0x8d, 0xaf, 0x22, 0x07, 0xda, 0x0d, 0xed, 0x38, 0xc9, 0x21, 0xbb, 0x60, 0x4c, 0xca, 0xe4, 0xda, 0xa2,
0xa2, 0xa4, 0x7d, 0x02, 0x87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85, 0xd9, 0x70, 0xcc, 0xa3, 0x1e, 0x1e, 0x08, 0x7d, 0xd3, 0x76, 0x46, 0xdb, 0xe5, 0x58, 0xec, 0x86, 0xbe, 0x33,
0xad, 0x19, 0x5f, 0x40, 0x39, 0xe2, 0x7e, 0xb4, 0x15, 0x0a, 0xf1, 0x9a, 0xb2, 0xb3, 0x13, 0x32, 0x39, 0xc1, 0x2b, 0xe8, 0x53, 0x58, 0x13, 0x43, 0x98, 0x0f, 0x97, 0x1a, 0xf1, 0x19, 0x94, 0x8c,
0xe2, 0x81, 0x82, 0x13, 0xaf, 0xb2, 0xfc, 0xa7, 0xf9, 0xbd, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0xf0, 0xa3, 0x8d, 0x18, 0xc4, 0x6b, 0xca, 0xf6, 0x76, 0xac, 0x48, 0x26, 0x0a, 0x5e, 0x79, 0x95,
0xa5, 0x75, 0x24, 0x52, 0x69, 0x1f, 0x00, 0x00, 0xe3, 0xff, 0xe8, 0xdf, 0xfd, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x55, 0xb5, 0x08, 0xed, 0x06,
0x20, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -6,7 +6,7 @@ package wallet ...@@ -6,7 +6,7 @@ package wallet
import ( import (
"bytes" "bytes"
"fmt"
"github.com/33cn/chain33/system/dapp" "github.com/33cn/chain33/system/dapp"
"github.com/pkg/errors" "github.com/pkg/errors"
...@@ -20,14 +20,16 @@ import ( ...@@ -20,14 +20,16 @@ import (
fr_bn256 "github.com/consensys/gurvy/bn256/fr" fr_bn256 "github.com/consensys/gurvy/bn256/fr"
) )
const CECBLOCKSIZE = 32
// newPrivacyWithPrivKey create privacy from private key // newPrivacyWithPrivKey create privacy from private key
//payment, payPrivKey=hash(privkey), payPubkey=hash(payPrivKey) //payment, payPrivKey=hash(privkey), payPubkey=hash(payPrivKey)
//DH crypt key, prikey=payPrikey, pubKey=payPrikey*G //DH crypt key, prikey=payPrikey, pubKey=payPrikey*G
func newPrivacyWithPrivKey(privKey []byte) (*mixTy.AccountPrivacyKey, error) { func newPrivacyWithPrivKey(privKey []byte) (*mixTy.AccountPrivacyKey, error) {
payPrivacyKey := mimcHashByte([][]byte{privKey}) payPrivacyKey := mimcHashByte([][]byte{privKey})
paymentKey := &mixTy.PaymentKeyPair{} paymentKey := &mixTy.PaymentKeyPair{}
paymentKey.SpendKey = getFrString(payPrivacyKey) paymentKey.SpendPriKey = getFrString(payPrivacyKey)
paymentKey.PayKey = getFrString(mimcHashByte([][]byte{payPrivacyKey})) paymentKey.ReceiverPubKey = getFrString(mimcHashByte([][]byte{payPrivacyKey}))
shareSecretKey := &mixTy.ShareSecretKeyPair{} shareSecretKey := &mixTy.ShareSecretKeyPair{}
ecdh := NewCurveBn256ECDH() ecdh := NewCurveBn256ECDH()
...@@ -44,13 +46,13 @@ func newPrivacyWithPrivKey(privKey []byte) (*mixTy.AccountPrivacyKey, error) { ...@@ -44,13 +46,13 @@ func newPrivacyWithPrivKey(privKey []byte) (*mixTy.AccountPrivacyKey, error) {
//填充算法有pkcs5,pkcs7, 比如Pkcs5的思想填充的值为填充的长度,比如加密he,不足8 //填充算法有pkcs5,pkcs7, 比如Pkcs5的思想填充的值为填充的长度,比如加密he,不足8
//则填充为he666666, 解密后直接算最后一个值为6,把解密值的后6个Byte去掉即可 //则填充为he666666, 解密后直接算最后一个值为6,把解密值的后6个Byte去掉即可
func pKCS5Padding(plainText []byte, blockSize int) []byte { func pKCS5Padding(plainText []byte, blockSize int) []byte {
if blockSize < 32 { if blockSize < CECBLOCKSIZE {
blockSize = 32 blockSize = CECBLOCKSIZE
} }
padding := blockSize - (len(plainText) % blockSize) padding := blockSize - (len(plainText) % blockSize)
fmt.Println("pading", "passsize", blockSize, "plaintext", len(plainText), "pad", padding) //fmt.Println("pading", "passsize", blockSize, "plaintext", len(plainText), "pad", padding)
padText := bytes.Repeat([]byte{byte(padding)}, padding) padText := bytes.Repeat([]byte{byte(padding)}, padding)
fmt.Println("padding", padding, "text", common.ToHex(padText[:])) //fmt.Println("padding", padding, "text", common.ToHex(padText[:]))
newText := append(plainText, padText...) newText := append(plainText, padText...)
return newText return newText
} }
...@@ -196,9 +198,7 @@ func (policy *mixPolicy) savePrivacyPair(addr string) (*mixTy.WalletAddrPrivacy, ...@@ -196,9 +198,7 @@ func (policy *mixPolicy) savePrivacyPair(addr string) (*mixTy.WalletAddrPrivacy,
} }
password := []byte(policy.getWalletOperate().GetPassword()) password := []byte(policy.getWalletOperate().GetPassword())
bizlog.Info("savePrivacyPair", "newprivacy", newPrivacy.PaymentKey.PayKey, "password", common.ToHex(password))
encryptered := encryptDataWithPadding(password, types.Encode(newPrivacy)) encryptered := encryptDataWithPadding(password, types.Encode(newPrivacy))
bizlog.Info("savePrivacyPair--2")
//save the privacy created to wallet db //save the privacy created to wallet db
policy.store.setAccountPrivacy(addr, encryptered) policy.store.setAccountPrivacy(addr, encryptered)
return &mixTy.WalletAddrPrivacy{Privacy: newPrivacy, Addr: addr}, nil return &mixTy.WalletAddrPrivacy{Privacy: newPrivacy, Addr: addr}, nil
...@@ -312,7 +312,7 @@ func (policy *mixPolicy) rescanNotes() { ...@@ -312,7 +312,7 @@ func (policy *mixPolicy) rescanNotes() {
txInfo.Index = mixTxInfos.Txs[txcount-1].GetIndex() txInfo.Index = mixTxInfos.Txs[txcount-1].GetIndex()
} }
policy.getPrivacyTxDetailByHashs(&ReqHashes) policy.processPrivcyTxs(&ReqHashes)
if txcount < int(MaxTxHashsPerTime) { if txcount < int(MaxTxHashsPerTime) {
break break
} }
...@@ -322,16 +322,25 @@ func (policy *mixPolicy) rescanNotes() { ...@@ -322,16 +322,25 @@ func (policy *mixPolicy) rescanNotes() {
return return
} }
func (policy *mixPolicy) getPrivacyTxDetailByHashs(ReqHashes *types.ReqHashes) { func (policy *mixPolicy) processPrivcyTxs(ReqHashes *types.ReqHashes) {
//通过txhashs获取对应的txdetail //通过txhashs获取对应的txdetail
txDetails, err := policy.getWalletOperate().GetAPI().GetTransactionByHash(ReqHashes) txDetails, err := policy.getWalletOperate().GetAPI().GetTransactionByHash(ReqHashes)
if err != nil { if err != nil {
bizlog.Error("getPrivacyTxDetailByHashs", "GetTransactionByHash error", err) bizlog.Error("processPrivcyTx", "GetTransactionByHash error", err)
return return
} }
for _, tx := range txDetails.Txs { for _, tx := range txDetails.Txs {
policy.processMixTx(tx.Tx, tx.Height, tx.Index) if tx.Receipt.Ty != types.ExecOk {
bizlog.Error("processPrivcyTx wrong tx", "receipt ty", tx.Receipt.Ty, "hash", common.ToHex(tx.Tx.Hash()))
continue
}
set, err := policy.processMixTx(tx.Tx, tx.Height, tx.Index)
if err != nil {
bizlog.Error("processPrivcyTx", "processMixTx error", err)
continue
}
policy.store.setKvs(set)
} }
} }
...@@ -382,7 +391,7 @@ func (policy *mixPolicy) showAccountNoteInfo(addrs []string) (*mixTy.WalletIndex ...@@ -382,7 +391,7 @@ func (policy *mixPolicy) showAccountNoteInfo(addrs []string) (*mixTy.WalletIndex
if err != nil { if err != nil {
return nil, err return nil, err
} }
resps.Datas = append(resps.Datas, resp.(*mixTy.WalletIndexResp).Datas...) resps.Notes = append(resps.Notes, resp.(*mixTy.WalletIndexResp).Notes...)
} }
return &resps, nil return &resps, nil
} }
...@@ -199,7 +199,7 @@ func (e *mixPolicy) listMixInfos(req *mixTy.WalletMixIndexReq) (types.Message, e ...@@ -199,7 +199,7 @@ func (e *mixPolicy) listMixInfos(req *mixTy.WalletMixIndexReq) (types.Message, e
indexName = "noteHash" indexName = "noteHash"
} else if len(req.Nullifier) > 0 { } else if len(req.Nullifier) > 0 {
indexName = "nullifier" indexName = "nullifier"
} else if len(req.AuthSpendHash) > 0 { } else if len(req.AuthorizeSpendHash) > 0 {
indexName = "authSpendHash" indexName = "authSpendHash"
} else if len(req.Account) > 0 { } else if len(req.Account) > 0 {
indexName = "account" indexName = "account"
...@@ -211,7 +211,7 @@ func (e *mixPolicy) listMixInfos(req *mixTy.WalletMixIndexReq) (types.Message, e ...@@ -211,7 +211,7 @@ func (e *mixPolicy) listMixInfos(req *mixTy.WalletMixIndexReq) (types.Message, e
WalletDbMixInfo: &mixTy.WalletDbMixInfo{Info: &mixTy.WalletIndexInfo{ WalletDbMixInfo: &mixTy.WalletDbMixInfo{Info: &mixTy.WalletIndexInfo{
NoteHash: req.NoteHash, NoteHash: req.NoteHash,
Nullifier: req.Nullifier, Nullifier: req.Nullifier,
AuthSpendHash: req.AuthSpendHash, AuthorizeSpendHash: req.AuthorizeSpendHash,
Account: req.Account, Account: req.Account,
Status: mixTy.NoteStatus(req.Status), Status: mixTy.NoteStatus(req.Status),
}}, }},
...@@ -224,7 +224,7 @@ func (e *mixPolicy) listMixInfos(req *mixTy.WalletMixIndexReq) (types.Message, e ...@@ -224,7 +224,7 @@ func (e *mixPolicy) listMixInfos(req *mixTy.WalletMixIndexReq) (types.Message, e
} }
rows, err := query.ListIndex(indexName, prefix, primary, req.Count, req.Direction) rows, err := query.ListIndex(indexName, prefix, primary, req.Count, req.Direction)
if err != nil { if err != nil {
bizlog.Error("listMixInfos query failed", "indexName", indexName, "prefix", prefix, "key", string(primary), "err", err) bizlog.Error("listMixInfos query failed", "indexName", indexName, "prefix", string(prefix), "key", string(primary), "err", err)
return nil, err return nil, err
} }
if len(rows) == 0 { if len(rows) == 0 {
...@@ -276,8 +276,8 @@ func (p *mixPolicy) processSecretGroup(noteHash string, secretGroup *mixTy.DHSec ...@@ -276,8 +276,8 @@ func (p *mixPolicy) processSecretGroup(noteHash string, secretGroup *mixTy.DHSec
} }
//可能自己账户里面既有spender,也有returner 或authorize,都要解一遍 //可能自己账户里面既有spender,也有returner 或authorize,都要解一遍
if len(secretGroup.Payment) > 0 { if len(secretGroup.Receiver) > 0 {
info, err := p.decodeSecret(noteHash, secretGroup.Payment, privacyKeys) info, err := p.decodeSecret(noteHash, secretGroup.Receiver, privacyKeys)
if err != nil { if err != nil {
bizlog.Error("processSecretGroup.spender", "err", err) bizlog.Error("processSecretGroup.spender", "err", err)
} }
...@@ -330,16 +330,18 @@ func (p *mixPolicy) decodeSecret(noteHash string, secretData string, privacyKeys ...@@ -330,16 +330,18 @@ func (p *mixPolicy) decodeSecret(noteHash string, secretData string, privacyKeys
bizlog.Info("processSecret.decryptData", "decrypt for notehash", noteHash, "secret", secretData, "addr", key.Addr, "err", err) bizlog.Info("processSecret.decryptData", "decrypt for notehash", noteHash, "secret", secretData, "addr", key.Addr, "err", err)
continue continue
} }
bizlog.Info("processSecret.decryptData OK", "decrypt for notehash", noteHash, "addr", key.Addr)
var rawData mixTy.SecretData var rawData mixTy.SecretData
err = types.Decode(decryptData, &rawData) err = types.Decode(decryptData, &rawData)
if err != nil { if err != nil {
bizlog.Info("processSecret.DecrypterPrivkey", "err", err) bizlog.Info("processSecret.decode rawData", "addr", key.Addr, "err", err)
continue continue
} }
if rawData.PaymentPubKey == key.Privacy.PaymentKey.PayKey || bizlog.Info("processSecret.decode rawData OK", "notehash", noteHash, "addr", key.Addr)
rawData.ReturnPubKey == key.Privacy.PaymentKey.PayKey ||
rawData.AuthorizePubKey == key.Privacy.PaymentKey.PayKey { if rawData.ReceiverPubKey == key.Privacy.PaymentKey.ReceiverPubKey ||
rawData.ReturnPubKey == key.Privacy.PaymentKey.ReceiverPubKey ||
rawData.AuthorizePubKey == key.Privacy.PaymentKey.ReceiverPubKey {
//decrypted, save database //decrypted, save database
var info mixTy.WalletIndexInfo var info mixTy.WalletIndexInfo
info.NoteHash = noteHash info.NoteHash = noteHash
...@@ -347,12 +349,13 @@ func (p *mixPolicy) decodeSecret(noteHash string, secretData string, privacyKeys ...@@ -347,12 +349,13 @@ func (p *mixPolicy) decodeSecret(noteHash string, secretData string, privacyKeys
//如果自己是spender,则记录有关spenderAuthHash,如果是returner,则记录returnerAuthHash //如果自己是spender,则记录有关spenderAuthHash,如果是returner,则记录returnerAuthHash
//如果授权为spenderAuthHash,则根据授权hash索引到本地数据库,spender更新本地为VALID,returner侧不变仍为FROZEN,花费后,两端都变为USED //如果授权为spenderAuthHash,则根据授权hash索引到本地数据库,spender更新本地为VALID,returner侧不变仍为FROZEN,花费后,两端都变为USED
//如果授权为returnerAuthHash,则returner更新本地为VALID,spender侧仍为FROZEN, //如果授权为returnerAuthHash,则returner更新本地为VALID,spender侧仍为FROZEN,
info.AuthorizeSpendHash = "0"
if len(rawData.AuthorizePubKey) > LENNULLKEY { if len(rawData.AuthorizePubKey) > LENNULLKEY {
if rawData.PaymentPubKey == key.Privacy.PaymentKey.PayKey { if rawData.ReceiverPubKey == key.Privacy.PaymentKey.ReceiverPubKey {
info.AuthSpendHash = getFrString(mimcHashString([]string{rawData.PaymentPubKey, rawData.Amount, rawData.NoteRandom})) info.AuthorizeSpendHash = getFrString(mimcHashString([]string{rawData.ReceiverPubKey, rawData.Amount, rawData.NoteRandom}))
} else if rawData.ReturnPubKey == key.Privacy.PaymentKey.PayKey { } else if rawData.ReturnPubKey == key.Privacy.PaymentKey.ReceiverPubKey {
info.IsReturner = true info.IsReturner = true
info.AuthSpendHash = getFrString(mimcHashString([]string{rawData.ReturnPubKey, rawData.Amount, rawData.NoteRandom})) info.AuthorizeSpendHash = getFrString(mimcHashString([]string{rawData.ReturnPubKey, rawData.Amount, rawData.NoteRandom}))
} }
} }
......
...@@ -71,7 +71,7 @@ func (r *MixRow) Get(key string) ([]byte, error) { ...@@ -71,7 +71,7 @@ func (r *MixRow) Get(key string) ([]byte, error) {
case "nullifier": case "nullifier":
return []byte(r.Info.Nullifier), nil return []byte(r.Info.Nullifier), nil
case "authSpendHash": case "authSpendHash":
return []byte(r.Info.AuthSpendHash), nil return []byte(r.Info.AuthorizeSpendHash), nil
case "account": case "account":
return []byte(r.Info.Account), nil return []byte(r.Info.Account), nil
case "status": case "status":
......
...@@ -10,6 +10,7 @@ package wallet ...@@ -10,6 +10,7 @@ package wallet
import ( import (
"bytes" "bytes"
"encoding/hex"
"fmt" "fmt"
"github.com/33cn/chain33/common" "github.com/33cn/chain33/common"
...@@ -33,29 +34,28 @@ func init() { ...@@ -33,29 +34,28 @@ func init() {
// MixSignature mix签名中对于crypto.Signature接口实现 // MixSignature mix签名中对于crypto.Signature接口实现
type MixSignature struct { type MixSignature struct {
sign mixTy.MixTransferAction sign []byte
} }
// Bytes convert to bytest // Bytes convert to bytest
func (r *MixSignature) Bytes() []byte { func (r *MixSignature) Bytes() []byte {
return types.Encode(&r.sign) return r.sign[:]
} }
// IsZero check is zero // IsZero check is zero
func (r *MixSignature) IsZero() bool { func (r *MixSignature) IsZero() bool {
return r.sign.Output == nil || r.sign.Input == nil return len(r.sign) == 0
} }
// String convert to string // String convert to string
func (r *MixSignature) String() string { func (r *MixSignature) String() string {
return r.sign.String() return hex.EncodeToString(r.sign)
} }
// Equals check equals // Equals check equals
func (r *MixSignature) Equals(other crypto.Signature) bool { func (r *MixSignature) Equals(other crypto.Signature) bool {
if _, ok := other.(*MixSignature); ok { if _, ok := other.(*MixSignature); ok {
this := types.Encode(&r.sign) return bytes.Equal(r.Bytes(), other.Bytes())
return bytes.Equal(this, other.Bytes())
} }
return false return false
} }
...@@ -213,10 +213,9 @@ func (r *MixSignZkSnark) SignatureFromBytes(b []byte) (crypto.Signature, error) ...@@ -213,10 +213,9 @@ func (r *MixSignZkSnark) SignatureFromBytes(b []byte) (crypto.Signature, error)
if len(b) <= 0 { if len(b) <= 0 {
return nil, types.ErrInvalidParam return nil, types.ErrInvalidParam
} }
sign := new(MixSignature)
if err := types.Decode(b, &sign.sign); err != nil {
return nil, err
}
return sign, nil var mixSig MixSignature
mixSig.sign = append(mixSig.sign, b...)
return &mixSig, nil
} }
...@@ -117,6 +117,14 @@ func (store *mixStore) setRescanNoteStatus(status int32) { ...@@ -117,6 +117,14 @@ func (store *mixStore) setRescanNoteStatus(status int32) {
newbatch.Write() newbatch.Write()
} }
func (store *mixStore) setKvs(set *types.LocalDBSet) {
newbatch := store.NewBatch(true)
for _, s := range set.KV {
newbatch.Set(s.Key, s.Value)
}
newbatch.Write()
}
func (store *mixStore) getRescanNoteStatus() int32 { func (store *mixStore) getRescanNoteStatus() int32 {
v, err := store.Get(calcRescanNoteStatus()) v, err := store.Get(calcRescanNoteStatus())
if err != nil { if err != nil {
......
...@@ -24,7 +24,7 @@ func encodeSecretData(secret *mixTy.SecretData) (*mixTy.EncodedSecretData, error ...@@ -24,7 +24,7 @@ func encodeSecretData(secret *mixTy.SecretData) (*mixTy.EncodedSecretData, error
if secret == nil { if secret == nil {
return nil, errors.Wrap(types.ErrInvalidParam, "para is nil") return nil, errors.Wrap(types.ErrInvalidParam, "para is nil")
} }
if len(secret.PaymentPubKey) <= 0 { if len(secret.ReceiverPubKey) <= 0 {
return nil, errors.Wrap(types.ErrInvalidParam, "spendPubKey is nil") return nil, errors.Wrap(types.ErrInvalidParam, "spendPubKey is nil")
} }
var val big.Int var val big.Int
...@@ -57,7 +57,7 @@ func encryptSecretData(req *mixTy.EncryptSecretData) (*mixTy.DHSecret, error) { ...@@ -57,7 +57,7 @@ func encryptSecretData(req *mixTy.EncryptSecretData) (*mixTy.DHSecret, error) {
return nil, errors.Wrap(err, "decode secret") return nil, errors.Wrap(err, "decode secret")
} }
return encryptData(req.ReceivingPk, secret), nil return encryptData(req.SecretPubKey, secret), nil
} }
func decryptSecretData(req *mixTy.DecryptSecretData) (*mixTy.SecretData, error) { func decryptSecretData(req *mixTy.DecryptSecretData) (*mixTy.SecretData, error) {
...@@ -65,7 +65,7 @@ func decryptSecretData(req *mixTy.DecryptSecretData) (*mixTy.SecretData, error) ...@@ -65,7 +65,7 @@ func decryptSecretData(req *mixTy.DecryptSecretData) (*mixTy.SecretData, error)
if err != nil { if err != nil {
return nil, errors.Wrap(err, "decode req.secret") return nil, errors.Wrap(err, "decode req.secret")
} }
decrypt, err := decryptData(req.ReceivingPriKey, req.Epk, secret) decrypt, err := decryptData(req.SecretPriKey, req.Epk, secret)
if err != nil { if err != nil {
return nil, errors.Wrap(err, "decrypt secret") return nil, errors.Wrap(err, "decrypt secret")
} }
...@@ -90,7 +90,7 @@ func (policy *mixPolicy) getPaymentKey(addr string) (*mixTy.PaymentKey, error) { ...@@ -90,7 +90,7 @@ func (policy *mixPolicy) getPaymentKey(addr string) (*mixTy.PaymentKey, error) {
} }
func (policy *mixPolicy) depositProof(req *mixTy.DepositProofReq) (*mixTy.DepositProofResp, error) { func (policy *mixPolicy) depositProof(req *mixTy.DepositProofReq) (*mixTy.DepositProofResp, error) {
if req == nil || len(req.PaymentAddr) <= 0 { if req == nil || len(req.ReceiverAddr) <= 0 {
return nil, errors.Wrap(types.ErrInvalidParam, "paymentAddr is nil") return nil, errors.Wrap(types.ErrInvalidParam, "paymentAddr is nil")
} }
if req.Amount <= 0 { if req.Amount <= 0 {
...@@ -106,11 +106,11 @@ func (policy *mixPolicy) depositProof(req *mixTy.DepositProofReq) (*mixTy.Deposi ...@@ -106,11 +106,11 @@ func (policy *mixPolicy) depositProof(req *mixTy.DepositProofReq) (*mixTy.Deposi
secret.NoteRandom = fr.String() secret.NoteRandom = fr.String()
// 获取receiving addr对应的paymentKey // 获取receiving addr对应的paymentKey
toKey, e := policy.getPaymentKey(req.PaymentAddr) toKey, e := policy.getPaymentKey(req.ReceiverAddr)
if e != nil { if e != nil {
return nil, errors.Wrapf(e, "get payment key for addr = %s", req.PaymentAddr) return nil, errors.Wrapf(e, "get payment key for addr = %s", req.ReceiverAddr)
} }
secret.PaymentPubKey = toKey.PayingKey secret.ReceiverPubKey = toKey.ReceiverKey
//获取return addr对应的key //获取return addr对应的key
var returnKey *mixTy.PaymentKey var returnKey *mixTy.PaymentKey
...@@ -122,7 +122,7 @@ func (policy *mixPolicy) depositProof(req *mixTy.DepositProofReq) (*mixTy.Deposi ...@@ -122,7 +122,7 @@ func (policy *mixPolicy) depositProof(req *mixTy.DepositProofReq) (*mixTy.Deposi
if err != nil { if err != nil {
return nil, errors.Wrapf(err, "get payment key for return addr = %s", req.ReturnAddr) return nil, errors.Wrapf(err, "get payment key for return addr = %s", req.ReturnAddr)
} }
secret.ReturnPubKey = returnKey.PayingKey secret.ReturnPubKey = returnKey.ReceiverKey
} }
//获取auth addr对应的key //获取auth addr对应的key
...@@ -133,19 +133,19 @@ func (policy *mixPolicy) depositProof(req *mixTy.DepositProofReq) (*mixTy.Deposi ...@@ -133,19 +133,19 @@ func (policy *mixPolicy) depositProof(req *mixTy.DepositProofReq) (*mixTy.Deposi
if err != nil { if err != nil {
return nil, errors.Wrapf(err, "get payment key for authorize addr = %s", req.AuthorizeAddr) return nil, errors.Wrapf(err, "get payment key for authorize addr = %s", req.AuthorizeAddr)
} }
secret.AuthorizePubKey = authKey.PayingKey secret.AuthorizePubKey = authKey.ReceiverKey
} }
//DH加密 //DH加密
data := types.Encode(&secret) data := types.Encode(&secret)
var group mixTy.DHSecretGroup var group mixTy.DHSecretGroup
group.Payment = hex.EncodeToString(types.Encode(encryptData(toKey.ReceivingKey, data))) group.Receiver = hex.EncodeToString(types.Encode(encryptData(toKey.SecretKey, data)))
if returnKey != nil { if returnKey != nil {
group.Returner = hex.EncodeToString(types.Encode(encryptData(returnKey.ReceivingKey, data))) group.Returner = hex.EncodeToString(types.Encode(encryptData(returnKey.SecretKey, data)))
} }
if authKey != nil { if authKey != nil {
group.Authorize = hex.EncodeToString(types.Encode(encryptData(authKey.ReceivingKey, data))) group.Authorize = hex.EncodeToString(types.Encode(encryptData(authKey.SecretKey, data)))
} }
var resp mixTy.DepositProofResp var resp mixTy.DepositProofResp
...@@ -153,7 +153,7 @@ func (policy *mixPolicy) depositProof(req *mixTy.DepositProofReq) (*mixTy.Deposi ...@@ -153,7 +153,7 @@ func (policy *mixPolicy) depositProof(req *mixTy.DepositProofReq) (*mixTy.Deposi
resp.Secrets = &group resp.Secrets = &group
keys := []string{ keys := []string{
secret.PaymentPubKey, secret.ReceiverPubKey,
secret.ReturnPubKey, secret.ReturnPubKey,
secret.AuthorizePubKey, secret.AuthorizePubKey,
secret.Amount, secret.Amount,
...@@ -206,16 +206,16 @@ func (policy *mixPolicy) withdrawProof(req *mixTy.WithdrawProofReq) (*mixTy.With ...@@ -206,16 +206,16 @@ func (policy *mixPolicy) withdrawProof(req *mixTy.WithdrawProofReq) (*mixTy.With
} }
var resp mixTy.WithdrawProofResp var resp mixTy.WithdrawProofResp
resp.Proof = note.Secret resp.Secret = note.Secret
resp.NullifierHash = note.Nullifier resp.NullifierHash = note.Nullifier
resp.AuthSpendHash = note.AuthSpendHash resp.AuthorizeSpendHash = note.AuthorizeSpendHash
resp.NoteHash = note.NoteHash resp.NoteHash = note.NoteHash
resp.SpendFlag = 1 resp.SpendFlag = 1
if note.IsReturner { if note.IsReturner {
resp.SpendFlag = 0 resp.SpendFlag = 0
} }
if len(resp.AuthSpendHash) > 0 { if len(resp.AuthorizeSpendHash) > 0 {
resp.AuthFlag = 1 resp.AuthorizeFlag = 1
} }
//get spend privacy key //get spend privacy key
...@@ -223,7 +223,7 @@ func (policy *mixPolicy) withdrawProof(req *mixTy.WithdrawProofReq) (*mixTy.With ...@@ -223,7 +223,7 @@ func (policy *mixPolicy) withdrawProof(req *mixTy.WithdrawProofReq) (*mixTy.With
if err != nil { if err != nil {
return nil, errors.Wrapf(err, "getAccountPrivacyKey addr=%s", note.Account) return nil, errors.Wrapf(err, "getAccountPrivacyKey addr=%s", note.Account)
} }
resp.SpendPrivKey = privacyKey.Privacy.PaymentKey.SpendKey resp.SpendPrivKey = privacyKey.Privacy.PaymentKey.SpendPriKey
//get tree path //get tree path
path, err := policy.getPathProof(note.NoteHash) path, err := policy.getPathProof(note.NoteHash)
if err != nil { if err != nil {
...@@ -255,22 +255,22 @@ func (policy *mixPolicy) authProof(req *mixTy.AuthProofReq) (*mixTy.AuthProofRes ...@@ -255,22 +255,22 @@ func (policy *mixPolicy) authProof(req *mixTy.AuthProofReq) (*mixTy.AuthProofRes
var resp mixTy.AuthProofResp var resp mixTy.AuthProofResp
resp.Proof = note.Secret resp.Proof = note.Secret
resp.NoteHash = note.NoteHash resp.NoteHash = note.NoteHash
resp.AuthPrivKey = privacyKey.Privacy.PaymentKey.SpendKey resp.AuthPrivKey = privacyKey.Privacy.PaymentKey.SpendPriKey
resp.AuthPubKey = privacyKey.Privacy.PaymentKey.PayKey resp.AuthPubKey = privacyKey.Privacy.PaymentKey.ReceiverPubKey
if privacyKey.Privacy.PaymentKey.PayKey != note.Secret.AuthorizePubKey { if privacyKey.Privacy.PaymentKey.ReceiverPubKey != note.Secret.AuthorizePubKey {
return nil, errors.Wrapf(types.ErrInvalidParam, "auth pubkey from note=%s, from privacyKey=%s,for account =%s", return nil, errors.Wrapf(types.ErrInvalidParam, "auth pubkey from note=%s, from privacyKey=%s,for account =%s",
note.Secret.AuthorizePubKey, privacyKey.Privacy.PaymentKey.PayKey, note.Account) note.Secret.AuthorizePubKey, privacyKey.Privacy.PaymentKey.ReceiverPubKey, note.Account)
} }
resp.AuthHash = getFrString(mimcHashString([]string{resp.AuthPubKey, note.Secret.NoteRandom})) resp.AuthHash = getFrString(mimcHashString([]string{resp.AuthPubKey, note.Secret.NoteRandom}))
//default auto to paymenter //default auto to paymenter
resp.SpendFlag = 1 resp.SpendFlag = 1
resp.AuthSpendHash = getFrString(mimcHashString([]string{note.Secret.PaymentPubKey, note.Secret.Amount, note.Secret.NoteRandom})) resp.AuthorizeSpendHash = getFrString(mimcHashString([]string{note.Secret.ReceiverPubKey, note.Secret.Amount, note.Secret.NoteRandom}))
if req.ToReturn != 0 { if req.ToReturn != 0 {
resp.SpendFlag = 0 resp.SpendFlag = 0
//auth to returner //auth to returner
resp.AuthSpendHash = getFrString(mimcHashString([]string{note.Secret.ReturnPubKey, note.Secret.Amount, note.Secret.NoteRandom})) resp.AuthorizeSpendHash = getFrString(mimcHashString([]string{note.Secret.ReturnPubKey, note.Secret.Amount, note.Secret.NoteRandom}))
} }
//get tree path //get tree path
...@@ -289,8 +289,23 @@ func (policy *mixPolicy) authProof(req *mixTy.AuthProofReq) (*mixTy.AuthProofRes ...@@ -289,8 +289,23 @@ func (policy *mixPolicy) authProof(req *mixTy.AuthProofReq) (*mixTy.AuthProofRes
} }
func (policy *mixPolicy) getTransferInputPart(note *mixTy.WalletIndexInfo) (*mixTy.TransferInputProof, error) { func (policy *mixPolicy) getTreeProof(leaf string) (*mixTy.TreePathProof, error) {
//get tree path
path, err := policy.getPathProof(leaf)
if err != nil {
return nil, errors.Wrapf(err, "get tree proof for noteHash=%s", leaf)
}
var proof mixTy.TreePathProof
proof.TreePath = path.ProofSet[1:]
proof.Helpers = path.Helpers
for i := 0; i < len(proof.TreePath); i++ {
proof.ValidPath = append(proof.ValidPath, 1)
}
proof.TreeRootHash = path.RootHash
return &proof, nil
}
func (policy *mixPolicy) getTransferInputPart(note *mixTy.WalletIndexInfo) (*mixTy.TransferInputProof, error) {
//get spend privacy key //get spend privacy key
privacyKey, err := policy.getAccountPrivacyKey(note.Account) privacyKey, err := policy.getAccountPrivacyKey(note.Account)
if err != nil { if err != nil {
...@@ -302,23 +317,30 @@ func (policy *mixPolicy) getTransferInputPart(note *mixTy.WalletIndexInfo) (*mix ...@@ -302,23 +317,30 @@ func (policy *mixPolicy) getTransferInputPart(note *mixTy.WalletIndexInfo) (*mix
input.NoteHash = note.NoteHash input.NoteHash = note.NoteHash
input.NullifierHash = note.Nullifier input.NullifierHash = note.Nullifier
//自己是payment 还是returner已经在解析note时候算好了,authSpendHash也对应算好了,如果note valid,则就用本地即可 //自己是payment 还是returner已经在解析note时候算好了,authSpendHash也对应算好了,如果note valid,则就用本地即可
input.AuthSpendHash = note.AuthSpendHash input.AuthorizeSpendHash = note.AuthorizeSpendHash
input.SpendPrivKey = privacyKey.Privacy.PaymentKey.SpendKey input.SpendPrivKey = privacyKey.Privacy.PaymentKey.SpendPriKey
if privacyKey.Privacy.PaymentKey.PayKey != note.Secret.AuthorizePubKey { if privacyKey.Privacy.PaymentKey.ReceiverPubKey != note.Secret.ReceiverPubKey {
return nil, errors.Wrapf(types.ErrInvalidParam, "payment pubkey from note=%s not match from privacyKey=%s,for account =%s", return nil, errors.Wrapf(types.ErrInvalidParam, "payment pubkey from note=%s not match from privacyKey=%s,for account =%s",
note.Secret.AuthorizePubKey, privacyKey.Privacy.PaymentKey.PayKey, note.Account) note.Secret.ReceiverPubKey, privacyKey.Privacy.PaymentKey.ReceiverPubKey, note.Account)
} }
input.SpendFlag = 1 input.SpendFlag = 1
if note.IsReturner { if note.IsReturner {
input.SpendFlag = 0 input.SpendFlag = 0
} }
if len(input.AuthSpendHash) > 0 { if len(input.AuthorizeSpendHash) > LENNULLKEY {
input.AuthFlag = 1 input.AuthorizeFlag = 1
}
treeProof, err := policy.getTreeProof(note.NoteHash)
if err != nil {
return nil, errors.Wrapf(err, "getTreeProof for hash=%s", note.NoteHash)
} }
input.TreeProof = treeProof
return &input, nil return &input, nil
} }
func getCommitValue(noteAmount, transferAmount, minTxFee uint64) (*mixTy.CommitValueRst, error) { func getCommitValue(noteAmount, transferAmount, minTxFee uint64) (*mixTy.ShieldAmountRst, error) {
if noteAmount < transferAmount+minTxFee { if noteAmount < transferAmount+minTxFee {
return nil, errors.Wrapf(types.ErrInvalidParam, "transfer amount=%d big than note=%d - fee=%d", transferAmount, noteAmount, minTxFee) return nil, errors.Wrapf(types.ErrInvalidParam, "transfer amount=%d big than note=%d - fee=%d", transferAmount, noteAmount, minTxFee)
} }
...@@ -337,17 +359,17 @@ func getCommitValue(noteAmount, transferAmount, minTxFee uint64) (*mixTy.CommitV ...@@ -337,17 +359,17 @@ func getCommitValue(noteAmount, transferAmount, minTxFee uint64) (*mixTy.CommitV
//三个混淆随机值可以随机获取,这里noteRandom和为了Nullifier计算的NoteRandom不同。 //三个混淆随机值可以随机获取,这里noteRandom和为了Nullifier计算的NoteRandom不同。
//获取随机值,截取一半给change和transfer,和值给Note,直接用完整的random值会溢出 //获取随机值,截取一半给change和transfer,和值给Note,直接用完整的random值会溢出
var changeRdm, transRdm, v fr_bn256.Element var rChange, rTrans, v fr_bn256.Element
random := v.SetRandom().String() random := v.SetRandom().String()
changeRdm.SetString(random[0 : len(random)/2]) rChange.SetString(random[0 : len(random)/2])
transRdm.SetString(random[len(random)/2:]) rTrans.SetString(random[len(random)/2:])
var noteRdm fr_bn256.Element var rNote fr_bn256.Element
noteRdm.Add(&changeRdm, &transRdm) rNote.Add(&rChange, &rTrans)
noteH := mixTy.MulCurvePointH(noteRdm.String()) noteH := mixTy.MulCurvePointH(rNote.String())
transferH := mixTy.MulCurvePointH(transRdm.String()) transferH := mixTy.MulCurvePointH(rTrans.String())
changeH := mixTy.MulCurvePointH(changeRdm.String()) changeH := mixTy.MulCurvePointH(rChange.String())
//fmt.Println("change",changeRandom.String()) //fmt.Println("change",changeRandom.String())
//fmt.Println("transfer",transRandom.String()) //fmt.Println("transfer",transRandom.String())
//fmt.Println("note",noteRandom.String()) //fmt.Println("note",noteRandom.String())
...@@ -364,13 +386,13 @@ func getCommitValue(noteAmount, transferAmount, minTxFee uint64) (*mixTy.CommitV ...@@ -364,13 +386,13 @@ func getCommitValue(noteAmount, transferAmount, minTxFee uint64) (*mixTy.CommitV
return nil, errors.Wrapf(types.ErrInvalidParam, "amount sum fail for G+H point") return nil, errors.Wrapf(types.ErrInvalidParam, "amount sum fail for G+H point")
} }
rst := &mixTy.CommitValueRst{ rst := &mixTy.ShieldAmountRst{
NoteRandom: noteRdm.String(), NoteRandom: rNote.String(),
TransferRandom: transRdm.String(), TransferRandom: rTrans.String(),
ChangeRandom: changeRdm.String(), ChangeRandom: rChange.String(),
Note: &mixTy.CommitValue{X: noteAmountG.X.String(), Y: noteAmountG.Y.String()}, Note: &mixTy.ShieldAmount{X: noteAmountG.X.String(), Y: noteAmountG.Y.String()},
Transfer: &mixTy.CommitValue{X: transAmountG.X.String(), Y: transAmountG.Y.String()}, Transfer: &mixTy.ShieldAmount{X: transAmountG.X.String(), Y: transAmountG.Y.String()},
Change: &mixTy.CommitValue{X: changeAmountG.X.String(), Y: changeAmountG.Y.String()}, Change: &mixTy.ShieldAmount{X: changeAmountG.X.String(), Y: changeAmountG.Y.String()},
} }
return rst, nil return rst, nil
} }
...@@ -381,6 +403,9 @@ func (policy *mixPolicy) transferProof(req *mixTy.TransferProofReq) (*mixTy.Tran ...@@ -381,6 +403,9 @@ func (policy *mixPolicy) transferProof(req *mixTy.TransferProofReq) (*mixTy.Tran
return nil, err return nil, err
} }
inputPart, err := policy.getTransferInputPart(note) inputPart, err := policy.getTransferInputPart(note)
if err != nil {
return nil, errors.Wrapf(err, "getTransferInputPart note=%s", note.NoteHash)
}
bizlog.Info("transferProof get notes succ", "notehash", req.NoteHash) bizlog.Info("transferProof get notes succ", "notehash", req.NoteHash)
noteAmount, err := strconv.ParseUint(note.Secret.Amount, 10, 64) noteAmount, err := strconv.ParseUint(note.Secret.Amount, 10, 64)
...@@ -392,7 +417,7 @@ func (policy *mixPolicy) transferProof(req *mixTy.TransferProofReq) (*mixTy.Tran ...@@ -392,7 +417,7 @@ func (policy *mixPolicy) transferProof(req *mixTy.TransferProofReq) (*mixTy.Tran
//output toAddr part //output toAddr part
reqTransfer := &mixTy.DepositProofReq{ reqTransfer := &mixTy.DepositProofReq{
PaymentAddr: req.ToAddr, ReceiverAddr: req.ToAddr,
AuthorizeAddr: req.ToAuthAddr, AuthorizeAddr: req.ToAuthAddr,
ReturnAddr: req.ReturnAddr, ReturnAddr: req.ReturnAddr,
Amount: req.Amount, Amount: req.Amount,
...@@ -406,7 +431,7 @@ func (policy *mixPolicy) transferProof(req *mixTy.TransferProofReq) (*mixTy.Tran ...@@ -406,7 +431,7 @@ func (policy *mixPolicy) transferProof(req *mixTy.TransferProofReq) (*mixTy.Tran
//output 找零 part,如果找零为0也需要设置,否则只有一个输入一个输出,H部分的随机数要相等,就能推测出转账值来 //output 找零 part,如果找零为0也需要设置,否则只有一个输入一个输出,H部分的随机数要相等,就能推测出转账值来
//在transfer output 部分特殊处理,如果amount是0的值则不加进tree //在transfer output 部分特殊处理,如果amount是0的值则不加进tree
reqChange := &mixTy.DepositProofReq{ reqChange := &mixTy.DepositProofReq{
PaymentAddr: note.Account, ReceiverAddr: note.Account,
Amount: noteAmount - req.Amount - minTxFee, Amount: noteAmount - req.Amount - minTxFee,
} }
depositChange, err := policy.depositProof(reqChange) depositChange, err := policy.depositProof(reqChange)
...@@ -416,28 +441,30 @@ func (policy *mixPolicy) transferProof(req *mixTy.TransferProofReq) (*mixTy.Tran ...@@ -416,28 +441,30 @@ func (policy *mixPolicy) transferProof(req *mixTy.TransferProofReq) (*mixTy.Tran
bizlog.Info("transferProof deposit to change succ", "notehash", req.NoteHash) bizlog.Info("transferProof deposit to change succ", "notehash", req.NoteHash)
commitValue, err := getCommitValue(noteAmount, req.Amount, minTxFee) commitValue, err := getCommitValue(noteAmount, req.Amount, minTxFee)
if err != nil { if err != nil {
return nil, err return nil, err
} }
bizlog.Info("transferProof get commit value succ", "notehash", req.NoteHash) bizlog.Info("transferProof get commit value succ", "notehash", req.NoteHash)
//noteCommitX, transferX, changeX //noteCommitX, transferX, changeX
inputPart.CommitValue = commitValue.Note inputPart.ShieldAmount = commitValue.Note
inputPart.SpendRandom = commitValue.NoteRandom inputPart.AmountRandom = commitValue.NoteRandom
transferOutput := &mixTy.TransferOutputProof{ transferOutput := &mixTy.TransferOutputProof{
Proof: depositTransfer.Proof, Proof: depositTransfer.Proof,
NoteHash: depositTransfer.NoteHash, NoteHash: depositTransfer.NoteHash,
Secrets: depositTransfer.Secrets, Secrets: depositTransfer.Secrets,
CommitValue: commitValue.Transfer, ShieldAmount: commitValue.Transfer,
SpendRandom: commitValue.TransferRandom, AmountRandom: commitValue.TransferRandom,
} }
changeOutput := &mixTy.TransferOutputProof{ changeOutput := &mixTy.TransferOutputProof{
Proof: depositChange.Proof, Proof: depositChange.Proof,
NoteHash: depositChange.NoteHash, NoteHash: depositChange.NoteHash,
Secrets: depositChange.Secrets, Secrets: depositChange.Secrets,
CommitValue: commitValue.Change, ShieldAmount: commitValue.Change,
SpendRandom: commitValue.ChangeRandom, AmountRandom: commitValue.ChangeRandom,
} }
return &mixTy.TransferProofResp{ return &mixTy.TransferProofResp{
TransferInput: inputPart, TransferInput: inputPart,
TargetOutput: transferOutput, TargetOutput: transferOutput,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment