Commit 1ea44029 authored by madengji's avatar madengji Committed by vipwzw

add query

parent 6a0752f6
Title="user.p.para." Title="user.p.para."
TestNet=false TestNet=false
CoinSymbol="para" #symbol需要大小
CoinSymbol="PARA"
EnableParaFork=true EnableParaFork=true
[crypto] [crypto]
......
package main package main
import ( import (
util "github.com/33cn/plugin/plugin/dapp/mix/cmd/gnark/circuit"
"github.com/consensys/gnark/encoding/gob" "github.com/consensys/gnark/encoding/gob"
"github.com/consensys/gnark/frontend" "github.com/consensys/gnark/frontend"
"github.com/consensys/gnark/gadgets/hash/mimc" "github.com/consensys/gnark/gadgets/hash/mimc"
...@@ -68,7 +69,7 @@ func NewAuth() *frontend.R1CS { ...@@ -68,7 +69,7 @@ func NewAuth() *frontend.R1CS {
//通过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, spendPubKey, returnPubKey, authPubKey, spendAmount, noteRandom)
merkelPathPart(&circuit, mimc, preImage) util.MerkelPathPart(&circuit, mimc, preImage)
r1cs := circuit.ToR1CS() r1cs := circuit.ToR1CS()
......
package main package main
import ( import (
util "github.com/33cn/plugin/plugin/dapp/mix/cmd/gnark/circuit"
"github.com/consensys/gnark/encoding/gob" "github.com/consensys/gnark/encoding/gob"
"github.com/consensys/gnark/frontend" "github.com/consensys/gnark/frontend"
"github.com/consensys/gnark/gadgets/hash/mimc" "github.com/consensys/gnark/gadgets/hash/mimc"
...@@ -86,8 +87,8 @@ func NewTransferInput() *frontend.R1CS { ...@@ -86,8 +87,8 @@ func NewTransferInput() *frontend.R1CS {
preImage := mimc.Hash(&circuit, spendPubkey, calcReturnPubkey, calcAuthPubkey, spendValue, noteRandom) preImage := mimc.Hash(&circuit, spendPubkey, calcReturnPubkey, calcAuthPubkey, spendValue, noteRandom)
circuit.MUSTBE_EQ(noteHash, preImage) circuit.MUSTBE_EQ(noteHash, preImage)
commitValuePart(&circuit, spendValue) util.CommitValuePart(&circuit, spendValue)
merkelPathPart(&circuit, mimc, preImage) util.MerkelPathPart(&circuit, mimc, preImage)
r1cs := circuit.ToR1CS() r1cs := circuit.ToR1CS()
......
package main package main
import ( import (
util "github.com/33cn/plugin/plugin/dapp/mix/cmd/gnark/circuit"
"github.com/consensys/gnark/encoding/gob" "github.com/consensys/gnark/encoding/gob"
"github.com/consensys/gnark/frontend" "github.com/consensys/gnark/frontend"
"github.com/consensys/gnark/gadgets/hash/mimc" "github.com/consensys/gnark/gadgets/hash/mimc"
...@@ -53,7 +54,7 @@ func NewTransferOutput() *frontend.R1CS { ...@@ -53,7 +54,7 @@ func NewTransferOutput() *frontend.R1CS {
preImage := mimc.Hash(&circuit, spendPubkey, returnPubkey, authPubkey, spendValue, noteRandom) preImage := mimc.Hash(&circuit, spendPubkey, returnPubkey, authPubkey, spendValue, noteRandom)
circuit.MUSTBE_EQ(noteHash, preImage) circuit.MUSTBE_EQ(noteHash, preImage)
commitValuePart(&circuit, spendValue) util.CommitValuePart(&circuit, spendValue)
r1cs := circuit.ToR1CS() r1cs := circuit.ToR1CS()
......
package main package circuit
import ( import (
"strconv" "strconv"
...@@ -10,7 +10,7 @@ import ( ...@@ -10,7 +10,7 @@ import (
fr_bn256 "github.com/consensys/gurvy/bn256/fr" fr_bn256 "github.com/consensys/gurvy/bn256/fr"
) )
func merkelPathPart(circuit *frontend.CS, mimc mimc.MiMCGadget, noteHash *frontend.Constraint) { func MerkelPathPart(circuit *frontend.CS, mimc mimc.MiMCGadget, noteHash *frontend.Constraint) {
var proofSet, helper, valid []*frontend.Constraint var proofSet, helper, valid []*frontend.Constraint
merkleRoot := circuit.PUBLIC_INPUT("treeRootHash") merkleRoot := circuit.PUBLIC_INPUT("treeRootHash")
proofSet = append(proofSet, noteHash) proofSet = append(proofSet, noteHash)
...@@ -25,10 +25,10 @@ func merkelPathPart(circuit *frontend.CS, mimc mimc.MiMCGadget, noteHash *fronte ...@@ -25,10 +25,10 @@ func merkelPathPart(circuit *frontend.CS, mimc mimc.MiMCGadget, noteHash *fronte
valid = append(valid, circuit.SECRET_INPUT("valid"+strconv.Itoa(i))) valid = append(valid, circuit.SECRET_INPUT("valid"+strconv.Itoa(i)))
} }
verifyMerkleProof(circuit, mimc, merkleRoot, proofSet, helper, valid) VerifyMerkleProof(circuit, mimc, merkleRoot, proofSet, helper, valid)
} }
func verifyMerkleProof(circuit *frontend.CS, h mimc.MiMCGadget, merkleRoot *frontend.Constraint, proofSet, helper, valid []*frontend.Constraint) { func VerifyMerkleProof(circuit *frontend.CS, h mimc.MiMCGadget, merkleRoot *frontend.Constraint, proofSet, helper, valid []*frontend.Constraint) {
sum := leafSum(circuit, h, proofSet[0]) sum := leafSum(circuit, h, proofSet[0])
...@@ -63,7 +63,7 @@ func leafSum(circuit *frontend.CS, h mimc.MiMCGadget, data *frontend.Constraint) ...@@ -63,7 +63,7 @@ func leafSum(circuit *frontend.CS, h mimc.MiMCGadget, data *frontend.Constraint)
return res return res
} }
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("commitValueX")
cmtvalueY := circuit.PUBLIC_INPUT("commitValueY") cmtvalueY := circuit.PUBLIC_INPUT("commitValueY")
......
package main package main
import ( import (
util "github.com/33cn/plugin/plugin/dapp/mix/cmd/gnark/circuit"
"github.com/consensys/gnark/encoding/gob" "github.com/consensys/gnark/encoding/gob"
"github.com/consensys/gnark/frontend" "github.com/consensys/gnark/frontend"
"github.com/consensys/gnark/gadgets/hash/mimc" "github.com/consensys/gnark/gadgets/hash/mimc"
...@@ -79,7 +80,7 @@ func NewWithdraw() *frontend.R1CS { ...@@ -79,7 +80,7 @@ func NewWithdraw() *frontend.R1CS {
preImage := mimc.Hash(&circuit, spendPubkey, calcReturnPubkey, calcAuthPubkey, spendValue, noteRandom) preImage := mimc.Hash(&circuit, spendPubkey, calcReturnPubkey, calcAuthPubkey, spendValue, noteRandom)
circuit.MUSTBE_EQ(noteHash, preImage) circuit.MUSTBE_EQ(noteHash, preImage)
merkelPathPart(&circuit, mimc, preImage) util.MerkelPathPart(&circuit, mimc, preImage)
r1cs := circuit.ToR1CS() r1cs := circuit.ToR1CS()
......
...@@ -17,7 +17,7 @@ import ( ...@@ -17,7 +17,7 @@ import (
) )
//ParcCmd paracross cmd register //ParcCmd paracross cmd register
func ParcCmd() *cobra.Command { func MixCmd() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "mix", Use: "mix",
Short: "Construct mix coin transactions", Short: "Construct mix coin transactions",
...@@ -30,6 +30,7 @@ func ParcCmd() *cobra.Command { ...@@ -30,6 +30,7 @@ func ParcCmd() *cobra.Command {
CreateConfigCmd(), CreateConfigCmd(),
CreateAuthorizeCmd(), CreateAuthorizeCmd(),
QueryCmd(), QueryCmd(),
WalletCmd(),
) )
return cmd return cmd
} }
...@@ -314,23 +315,23 @@ func mixConfigAuthPubKeyParaCmd() *cobra.Command { ...@@ -314,23 +315,23 @@ func mixConfigAuthPubKeyParaCmd() *cobra.Command {
func addPubKeyConfigFlags(cmd *cobra.Command) { func addPubKeyConfigFlags(cmd *cobra.Command) {
cmd.Flags().Uint32P("action", "a", 0, "0:add,1:delete") cmd.Flags().Uint32P("action", "a", 0, "0:add,1:delete")
cmd.Flags().StringP("zkey", "z", "", "zk proof verify key") cmd.Flags().StringP("key", "k", "", "authorize pub key")
cmd.MarkFlagRequired("zkey") cmd.MarkFlagRequired("key")
} }
func createConfigPubKey(cmd *cobra.Command, args []string) { func createConfigPubKey(cmd *cobra.Command, args []string) {
paraName, _ := cmd.Flags().GetString("paraName") paraName, _ := cmd.Flags().GetString("paraName")
action, _ := cmd.Flags().GetUint32("action") action, _ := cmd.Flags().GetUint32("action")
key, _ := cmd.Flags().GetString("zkey") key, _ := cmd.Flags().GetString("key")
var pubkey mixTy.AuthorizePubKey //var pubkey mixTy.AuthorizePubKey
pubkey.Value = key //pubkey.Value = key
payload := &mixTy.MixConfigAction{} payload := &mixTy.MixConfigAction{}
payload.Ty = mixTy.MixConfigType_AuthPubKey payload.Ty = mixTy.MixConfigType_AuthPubKey
payload.Action = mixTy.MixConfigAct(action) payload.Action = mixTy.MixConfigAct(action)
payload.Value = &mixTy.MixConfigAction_AuthKey{AuthKey: &pubkey} payload.Value = &mixTy.MixConfigAction_AuthPk{AuthPk: key}
params := &rpctypes.CreateTxIn{ params := &rpctypes.CreateTxIn{
Execer: getRealExecName(paraName, mixTy.MixX), Execer: getRealExecName(paraName, mixTy.MixX),
...@@ -349,6 +350,9 @@ func QueryCmd() *cobra.Command { ...@@ -349,6 +350,9 @@ func QueryCmd() *cobra.Command {
Short: "query cmd", Short: "query cmd",
} }
cmd.AddCommand(GetTreePathCmd()) cmd.AddCommand(GetTreePathCmd())
cmd.AddCommand(GetTreeLeavesCmd())
cmd.AddCommand(GetTreeRootsCmd())
cmd.AddCommand(ShowMixTxsCmd())
return cmd return cmd
} }
...@@ -380,7 +384,7 @@ func treePath(cmd *cobra.Command, args []string) { ...@@ -380,7 +384,7 @@ func treePath(cmd *cobra.Command, args []string) {
var params rpctypes.Query4Jrpc var params rpctypes.Query4Jrpc
params.Execer = mixTy.MixX params.Execer = mixTy.MixX
params.FuncName = "GetTreePath" params.FuncName = "GetTreePath"
req := mixTy.TreePathReq{ req := mixTy.TreeInfoReq{
RootHash: root, RootHash: root,
LeafHash: leaf, LeafHash: leaf,
} }
...@@ -390,3 +394,421 @@ func treePath(cmd *cobra.Command, args []string) { ...@@ -390,3 +394,421 @@ func treePath(cmd *cobra.Command, args []string) {
ctx := jsonclient.NewRPCCtx(rpcLaddr, "Chain33.Query", params, &res) ctx := jsonclient.NewRPCCtx(rpcLaddr, "Chain33.Query", params, &res)
ctx.Run() ctx.Run()
} }
// GetParaInfoCmd get para chain status by height
func GetTreeLeavesCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "leaves",
Short: "Get tree leaves",
Run: treeLeaves,
}
addGetLeavesCmdFlags(cmd)
return cmd
}
func addGetLeavesCmdFlags(cmd *cobra.Command) {
cmd.Flags().StringP("root", "r", "", "tree root hash, null means current leaves")
}
func treeLeaves(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
root, _ := cmd.Flags().GetString("root")
var params rpctypes.Query4Jrpc
params.Execer = mixTy.MixX
params.FuncName = "Query_GetLeavesList"
req := mixTy.TreeInfoReq{
RootHash: root,
}
params.Payload = types.MustPBToJSON(&req)
var res mixTy.TreeListResp
ctx := jsonclient.NewRPCCtx(rpcLaddr, "Chain33.Query", params, &res)
ctx.Run()
}
// GetParaInfoCmd get para chain status by height
func GetTreeRootsCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "roots",
Short: "Get archive roots",
Run: treeRoot,
}
//addGetPathCmdFlags(cmd)
return cmd
}
func treeRoot(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
var params rpctypes.Query4Jrpc
params.Execer = mixTy.MixX
params.FuncName = "GetRootList"
params.Payload = types.MustPBToJSON(&types.ReqNil{})
var res mixTy.TreeListResp
ctx := jsonclient.NewRPCCtx(rpcLaddr, "Chain33.Query", params, &res)
ctx.Run()
}
// ShowProposalBoardCmd 显示提案查询信息
func ShowMixTxsCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "txs",
Short: "show mix txs info",
Run: showMixTxs,
}
addShowMixTxsflags(cmd)
return cmd
}
func addShowMixTxsflags(cmd *cobra.Command) {
cmd.Flags().Uint32P("type", "y", 0, "type(0:query by hash; 1:list)")
cmd.MarkFlagRequired("type")
cmd.Flags().StringP("hash", "s", "", "mix tx hash")
cmd.Flags().Int64P("height", "t", -1, "height, default is -1")
cmd.Flags().Int64P("index", "i", -1, "index, default is -1")
cmd.Flags().Int32P("count", "c", 1, "count, default is 1")
cmd.Flags().Int32P("direction", "d", 0, "direction, default is reserve")
}
func showMixTxs(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
typ, _ := cmd.Flags().GetUint32("type")
hash, _ := cmd.Flags().GetString("hash")
count, _ := cmd.Flags().GetInt32("count")
direction, _ := cmd.Flags().GetInt32("direction")
height, _ := cmd.Flags().GetInt64("height")
index, _ := cmd.Flags().GetInt64("index")
var params rpctypes.Query4Jrpc
params.Execer = mixTy.MixX
var req *mixTy.MixTxListReq
if typ < 1 {
req = &mixTy.MixTxListReq{
Count: count,
Direction: direction,
Hash: hash,
}
} else {
req = &mixTy.MixTxListReq{
Count: count,
Direction: direction,
Height: height,
Index: index,
}
}
params.FuncName = "ListMixTxs"
params.Payload = types.MustPBToJSON(req)
var resp mixTy.MixTxListResp
ctx := jsonclient.NewRPCCtx(rpcLaddr, "Chain33.Query", params, &resp)
ctx.Run()
}
func WalletCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "wallet",
Short: "wallet query cmd",
}
cmd.AddCommand(ShowAccountPrivacyInfo())
cmd.AddCommand(ShowAccountNoteInfo())
cmd.AddCommand(RescanCmd())
cmd.AddCommand(RescanStatusCmd())
cmd.AddCommand(EnableCmd())
cmd.AddCommand(EncodeSecretDataCmd())
cmd.AddCommand(EncryptSecretDataCmd())
cmd.AddCommand(DecryptSecretDataCmd())
return cmd
}
// ShowAccountPrivacyInfo get para chain status by height
func ShowAccountPrivacyInfo() *cobra.Command {
cmd := &cobra.Command{
Use: "keys",
Short: "show account privacy keys",
Run: accountPrivacy,
}
accountPrivacyCmdFlags(cmd)
return cmd
}
func accountPrivacyCmdFlags(cmd *cobra.Command) {
cmd.Flags().StringP("account", "a", "", "accounts")
cmd.MarkFlagRequired("account")
}
func accountPrivacy(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
account, _ := cmd.Flags().GetString("account")
var res mixTy.WalletAddrPrivacy
ctx := jsonclient.NewRPCCtx(rpcLaddr, "mix.ShowAccountPrivacyInfo", &types.ReqString{Data: account}, &res)
ctx.Run()
}
// ShowAccountPrivacyInfo get para chain status by height
func ShowAccountNoteInfo() *cobra.Command {
cmd := &cobra.Command{
Use: "notes",
Short: "show account notes",
Run: accountNote,
}
accountNoteCmdFlags(cmd)
return cmd
}
func accountNoteCmdFlags(cmd *cobra.Command) {
cmd.Flags().StringP("accounts", "a", "", "accounts")
cmd.MarkFlagRequired("accounts")
}
func accountNote(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
accounts, _ := cmd.Flags().GetString("accounts")
l := strings.Split(accounts, ",")
var params types.ReqAddrs
params.Addrs = append(params.Addrs, l...)
var res mixTy.WalletIndexResp
ctx := jsonclient.NewRPCCtx(rpcLaddr, "mix.ShowAccountNoteInfo", params, &res)
ctx.Run()
}
// ShowAccountPrivacyInfo get para chain status by height
func RescanStatusCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "status",
Short: "rescan status",
Run: rescanStatus,
}
rescanStatusCmdFlags(cmd)
return cmd
}
func rescanStatusCmdFlags(cmd *cobra.Command) {
cmd.Flags().StringP("accounts", "a", "", "accounts")
//cmd.MarkFlagRequired("accounts")
}
func rescanStatus(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
//accounts, _ := cmd.Flags().GetString("accounts")
//l := strings.Split(accounts,",")
//var params types.ReqAddrs
//params.Addrs = append(params.Addrs,l...)
var res types.ReqString
ctx := jsonclient.NewRPCCtx(rpcLaddr, "mix.GetRescanStatus", &types.ReqNil{}, &res)
ctx.Run()
}
// ShowAccountPrivacyInfo get para chain status by height
func RescanCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "rescan",
Short: "rescan notes",
Run: rescanNote,
}
rescanNoteCmdFlags(cmd)
return cmd
}
func rescanNoteCmdFlags(cmd *cobra.Command) {
cmd.Flags().StringP("accounts", "a", "", "accounts")
//cmd.MarkFlagRequired("accounts")
}
func rescanNote(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
//accounts, _ := cmd.Flags().GetString("accounts")
//l := strings.Split(accounts,",")
//var params types.ReqAddrs
//params.Addrs = append(params.Addrs,l...)
var res types.ReqString
ctx := jsonclient.NewRPCCtx(rpcLaddr, "mix.RescanNotes", &types.ReqNil{}, &res)
ctx.Run()
}
// ShowAccountPrivacyInfo get para chain status by height
func EnableCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "enable",
Short: "enable privacy",
Run: enablePrivacy,
}
enablePrivacyCmdFlags(cmd)
return cmd
}
func enablePrivacyCmdFlags(cmd *cobra.Command) {
cmd.Flags().StringP("accounts", "a", "", "accounts")
//cmd.MarkFlagRequired("accounts")
}
func enablePrivacy(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
accounts, _ := cmd.Flags().GetString("accounts")
var params types.ReqAddrs
if len(accounts) > 0 {
l := strings.Split(accounts, ",")
params.Addrs = append(params.Addrs, l...)
}
var res mixTy.ReqEnablePrivacyRst
ctx := jsonclient.NewRPCCtx(rpcLaddr, "mix.EnablePrivacy", &params, &res)
ctx.Run()
}
// ShowAccountPrivacyInfo get para chain status by height
func EncodeSecretDataCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "encode",
Short: "encode secret data",
Run: encodeSecret,
}
encodeSecretCmdFlags(cmd)
return cmd
}
func encodeSecretCmdFlags(cmd *cobra.Command) {
cmd.Flags().StringP("payment", "p", "", "payment key")
cmd.MarkFlagRequired("payment")
cmd.Flags().StringP("return", "r", "", "return key")
cmd.Flags().StringP("authorize", "a", "", "authorize key")
cmd.Flags().StringP("amount", "m", "", "amount with 1e8")
cmd.MarkFlagRequired("amount")
}
func encodeSecret(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
payment, _ := cmd.Flags().GetString("payment")
returnKey, _ := cmd.Flags().GetString("return")
authorize, _ := cmd.Flags().GetString("authorize")
amount, _ := cmd.Flags().GetString("amount")
req := mixTy.SecretData{
PaymentPubKey: payment,
ReturnPubKey: returnKey,
AuthorizePubKey: authorize,
Amount: amount,
}
var res mixTy.EncodedSecretData
ctx := jsonclient.NewRPCCtx(rpcLaddr, "mix.EncodeSecretData", req, &res)
ctx.Run()
}
// ShowAccountPrivacyInfo get para chain status by height
func EncryptSecretDataCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "encrypt",
Short: "encrypt secret data",
Run: encryptSecret,
}
encryptSecrettCmdFlags(cmd)
return cmd
}
func encryptSecrettCmdFlags(cmd *cobra.Command) {
cmd.Flags().StringP("secret", "s", "", "raw secret data")
cmd.MarkFlagRequired("secret")
cmd.Flags().StringP("pubX", "x", "", "receiving pub key X")
cmd.MarkFlagRequired("pubX")
cmd.Flags().StringP("pubY", "y", "", "receiving pub key Y")
cmd.MarkFlagRequired("pubY")
}
func encryptSecret(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
secret, _ := cmd.Flags().GetString("secret")
x, _ := cmd.Flags().GetString("pubX")
y, _ := cmd.Flags().GetString("pubY")
pubkey := &mixTy.PubKey{X: x, Y: y}
req := mixTy.EncryptSecretData{
Secret: secret,
ReceivingPk: pubkey,
}
var res mixTy.DHSecret
ctx := jsonclient.NewRPCCtx(rpcLaddr, "mix.EncryptSecretData", req, &res)
ctx.Run()
}
// ShowAccountPrivacyInfo get para chain status by height
func DecryptSecretDataCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "decrypt",
Short: "decrypt secret data by receiving privacy key",
Run: decryptSecret,
}
decryptSecrettCmdFlags(cmd)
return cmd
}
func decryptSecrettCmdFlags(cmd *cobra.Command) {
cmd.Flags().StringP("secret", "s", "", "raw secret data")
cmd.MarkFlagRequired("secret")
cmd.Flags().StringP("pri", "p", "", "receiving pri key")
cmd.MarkFlagRequired("pri")
cmd.Flags().StringP("epkX", "x", "", "ephemeral pub key X")
cmd.MarkFlagRequired("epkX")
cmd.Flags().StringP("epkY", "y", "", "ephemeral pub key Y")
cmd.MarkFlagRequired("epkY")
}
func decryptSecret(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
secret, _ := cmd.Flags().GetString("secret")
p, _ := cmd.Flags().GetString("pri")
x, _ := cmd.Flags().GetString("epkX")
y, _ := cmd.Flags().GetString("epkY")
pubkey := &mixTy.PubKey{X: x, Y: y}
prikey := &mixTy.PrivKey{Data: p}
req := mixTy.DecryptSecretData{
Secret: secret,
Epk: pubkey,
ReceivingPriKey: prikey,
}
var res mixTy.SecretData
ctx := jsonclient.NewRPCCtx(rpcLaddr, "mix.DecryptSecretData", req, &res)
ctx.Run()
}
...@@ -94,11 +94,14 @@ func (a *action) Authorize(authorize *mixTy.MixAuthorizeAction) (*types.Receipt, ...@@ -94,11 +94,14 @@ func (a *action) Authorize(authorize *mixTy.MixAuthorizeAction) (*types.Receipt,
} }
receipt := &types.Receipt{Ty: types.ExecOk} receipt := &types.Receipt{Ty: types.ExecOk}
var auths, authSpends []string
for _, in := range inputs { for _, in := range inputs {
r := makeReceipt(calcAuthorizeHashKey(in.AuthorizeHash), mixTy.TyLogAuthorizeSet, &mixTy.ExistValue{Data: true}) r := makeReceipt(calcAuthorizeHashKey(in.AuthorizeHash), mixTy.TyLogAuthorizeSet, &mixTy.ExistValue{Data: true})
mergeReceipt(receipt, r) mergeReceipt(receipt, r)
r = makeReceipt(calcAuthorizeSpendHashKey(in.AuthorizeSpendHash), mixTy.TyLogAuthorizeSpendSet, &mixTy.ExistValue{Data: true}) r = makeReceipt(calcAuthorizeSpendHashKey(in.AuthorizeSpendHash), mixTy.TyLogAuthorizeSpendSet, &mixTy.ExistValue{Data: true})
mergeReceipt(receipt, r) mergeReceipt(receipt, r)
auths = append(auths, in.AuthorizeHash)
authSpends = append(authSpends, in.AuthorizeSpendHash)
} }
return receipt, nil return receipt, nil
......
...@@ -245,6 +245,8 @@ func getProveData(targetLeaf []byte, leaves [][]byte) (*mixTy.CommitTreeProve, e ...@@ -245,6 +245,8 @@ func getProveData(targetLeaf []byte, leaves [][]byte) (*mixTy.CommitTreeProve, e
} }
//1. 首先在当前tree查找
//2. 如果提供了rootHash,则根据roothash+leaf查找,否则全局遍历查找
func CalcTreeProve(db dbm.KV, rootHash, leaf string) (*mixTy.CommitTreeProve, error) { func CalcTreeProve(db dbm.KV, rootHash, leaf string) (*mixTy.CommitTreeProve, error) {
if len(leaf) <= 0 { if len(leaf) <= 0 {
return nil, errors.Wrap(types.ErrInvalidParam, "leaf is null") return nil, errors.Wrap(types.ErrInvalidParam, "leaf is null")
......
...@@ -37,9 +37,9 @@ func (a *action) Config(config *mixTy.MixConfigAction) (*types.Receipt, error) { ...@@ -37,9 +37,9 @@ func (a *action) Config(config *mixTy.MixConfigAction) (*types.Receipt, error) {
} }
case mixTy.MixConfigType_AuthPubKey: case mixTy.MixConfigType_AuthPubKey:
if config.Action == mixTy.MixConfigAct_Add { if config.Action == mixTy.MixConfigAct_Add {
return a.ConfigAddAuthPubKey(config.GetAuthKey()) return a.ConfigAddAuthPubKey(config.GetAuthPk())
} else { } else {
return a.ConfigDeleteAuthPubKey(config.GetAuthKey()) return a.ConfigDeleteAuthPubKey(config.GetAuthPk())
} }
} }
return nil, types.ErrNotFound return nil, types.ErrNotFound
...@@ -137,22 +137,22 @@ func (a *action) getAuthKeys() (*mixTy.AuthPubKeys, error) { ...@@ -137,22 +137,22 @@ func (a *action) getAuthKeys() (*mixTy.AuthPubKeys, error) {
return &keys, nil return &keys, nil
} }
func (a *action) ConfigAddAuthPubKey(config *mixTy.AuthorizePubKey) (*types.Receipt, error) { func (a *action) ConfigAddAuthPubKey(key string) (*types.Receipt, error) {
keys, err := a.getAuthKeys() keys, err := a.getAuthKeys()
if isNotFound(errors.Cause(err)) { if isNotFound(errors.Cause(err)) {
keys := &mixTy.AuthPubKeys{} keys := &mixTy.AuthPubKeys{}
keys.Data = append(keys.Data, config.Value) keys.Data = append(keys.Data, key)
return makeConfigAuthKeyReceipt(keys), nil return makeConfigAuthKeyReceipt(keys), nil
} }
if err != nil { if err != nil {
return nil, err return nil, err
} }
keys.Data = append(keys.Data, config.Value) keys.Data = append(keys.Data, key)
return makeConfigAuthKeyReceipt(keys), nil return makeConfigAuthKeyReceipt(keys), nil
} }
func (a *action) ConfigDeleteAuthPubKey(config *mixTy.AuthorizePubKey) (*types.Receipt, error) { func (a *action) ConfigDeleteAuthPubKey(key string) (*types.Receipt, error) {
keys, err := a.getAuthKeys() keys, err := a.getAuthKeys()
if err != nil { if err != nil {
return nil, err return nil, err
...@@ -160,7 +160,7 @@ func (a *action) ConfigDeleteAuthPubKey(config *mixTy.AuthorizePubKey) (*types.R ...@@ -160,7 +160,7 @@ func (a *action) ConfigDeleteAuthPubKey(config *mixTy.AuthorizePubKey) (*types.R
var newKeys mixTy.AuthPubKeys var newKeys mixTy.AuthPubKeys
for _, v := range keys.Data { for _, v := range keys.Data {
if config.Value == v { if key == v {
continue continue
} }
newKeys.Data = append(newKeys.Data, v) newKeys.Data = append(newKeys.Data, v)
......
...@@ -50,27 +50,27 @@ func (a *action) zkProofVerify(proof *mixTy.ZkProofInfo, verifyTy mixTy.VerifyTy ...@@ -50,27 +50,27 @@ func (a *action) zkProofVerify(proof *mixTy.ZkProofInfo, verifyTy mixTy.VerifyTy
return nil return nil
} }
func (a *action) depositVerify(proof *mixTy.ZkProofInfo) ([]byte, uint64, error) { func (a *action) depositVerify(proof *mixTy.ZkProofInfo) (string, uint64, error) {
var input mixTy.DepositPublicInput var input mixTy.DepositPublicInput
data, err := hex.DecodeString(proof.PublicInput) data, err := hex.DecodeString(proof.PublicInput)
if err != nil { if err != nil {
return nil, 0, errors.Wrapf(err, "decode string=%s", proof.PublicInput) return "", 0, errors.Wrapf(err, "decode string=%s", proof.PublicInput)
} }
err = json.Unmarshal(data, &input) err = json.Unmarshal(data, &input)
if err != nil { if err != nil {
return nil, 0, errors.Wrapf(err, "unmarshal string=%s", proof.PublicInput) return "", 0, errors.Wrapf(err, "unmarshal string=%s", proof.PublicInput)
} }
val, err := strconv.ParseUint(input.Amount, 10, 64) val, err := strconv.ParseUint(input.Amount, 10, 64)
if err != nil { if err != nil {
return nil, 0, errors.Wrapf(err, "parseUint=%s", input.Amount) return "", 0, errors.Wrapf(err, "parseUint=%s", input.Amount)
} }
err = a.zkProofVerify(proof, mixTy.VerifyType_DEPOSIT) err = a.zkProofVerify(proof, mixTy.VerifyType_DEPOSIT)
if err != nil { if err != nil {
return nil, 0, err return "", 0, err
} }
return transferFr2Bytes(input.NoteHash), val, nil return input.NoteHash, val, nil
} }
...@@ -83,7 +83,7 @@ func (a *action) depositVerify(proof *mixTy.ZkProofInfo) ([]byte, uint64, error) ...@@ -83,7 +83,7 @@ func (a *action) depositVerify(proof *mixTy.ZkProofInfo) ([]byte, uint64, error)
func (a *action) Deposit(deposit *mixTy.MixDepositAction) (*types.Receipt, error) { func (a *action) Deposit(deposit *mixTy.MixDepositAction) (*types.Receipt, error) {
//1. zk-proof校验 //1. zk-proof校验
var sum uint64 var sum uint64
var commitHashs [][]byte var commitHashs []string
for _, v := range deposit.NewCommits { for _, v := range deposit.NewCommits {
hash, val, err := a.depositVerify(v) hash, val, err := a.depositVerify(v)
if err != nil { if err != nil {
...@@ -112,7 +112,7 @@ func (a *action) Deposit(deposit *mixTy.MixDepositAction) (*types.Receipt, error ...@@ -112,7 +112,7 @@ func (a *action) Deposit(deposit *mixTy.MixDepositAction) (*types.Receipt, error
//push new commit to merkle tree //push new commit to merkle tree
var leaves [][]byte var leaves [][]byte
for _, h := range commitHashs { for _, h := range commitHashs {
leaves = append(leaves, h) leaves = append(leaves, transferFr2Bytes(h))
} }
rpt, err := pushTree(a.db, leaves) rpt, err := pushTree(a.db, leaves)
if err != nil { if err != nil {
......
...@@ -6,29 +6,30 @@ package executor ...@@ -6,29 +6,30 @@ package executor
import ( import (
"github.com/33cn/chain33/types" "github.com/33cn/chain33/types"
mixTy "github.com/33cn/plugin/plugin/dapp/mix/types"
) )
//ExecLocal_Config asset withdraw local db process //ExecLocal_Config asset withdraw local db process
func (m *Mix) ExecDelLocal_Config(payload *types.AssetsWithdraw, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) { func (m *Mix) ExecDelLocal_Config(payload *mixTy.MixConfigAction, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return nil, nil return nil, nil
} }
//ExecLocal_Deposit asset withdraw local db process //ExecLocal_Deposit asset withdraw local db process
func (m *Mix) ExecDelLocal_Deposit(payload *types.AssetsWithdraw, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) { func (m *Mix) ExecDelLocal_Deposit(payload *mixTy.MixDepositAction, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return nil, nil return m.execAutoDelLocal(tx, receiptData)
} }
//ExecLocal_Withdraw asset withdraw local db process //ExecLocal_Withdraw asset withdraw local db process
func (m *Mix) ExecDelLocal_Withdraw(payload *types.AssetsWithdraw, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) { func (m *Mix) ExecDelLocal_Withdraw(payload *mixTy.MixWithdrawAction, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return nil, nil return m.execAutoDelLocal(tx, receiptData)
} }
// ExecLocal_Transfer asset transfer local db process // ExecLocal_Transfer asset transfer local db process
func (m *Mix) ExecDelLocal_Transfer(payload *types.AssetsTransfer, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) { func (m *Mix) ExecDelLocal_Transfer(payload *mixTy.MixTransferAction, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return nil, nil return m.execAutoDelLocal(tx, receiptData)
} }
//ExecLocal_Authorize asset withdraw local db process //ExecLocal_Authorize asset withdraw local db process
func (m *Mix) ExecDelLocal_Authorize(payload *types.AssetsWithdraw, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) { func (m *Mix) ExecDelLocal_Authorize(payload *mixTy.MixAuthorizeAction, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return nil, nil return m.execAutoDelLocal(tx, receiptData)
} }
...@@ -6,29 +6,31 @@ package executor ...@@ -6,29 +6,31 @@ package executor
import ( import (
"github.com/33cn/chain33/types" "github.com/33cn/chain33/types"
mixTy "github.com/33cn/plugin/plugin/dapp/mix/types"
) )
//ExecLocal_Config asset withdraw local db process //ExecLocal_Config asset withdraw local db process
func (m *Mix) ExecLocal_Config(payload *types.AssetsWithdraw, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) { func (m *Mix) ExecLocal_Config(payload *mixTy.MixConfigAction, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return nil, nil return nil, nil
} }
//ExecLocal_Deposit asset withdraw local db process //ExecLocal_Deposit asset withdraw local db process
func (m *Mix) ExecLocal_Deposit(payload *types.AssetsWithdraw, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) { func (m *Mix) ExecLocal_Deposit(payload *mixTy.MixDepositAction, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return nil, nil return m.execAutoLocalMix(tx, receiptData, index)
} }
//ExecLocal_Withdraw asset withdraw local db process //ExecLocal_Withdraw asset withdraw local db process
func (m *Mix) ExecLocal_Withdraw(payload *types.AssetsWithdraw, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) { func (m *Mix) ExecLocal_Withdraw(payload *mixTy.MixWithdrawAction, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return nil, nil return m.execAutoLocalMix(tx, receiptData, index)
} }
// ExecLocal_Transfer asset transfer local db process // ExecLocal_Transfer asset transfer local db process
func (m *Mix) ExecLocal_Transfer(payload *types.AssetsTransfer, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) { func (m *Mix) ExecLocal_Transfer(payload *mixTy.MixTransferAction, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return nil, nil return m.execAutoLocalMix(tx, receiptData, index)
} }
//ExecLocal_Authorize asset withdraw local db process //ExecLocal_Authorize asset withdraw local db process
func (m *Mix) ExecLocal_Authorize(payload *types.AssetsWithdraw, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) { func (m *Mix) ExecLocal_Authorize(payload *mixTy.MixAuthorizeAction, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return nil, nil return m.execAutoLocalMix(tx, receiptData, index)
} }
...@@ -18,9 +18,6 @@ var ( ...@@ -18,9 +18,6 @@ var (
authorizeHash string authorizeHash string
authorizeSpendHash string authorizeSpendHash string
nullifierHash string nullifierHash string
localTx string
localTitle string
) )
func setPrefix() { func setPrefix() {
......
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package executor
import (
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/types"
mixTy "github.com/33cn/plugin/plugin/dapp/mix/types"
)
func (e *Mix) execAutoLocalMix(tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
if receiptData.Ty != types.ExecOk {
return nil, types.ErrInvalidParam
}
set, err := e.execLocalMix(tx, receiptData, index)
if err != nil {
return set, err
}
dbSet := &types.LocalDBSet{}
dbSet.KV = e.AddRollbackKV(tx, tx.Execer, set.KV)
return dbSet, nil
}
func (e *Mix) execLocalMix(tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
table := NewMixTxTable(e.GetLocalDB())
r := &mixTy.LocalMixTx{
Hash: tx.Hash(),
Height: e.GetHeight(),
Index: int64(index),
}
err := table.Add(r)
if err != nil {
return nil, err
}
kvs, err := table.Save()
if err != nil {
return nil, err
}
dbSet := &types.LocalDBSet{}
dbSet.KV = append(dbSet.KV, kvs...)
return dbSet, nil
}
func (e *Mix) execAutoDelLocal(tx *types.Transaction, receiptData *types.ReceiptData) (*types.LocalDBSet, error) {
kvs, err := e.DelRollbackKV(tx, tx.Execer)
if err != nil {
return nil, err
}
dbSet := &types.LocalDBSet{}
dbSet.KV = append(dbSet.KV, kvs...)
return dbSet, nil
}
func (e *Mix) listMixInfos(req *mixTy.MixTxListReq) (types.Message, error) {
if req == nil {
return nil, types.ErrInvalidParam
}
localDb := e.GetLocalDB()
query := NewMixTxTable(localDb).GetQuery(localDb)
var primary []byte
if len(req.TxIndex) > 0 {
primary = []byte(req.TxIndex)
}
indexName := "height"
info := &mixTy.LocalMixTx{Height: req.Height, Index: req.Index}
if len(req.Hash) > 0 {
hash, err := common.FromHex(req.Hash)
if err != nil {
mlog.Error("listMixInfos fromHex", "hash", req.Hash, "err", err)
return nil, err
}
info.Hash = hash
indexName = "hash"
}
cur := &MixTxRow{}
cur.SetPayload(info)
prefix, err := cur.Get(indexName)
if err != nil {
mlog.Error("listMixInfos Get", "indexName", indexName, "err", err)
return nil, err
}
rows, err := query.ListIndex(indexName, prefix, primary, req.Count, req.Direction)
if err != nil {
mlog.Error("listMixInfos query failed", "indexName", indexName, "prefix", prefix, "key", string(primary), "err", err)
return nil, err
}
if len(rows) == 0 {
return nil, types.ErrNotFound
}
var rep mixTy.MixTxListResp
for _, row := range rows {
r, ok := row.Data.(*mixTy.LocalMixTx)
if !ok {
mlog.Error("listMixInfos", "err", "bad row type")
return nil, types.ErrDecode
}
rep.Txs = append(rep.Txs, r)
}
return &rep, nil
}
package executor
import (
"fmt"
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/common/db/table"
"github.com/33cn/chain33/types"
mix "github.com/33cn/plugin/plugin/dapp/mix/types"
)
/*
table struct
data: self consens stage
index: status
*/
var txBoardOpt = &table.Option{
Prefix: "LODB-mixcoin",
Name: "tx",
Primary: "txIndex",
Index: []string{"height", "hash"},
}
//NewStageTable 新建表
func NewMixTxTable(kvdb db.KV) *table.Table {
rowmeta := NewMixTxRow()
table, err := table.NewTable(rowmeta, kvdb, txBoardOpt)
if err != nil {
panic(err)
}
return table
}
//MixRow table meta 结构
type MixTxRow struct {
*mix.LocalMixTx
}
//NewMixTxRow 新建一个meta 结构
func NewMixTxRow() *MixTxRow {
return &MixTxRow{LocalMixTx: &mix.LocalMixTx{}}
}
//CreateRow 新建数据行(注意index 数据一定也要保存到数据中,不能就保存heightindex)
func (r *MixTxRow) CreateRow() *table.Row {
return &table.Row{Data: &mix.LocalMixTx{}}
}
//SetPayload 设置数据
func (r *MixTxRow) SetPayload(data types.Message) error {
if d, ok := data.(*mix.LocalMixTx); ok {
r.LocalMixTx = d
return nil
}
return types.ErrTypeAsset
}
//Get 按照indexName 查询 indexValue
func (r *MixTxRow) Get(key string) ([]byte, error) {
switch key {
case "txIndex":
return []byte(dapp.HeightIndexStr(r.Height, r.Index)), nil
case "height":
return []byte(fmt.Sprintf("%022d", r.Height)), nil
case "hash":
return r.Hash, nil
default:
return nil, types.ErrNotFound
}
}
...@@ -11,9 +11,52 @@ import ( ...@@ -11,9 +11,52 @@ import (
) )
// Query_GetTitle query paracross title // Query_GetTitle query paracross title
func (m *Mix) Query_GetTreePath(in *mixTy.TreePathReq) (types.Message, error) { func (m *Mix) Query_GetTreePath(in *mixTy.TreeInfoReq) (types.Message, error) {
if in == nil { if in == nil {
return nil, types.ErrInvalidParam return nil, types.ErrInvalidParam
} }
return CalcTreeProve(m.GetStateDB(), in.RootHash, in.LeafHash) return CalcTreeProve(m.GetStateDB(), in.RootHash, in.LeafHash)
} }
// Query_GetTreeList query paracross title
func (m *Mix) Query_GetLeavesList(in *mixTy.TreeInfoReq) (types.Message, error) {
if in == nil {
return nil, types.ErrInvalidParam
}
var leaves *mixTy.CommitTreeLeaves
var err error
if len(in.RootHash) > 0 {
leaves, err = getCommitLeaves(m.GetStateDB(), calcCommitTreeRootLeaves(in.RootHash))
} else {
leaves, err = getCommitLeaves(m.GetStateDB(), calcCurrentCommitLeavesKey())
}
if err != nil {
return nil, err
}
var resp mixTy.TreeListResp
for _, k := range leaves.Data {
resp.Datas = append(resp.Datas, transferFr2String(k))
}
return &resp, nil
}
// Query_GetRootList query title
func (m *Mix) Query_GetRootList(in *types.ReqNil) (types.Message, error) {
roots, err := getArchiveCommitRoots(m.GetStateDB())
if err != nil {
return nil, err
}
var resp mixTy.TreeListResp
for _, k := range roots.Data {
resp.Datas = append(resp.Datas, transferFr2String(k))
}
return &resp, nil
}
// Query_ListMixTxs 批量查询
func (m *Mix) Query_ListMixTxs(in *mixTy.MixTxListReq) (types.Message, error) {
return m.listMixInfos(in)
}
...@@ -74,15 +74,15 @@ func verifyCommitValues(inputs []*mixTy.TransferInputPublicInput, outputs []*mix ...@@ -74,15 +74,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.CommitValueX) p.X.SetString(in.AmountX)
p.Y.SetString(in.CommitValueY) p.Y.SetString(in.AmountY)
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.CommitValueX) p.X.SetString(out.AmountX)
p.Y.SetString(out.CommitValueY) p.Y.SetString(out.AmountY)
outputPoints = append(outputPoints, &p) outputPoints = append(outputPoints, &p)
} }
...@@ -130,7 +130,6 @@ func (a *action) Transfer(transfer *mixTy.MixTransferAction) (*types.Receipt, er ...@@ -130,7 +130,6 @@ func (a *action) Transfer(transfer *mixTy.MixTransferAction) (*types.Receipt, er
} }
receipt := &types.Receipt{Ty: types.ExecOk} receipt := &types.Receipt{Ty: types.ExecOk}
//set nullifier
for _, k := range inputs { for _, k := range inputs {
r := makeNullifierSetReceipt(k.NullifierHash, &mixTy.ExistValue{Data: true}) r := makeNullifierSetReceipt(k.NullifierHash, &mixTy.ExistValue{Data: true})
mergeReceipt(receipt, r) mergeReceipt(receipt, r)
......
...@@ -113,6 +113,5 @@ func (a *action) Withdraw(withdraw *mixTy.MixWithdrawAction) (*types.Receipt, er ...@@ -113,6 +113,5 @@ func (a *action) Withdraw(withdraw *mixTy.MixWithdrawAction) (*types.Receipt, er
r := makeNullifierSetReceipt(k, &mixTy.ExistValue{Data: true}) r := makeNullifierSetReceipt(k, &mixTy.ExistValue{Data: true})
mergeReceipt(receipt, r) mergeReceipt(receipt, r)
} }
return receipt, nil return receipt, nil
} }
...@@ -6,11 +6,11 @@ package paracross ...@@ -6,11 +6,11 @@ package paracross
import ( import (
"github.com/33cn/chain33/pluginmgr" "github.com/33cn/chain33/pluginmgr"
"github.com/33cn/plugin/plugin/dapp/mix/commands" "github.com/33cn/plugin/plugin/dapp/mix/commands"
"github.com/33cn/plugin/plugin/dapp/mix/executor" "github.com/33cn/plugin/plugin/dapp/mix/executor"
"github.com/33cn/plugin/plugin/dapp/mix/rpc"
"github.com/33cn/plugin/plugin/dapp/mix/types" "github.com/33cn/plugin/plugin/dapp/mix/types"
_ "github.com/33cn/plugin/plugin/dapp/paracross/wallet" // register wallet package _ "github.com/33cn/plugin/plugin/dapp/mix/wallet" // register wallet package
) )
func init() { func init() {
...@@ -18,6 +18,7 @@ func init() { ...@@ -18,6 +18,7 @@ func init() {
Name: types.MixX, Name: types.MixX,
ExecName: executor.GetName(), ExecName: executor.GetName(),
Exec: executor.Init, Exec: executor.Init,
Cmd: commands.ParcCmd, Cmd: commands.MixCmd,
RPC: rpc.Init,
}) })
} }
...@@ -3,6 +3,9 @@ syntax = "proto3"; ...@@ -3,6 +3,9 @@ syntax = "proto3";
package types; package types;
import "common.proto";
import "transaction.proto";
//区分不同的验证电路 //区分不同的验证电路
enum VerifyType{ enum VerifyType{
DEPOSIT = 0; DEPOSIT = 0;
...@@ -36,7 +39,10 @@ message AuthPubKeys{ ...@@ -36,7 +39,10 @@ message AuthPubKeys{
enum MixConfigType{ enum MixConfigType{
VerifyKey = 0; VerifyKey = 0;
//register unify authorize pubkey
AuthPubKey = 1; AuthPubKey = 1;
//for spender's pay pubkey register,DH secret
PaymentPubKey = 2;
} }
enum MixConfigAct{ enum MixConfigAct{
...@@ -45,23 +51,36 @@ enum MixConfigAct{ ...@@ -45,23 +51,36 @@ enum MixConfigAct{
} }
message AuthorizePubKey {
string value = 3;
}
//config verify parameter for proof //config verify parameter for proof
//当前authPk=mimc_hash(prikey),没有X,Y值
message MixConfigAction { message MixConfigAction {
MixConfigType Ty = 1; MixConfigType Ty = 1;
MixConfigAct Action = 2; MixConfigAct Action = 2;
oneof value { oneof value {
ZkVerifyKey verifyKey = 3; ZkVerifyKey verifyKey = 3;
AuthorizePubKey authKey = 4; string authPk = 4;
PubKey paymentPk = 5;
} }
} }
//DH one time pubkey with secret
message DHSecret{
PubKey epk = 1;
string secret = 3;
}
//Diff-Helman 加密group, for spender, returner, authorizer to decrypt
message DHSecretGroup{
DHSecret spender = 1;
DHSecret returner = 2;
DHSecret authorize = 3;
}
message ZkProofInfo { message ZkProofInfo {
string proof = 1; string proof = 1;
string publicInput = 2; string publicInput = 2;
DHSecretGroup group = 3;
} }
message MixDepositAction { message MixDepositAction {
...@@ -101,6 +120,7 @@ message MixAction { ...@@ -101,6 +120,7 @@ message MixAction {
} }
message DepositPublicInput { message DepositPublicInput {
string noteHash = 1; string noteHash = 1;
string amount = 2; string amount = 2;
...@@ -115,19 +135,26 @@ message WithdrawPublicInput { ...@@ -115,19 +135,26 @@ message WithdrawPublicInput {
} }
//加密了的input/output amount
message commitAmount{
string X = 1;
string Y = 2;
}
message TransferInputPublicInput { message TransferInputPublicInput {
string treeRootHash = 1; string treeRootHash = 1;
string commitValueX = 2; string amountX = 2;
string commitValueY = 3; string amountY = 3;
string authorizeSpendHash = 4; string authorizeSpendHash = 4;
string nullifierHash = 5; string nullifierHash = 5;
} }
message TransferOutputPublicInput { message TransferOutputPublicInput {
string noteHash = 1; string noteHash = 1;
string commitValueX = 2; string amountX = 2;
string commitValueY = 3; string amountY = 3;
DHSecretGroup dhSecrets = 4;
} }
message AuthorizePublicInput { message AuthorizePublicInput {
...@@ -138,6 +165,7 @@ message AuthorizePublicInput { ...@@ -138,6 +165,7 @@ message AuthorizePublicInput {
} }
//nullifer 存在value
message ExistValue { message ExistValue {
bool data = 1; bool data = 1;
} }
...@@ -159,11 +187,176 @@ message CommitTreeProve { ...@@ -159,11 +187,176 @@ message CommitTreeProve {
string helpers = 5; string helpers = 5;
} }
message TreePathReq{ message TreeInfoReq{
string rootHash = 1; string rootHash = 1;
string leafHash = 2; string leafHash = 2;
} }
message TreeListResp{
repeated string datas = 1;
}
// mix wallet part
// payKey = hash(spendKey) for zk-snark note spend
// 用在note内部的payment key
message PaymentKeyPair {
string payKey = 1;
string spendKey = 2;
}
// pub = priv*G for diff-helman crypto
// out: take spender's tempPrikey*pubkey as password, tempPubkey show in note
// spender: take self prikey*tempPubkey as password to decode
message PubKey {
string X = 1;
string Y = 2;
}
message PrivKey{
string data = 1;
}
message ShareSecretKeyPair {
PrivKey privKey = 1;
PubKey receivingPk = 2;
}
//spend pair for note proof
//crypt pair for DH crypt/decrypt
message AccountPrivacyKey {
PaymentKeyPair paymentKey = 1;
ShareSecretKeyPair shareSecretKey = 2;
}
message WalletAddrPrivacy {
AccountPrivacyKey privacy = 1;
string addr = 2;
}
message SecretData{
string paymentPubKey = 1;
string returnPubKey = 2;
string authorizePubKey = 3;
string amount = 4;
string noteRandom = 5;
}
message EncodedSecretData{
string encoded = 1;
SecretData rawData = 2;
}
message EncryptSecretData{
string secret = 1;
PubKey receivingPk = 2;
}
message DecryptSecretData{
string secret = 1;
PrivKey receivingPriKey = 2;
PubKey epk = 3;
}
enum NoteStatus{
UNDEF = 0;
FROZEN = 1; //未授权
OPEN = 2; //已授权可使用
CLOSE = 3; //已使用
}
message WalletIndexInfo {
string noteHash = 1;
string nullifier = 2;
string authSpendHash = 3;
string spender = 4;
string account = 5; //账户地址
NoteStatus status = 6;
SecretData note = 7;
}
message WalletDbMixInfo {
WalletIndexInfo info = 1;
string txIndex = 2;
}
message WalletMixIndexReq {
string noteHash = 1;
string nullifier = 2;
string authSpendHash = 3;
string spender = 4;
string account = 5;
int32 status = 6;
int32 count = 7;
int32 direction = 8;
}
message WalletIndexResp {
repeated WalletIndexInfo datas = 1;
}
message WalletReqAddrs{
repeated string data = 1;
}
message WalletEnablePrivacyRst{
string addr = 1;
bool isOK = 2;
string msg = 3;
}
message WalletEnablePrivacyResp{
repeated WalletEnablePrivacyRst data = 1;
}
enum MixWalletRescanStatus{
IDLE = 0;
SCANNING = 1;
FINISHED = 2;
}
///////localdb index query
message LocalMixTx {
bytes hash = 1;
int64 height = 2;
int64 index = 3;
}
message MixTxListReq{
string txIndex = 1; //primary direct query
string hash = 2;
int64 height = 3;
int64 index = 4;
int32 count =5;
int32 direction = 6;
}
message MixTxListResp{
repeated LocalMixTx txs = 1;
}
message PrivacyAddrResult{
string addr = 1;
bool isOK = 2;
string msg = 3;
}
message ReqEnablePrivacyRst{
repeated PrivacyAddrResult results = 1;
}
service mixPrivacy {
// 扫描UTXO以及获取扫描UTXO后的状态
rpc GetRescanStatus(ReqNil) returns (ReqString) {}
// 使能隐私账户
rpc RescanNotes(ReqNil) returns (ReqString) {}
// 创建隐私交易
rpc EnablePrivacy(ReqAddrs) returns (ReqEnablePrivacyRst) {}
}
\ No newline at end of file
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package rpc
import (
"encoding/json"
"github.com/33cn/chain33/types"
mixTy "github.com/33cn/plugin/plugin/dapp/mix/types"
"golang.org/x/net/context"
)
// 显示指定地址的公钥对信息,可以作为后续交易参数
//func (g *channelClient) ShowPrivacyKey(ctx context.Context, in *types.ReqString) (*mixTy.AccountPrivacyKey, error) {
// data, err := g.ExecWalletFunc(mixTy.MixX, "ShowPrivacyKey", in)
// if err != nil {
// return nil, err
// }
// return data.(*mixTy.AccountPrivacyKey), nil
//}
func (g *channelClient) GetRescanStatus(ctx context.Context, in *types.ReqNil) (*types.ReqString, error) {
log.Info("GetRescanStatus in")
data, err := g.ExecWalletFunc(mixTy.MixX, "GetRescanStatus", in)
if err != nil {
return nil, err
}
return data.(*types.ReqString), nil
}
//
//// 扫描UTXO以及获取扫描UTXO后的状态
func (g *channelClient) RescanNotes(ctx context.Context, in *types.ReqNil) (*types.ReqString, error) {
log.Info("RescanNotes in")
data, err := g.ExecWalletFunc(mixTy.MixX, "RescanNotes", in)
if err != nil {
return nil, err
}
return data.(*types.ReqString), nil
}
// 使能隐私账户
func (g *channelClient) EnablePrivacy(ctx context.Context, in *types.ReqAddrs) (*mixTy.ReqEnablePrivacyRst, error) {
data, err := g.ExecWalletFunc(mixTy.MixX, "EnablePrivacy", in)
if err != nil {
return nil, err
}
return data.(*mixTy.ReqEnablePrivacyRst), nil
}
// ShowPrivacyAccountInfo display privacy account information for json rpc
func (c *Jrpc) ShowAccountPrivacyInfo(in *types.ReqString, result *json.RawMessage) error {
log.Info("ShowAccountPrivacyInfo jrpc in")
reply, err := c.cli.ExecWalletFunc(mixTy.MixX, "ShowAccountPrivacyInfo", in)
if err != nil {
return err
}
*result, err = types.PBToJSON(reply)
return err
}
/////////////////privacy///////////////
// ShowPrivacyAccountSpend display spend privacy account for json rpc
func (c *Jrpc) ShowAccountNoteInfo(in *types.ReqAddrs, result *json.RawMessage) error {
if 0 == len(in.Addrs) {
return types.ErrInvalidParam
}
reply, err := c.cli.ExecWalletFunc(mixTy.MixX, "ShowAccountNoteInfo", in)
if err != nil {
log.Info("ShowPrivacyAccountSpend", "return err info", err)
return err
}
*result, err = types.PBToJSON(reply)
return err
}
func (c *Jrpc) GetRescanStatus(in *types.ReqNil, result *json.RawMessage) error {
reply, err := c.cli.GetRescanStatus(context.Background(), in)
if err != nil {
return err
}
*result, err = types.PBToJSON(reply)
return err
}
// RescanUtxos rescan utxosl for json rpc
func (c *Jrpc) RescanNotes(in *types.ReqNil, result *json.RawMessage) error {
reply, err := c.cli.RescanNotes(context.Background(), in)
if err != nil {
return err
}
*result, err = types.PBToJSON(reply)
return err
}
// EnablePrivacy enable privacy for json rpc
func (c *Jrpc) EnablePrivacy(in *types.ReqAddrs, result *json.RawMessage) error {
reply, err := c.cli.EnablePrivacy(context.Background(), in)
if err != nil {
return err
}
*result, err = types.PBToJSON(reply)
return err
}
func (c *Jrpc) EncodeSecretData(in *mixTy.SecretData, result *json.RawMessage) error {
reply, err := c.cli.ExecWalletFunc(mixTy.MixX, "EncodeSecretData", in)
if err != nil {
return err
}
*result, err = types.PBToJSON(reply)
return err
}
func (c *Jrpc) EncryptSecretData(in *mixTy.EncryptSecretData, result *json.RawMessage) error {
reply, err := c.cli.ExecWalletFunc(mixTy.MixX, "EncryptSecretData", in)
if err != nil {
return err
}
*result, err = types.PBToJSON(reply)
return err
}
func (c *Jrpc) DecryptSecretData(in *mixTy.DecryptSecretData, result *json.RawMessage) error {
reply, err := c.cli.ExecWalletFunc(mixTy.MixX, "DecryptSecretData", in)
if err != nil {
return err
}
*result, err = types.PBToJSON(reply)
return err
}
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package rpc
import (
"github.com/33cn/chain33/common/log/log15"
"github.com/33cn/chain33/rpc/types"
mixTy "github.com/33cn/plugin/plugin/dapp/mix/types"
)
var log = log15.New("module", "mix.rpc")
// Jrpc json rpc class
type Jrpc struct {
cli *channelClient
}
// Grpc grpc class
type Grpc struct {
*channelClient
}
type channelClient struct {
types.ChannelClient
}
// Init init rpc server
func Init(name string, s types.RPCServer) {
cli := &channelClient{}
grpc := &Grpc{channelClient: cli}
cli.Init(name, s, &Jrpc{cli: cli}, grpc)
mixTy.RegisterMixPrivacyServer(s.GRPC(), grpc)
}
...@@ -23,4 +23,7 @@ var ( ...@@ -23,4 +23,7 @@ var (
//ErrSpendInOutValueNotMatch spend input and output value not match //ErrSpendInOutValueNotMatch spend input and output value not match
ErrSpendInOutValueNotMatch = errors.New("ErrSpendInOutValueNotMatch") ErrSpendInOutValueNotMatch = errors.New("ErrSpendInOutValueNotMatch")
//ErrDecryptDataFail decrypt data fail like by wrong prikey
ErrDecryptDataFail = errors.New("ErrDecryptDataFail")
) )
...@@ -15,10 +15,10 @@ const ( ...@@ -15,10 +15,10 @@ const (
// 执行器的日志类型 // 执行器的日志类型
const ( const (
// TyLogParacrossCommit commit log key // TyLogParacrossCommit commit log key
TyLogMixDeposit = 750 TyLogMixLocalDeposit = 750
TyLogMixWithdraw = 751 TyLogMixLocalNullifier = 751
TyLogMixTransfer = 752 TyLogMixLocalAuth = 752
TyLogMixAuth = 753 TyLogMixLocalAuthSpend = 753
TyLogMixConfigVk = 754 TyLogMixConfigVk = 754
TyLogMixConfigAuth = 755 TyLogMixConfigAuth = 755
TyLogCurrentCommitTreeLeaves = 756 TyLogCurrentCommitTreeLeaves = 756
......
...@@ -4,10 +4,15 @@ ...@@ -4,10 +4,15 @@
package types package types
import ( import (
context "context"
fmt "fmt" fmt "fmt"
math "math" math "math"
types "github.com/33cn/chain33/types"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
...@@ -91,18 +96,23 @@ func (ZkCurveId) EnumDescriptor() ([]byte, []int) { ...@@ -91,18 +96,23 @@ func (ZkCurveId) EnumDescriptor() ([]byte, []int) {
type MixConfigType int32 type MixConfigType int32
const ( const (
MixConfigType_VerifyKey MixConfigType = 0 MixConfigType_VerifyKey MixConfigType = 0
//register unify authorize pubkey
MixConfigType_AuthPubKey MixConfigType = 1 MixConfigType_AuthPubKey MixConfigType = 1
//for spender's pay pubkey register,DH secret
MixConfigType_PaymentPubKey MixConfigType = 2
) )
var MixConfigType_name = map[int32]string{ var MixConfigType_name = map[int32]string{
0: "VerifyKey", 0: "VerifyKey",
1: "AuthPubKey", 1: "AuthPubKey",
2: "PaymentPubKey",
} }
var MixConfigType_value = map[string]int32{ var MixConfigType_value = map[string]int32{
"VerifyKey": 0, "VerifyKey": 0,
"AuthPubKey": 1, "AuthPubKey": 1,
"PaymentPubKey": 2,
} }
func (x MixConfigType) String() string { func (x MixConfigType) String() string {
...@@ -138,6 +148,65 @@ func (MixConfigAct) EnumDescriptor() ([]byte, []int) { ...@@ -138,6 +148,65 @@ func (MixConfigAct) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{3} return fileDescriptor_5c21d519a9be369a, []int{3}
} }
type NoteStatus int32
const (
NoteStatus_UNDEF NoteStatus = 0
NoteStatus_FROZEN NoteStatus = 1
NoteStatus_OPEN NoteStatus = 2
NoteStatus_CLOSE NoteStatus = 3
)
var NoteStatus_name = map[int32]string{
0: "UNDEF",
1: "FROZEN",
2: "OPEN",
3: "CLOSE",
}
var NoteStatus_value = map[string]int32{
"UNDEF": 0,
"FROZEN": 1,
"OPEN": 2,
"CLOSE": 3,
}
func (x NoteStatus) String() string {
return proto.EnumName(NoteStatus_name, int32(x))
}
func (NoteStatus) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{4}
}
type MixWalletRescanStatus int32
const (
MixWalletRescanStatus_IDLE MixWalletRescanStatus = 0
MixWalletRescanStatus_SCANNING MixWalletRescanStatus = 1
MixWalletRescanStatus_FINISHED MixWalletRescanStatus = 2
)
var MixWalletRescanStatus_name = map[int32]string{
0: "IDLE",
1: "SCANNING",
2: "FINISHED",
}
var MixWalletRescanStatus_value = map[string]int32{
"IDLE": 0,
"SCANNING": 1,
"FINISHED": 2,
}
func (x MixWalletRescanStatus) String() string {
return proto.EnumName(MixWalletRescanStatus_name, int32(x))
}
func (MixWalletRescanStatus) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{5}
}
type ZkVerifyKey struct { type ZkVerifyKey struct {
CurveId ZkCurveId `protobuf:"varint,1,opt,name=curveId,proto3,enum=types.ZkCurveId" json:"curveId,omitempty"` CurveId ZkCurveId `protobuf:"varint,1,opt,name=curveId,proto3,enum=types.ZkCurveId" json:"curveId,omitempty"`
Type VerifyType `protobuf:"varint,2,opt,name=type,proto3,enum=types.VerifyType" json:"type,omitempty"` Type VerifyType `protobuf:"varint,2,opt,name=type,proto3,enum=types.VerifyType" json:"type,omitempty"`
...@@ -271,52 +340,15 @@ func (m *AuthPubKeys) GetData() []string { ...@@ -271,52 +340,15 @@ func (m *AuthPubKeys) GetData() []string {
return nil return nil
} }
type AuthorizePubKey struct {
Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *AuthorizePubKey) Reset() { *m = AuthorizePubKey{} }
func (m *AuthorizePubKey) String() string { return proto.CompactTextString(m) }
func (*AuthorizePubKey) ProtoMessage() {}
func (*AuthorizePubKey) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{3}
}
func (m *AuthorizePubKey) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AuthorizePubKey.Unmarshal(m, b)
}
func (m *AuthorizePubKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_AuthorizePubKey.Marshal(b, m, deterministic)
}
func (m *AuthorizePubKey) XXX_Merge(src proto.Message) {
xxx_messageInfo_AuthorizePubKey.Merge(m, src)
}
func (m *AuthorizePubKey) XXX_Size() int {
return xxx_messageInfo_AuthorizePubKey.Size(m)
}
func (m *AuthorizePubKey) XXX_DiscardUnknown() {
xxx_messageInfo_AuthorizePubKey.DiscardUnknown(m)
}
var xxx_messageInfo_AuthorizePubKey proto.InternalMessageInfo
func (m *AuthorizePubKey) GetValue() string {
if m != nil {
return m.Value
}
return ""
}
//config verify parameter for proof //config verify parameter for proof
//当前authPk=mimc_hash(prikey),没有X,Y值
type MixConfigAction struct { type MixConfigAction struct {
Ty MixConfigType `protobuf:"varint,1,opt,name=Ty,proto3,enum=types.MixConfigType" json:"Ty,omitempty"` Ty MixConfigType `protobuf:"varint,1,opt,name=Ty,proto3,enum=types.MixConfigType" json:"Ty,omitempty"`
Action MixConfigAct `protobuf:"varint,2,opt,name=Action,proto3,enum=types.MixConfigAct" json:"Action,omitempty"` Action MixConfigAct `protobuf:"varint,2,opt,name=Action,proto3,enum=types.MixConfigAct" json:"Action,omitempty"`
// Types that are valid to be assigned to Value: // Types that are valid to be assigned to Value:
// *MixConfigAction_VerifyKey // *MixConfigAction_VerifyKey
// *MixConfigAction_AuthKey // *MixConfigAction_AuthPk
// *MixConfigAction_PaymentPk
Value isMixConfigAction_Value `protobuf_oneof:"value"` Value isMixConfigAction_Value `protobuf_oneof:"value"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
...@@ -327,7 +359,7 @@ func (m *MixConfigAction) Reset() { *m = MixConfigAction{} } ...@@ -327,7 +359,7 @@ func (m *MixConfigAction) Reset() { *m = MixConfigAction{} }
func (m *MixConfigAction) String() string { return proto.CompactTextString(m) } func (m *MixConfigAction) String() string { return proto.CompactTextString(m) }
func (*MixConfigAction) ProtoMessage() {} func (*MixConfigAction) ProtoMessage() {}
func (*MixConfigAction) Descriptor() ([]byte, []int) { func (*MixConfigAction) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{4} return fileDescriptor_5c21d519a9be369a, []int{3}
} }
func (m *MixConfigAction) XXX_Unmarshal(b []byte) error { func (m *MixConfigAction) XXX_Unmarshal(b []byte) error {
...@@ -370,13 +402,19 @@ type MixConfigAction_VerifyKey struct { ...@@ -370,13 +402,19 @@ type MixConfigAction_VerifyKey struct {
VerifyKey *ZkVerifyKey `protobuf:"bytes,3,opt,name=verifyKey,proto3,oneof"` VerifyKey *ZkVerifyKey `protobuf:"bytes,3,opt,name=verifyKey,proto3,oneof"`
} }
type MixConfigAction_AuthKey struct { type MixConfigAction_AuthPk struct {
AuthKey *AuthorizePubKey `protobuf:"bytes,4,opt,name=authKey,proto3,oneof"` AuthPk string `protobuf:"bytes,4,opt,name=authPk,proto3,oneof"`
}
type MixConfigAction_PaymentPk struct {
PaymentPk *PubKey `protobuf:"bytes,5,opt,name=paymentPk,proto3,oneof"`
} }
func (*MixConfigAction_VerifyKey) isMixConfigAction_Value() {} func (*MixConfigAction_VerifyKey) isMixConfigAction_Value() {}
func (*MixConfigAction_AuthKey) isMixConfigAction_Value() {} func (*MixConfigAction_AuthPk) isMixConfigAction_Value() {}
func (*MixConfigAction_PaymentPk) isMixConfigAction_Value() {}
func (m *MixConfigAction) GetValue() isMixConfigAction_Value { func (m *MixConfigAction) GetValue() isMixConfigAction_Value {
if m != nil { if m != nil {
...@@ -392,9 +430,16 @@ func (m *MixConfigAction) GetVerifyKey() *ZkVerifyKey { ...@@ -392,9 +430,16 @@ func (m *MixConfigAction) GetVerifyKey() *ZkVerifyKey {
return nil return nil
} }
func (m *MixConfigAction) GetAuthKey() *AuthorizePubKey { func (m *MixConfigAction) GetAuthPk() string {
if x, ok := m.GetValue().(*MixConfigAction_AuthKey); ok { if x, ok := m.GetValue().(*MixConfigAction_AuthPk); ok {
return x.AuthKey return x.AuthPk
}
return ""
}
func (m *MixConfigAction) GetPaymentPk() *PubKey {
if x, ok := m.GetValue().(*MixConfigAction_PaymentPk); ok {
return x.PaymentPk
} }
return nil return nil
} }
...@@ -403,23 +448,129 @@ func (m *MixConfigAction) GetAuthKey() *AuthorizePubKey { ...@@ -403,23 +448,129 @@ func (m *MixConfigAction) GetAuthKey() *AuthorizePubKey {
func (*MixConfigAction) XXX_OneofWrappers() []interface{} { func (*MixConfigAction) XXX_OneofWrappers() []interface{} {
return []interface{}{ return []interface{}{
(*MixConfigAction_VerifyKey)(nil), (*MixConfigAction_VerifyKey)(nil),
(*MixConfigAction_AuthKey)(nil), (*MixConfigAction_AuthPk)(nil),
(*MixConfigAction_PaymentPk)(nil),
} }
} }
type ZkProofInfo struct { //DH one time pubkey with secret
Proof string `protobuf:"bytes,1,opt,name=proof,proto3" json:"proof,omitempty"` type DHSecret struct {
PublicInput string `protobuf:"bytes,2,opt,name=publicInput,proto3" json:"publicInput,omitempty"` Epk *PubKey `protobuf:"bytes,1,opt,name=epk,proto3" json:"epk,omitempty"`
Secret string `protobuf:"bytes,3,opt,name=secret,proto3" json:"secret,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 *DHSecret) Reset() { *m = DHSecret{} }
func (m *DHSecret) String() string { return proto.CompactTextString(m) }
func (*DHSecret) ProtoMessage() {}
func (*DHSecret) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{4}
}
func (m *DHSecret) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DHSecret.Unmarshal(m, b)
}
func (m *DHSecret) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_DHSecret.Marshal(b, m, deterministic)
}
func (m *DHSecret) XXX_Merge(src proto.Message) {
xxx_messageInfo_DHSecret.Merge(m, src)
}
func (m *DHSecret) XXX_Size() int {
return xxx_messageInfo_DHSecret.Size(m)
}
func (m *DHSecret) XXX_DiscardUnknown() {
xxx_messageInfo_DHSecret.DiscardUnknown(m)
}
var xxx_messageInfo_DHSecret proto.InternalMessageInfo
func (m *DHSecret) GetEpk() *PubKey {
if m != nil {
return m.Epk
}
return nil
}
func (m *DHSecret) GetSecret() string {
if m != nil {
return m.Secret
}
return ""
}
//Diff-Helman 加密group, for spender, returner, authorizer to decrypt
type DHSecretGroup struct {
Spender *DHSecret `protobuf:"bytes,1,opt,name=spender,proto3" json:"spender,omitempty"`
Returner *DHSecret `protobuf:"bytes,2,opt,name=returner,proto3" json:"returner,omitempty"`
Authorize *DHSecret `protobuf:"bytes,3,opt,name=authorize,proto3" json:"authorize,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *DHSecretGroup) Reset() { *m = DHSecretGroup{} }
func (m *DHSecretGroup) String() string { return proto.CompactTextString(m) }
func (*DHSecretGroup) ProtoMessage() {}
func (*DHSecretGroup) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{5}
}
func (m *DHSecretGroup) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DHSecretGroup.Unmarshal(m, b)
}
func (m *DHSecretGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_DHSecretGroup.Marshal(b, m, deterministic)
}
func (m *DHSecretGroup) XXX_Merge(src proto.Message) {
xxx_messageInfo_DHSecretGroup.Merge(m, src)
}
func (m *DHSecretGroup) XXX_Size() int {
return xxx_messageInfo_DHSecretGroup.Size(m)
}
func (m *DHSecretGroup) XXX_DiscardUnknown() {
xxx_messageInfo_DHSecretGroup.DiscardUnknown(m)
}
var xxx_messageInfo_DHSecretGroup proto.InternalMessageInfo
func (m *DHSecretGroup) GetSpender() *DHSecret {
if m != nil {
return m.Spender
}
return nil
}
func (m *DHSecretGroup) GetReturner() *DHSecret {
if m != nil {
return m.Returner
}
return nil
}
func (m *DHSecretGroup) GetAuthorize() *DHSecret {
if m != nil {
return m.Authorize
}
return nil
}
type ZkProofInfo struct {
Proof string `protobuf:"bytes,1,opt,name=proof,proto3" json:"proof,omitempty"`
PublicInput string `protobuf:"bytes,2,opt,name=publicInput,proto3" json:"publicInput,omitempty"`
Group *DHSecretGroup `protobuf:"bytes,3,opt,name=group,proto3" json:"group,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ZkProofInfo) Reset() { *m = ZkProofInfo{} } func (m *ZkProofInfo) Reset() { *m = ZkProofInfo{} }
func (m *ZkProofInfo) String() string { return proto.CompactTextString(m) } func (m *ZkProofInfo) String() string { return proto.CompactTextString(m) }
func (*ZkProofInfo) ProtoMessage() {} func (*ZkProofInfo) ProtoMessage() {}
func (*ZkProofInfo) Descriptor() ([]byte, []int) { func (*ZkProofInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{5} return fileDescriptor_5c21d519a9be369a, []int{6}
} }
func (m *ZkProofInfo) XXX_Unmarshal(b []byte) error { func (m *ZkProofInfo) XXX_Unmarshal(b []byte) error {
...@@ -454,6 +605,13 @@ func (m *ZkProofInfo) GetPublicInput() string { ...@@ -454,6 +605,13 @@ func (m *ZkProofInfo) GetPublicInput() string {
return "" return ""
} }
func (m *ZkProofInfo) GetGroup() *DHSecretGroup {
if m != nil {
return m.Group
}
return nil
}
type MixDepositAction struct { type MixDepositAction struct {
Amount uint64 `protobuf:"varint,1,opt,name=amount,proto3" json:"amount,omitempty"` Amount uint64 `protobuf:"varint,1,opt,name=amount,proto3" json:"amount,omitempty"`
NewCommits []*ZkProofInfo `protobuf:"bytes,2,rep,name=newCommits,proto3" json:"newCommits,omitempty"` NewCommits []*ZkProofInfo `protobuf:"bytes,2,rep,name=newCommits,proto3" json:"newCommits,omitempty"`
...@@ -466,7 +624,7 @@ func (m *MixDepositAction) Reset() { *m = MixDepositAction{} } ...@@ -466,7 +624,7 @@ func (m *MixDepositAction) Reset() { *m = MixDepositAction{} }
func (m *MixDepositAction) String() string { return proto.CompactTextString(m) } func (m *MixDepositAction) String() string { return proto.CompactTextString(m) }
func (*MixDepositAction) ProtoMessage() {} func (*MixDepositAction) ProtoMessage() {}
func (*MixDepositAction) Descriptor() ([]byte, []int) { func (*MixDepositAction) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{6} return fileDescriptor_5c21d519a9be369a, []int{7}
} }
func (m *MixDepositAction) XXX_Unmarshal(b []byte) error { func (m *MixDepositAction) XXX_Unmarshal(b []byte) error {
...@@ -513,7 +671,7 @@ func (m *MixTransferAction) Reset() { *m = MixTransferAction{} } ...@@ -513,7 +671,7 @@ func (m *MixTransferAction) Reset() { *m = MixTransferAction{} }
func (m *MixTransferAction) String() string { return proto.CompactTextString(m) } func (m *MixTransferAction) String() string { return proto.CompactTextString(m) }
func (*MixTransferAction) ProtoMessage() {} func (*MixTransferAction) ProtoMessage() {}
func (*MixTransferAction) Descriptor() ([]byte, []int) { func (*MixTransferAction) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{7} return fileDescriptor_5c21d519a9be369a, []int{8}
} }
func (m *MixTransferAction) XXX_Unmarshal(b []byte) error { func (m *MixTransferAction) XXX_Unmarshal(b []byte) error {
...@@ -560,7 +718,7 @@ func (m *MixWithdrawAction) Reset() { *m = MixWithdrawAction{} } ...@@ -560,7 +718,7 @@ func (m *MixWithdrawAction) Reset() { *m = MixWithdrawAction{} }
func (m *MixWithdrawAction) String() string { return proto.CompactTextString(m) } func (m *MixWithdrawAction) String() string { return proto.CompactTextString(m) }
func (*MixWithdrawAction) ProtoMessage() {} func (*MixWithdrawAction) ProtoMessage() {}
func (*MixWithdrawAction) Descriptor() ([]byte, []int) { func (*MixWithdrawAction) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{8} return fileDescriptor_5c21d519a9be369a, []int{9}
} }
func (m *MixWithdrawAction) XXX_Unmarshal(b []byte) error { func (m *MixWithdrawAction) XXX_Unmarshal(b []byte) error {
...@@ -606,7 +764,7 @@ func (m *MixAuthorizeAction) Reset() { *m = MixAuthorizeAction{} } ...@@ -606,7 +764,7 @@ func (m *MixAuthorizeAction) Reset() { *m = MixAuthorizeAction{} }
func (m *MixAuthorizeAction) String() string { return proto.CompactTextString(m) } func (m *MixAuthorizeAction) String() string { return proto.CompactTextString(m) }
func (*MixAuthorizeAction) ProtoMessage() {} func (*MixAuthorizeAction) ProtoMessage() {}
func (*MixAuthorizeAction) Descriptor() ([]byte, []int) { func (*MixAuthorizeAction) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{9} return fileDescriptor_5c21d519a9be369a, []int{10}
} }
func (m *MixAuthorizeAction) XXX_Unmarshal(b []byte) error { func (m *MixAuthorizeAction) XXX_Unmarshal(b []byte) error {
...@@ -652,7 +810,7 @@ func (m *MixAction) Reset() { *m = MixAction{} } ...@@ -652,7 +810,7 @@ func (m *MixAction) Reset() { *m = MixAction{} }
func (m *MixAction) String() string { return proto.CompactTextString(m) } func (m *MixAction) String() string { return proto.CompactTextString(m) }
func (*MixAction) ProtoMessage() {} func (*MixAction) ProtoMessage() {}
func (*MixAction) Descriptor() ([]byte, []int) { func (*MixAction) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{10} return fileDescriptor_5c21d519a9be369a, []int{11}
} }
func (m *MixAction) XXX_Unmarshal(b []byte) error { func (m *MixAction) XXX_Unmarshal(b []byte) error {
...@@ -779,7 +937,7 @@ func (m *DepositPublicInput) Reset() { *m = DepositPublicInput{} } ...@@ -779,7 +937,7 @@ func (m *DepositPublicInput) Reset() { *m = DepositPublicInput{} }
func (m *DepositPublicInput) String() string { return proto.CompactTextString(m) } func (m *DepositPublicInput) String() string { return proto.CompactTextString(m) }
func (*DepositPublicInput) ProtoMessage() {} func (*DepositPublicInput) ProtoMessage() {}
func (*DepositPublicInput) Descriptor() ([]byte, []int) { func (*DepositPublicInput) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{11} return fileDescriptor_5c21d519a9be369a, []int{12}
} }
func (m *DepositPublicInput) XXX_Unmarshal(b []byte) error { func (m *DepositPublicInput) XXX_Unmarshal(b []byte) error {
...@@ -828,7 +986,7 @@ func (m *WithdrawPublicInput) Reset() { *m = WithdrawPublicInput{} } ...@@ -828,7 +986,7 @@ func (m *WithdrawPublicInput) Reset() { *m = WithdrawPublicInput{} }
func (m *WithdrawPublicInput) String() string { return proto.CompactTextString(m) } func (m *WithdrawPublicInput) String() string { return proto.CompactTextString(m) }
func (*WithdrawPublicInput) ProtoMessage() {} func (*WithdrawPublicInput) ProtoMessage() {}
func (*WithdrawPublicInput) Descriptor() ([]byte, []int) { func (*WithdrawPublicInput) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{12} return fileDescriptor_5c21d519a9be369a, []int{13}
} }
func (m *WithdrawPublicInput) XXX_Unmarshal(b []byte) error { func (m *WithdrawPublicInput) XXX_Unmarshal(b []byte) error {
...@@ -877,10 +1035,58 @@ func (m *WithdrawPublicInput) GetAmount() string { ...@@ -877,10 +1035,58 @@ func (m *WithdrawPublicInput) GetAmount() string {
return "" return ""
} }
//加密了的input/output amount
type CommitAmount struct {
X string `protobuf:"bytes,1,opt,name=X,proto3" json:"X,omitempty"`
Y string `protobuf:"bytes,2,opt,name=Y,proto3" json:"Y,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *CommitAmount) Reset() { *m = CommitAmount{} }
func (m *CommitAmount) String() string { return proto.CompactTextString(m) }
func (*CommitAmount) ProtoMessage() {}
func (*CommitAmount) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{14}
}
func (m *CommitAmount) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CommitAmount.Unmarshal(m, b)
}
func (m *CommitAmount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CommitAmount.Marshal(b, m, deterministic)
}
func (m *CommitAmount) XXX_Merge(src proto.Message) {
xxx_messageInfo_CommitAmount.Merge(m, src)
}
func (m *CommitAmount) XXX_Size() int {
return xxx_messageInfo_CommitAmount.Size(m)
}
func (m *CommitAmount) XXX_DiscardUnknown() {
xxx_messageInfo_CommitAmount.DiscardUnknown(m)
}
var xxx_messageInfo_CommitAmount proto.InternalMessageInfo
func (m *CommitAmount) GetX() string {
if m != nil {
return m.X
}
return ""
}
func (m *CommitAmount) GetY() string {
if m != nil {
return m.Y
}
return ""
}
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"`
CommitValueX string `protobuf:"bytes,2,opt,name=commitValueX,proto3" json:"commitValueX,omitempty"` AmountX string `protobuf:"bytes,2,opt,name=amountX,proto3" json:"amountX,omitempty"`
CommitValueY string `protobuf:"bytes,3,opt,name=commitValueY,proto3" json:"commitValueY,omitempty"` AmountY string `protobuf:"bytes,3,opt,name=amountY,proto3" json:"amountY,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:"-"`
...@@ -892,7 +1098,7 @@ func (m *TransferInputPublicInput) Reset() { *m = TransferInputPublicInp ...@@ -892,7 +1098,7 @@ func (m *TransferInputPublicInput) Reset() { *m = TransferInputPublicInp
func (m *TransferInputPublicInput) String() string { return proto.CompactTextString(m) } func (m *TransferInputPublicInput) String() string { return proto.CompactTextString(m) }
func (*TransferInputPublicInput) ProtoMessage() {} func (*TransferInputPublicInput) ProtoMessage() {}
func (*TransferInputPublicInput) Descriptor() ([]byte, []int) { func (*TransferInputPublicInput) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{13} return fileDescriptor_5c21d519a9be369a, []int{15}
} }
func (m *TransferInputPublicInput) XXX_Unmarshal(b []byte) error { func (m *TransferInputPublicInput) XXX_Unmarshal(b []byte) error {
...@@ -920,16 +1126,16 @@ func (m *TransferInputPublicInput) GetTreeRootHash() string { ...@@ -920,16 +1126,16 @@ func (m *TransferInputPublicInput) GetTreeRootHash() string {
return "" return ""
} }
func (m *TransferInputPublicInput) GetCommitValueX() string { func (m *TransferInputPublicInput) GetAmountX() string {
if m != nil { if m != nil {
return m.CommitValueX return m.AmountX
} }
return "" return ""
} }
func (m *TransferInputPublicInput) GetCommitValueY() string { func (m *TransferInputPublicInput) GetAmountY() string {
if m != nil { if m != nil {
return m.CommitValueY return m.AmountY
} }
return "" return ""
} }
...@@ -949,19 +1155,20 @@ func (m *TransferInputPublicInput) GetNullifierHash() string { ...@@ -949,19 +1155,20 @@ 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"`
CommitValueX string `protobuf:"bytes,2,opt,name=commitValueX,proto3" json:"commitValueX,omitempty"` AmountX string `protobuf:"bytes,2,opt,name=amountX,proto3" json:"amountX,omitempty"`
CommitValueY string `protobuf:"bytes,3,opt,name=commitValueY,proto3" json:"commitValueY,omitempty"` AmountY string `protobuf:"bytes,3,opt,name=amountY,proto3" json:"amountY,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` DhSecrets *DHSecretGroup `protobuf:"bytes,4,opt,name=dhSecrets,proto3" json:"dhSecrets,omitempty"`
XXX_unrecognized []byte `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *TransferOutputPublicInput) Reset() { *m = TransferOutputPublicInput{} } func (m *TransferOutputPublicInput) Reset() { *m = TransferOutputPublicInput{} }
func (m *TransferOutputPublicInput) String() string { return proto.CompactTextString(m) } func (m *TransferOutputPublicInput) String() string { return proto.CompactTextString(m) }
func (*TransferOutputPublicInput) ProtoMessage() {} func (*TransferOutputPublicInput) ProtoMessage() {}
func (*TransferOutputPublicInput) Descriptor() ([]byte, []int) { func (*TransferOutputPublicInput) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{14} return fileDescriptor_5c21d519a9be369a, []int{16}
} }
func (m *TransferOutputPublicInput) XXX_Unmarshal(b []byte) error { func (m *TransferOutputPublicInput) XXX_Unmarshal(b []byte) error {
...@@ -989,20 +1196,27 @@ func (m *TransferOutputPublicInput) GetNoteHash() string { ...@@ -989,20 +1196,27 @@ func (m *TransferOutputPublicInput) GetNoteHash() string {
return "" return ""
} }
func (m *TransferOutputPublicInput) GetCommitValueX() string { func (m *TransferOutputPublicInput) GetAmountX() string {
if m != nil { if m != nil {
return m.CommitValueX return m.AmountX
} }
return "" return ""
} }
func (m *TransferOutputPublicInput) GetCommitValueY() string { func (m *TransferOutputPublicInput) GetAmountY() string {
if m != nil { if m != nil {
return m.CommitValueY return m.AmountY
} }
return "" return ""
} }
func (m *TransferOutputPublicInput) GetDhSecrets() *DHSecretGroup {
if m != nil {
return m.DhSecrets
}
return nil
}
type AuthorizePublicInput struct { type AuthorizePublicInput 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"`
AuthorizePubKey string `protobuf:"bytes,2,opt,name=authorizePubKey,proto3" json:"authorizePubKey,omitempty"` AuthorizePubKey string `protobuf:"bytes,2,opt,name=authorizePubKey,proto3" json:"authorizePubKey,omitempty"`
...@@ -1017,7 +1231,7 @@ func (m *AuthorizePublicInput) Reset() { *m = AuthorizePublicInput{} } ...@@ -1017,7 +1231,7 @@ func (m *AuthorizePublicInput) Reset() { *m = AuthorizePublicInput{} }
func (m *AuthorizePublicInput) String() string { return proto.CompactTextString(m) } func (m *AuthorizePublicInput) String() string { return proto.CompactTextString(m) }
func (*AuthorizePublicInput) ProtoMessage() {} func (*AuthorizePublicInput) ProtoMessage() {}
func (*AuthorizePublicInput) Descriptor() ([]byte, []int) { func (*AuthorizePublicInput) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{15} return fileDescriptor_5c21d519a9be369a, []int{17}
} }
func (m *AuthorizePublicInput) XXX_Unmarshal(b []byte) error { func (m *AuthorizePublicInput) XXX_Unmarshal(b []byte) error {
...@@ -1066,6 +1280,7 @@ func (m *AuthorizePublicInput) GetAuthorizeSpendHash() string { ...@@ -1066,6 +1280,7 @@ func (m *AuthorizePublicInput) GetAuthorizeSpendHash() string {
return "" return ""
} }
//nullifer 存在value
type ExistValue struct { type ExistValue struct {
Data bool `protobuf:"varint,1,opt,name=data,proto3" json:"data,omitempty"` Data bool `protobuf:"varint,1,opt,name=data,proto3" json:"data,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
...@@ -1077,7 +1292,7 @@ func (m *ExistValue) Reset() { *m = ExistValue{} } ...@@ -1077,7 +1292,7 @@ func (m *ExistValue) Reset() { *m = ExistValue{} }
func (m *ExistValue) String() string { return proto.CompactTextString(m) } func (m *ExistValue) String() string { return proto.CompactTextString(m) }
func (*ExistValue) ProtoMessage() {} func (*ExistValue) ProtoMessage() {}
func (*ExistValue) Descriptor() ([]byte, []int) { func (*ExistValue) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{16} return fileDescriptor_5c21d519a9be369a, []int{18}
} }
func (m *ExistValue) XXX_Unmarshal(b []byte) error { func (m *ExistValue) XXX_Unmarshal(b []byte) error {
...@@ -1116,7 +1331,7 @@ func (m *CommitTreeLeaves) Reset() { *m = CommitTreeLeaves{} } ...@@ -1116,7 +1331,7 @@ func (m *CommitTreeLeaves) Reset() { *m = CommitTreeLeaves{} }
func (m *CommitTreeLeaves) String() string { return proto.CompactTextString(m) } func (m *CommitTreeLeaves) String() string { return proto.CompactTextString(m) }
func (*CommitTreeLeaves) ProtoMessage() {} func (*CommitTreeLeaves) ProtoMessage() {}
func (*CommitTreeLeaves) Descriptor() ([]byte, []int) { func (*CommitTreeLeaves) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{17} return fileDescriptor_5c21d519a9be369a, []int{19}
} }
func (m *CommitTreeLeaves) XXX_Unmarshal(b []byte) error { func (m *CommitTreeLeaves) XXX_Unmarshal(b []byte) error {
...@@ -1155,7 +1370,7 @@ func (m *CommitTreeRoots) Reset() { *m = CommitTreeRoots{} } ...@@ -1155,7 +1370,7 @@ func (m *CommitTreeRoots) Reset() { *m = CommitTreeRoots{} }
func (m *CommitTreeRoots) String() string { return proto.CompactTextString(m) } func (m *CommitTreeRoots) String() string { return proto.CompactTextString(m) }
func (*CommitTreeRoots) ProtoMessage() {} func (*CommitTreeRoots) ProtoMessage() {}
func (*CommitTreeRoots) Descriptor() ([]byte, []int) { func (*CommitTreeRoots) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{18} return fileDescriptor_5c21d519a9be369a, []int{20}
} }
func (m *CommitTreeRoots) XXX_Unmarshal(b []byte) error { func (m *CommitTreeRoots) XXX_Unmarshal(b []byte) error {
...@@ -1198,7 +1413,7 @@ func (m *CommitTreeProve) Reset() { *m = CommitTreeProve{} } ...@@ -1198,7 +1413,7 @@ func (m *CommitTreeProve) Reset() { *m = CommitTreeProve{} }
func (m *CommitTreeProve) String() string { return proto.CompactTextString(m) } func (m *CommitTreeProve) String() string { return proto.CompactTextString(m) }
func (*CommitTreeProve) ProtoMessage() {} func (*CommitTreeProve) ProtoMessage() {}
func (*CommitTreeProve) Descriptor() ([]byte, []int) { func (*CommitTreeProve) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{19} return fileDescriptor_5c21d519a9be369a, []int{21}
} }
func (m *CommitTreeProve) XXX_Unmarshal(b []byte) error { func (m *CommitTreeProve) XXX_Unmarshal(b []byte) error {
...@@ -1254,7 +1469,7 @@ func (m *CommitTreeProve) GetHelpers() string { ...@@ -1254,7 +1469,7 @@ func (m *CommitTreeProve) GetHelpers() string {
return "" return ""
} }
type TreePathReq struct { type TreeInfoReq struct {
RootHash string `protobuf:"bytes,1,opt,name=rootHash,proto3" json:"rootHash,omitempty"` RootHash string `protobuf:"bytes,1,opt,name=rootHash,proto3" json:"rootHash,omitempty"`
LeafHash string `protobuf:"bytes,2,opt,name=leafHash,proto3" json:"leafHash,omitempty"` LeafHash string `protobuf:"bytes,2,opt,name=leafHash,proto3" json:"leafHash,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
...@@ -1262,141 +1477,1598 @@ type TreePathReq struct { ...@@ -1262,141 +1477,1598 @@ type TreePathReq struct {
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
} }
func (m *TreePathReq) Reset() { *m = TreePathReq{} } func (m *TreeInfoReq) Reset() { *m = TreeInfoReq{} }
func (m *TreePathReq) String() string { return proto.CompactTextString(m) } func (m *TreeInfoReq) String() string { return proto.CompactTextString(m) }
func (*TreePathReq) ProtoMessage() {} func (*TreeInfoReq) ProtoMessage() {}
func (*TreePathReq) Descriptor() ([]byte, []int) { func (*TreeInfoReq) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{20} return fileDescriptor_5c21d519a9be369a, []int{22}
} }
func (m *TreePathReq) XXX_Unmarshal(b []byte) error { func (m *TreeInfoReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_TreePathReq.Unmarshal(m, b) return xxx_messageInfo_TreeInfoReq.Unmarshal(m, b)
} }
func (m *TreePathReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *TreeInfoReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_TreePathReq.Marshal(b, m, deterministic) return xxx_messageInfo_TreeInfoReq.Marshal(b, m, deterministic)
} }
func (m *TreePathReq) XXX_Merge(src proto.Message) { func (m *TreeInfoReq) XXX_Merge(src proto.Message) {
xxx_messageInfo_TreePathReq.Merge(m, src) xxx_messageInfo_TreeInfoReq.Merge(m, src)
} }
func (m *TreePathReq) XXX_Size() int { func (m *TreeInfoReq) XXX_Size() int {
return xxx_messageInfo_TreePathReq.Size(m) return xxx_messageInfo_TreeInfoReq.Size(m)
} }
func (m *TreePathReq) XXX_DiscardUnknown() { func (m *TreeInfoReq) XXX_DiscardUnknown() {
xxx_messageInfo_TreePathReq.DiscardUnknown(m) xxx_messageInfo_TreeInfoReq.DiscardUnknown(m)
} }
var xxx_messageInfo_TreePathReq proto.InternalMessageInfo var xxx_messageInfo_TreeInfoReq proto.InternalMessageInfo
func (m *TreePathReq) GetRootHash() string { func (m *TreeInfoReq) GetRootHash() string {
if m != nil { if m != nil {
return m.RootHash return m.RootHash
} }
return "" return ""
} }
func (m *TreePathReq) GetLeafHash() string { func (m *TreeInfoReq) GetLeafHash() string {
if m != nil { if m != nil {
return m.LeafHash return m.LeafHash
} }
return "" return ""
} }
func init() { type TreeListResp struct {
proto.RegisterEnum("types.VerifyType", VerifyType_name, VerifyType_value) Datas []string `protobuf:"bytes,1,rep,name=datas,proto3" json:"datas,omitempty"`
proto.RegisterEnum("types.ZkCurveId", ZkCurveId_name, ZkCurveId_value) XXX_NoUnkeyedLiteral struct{} `json:"-"`
proto.RegisterEnum("types.MixConfigType", MixConfigType_name, MixConfigType_value) XXX_unrecognized []byte `json:"-"`
proto.RegisterEnum("types.MixConfigAct", MixConfigAct_name, MixConfigAct_value) XXX_sizecache int32 `json:"-"`
proto.RegisterType((*ZkVerifyKey)(nil), "types.ZkVerifyKey")
proto.RegisterType((*ZkVerifyKeys)(nil), "types.ZkVerifyKeys")
proto.RegisterType((*AuthPubKeys)(nil), "types.AuthPubKeys")
proto.RegisterType((*AuthorizePubKey)(nil), "types.AuthorizePubKey")
proto.RegisterType((*MixConfigAction)(nil), "types.MixConfigAction")
proto.RegisterType((*ZkProofInfo)(nil), "types.ZkProofInfo")
proto.RegisterType((*MixDepositAction)(nil), "types.MixDepositAction")
proto.RegisterType((*MixTransferAction)(nil), "types.MixTransferAction")
proto.RegisterType((*MixWithdrawAction)(nil), "types.MixWithdrawAction")
proto.RegisterType((*MixAuthorizeAction)(nil), "types.MixAuthorizeAction")
proto.RegisterType((*MixAction)(nil), "types.MixAction")
proto.RegisterType((*DepositPublicInput)(nil), "types.DepositPublicInput")
proto.RegisterType((*WithdrawPublicInput)(nil), "types.WithdrawPublicInput")
proto.RegisterType((*TransferInputPublicInput)(nil), "types.TransferInputPublicInput")
proto.RegisterType((*TransferOutputPublicInput)(nil), "types.TransferOutputPublicInput")
proto.RegisterType((*AuthorizePublicInput)(nil), "types.AuthorizePublicInput")
proto.RegisterType((*ExistValue)(nil), "types.ExistValue")
proto.RegisterType((*CommitTreeLeaves)(nil), "types.CommitTreeLeaves")
proto.RegisterType((*CommitTreeRoots)(nil), "types.CommitTreeRoots")
proto.RegisterType((*CommitTreeProve)(nil), "types.CommitTreeProve")
proto.RegisterType((*TreePathReq)(nil), "types.TreePathReq")
} }
func init() { func (m *TreeListResp) Reset() { *m = TreeListResp{} }
proto.RegisterFile("mix.proto", fileDescriptor_5c21d519a9be369a) func (m *TreeListResp) String() string { return proto.CompactTextString(m) }
func (*TreeListResp) ProtoMessage() {}
func (*TreeListResp) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{23}
} }
var fileDescriptor_5c21d519a9be369a = []byte{ func (m *TreeListResp) XXX_Unmarshal(b []byte) error {
// 1013 bytes of a gzipped FileDescriptorProto return xxx_messageInfo_TreeListResp.Unmarshal(m, b)
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xdd, 0x6e, 0xe3, 0x54, }
0x10, 0x8e, 0xf3, 0x5b, 0x4f, 0x92, 0xd6, 0x3d, 0x5b, 0x2d, 0x5e, 0x84, 0x50, 0x30, 0xbb, 0x4b, func (m *TreeListResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
0x14, 0xa4, 0x08, 0x52, 0xe8, 0x82, 0xb8, 0x4a, 0xdb, 0xa0, 0x84, 0xdd, 0x26, 0xd1, 0x89, 0xbb, return xxx_messageInfo_TreeListResp.Marshal(b, m, deterministic)
0x85, 0x4a, 0x20, 0xb9, 0xc9, 0x09, 0xb1, 0x9a, 0xd8, 0xc6, 0x39, 0x4e, 0x13, 0x6e, 0x78, 0x16, }
0xae, 0x78, 0x03, 0x2e, 0x78, 0x0f, 0xee, 0x78, 0x18, 0x74, 0x7e, 0xfc, 0x17, 0x1a, 0x95, 0x4a, func (m *TreeListResp) XXX_Merge(src proto.Message) {
0x7b, 0xe7, 0x19, 0x7f, 0x33, 0xe7, 0xfb, 0x66, 0xe6, 0xfc, 0x80, 0xba, 0xb0, 0xd7, 0x4d, 0xcf, xxx_messageInfo_TreeListResp.Merge(m, src)
0x77, 0xa9, 0x8b, 0x0a, 0x74, 0xe3, 0x91, 0xa5, 0xb1, 0x82, 0xf2, 0xf5, 0xed, 0x5b, 0xe2, 0xdb, }
0xd3, 0xcd, 0x6b, 0xb2, 0x41, 0x0d, 0x28, 0x8d, 0x03, 0x7f, 0x45, 0x7a, 0x13, 0x5d, 0xa9, 0x29, func (m *TreeListResp) XXX_Size() int {
0xf5, 0xfd, 0x96, 0xd6, 0xe4, 0xb8, 0xe6, 0xf5, 0xed, 0x99, 0xf0, 0xe3, 0x10, 0x80, 0x5e, 0x40, return xxx_messageInfo_TreeListResp.Size(m)
0x9e, 0xfd, 0xd3, 0xb3, 0x1c, 0x78, 0x28, 0x81, 0x22, 0x97, 0xb9, 0xf1, 0x08, 0xe6, 0xbf, 0xd1, }
0x11, 0x14, 0x56, 0xd6, 0x3c, 0x20, 0x7a, 0xae, 0xa6, 0xd4, 0x55, 0x2c, 0x0c, 0xe3, 0x04, 0x2a, func (m *TreeListResp) XXX_DiscardUnknown() {
0x89, 0x75, 0x97, 0xe8, 0x25, 0xe4, 0x27, 0x16, 0xb5, 0x74, 0xa5, 0x96, 0xab, 0x97, 0x5b, 0x28, xxx_messageInfo_TreeListResp.DiscardUnknown(m)
0x5a, 0x35, 0x82, 0x60, 0xfe, 0xdf, 0xf8, 0x08, 0xca, 0xed, 0x80, 0xce, 0x86, 0xc1, 0x0d, 0x0f, }
0x43, 0x89, 0x30, 0x55, 0x42, 0x3e, 0x81, 0x03, 0x06, 0x71, 0x7d, 0xfb, 0x57, 0x22, 0x70, 0x3b,
0x38, 0xfc, 0xad, 0xc0, 0xc1, 0x85, 0xbd, 0x3e, 0x73, 0x9d, 0xa9, 0xfd, 0x73, 0x7b, 0x4c, 0x6d, var xxx_messageInfo_TreeListResp proto.InternalMessageInfo
0xd7, 0x41, 0xcf, 0x21, 0x6b, 0x6e, 0xa4, 0xf6, 0x23, 0xc9, 0x22, 0xc2, 0x70, 0x55, 0x59, 0x73,
0x83, 0x3e, 0x85, 0xa2, 0xc0, 0x4b, 0xf1, 0x4f, 0xb6, 0x91, 0xed, 0x31, 0xc5, 0x12, 0x82, 0x5a, func (m *TreeListResp) GetDatas() []string {
0xa0, 0xae, 0x42, 0x15, 0x9c, 0xc0, 0xbd, 0xfa, 0xba, 0x19, 0x1c, 0xc3, 0x50, 0x0b, 0x4a, 0x56, if m != nil {
0x40, 0x67, 0x2c, 0x22, 0xcf, 0x23, 0x9e, 0xca, 0x88, 0x2d, 0x65, 0xdd, 0x0c, 0x0e, 0x81, 0xa7, return m.Datas
0x25, 0x29, 0xd2, 0xe8, 0xb0, 0x9e, 0x0e, 0x7d, 0xd7, 0x9d, 0xf6, 0x9c, 0xa9, 0xcb, 0xc4, 0x7b, }
0xcc, 0xe0, 0xaa, 0x54, 0x2c, 0x0c, 0x54, 0x83, 0xb2, 0x17, 0xdc, 0xcc, 0xed, 0x71, 0xcf, 0xf1, return nil
0x02, 0xca, 0x75, 0xa8, 0x38, 0xe9, 0x32, 0x7e, 0x02, 0xed, 0xc2, 0x5e, 0x9f, 0x13, 0xcf, 0x5d, }
0xda, 0x54, 0x6a, 0x79, 0x0a, 0x45, 0x6b, 0xe1, 0x06, 0x0e, 0xe5, 0xc9, 0xf2, 0x58, 0x5a, 0xa8,
0x05, 0xe0, 0x90, 0xbb, 0x33, 0x77, 0xb1, 0xb0, 0xe9, 0x52, 0xcf, 0x6e, 0x35, 0x31, 0xe2, 0x82, // mix wallet part
0x13, 0x28, 0xc3, 0x86, 0xc3, 0x0b, 0x7b, 0x6d, 0xfa, 0x96, 0xb3, 0x9c, 0x12, 0x5f, 0x2e, 0x50, // payKey = hash(spendKey) for zk-snark note spend
0x87, 0x82, 0xcd, 0x09, 0x29, 0x3b, 0x73, 0x08, 0x00, 0x6a, 0x40, 0xd1, 0x0d, 0xa8, 0xe0, 0xbe, // 用在note内部的payment key
0x0b, 0x2a, 0x11, 0xc6, 0x98, 0x2f, 0x75, 0x65, 0xd3, 0xd9, 0xc4, 0xb7, 0xee, 0x1e, 0xd0, 0x72, type PaymentKeyPair struct {
0x02, 0x95, 0xa5, 0x47, 0x9c, 0xc9, 0xc3, 0x6a, 0x52, 0x38, 0xe3, 0x3b, 0x40, 0x17, 0xf6, 0x3a, PayKey string `protobuf:"bytes,1,opt,name=payKey,proto3" json:"payKey,omitempty"`
0x6a, 0x90, 0x5c, 0xe5, 0x0b, 0x28, 0xb3, 0x06, 0x85, 0xc9, 0x76, 0xcb, 0x4a, 0xc2, 0x8c, 0x3f, SpendKey string `protobuf:"bytes,2,opt,name=spendKey,proto3" json:"spendKey,omitempty"`
0xb3, 0xa0, 0xb2, 0x64, 0x22, 0xc7, 0x3e, 0x64, 0xa9, 0x18, 0xca, 0x02, 0xce, 0xd2, 0x0d, 0xfa, XXX_NoUnkeyedLiteral struct{} `json:"-"`
0x0c, 0x8a, 0x63, 0x3e, 0x66, 0xbc, 0x6d, 0xf1, 0x70, 0x6c, 0x0d, 0x73, 0x37, 0x83, 0x25, 0x0e, XXX_unrecognized []byte `json:"-"`
0x1d, 0x43, 0x69, 0x22, 0x1a, 0x29, 0x27, 0xf0, 0xbd, 0x38, 0x24, 0xd5, 0x61, 0x36, 0x50, 0x12, XXX_sizecache int32 `json:"-"`
0x89, 0x4e, 0x60, 0xef, 0x4e, 0x96, 0x4c, 0x4e, 0xa1, 0x1e, 0x47, 0xa5, 0x8b, 0xd9, 0xcd, 0xe0, }
0x08, 0xcb, 0xe2, 0xa8, 0xec, 0xaa, 0x5e, 0xd8, 0x8e, 0x4b, 0xf7, 0x9b, 0xc5, 0x85, 0x58, 0xf4,
0x35, 0xa8, 0x56, 0x58, 0x3d, 0xbd, 0xc8, 0x03, 0x9f, 0xc5, 0x81, 0x5b, 0x85, 0x65, 0xfb, 0x25, func (m *PaymentKeyPair) Reset() { *m = PaymentKeyPair{} }
0x42, 0xc7, 0xb3, 0xdf, 0x05, 0x24, 0xf5, 0x0c, 0xe3, 0x51, 0x46, 0xef, 0xc3, 0x9e, 0xe3, 0x52, func (m *PaymentKeyPair) String() string { return proto.CompactTextString(m) }
0xd2, 0xb5, 0x96, 0x33, 0xb9, 0x0b, 0x22, 0x3b, 0x31, 0x06, 0x62, 0x0f, 0x48, 0xcb, 0xf8, 0x43, func (*PaymentKeyPair) ProtoMessage() {}
0x81, 0x27, 0xa1, 0xc8, 0x64, 0x2e, 0x03, 0x2a, 0xd4, 0x27, 0x04, 0xbb, 0x2e, 0x4d, 0xe4, 0x4b, func (*PaymentKeyPair) Descriptor() ([]byte, []int) {
0xf9, 0xd0, 0x73, 0xa8, 0x3a, 0xc1, 0x7c, 0x6e, 0x4f, 0x6d, 0xe2, 0x73, 0x90, 0x48, 0x9d, 0x76, return fileDescriptor_5c21d519a9be369a, []int{24}
0xa2, 0x26, 0xa0, 0x48, 0xc1, 0x88, 0x4d, 0x12, 0x87, 0x8a, 0x23, 0xea, 0x9e, 0x3f, 0x09, 0xa6, }
0xf9, 0x14, 0xd3, 0x7f, 0x14, 0xd0, 0xc3, 0xb2, 0x72, 0x8e, 0x8f, 0xa5, 0x6b, 0x40, 0x65, 0xcc,
0x07, 0xef, 0x2d, 0xab, 0xe1, 0xf7, 0x92, 0x6d, 0xca, 0xb7, 0x85, 0xf9, 0x41, 0xd2, 0x4c, 0xf9, func (m *PaymentKeyPair) XXX_Unmarshal(b []byte) error {
0x76, 0x08, 0xca, 0xef, 0x14, 0xf4, 0x9f, 0x32, 0x15, 0xee, 0x29, 0x93, 0xf1, 0x1b, 0x3c, 0x0b, return xxx_messageInfo_PaymentKeyPair.Unmarshal(m, b)
0xd5, 0x0d, 0xf8, 0x76, 0xfe, 0xbf, 0x9d, 0x7d, 0x47, 0xb2, 0x8c, 0xbf, 0x14, 0x38, 0x4a, 0x9e, }
0xbb, 0x8f, 0xaa, 0x6d, 0x1d, 0x0e, 0xac, 0xf4, 0x99, 0x2d, 0x79, 0x6c, 0xbb, 0x59, 0x35, 0x22, func (m *PaymentKeyPair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
0x57, 0x62, 0x12, 0xd2, 0xce, 0xc7, 0xd6, 0xd8, 0xa8, 0x01, 0x74, 0xd6, 0xf6, 0x52, 0x68, 0x49, return xxx_messageInfo_PaymentKeyPair.Marshal(b, m, deterministic)
0xdc, 0x97, 0x4a, 0x7d, 0x4f, 0xde, 0x97, 0x2f, 0x41, 0x13, 0xc7, 0x8e, 0xe9, 0x13, 0xf2, 0x86, }
0x58, 0x2b, 0x92, 0xbe, 0x57, 0x2b, 0x12, 0xf7, 0x02, 0x0e, 0x62, 0x1c, 0xd3, 0x77, 0x3f, 0xec, func (m *PaymentKeyPair) XXX_Merge(src proto.Message) {
0x77, 0x25, 0x89, 0x1b, 0xfa, 0xee, 0x8a, 0xb0, 0x2e, 0xf9, 0xe9, 0x22, 0x45, 0x36, 0xfb, 0xc7, xxx_messageInfo_PaymentKeyPair.Merge(m, src)
0x6f, 0xa4, 0x11, 0x11, 0x27, 0xb9, 0x8a, 0x23, 0x1b, 0x7d, 0x08, 0xe0, 0x89, 0x03, 0x72, 0x42, }
0xd6, 0xbc, 0x1e, 0x55, 0x9c, 0xf0, 0xa0, 0x0f, 0x40, 0x75, 0x82, 0x85, 0xe0, 0xcc, 0x6b, 0x50, func (m *PaymentKeyPair) XXX_Size() int {
0xc5, 0xb1, 0x03, 0xe9, 0x50, 0x9a, 0x91, 0xb9, 0x47, 0xfc, 0xa5, 0x1c, 0xac, 0xd0, 0x64, 0x37, return xxx_messageInfo_PaymentKeyPair.Size(m)
0x24, 0x27, 0x67, 0xd1, 0x19, 0x26, 0xbf, 0x3c, 0x44, 0x6f, 0x4e, 0xac, 0x69, 0x62, 0x17, 0x47, }
0x76, 0xe3, 0x47, 0x80, 0xf8, 0xb9, 0x83, 0xca, 0x50, 0x3a, 0xef, 0x0c, 0x07, 0xa3, 0x9e, 0xa9, func (m *PaymentKeyPair) XXX_DiscardUnknown() {
0x65, 0x50, 0x05, 0xf6, 0xae, 0x7a, 0x66, 0xf7, 0x1c, 0xb7, 0xaf, 0x34, 0x05, 0x1d, 0x42, 0xd5, xxx_messageInfo_PaymentKeyPair.DiscardUnknown(m)
0xc4, 0xed, 0xfe, 0xe8, 0xdb, 0x0e, 0xee, 0xf5, 0x87, 0x97, 0xa6, 0x96, 0x45, 0x08, 0xf6, 0x43, }
0xd7, 0xe0, 0xd2, 0x64, 0xbe, 0x1c, 0xaa, 0x82, 0xda, 0xbe, 0x34, 0xbb, 0x03, 0xdc, 0xbb, 0xee,
0x68, 0xf9, 0xc6, 0x37, 0xa0, 0x46, 0xcf, 0x2e, 0x96, 0xfd, 0xb2, 0xff, 0xba, 0x3f, 0xb8, 0xea, var xxx_messageInfo_PaymentKeyPair proto.InternalMessageInfo
0x6b, 0x19, 0x04, 0x50, 0x3c, 0x7d, 0x33, 0x3a, 0x7e, 0xf5, 0x4a, 0x53, 0xc2, 0xef, 0xaf, 0x3e,
0xd7, 0xb2, 0x48, 0x85, 0xc2, 0x69, 0xbf, 0xf5, 0xe5, 0x89, 0x96, 0x6b, 0x34, 0xa1, 0x9a, 0x7a, func (m *PaymentKeyPair) GetPayKey() string {
0xb7, 0xb0, 0xe4, 0xd1, 0x63, 0x43, 0xcb, 0xa0, 0x7d, 0x80, 0xf8, 0x21, 0xa5, 0x29, 0x8d, 0x8f, if m != nil {
0xa1, 0x92, 0xbc, 0x3e, 0x50, 0x09, 0x72, 0xed, 0xc9, 0x44, 0xac, 0x75, 0x4e, 0xe6, 0x84, 0x12, return m.PayKey
0x4d, 0xb9, 0x29, 0xf2, 0xb7, 0xe3, 0xf1, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x5f, 0xa6, 0xaa, }
0xe3, 0x48, 0x0a, 0x00, 0x00, return ""
}
func (m *PaymentKeyPair) GetSpendKey() string {
if m != nil {
return m.SpendKey
}
return ""
}
// pub = priv*G for diff-helman crypto
// out: take spender's tempPrikey*pubkey as password, tempPubkey show in note
// spender: take self prikey*tempPubkey as password to decode
type PubKey struct {
X string `protobuf:"bytes,1,opt,name=X,proto3" json:"X,omitempty"`
Y string `protobuf:"bytes,2,opt,name=Y,proto3" json:"Y,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *PubKey) Reset() { *m = PubKey{} }
func (m *PubKey) String() string { return proto.CompactTextString(m) }
func (*PubKey) ProtoMessage() {}
func (*PubKey) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{25}
}
func (m *PubKey) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PubKey.Unmarshal(m, b)
}
func (m *PubKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_PubKey.Marshal(b, m, deterministic)
}
func (m *PubKey) XXX_Merge(src proto.Message) {
xxx_messageInfo_PubKey.Merge(m, src)
}
func (m *PubKey) XXX_Size() int {
return xxx_messageInfo_PubKey.Size(m)
}
func (m *PubKey) XXX_DiscardUnknown() {
xxx_messageInfo_PubKey.DiscardUnknown(m)
}
var xxx_messageInfo_PubKey proto.InternalMessageInfo
func (m *PubKey) GetX() string {
if m != nil {
return m.X
}
return ""
}
func (m *PubKey) GetY() string {
if m != nil {
return m.Y
}
return ""
}
type PrivKey struct {
Data string `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *PrivKey) Reset() { *m = PrivKey{} }
func (m *PrivKey) String() string { return proto.CompactTextString(m) }
func (*PrivKey) ProtoMessage() {}
func (*PrivKey) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{26}
}
func (m *PrivKey) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PrivKey.Unmarshal(m, b)
}
func (m *PrivKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_PrivKey.Marshal(b, m, deterministic)
}
func (m *PrivKey) XXX_Merge(src proto.Message) {
xxx_messageInfo_PrivKey.Merge(m, src)
}
func (m *PrivKey) XXX_Size() int {
return xxx_messageInfo_PrivKey.Size(m)
}
func (m *PrivKey) XXX_DiscardUnknown() {
xxx_messageInfo_PrivKey.DiscardUnknown(m)
}
var xxx_messageInfo_PrivKey proto.InternalMessageInfo
func (m *PrivKey) GetData() string {
if m != nil {
return m.Data
}
return ""
}
type ShareSecretKeyPair struct {
PrivKey *PrivKey `protobuf:"bytes,1,opt,name=privKey,proto3" json:"privKey,omitempty"`
ReceivingPk *PubKey `protobuf:"bytes,2,opt,name=receivingPk,proto3" json:"receivingPk,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ShareSecretKeyPair) Reset() { *m = ShareSecretKeyPair{} }
func (m *ShareSecretKeyPair) String() string { return proto.CompactTextString(m) }
func (*ShareSecretKeyPair) ProtoMessage() {}
func (*ShareSecretKeyPair) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{27}
}
func (m *ShareSecretKeyPair) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ShareSecretKeyPair.Unmarshal(m, b)
}
func (m *ShareSecretKeyPair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ShareSecretKeyPair.Marshal(b, m, deterministic)
}
func (m *ShareSecretKeyPair) XXX_Merge(src proto.Message) {
xxx_messageInfo_ShareSecretKeyPair.Merge(m, src)
}
func (m *ShareSecretKeyPair) XXX_Size() int {
return xxx_messageInfo_ShareSecretKeyPair.Size(m)
}
func (m *ShareSecretKeyPair) XXX_DiscardUnknown() {
xxx_messageInfo_ShareSecretKeyPair.DiscardUnknown(m)
}
var xxx_messageInfo_ShareSecretKeyPair proto.InternalMessageInfo
func (m *ShareSecretKeyPair) GetPrivKey() *PrivKey {
if m != nil {
return m.PrivKey
}
return nil
}
func (m *ShareSecretKeyPair) GetReceivingPk() *PubKey {
if m != nil {
return m.ReceivingPk
}
return nil
}
//spend pair for note proof
//crypt pair for DH crypt/decrypt
type AccountPrivacyKey struct {
PaymentKey *PaymentKeyPair `protobuf:"bytes,1,opt,name=paymentKey,proto3" json:"paymentKey,omitempty"`
ShareSecretKey *ShareSecretKeyPair `protobuf:"bytes,2,opt,name=shareSecretKey,proto3" json:"shareSecretKey,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *AccountPrivacyKey) Reset() { *m = AccountPrivacyKey{} }
func (m *AccountPrivacyKey) String() string { return proto.CompactTextString(m) }
func (*AccountPrivacyKey) ProtoMessage() {}
func (*AccountPrivacyKey) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{28}
}
func (m *AccountPrivacyKey) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AccountPrivacyKey.Unmarshal(m, b)
}
func (m *AccountPrivacyKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_AccountPrivacyKey.Marshal(b, m, deterministic)
}
func (m *AccountPrivacyKey) XXX_Merge(src proto.Message) {
xxx_messageInfo_AccountPrivacyKey.Merge(m, src)
}
func (m *AccountPrivacyKey) XXX_Size() int {
return xxx_messageInfo_AccountPrivacyKey.Size(m)
}
func (m *AccountPrivacyKey) XXX_DiscardUnknown() {
xxx_messageInfo_AccountPrivacyKey.DiscardUnknown(m)
}
var xxx_messageInfo_AccountPrivacyKey proto.InternalMessageInfo
func (m *AccountPrivacyKey) GetPaymentKey() *PaymentKeyPair {
if m != nil {
return m.PaymentKey
}
return nil
}
func (m *AccountPrivacyKey) GetShareSecretKey() *ShareSecretKeyPair {
if m != nil {
return m.ShareSecretKey
}
return nil
}
type WalletAddrPrivacy struct {
Privacy *AccountPrivacyKey `protobuf:"bytes,1,opt,name=privacy,proto3" json:"privacy,omitempty"`
Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *WalletAddrPrivacy) Reset() { *m = WalletAddrPrivacy{} }
func (m *WalletAddrPrivacy) String() string { return proto.CompactTextString(m) }
func (*WalletAddrPrivacy) ProtoMessage() {}
func (*WalletAddrPrivacy) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{29}
}
func (m *WalletAddrPrivacy) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_WalletAddrPrivacy.Unmarshal(m, b)
}
func (m *WalletAddrPrivacy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_WalletAddrPrivacy.Marshal(b, m, deterministic)
}
func (m *WalletAddrPrivacy) XXX_Merge(src proto.Message) {
xxx_messageInfo_WalletAddrPrivacy.Merge(m, src)
}
func (m *WalletAddrPrivacy) XXX_Size() int {
return xxx_messageInfo_WalletAddrPrivacy.Size(m)
}
func (m *WalletAddrPrivacy) XXX_DiscardUnknown() {
xxx_messageInfo_WalletAddrPrivacy.DiscardUnknown(m)
}
var xxx_messageInfo_WalletAddrPrivacy proto.InternalMessageInfo
func (m *WalletAddrPrivacy) GetPrivacy() *AccountPrivacyKey {
if m != nil {
return m.Privacy
}
return nil
}
func (m *WalletAddrPrivacy) GetAddr() string {
if m != nil {
return m.Addr
}
return ""
}
type SecretData struct {
PaymentPubKey string `protobuf:"bytes,1,opt,name=paymentPubKey,proto3" json:"paymentPubKey,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"`
Amount string `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount,omitempty"`
NoteRandom string `protobuf:"bytes,5,opt,name=noteRandom,proto3" json:"noteRandom,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *SecretData) Reset() { *m = SecretData{} }
func (m *SecretData) String() string { return proto.CompactTextString(m) }
func (*SecretData) ProtoMessage() {}
func (*SecretData) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{30}
}
func (m *SecretData) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SecretData.Unmarshal(m, b)
}
func (m *SecretData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_SecretData.Marshal(b, m, deterministic)
}
func (m *SecretData) XXX_Merge(src proto.Message) {
xxx_messageInfo_SecretData.Merge(m, src)
}
func (m *SecretData) XXX_Size() int {
return xxx_messageInfo_SecretData.Size(m)
}
func (m *SecretData) XXX_DiscardUnknown() {
xxx_messageInfo_SecretData.DiscardUnknown(m)
}
var xxx_messageInfo_SecretData proto.InternalMessageInfo
func (m *SecretData) GetPaymentPubKey() string {
if m != nil {
return m.PaymentPubKey
}
return ""
}
func (m *SecretData) GetReturnPubKey() string {
if m != nil {
return m.ReturnPubKey
}
return ""
}
func (m *SecretData) GetAuthorizePubKey() string {
if m != nil {
return m.AuthorizePubKey
}
return ""
}
func (m *SecretData) GetAmount() string {
if m != nil {
return m.Amount
}
return ""
}
func (m *SecretData) GetNoteRandom() string {
if m != nil {
return m.NoteRandom
}
return ""
}
type EncodedSecretData struct {
Encoded string `protobuf:"bytes,1,opt,name=encoded,proto3" json:"encoded,omitempty"`
RawData *SecretData `protobuf:"bytes,2,opt,name=rawData,proto3" json:"rawData,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *EncodedSecretData) Reset() { *m = EncodedSecretData{} }
func (m *EncodedSecretData) String() string { return proto.CompactTextString(m) }
func (*EncodedSecretData) ProtoMessage() {}
func (*EncodedSecretData) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{31}
}
func (m *EncodedSecretData) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_EncodedSecretData.Unmarshal(m, b)
}
func (m *EncodedSecretData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_EncodedSecretData.Marshal(b, m, deterministic)
}
func (m *EncodedSecretData) XXX_Merge(src proto.Message) {
xxx_messageInfo_EncodedSecretData.Merge(m, src)
}
func (m *EncodedSecretData) XXX_Size() int {
return xxx_messageInfo_EncodedSecretData.Size(m)
}
func (m *EncodedSecretData) XXX_DiscardUnknown() {
xxx_messageInfo_EncodedSecretData.DiscardUnknown(m)
}
var xxx_messageInfo_EncodedSecretData proto.InternalMessageInfo
func (m *EncodedSecretData) GetEncoded() string {
if m != nil {
return m.Encoded
}
return ""
}
func (m *EncodedSecretData) GetRawData() *SecretData {
if m != nil {
return m.RawData
}
return nil
}
type EncryptSecretData struct {
Secret string `protobuf:"bytes,1,opt,name=secret,proto3" json:"secret,omitempty"`
ReceivingPk *PubKey `protobuf:"bytes,2,opt,name=receivingPk,proto3" json:"receivingPk,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *EncryptSecretData) Reset() { *m = EncryptSecretData{} }
func (m *EncryptSecretData) String() string { return proto.CompactTextString(m) }
func (*EncryptSecretData) ProtoMessage() {}
func (*EncryptSecretData) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{32}
}
func (m *EncryptSecretData) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_EncryptSecretData.Unmarshal(m, b)
}
func (m *EncryptSecretData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_EncryptSecretData.Marshal(b, m, deterministic)
}
func (m *EncryptSecretData) XXX_Merge(src proto.Message) {
xxx_messageInfo_EncryptSecretData.Merge(m, src)
}
func (m *EncryptSecretData) XXX_Size() int {
return xxx_messageInfo_EncryptSecretData.Size(m)
}
func (m *EncryptSecretData) XXX_DiscardUnknown() {
xxx_messageInfo_EncryptSecretData.DiscardUnknown(m)
}
var xxx_messageInfo_EncryptSecretData proto.InternalMessageInfo
func (m *EncryptSecretData) GetSecret() string {
if m != nil {
return m.Secret
}
return ""
}
func (m *EncryptSecretData) GetReceivingPk() *PubKey {
if m != nil {
return m.ReceivingPk
}
return nil
}
type DecryptSecretData struct {
Secret string `protobuf:"bytes,1,opt,name=secret,proto3" json:"secret,omitempty"`
ReceivingPriKey *PrivKey `protobuf:"bytes,2,opt,name=receivingPriKey,proto3" json:"receivingPriKey,omitempty"`
Epk *PubKey `protobuf:"bytes,3,opt,name=epk,proto3" json:"epk,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *DecryptSecretData) Reset() { *m = DecryptSecretData{} }
func (m *DecryptSecretData) String() string { return proto.CompactTextString(m) }
func (*DecryptSecretData) ProtoMessage() {}
func (*DecryptSecretData) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{33}
}
func (m *DecryptSecretData) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DecryptSecretData.Unmarshal(m, b)
}
func (m *DecryptSecretData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_DecryptSecretData.Marshal(b, m, deterministic)
}
func (m *DecryptSecretData) XXX_Merge(src proto.Message) {
xxx_messageInfo_DecryptSecretData.Merge(m, src)
}
func (m *DecryptSecretData) XXX_Size() int {
return xxx_messageInfo_DecryptSecretData.Size(m)
}
func (m *DecryptSecretData) XXX_DiscardUnknown() {
xxx_messageInfo_DecryptSecretData.DiscardUnknown(m)
}
var xxx_messageInfo_DecryptSecretData proto.InternalMessageInfo
func (m *DecryptSecretData) GetSecret() string {
if m != nil {
return m.Secret
}
return ""
}
func (m *DecryptSecretData) GetReceivingPriKey() *PrivKey {
if m != nil {
return m.ReceivingPriKey
}
return nil
}
func (m *DecryptSecretData) GetEpk() *PubKey {
if m != nil {
return m.Epk
}
return nil
}
type WalletIndexInfo struct {
NoteHash string `protobuf:"bytes,1,opt,name=noteHash,proto3" json:"noteHash,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"`
Spender string `protobuf:"bytes,4,opt,name=spender,proto3" json:"spender,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"`
Note *SecretData `protobuf:"bytes,7,opt,name=note,proto3" json:"note,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *WalletIndexInfo) Reset() { *m = WalletIndexInfo{} }
func (m *WalletIndexInfo) String() string { return proto.CompactTextString(m) }
func (*WalletIndexInfo) ProtoMessage() {}
func (*WalletIndexInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{34}
}
func (m *WalletIndexInfo) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_WalletIndexInfo.Unmarshal(m, b)
}
func (m *WalletIndexInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_WalletIndexInfo.Marshal(b, m, deterministic)
}
func (m *WalletIndexInfo) XXX_Merge(src proto.Message) {
xxx_messageInfo_WalletIndexInfo.Merge(m, src)
}
func (m *WalletIndexInfo) XXX_Size() int {
return xxx_messageInfo_WalletIndexInfo.Size(m)
}
func (m *WalletIndexInfo) XXX_DiscardUnknown() {
xxx_messageInfo_WalletIndexInfo.DiscardUnknown(m)
}
var xxx_messageInfo_WalletIndexInfo proto.InternalMessageInfo
func (m *WalletIndexInfo) GetNoteHash() string {
if m != nil {
return m.NoteHash
}
return ""
}
func (m *WalletIndexInfo) GetNullifier() string {
if m != nil {
return m.Nullifier
}
return ""
}
func (m *WalletIndexInfo) GetAuthSpendHash() string {
if m != nil {
return m.AuthSpendHash
}
return ""
}
func (m *WalletIndexInfo) GetSpender() string {
if m != nil {
return m.Spender
}
return ""
}
func (m *WalletIndexInfo) GetAccount() string {
if m != nil {
return m.Account
}
return ""
}
func (m *WalletIndexInfo) GetStatus() NoteStatus {
if m != nil {
return m.Status
}
return NoteStatus_UNDEF
}
func (m *WalletIndexInfo) GetNote() *SecretData {
if m != nil {
return m.Note
}
return nil
}
type WalletDbMixInfo struct {
Info *WalletIndexInfo `protobuf:"bytes,1,opt,name=info,proto3" json:"info,omitempty"`
TxIndex string `protobuf:"bytes,2,opt,name=txIndex,proto3" json:"txIndex,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *WalletDbMixInfo) Reset() { *m = WalletDbMixInfo{} }
func (m *WalletDbMixInfo) String() string { return proto.CompactTextString(m) }
func (*WalletDbMixInfo) ProtoMessage() {}
func (*WalletDbMixInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{35}
}
func (m *WalletDbMixInfo) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_WalletDbMixInfo.Unmarshal(m, b)
}
func (m *WalletDbMixInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_WalletDbMixInfo.Marshal(b, m, deterministic)
}
func (m *WalletDbMixInfo) XXX_Merge(src proto.Message) {
xxx_messageInfo_WalletDbMixInfo.Merge(m, src)
}
func (m *WalletDbMixInfo) XXX_Size() int {
return xxx_messageInfo_WalletDbMixInfo.Size(m)
}
func (m *WalletDbMixInfo) XXX_DiscardUnknown() {
xxx_messageInfo_WalletDbMixInfo.DiscardUnknown(m)
}
var xxx_messageInfo_WalletDbMixInfo proto.InternalMessageInfo
func (m *WalletDbMixInfo) GetInfo() *WalletIndexInfo {
if m != nil {
return m.Info
}
return nil
}
func (m *WalletDbMixInfo) GetTxIndex() string {
if m != nil {
return m.TxIndex
}
return ""
}
type WalletMixIndexReq struct {
NoteHash string `protobuf:"bytes,1,opt,name=noteHash,proto3" json:"noteHash,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"`
Spender string `protobuf:"bytes,4,opt,name=spender,proto3" json:"spender,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"`
Count int32 `protobuf:"varint,7,opt,name=count,proto3" json:"count,omitempty"`
Direction int32 `protobuf:"varint,8,opt,name=direction,proto3" json:"direction,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *WalletMixIndexReq) Reset() { *m = WalletMixIndexReq{} }
func (m *WalletMixIndexReq) String() string { return proto.CompactTextString(m) }
func (*WalletMixIndexReq) ProtoMessage() {}
func (*WalletMixIndexReq) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{36}
}
func (m *WalletMixIndexReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_WalletMixIndexReq.Unmarshal(m, b)
}
func (m *WalletMixIndexReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_WalletMixIndexReq.Marshal(b, m, deterministic)
}
func (m *WalletMixIndexReq) XXX_Merge(src proto.Message) {
xxx_messageInfo_WalletMixIndexReq.Merge(m, src)
}
func (m *WalletMixIndexReq) XXX_Size() int {
return xxx_messageInfo_WalletMixIndexReq.Size(m)
}
func (m *WalletMixIndexReq) XXX_DiscardUnknown() {
xxx_messageInfo_WalletMixIndexReq.DiscardUnknown(m)
}
var xxx_messageInfo_WalletMixIndexReq proto.InternalMessageInfo
func (m *WalletMixIndexReq) GetNoteHash() string {
if m != nil {
return m.NoteHash
}
return ""
}
func (m *WalletMixIndexReq) GetNullifier() string {
if m != nil {
return m.Nullifier
}
return ""
}
func (m *WalletMixIndexReq) GetAuthSpendHash() string {
if m != nil {
return m.AuthSpendHash
}
return ""
}
func (m *WalletMixIndexReq) GetSpender() string {
if m != nil {
return m.Spender
}
return ""
}
func (m *WalletMixIndexReq) GetAccount() string {
if m != nil {
return m.Account
}
return ""
}
func (m *WalletMixIndexReq) GetStatus() int32 {
if m != nil {
return m.Status
}
return 0
}
func (m *WalletMixIndexReq) GetCount() int32 {
if m != nil {
return m.Count
}
return 0
}
func (m *WalletMixIndexReq) GetDirection() int32 {
if m != nil {
return m.Direction
}
return 0
}
type WalletIndexResp struct {
Datas []*WalletIndexInfo `protobuf:"bytes,1,rep,name=datas,proto3" json:"datas,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *WalletIndexResp) Reset() { *m = WalletIndexResp{} }
func (m *WalletIndexResp) String() string { return proto.CompactTextString(m) }
func (*WalletIndexResp) ProtoMessage() {}
func (*WalletIndexResp) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{37}
}
func (m *WalletIndexResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_WalletIndexResp.Unmarshal(m, b)
}
func (m *WalletIndexResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_WalletIndexResp.Marshal(b, m, deterministic)
}
func (m *WalletIndexResp) XXX_Merge(src proto.Message) {
xxx_messageInfo_WalletIndexResp.Merge(m, src)
}
func (m *WalletIndexResp) XXX_Size() int {
return xxx_messageInfo_WalletIndexResp.Size(m)
}
func (m *WalletIndexResp) XXX_DiscardUnknown() {
xxx_messageInfo_WalletIndexResp.DiscardUnknown(m)
}
var xxx_messageInfo_WalletIndexResp proto.InternalMessageInfo
func (m *WalletIndexResp) GetDatas() []*WalletIndexInfo {
if m != nil {
return m.Datas
}
return nil
}
type WalletReqAddrs struct {
Data []string `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *WalletReqAddrs) Reset() { *m = WalletReqAddrs{} }
func (m *WalletReqAddrs) String() string { return proto.CompactTextString(m) }
func (*WalletReqAddrs) ProtoMessage() {}
func (*WalletReqAddrs) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{38}
}
func (m *WalletReqAddrs) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_WalletReqAddrs.Unmarshal(m, b)
}
func (m *WalletReqAddrs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_WalletReqAddrs.Marshal(b, m, deterministic)
}
func (m *WalletReqAddrs) XXX_Merge(src proto.Message) {
xxx_messageInfo_WalletReqAddrs.Merge(m, src)
}
func (m *WalletReqAddrs) XXX_Size() int {
return xxx_messageInfo_WalletReqAddrs.Size(m)
}
func (m *WalletReqAddrs) XXX_DiscardUnknown() {
xxx_messageInfo_WalletReqAddrs.DiscardUnknown(m)
}
var xxx_messageInfo_WalletReqAddrs proto.InternalMessageInfo
func (m *WalletReqAddrs) GetData() []string {
if m != nil {
return m.Data
}
return nil
}
type WalletEnablePrivacyRst struct {
Addr string `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"`
IsOK bool `protobuf:"varint,2,opt,name=isOK,proto3" json:"isOK,omitempty"`
Msg string `protobuf:"bytes,3,opt,name=msg,proto3" json:"msg,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *WalletEnablePrivacyRst) Reset() { *m = WalletEnablePrivacyRst{} }
func (m *WalletEnablePrivacyRst) String() string { return proto.CompactTextString(m) }
func (*WalletEnablePrivacyRst) ProtoMessage() {}
func (*WalletEnablePrivacyRst) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{39}
}
func (m *WalletEnablePrivacyRst) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_WalletEnablePrivacyRst.Unmarshal(m, b)
}
func (m *WalletEnablePrivacyRst) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_WalletEnablePrivacyRst.Marshal(b, m, deterministic)
}
func (m *WalletEnablePrivacyRst) XXX_Merge(src proto.Message) {
xxx_messageInfo_WalletEnablePrivacyRst.Merge(m, src)
}
func (m *WalletEnablePrivacyRst) XXX_Size() int {
return xxx_messageInfo_WalletEnablePrivacyRst.Size(m)
}
func (m *WalletEnablePrivacyRst) XXX_DiscardUnknown() {
xxx_messageInfo_WalletEnablePrivacyRst.DiscardUnknown(m)
}
var xxx_messageInfo_WalletEnablePrivacyRst proto.InternalMessageInfo
func (m *WalletEnablePrivacyRst) GetAddr() string {
if m != nil {
return m.Addr
}
return ""
}
func (m *WalletEnablePrivacyRst) GetIsOK() bool {
if m != nil {
return m.IsOK
}
return false
}
func (m *WalletEnablePrivacyRst) GetMsg() string {
if m != nil {
return m.Msg
}
return ""
}
type WalletEnablePrivacyResp struct {
Data []*WalletEnablePrivacyRst `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *WalletEnablePrivacyResp) Reset() { *m = WalletEnablePrivacyResp{} }
func (m *WalletEnablePrivacyResp) String() string { return proto.CompactTextString(m) }
func (*WalletEnablePrivacyResp) ProtoMessage() {}
func (*WalletEnablePrivacyResp) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{40}
}
func (m *WalletEnablePrivacyResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_WalletEnablePrivacyResp.Unmarshal(m, b)
}
func (m *WalletEnablePrivacyResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_WalletEnablePrivacyResp.Marshal(b, m, deterministic)
}
func (m *WalletEnablePrivacyResp) XXX_Merge(src proto.Message) {
xxx_messageInfo_WalletEnablePrivacyResp.Merge(m, src)
}
func (m *WalletEnablePrivacyResp) XXX_Size() int {
return xxx_messageInfo_WalletEnablePrivacyResp.Size(m)
}
func (m *WalletEnablePrivacyResp) XXX_DiscardUnknown() {
xxx_messageInfo_WalletEnablePrivacyResp.DiscardUnknown(m)
}
var xxx_messageInfo_WalletEnablePrivacyResp proto.InternalMessageInfo
func (m *WalletEnablePrivacyResp) GetData() []*WalletEnablePrivacyRst {
if m != nil {
return m.Data
}
return nil
}
type LocalMixTx struct {
Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"`
Index int64 `protobuf:"varint,3,opt,name=index,proto3" json:"index,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *LocalMixTx) Reset() { *m = LocalMixTx{} }
func (m *LocalMixTx) String() string { return proto.CompactTextString(m) }
func (*LocalMixTx) ProtoMessage() {}
func (*LocalMixTx) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{41}
}
func (m *LocalMixTx) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_LocalMixTx.Unmarshal(m, b)
}
func (m *LocalMixTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_LocalMixTx.Marshal(b, m, deterministic)
}
func (m *LocalMixTx) XXX_Merge(src proto.Message) {
xxx_messageInfo_LocalMixTx.Merge(m, src)
}
func (m *LocalMixTx) XXX_Size() int {
return xxx_messageInfo_LocalMixTx.Size(m)
}
func (m *LocalMixTx) XXX_DiscardUnknown() {
xxx_messageInfo_LocalMixTx.DiscardUnknown(m)
}
var xxx_messageInfo_LocalMixTx proto.InternalMessageInfo
func (m *LocalMixTx) GetHash() []byte {
if m != nil {
return m.Hash
}
return nil
}
func (m *LocalMixTx) GetHeight() int64 {
if m != nil {
return m.Height
}
return 0
}
func (m *LocalMixTx) GetIndex() int64 {
if m != nil {
return m.Index
}
return 0
}
type MixTxListReq struct {
TxIndex string `protobuf:"bytes,1,opt,name=txIndex,proto3" json:"txIndex,omitempty"`
Hash string `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"`
Height int64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"`
Index int64 `protobuf:"varint,4,opt,name=index,proto3" json:"index,omitempty"`
Count int32 `protobuf:"varint,5,opt,name=count,proto3" json:"count,omitempty"`
Direction int32 `protobuf:"varint,6,opt,name=direction,proto3" json:"direction,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *MixTxListReq) Reset() { *m = MixTxListReq{} }
func (m *MixTxListReq) String() string { return proto.CompactTextString(m) }
func (*MixTxListReq) ProtoMessage() {}
func (*MixTxListReq) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{42}
}
func (m *MixTxListReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MixTxListReq.Unmarshal(m, b)
}
func (m *MixTxListReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_MixTxListReq.Marshal(b, m, deterministic)
}
func (m *MixTxListReq) XXX_Merge(src proto.Message) {
xxx_messageInfo_MixTxListReq.Merge(m, src)
}
func (m *MixTxListReq) XXX_Size() int {
return xxx_messageInfo_MixTxListReq.Size(m)
}
func (m *MixTxListReq) XXX_DiscardUnknown() {
xxx_messageInfo_MixTxListReq.DiscardUnknown(m)
}
var xxx_messageInfo_MixTxListReq proto.InternalMessageInfo
func (m *MixTxListReq) GetTxIndex() string {
if m != nil {
return m.TxIndex
}
return ""
}
func (m *MixTxListReq) GetHash() string {
if m != nil {
return m.Hash
}
return ""
}
func (m *MixTxListReq) GetHeight() int64 {
if m != nil {
return m.Height
}
return 0
}
func (m *MixTxListReq) GetIndex() int64 {
if m != nil {
return m.Index
}
return 0
}
func (m *MixTxListReq) GetCount() int32 {
if m != nil {
return m.Count
}
return 0
}
func (m *MixTxListReq) GetDirection() int32 {
if m != nil {
return m.Direction
}
return 0
}
type MixTxListResp struct {
Txs []*LocalMixTx `protobuf:"bytes,1,rep,name=txs,proto3" json:"txs,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *MixTxListResp) Reset() { *m = MixTxListResp{} }
func (m *MixTxListResp) String() string { return proto.CompactTextString(m) }
func (*MixTxListResp) ProtoMessage() {}
func (*MixTxListResp) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{43}
}
func (m *MixTxListResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MixTxListResp.Unmarshal(m, b)
}
func (m *MixTxListResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_MixTxListResp.Marshal(b, m, deterministic)
}
func (m *MixTxListResp) XXX_Merge(src proto.Message) {
xxx_messageInfo_MixTxListResp.Merge(m, src)
}
func (m *MixTxListResp) XXX_Size() int {
return xxx_messageInfo_MixTxListResp.Size(m)
}
func (m *MixTxListResp) XXX_DiscardUnknown() {
xxx_messageInfo_MixTxListResp.DiscardUnknown(m)
}
var xxx_messageInfo_MixTxListResp proto.InternalMessageInfo
func (m *MixTxListResp) GetTxs() []*LocalMixTx {
if m != nil {
return m.Txs
}
return nil
}
type PrivacyAddrResult struct {
Addr string `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"`
IsOK bool `protobuf:"varint,2,opt,name=isOK,proto3" json:"isOK,omitempty"`
Msg string `protobuf:"bytes,3,opt,name=msg,proto3" json:"msg,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *PrivacyAddrResult) Reset() { *m = PrivacyAddrResult{} }
func (m *PrivacyAddrResult) String() string { return proto.CompactTextString(m) }
func (*PrivacyAddrResult) ProtoMessage() {}
func (*PrivacyAddrResult) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{44}
}
func (m *PrivacyAddrResult) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PrivacyAddrResult.Unmarshal(m, b)
}
func (m *PrivacyAddrResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_PrivacyAddrResult.Marshal(b, m, deterministic)
}
func (m *PrivacyAddrResult) XXX_Merge(src proto.Message) {
xxx_messageInfo_PrivacyAddrResult.Merge(m, src)
}
func (m *PrivacyAddrResult) XXX_Size() int {
return xxx_messageInfo_PrivacyAddrResult.Size(m)
}
func (m *PrivacyAddrResult) XXX_DiscardUnknown() {
xxx_messageInfo_PrivacyAddrResult.DiscardUnknown(m)
}
var xxx_messageInfo_PrivacyAddrResult proto.InternalMessageInfo
func (m *PrivacyAddrResult) GetAddr() string {
if m != nil {
return m.Addr
}
return ""
}
func (m *PrivacyAddrResult) GetIsOK() bool {
if m != nil {
return m.IsOK
}
return false
}
func (m *PrivacyAddrResult) GetMsg() string {
if m != nil {
return m.Msg
}
return ""
}
type ReqEnablePrivacyRst struct {
Results []*PrivacyAddrResult `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ReqEnablePrivacyRst) Reset() { *m = ReqEnablePrivacyRst{} }
func (m *ReqEnablePrivacyRst) String() string { return proto.CompactTextString(m) }
func (*ReqEnablePrivacyRst) ProtoMessage() {}
func (*ReqEnablePrivacyRst) Descriptor() ([]byte, []int) {
return fileDescriptor_5c21d519a9be369a, []int{45}
}
func (m *ReqEnablePrivacyRst) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReqEnablePrivacyRst.Unmarshal(m, b)
}
func (m *ReqEnablePrivacyRst) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReqEnablePrivacyRst.Marshal(b, m, deterministic)
}
func (m *ReqEnablePrivacyRst) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReqEnablePrivacyRst.Merge(m, src)
}
func (m *ReqEnablePrivacyRst) XXX_Size() int {
return xxx_messageInfo_ReqEnablePrivacyRst.Size(m)
}
func (m *ReqEnablePrivacyRst) XXX_DiscardUnknown() {
xxx_messageInfo_ReqEnablePrivacyRst.DiscardUnknown(m)
}
var xxx_messageInfo_ReqEnablePrivacyRst proto.InternalMessageInfo
func (m *ReqEnablePrivacyRst) GetResults() []*PrivacyAddrResult {
if m != nil {
return m.Results
}
return nil
}
func init() {
proto.RegisterEnum("types.VerifyType", VerifyType_name, VerifyType_value)
proto.RegisterEnum("types.ZkCurveId", ZkCurveId_name, ZkCurveId_value)
proto.RegisterEnum("types.MixConfigType", MixConfigType_name, MixConfigType_value)
proto.RegisterEnum("types.MixConfigAct", MixConfigAct_name, MixConfigAct_value)
proto.RegisterEnum("types.NoteStatus", NoteStatus_name, NoteStatus_value)
proto.RegisterEnum("types.MixWalletRescanStatus", MixWalletRescanStatus_name, MixWalletRescanStatus_value)
proto.RegisterType((*ZkVerifyKey)(nil), "types.ZkVerifyKey")
proto.RegisterType((*ZkVerifyKeys)(nil), "types.ZkVerifyKeys")
proto.RegisterType((*AuthPubKeys)(nil), "types.AuthPubKeys")
proto.RegisterType((*MixConfigAction)(nil), "types.MixConfigAction")
proto.RegisterType((*DHSecret)(nil), "types.DHSecret")
proto.RegisterType((*DHSecretGroup)(nil), "types.DHSecretGroup")
proto.RegisterType((*ZkProofInfo)(nil), "types.ZkProofInfo")
proto.RegisterType((*MixDepositAction)(nil), "types.MixDepositAction")
proto.RegisterType((*MixTransferAction)(nil), "types.MixTransferAction")
proto.RegisterType((*MixWithdrawAction)(nil), "types.MixWithdrawAction")
proto.RegisterType((*MixAuthorizeAction)(nil), "types.MixAuthorizeAction")
proto.RegisterType((*MixAction)(nil), "types.MixAction")
proto.RegisterType((*DepositPublicInput)(nil), "types.DepositPublicInput")
proto.RegisterType((*WithdrawPublicInput)(nil), "types.WithdrawPublicInput")
proto.RegisterType((*CommitAmount)(nil), "types.commitAmount")
proto.RegisterType((*TransferInputPublicInput)(nil), "types.TransferInputPublicInput")
proto.RegisterType((*TransferOutputPublicInput)(nil), "types.TransferOutputPublicInput")
proto.RegisterType((*AuthorizePublicInput)(nil), "types.AuthorizePublicInput")
proto.RegisterType((*ExistValue)(nil), "types.ExistValue")
proto.RegisterType((*CommitTreeLeaves)(nil), "types.CommitTreeLeaves")
proto.RegisterType((*CommitTreeRoots)(nil), "types.CommitTreeRoots")
proto.RegisterType((*CommitTreeProve)(nil), "types.CommitTreeProve")
proto.RegisterType((*TreeInfoReq)(nil), "types.TreeInfoReq")
proto.RegisterType((*TreeListResp)(nil), "types.TreeListResp")
proto.RegisterType((*PaymentKeyPair)(nil), "types.PaymentKeyPair")
proto.RegisterType((*PubKey)(nil), "types.PubKey")
proto.RegisterType((*PrivKey)(nil), "types.PrivKey")
proto.RegisterType((*ShareSecretKeyPair)(nil), "types.ShareSecretKeyPair")
proto.RegisterType((*AccountPrivacyKey)(nil), "types.AccountPrivacyKey")
proto.RegisterType((*WalletAddrPrivacy)(nil), "types.WalletAddrPrivacy")
proto.RegisterType((*SecretData)(nil), "types.SecretData")
proto.RegisterType((*EncodedSecretData)(nil), "types.EncodedSecretData")
proto.RegisterType((*EncryptSecretData)(nil), "types.EncryptSecretData")
proto.RegisterType((*DecryptSecretData)(nil), "types.DecryptSecretData")
proto.RegisterType((*WalletIndexInfo)(nil), "types.WalletIndexInfo")
proto.RegisterType((*WalletDbMixInfo)(nil), "types.WalletDbMixInfo")
proto.RegisterType((*WalletMixIndexReq)(nil), "types.WalletMixIndexReq")
proto.RegisterType((*WalletIndexResp)(nil), "types.WalletIndexResp")
proto.RegisterType((*WalletReqAddrs)(nil), "types.WalletReqAddrs")
proto.RegisterType((*WalletEnablePrivacyRst)(nil), "types.WalletEnablePrivacyRst")
proto.RegisterType((*WalletEnablePrivacyResp)(nil), "types.WalletEnablePrivacyResp")
proto.RegisterType((*LocalMixTx)(nil), "types.LocalMixTx")
proto.RegisterType((*MixTxListReq)(nil), "types.MixTxListReq")
proto.RegisterType((*MixTxListResp)(nil), "types.MixTxListResp")
proto.RegisterType((*PrivacyAddrResult)(nil), "types.PrivacyAddrResult")
proto.RegisterType((*ReqEnablePrivacyRst)(nil), "types.ReqEnablePrivacyRst")
}
func init() {
proto.RegisterFile("mix.proto", fileDescriptor_5c21d519a9be369a)
}
var fileDescriptor_5c21d519a9be369a = []byte{
// 2018 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0x5b, 0x73, 0x1b, 0x49,
0x15, 0xf6, 0xe8, 0xae, 0x23, 0xd9, 0x1e, 0x75, 0xbc, 0x5e, 0xad, 0x8b, 0x05, 0x33, 0xeb, 0xdd,
0xf2, 0x2a, 0x10, 0x76, 0x95, 0x6c, 0x36, 0x14, 0x05, 0x94, 0x62, 0x29, 0x91, 0x88, 0x2d, 0xa9,
0x5a, 0xf2, 0x3a, 0x31, 0x97, 0xaa, 0xb1, 0xa6, 0x6d, 0x4d, 0x59, 0x9a, 0x19, 0xcf, 0xb4, 0x1c,
0x89, 0x1f, 0xc0, 0x1b, 0xaf, 0x3c, 0x42, 0xf1, 0xc4, 0x1f, 0xa0, 0x28, 0x8a, 0x5f, 0xc0, 0x6f,
0xe1, 0x95, 0x07, 0x5e, 0xa9, 0xbe, 0xcd, 0x45, 0x96, 0x72, 0x81, 0x97, 0x7d, 0x9b, 0x73, 0xfa,
0xeb, 0xd3, 0xe7, 0xde, 0xa7, 0x07, 0x8a, 0x53, 0x7b, 0xfe, 0xc0, 0xf3, 0x5d, 0xea, 0xa2, 0x2c,
0x5d, 0x78, 0x24, 0xd8, 0x2b, 0x8f, 0xdc, 0xe9, 0xd4, 0x75, 0x04, 0x73, 0xaf, 0x42, 0x7d, 0xd3,
0x09, 0xcc, 0x11, 0xb5, 0x15, 0xcb, 0xb8, 0x85, 0xd2, 0xf9, 0xf5, 0x37, 0xc4, 0xb7, 0x2f, 0x17,
0x2f, 0xc8, 0x02, 0xd5, 0x20, 0x3f, 0x9a, 0xf9, 0xb7, 0xa4, 0x63, 0x55, 0xb5, 0x7d, 0xed, 0x70,
0xab, 0xae, 0x3f, 0xe0, 0x82, 0x1e, 0x9c, 0x5f, 0x1f, 0x09, 0x3e, 0x56, 0x00, 0xf4, 0x29, 0x64,
0xd8, 0x5a, 0x35, 0xc5, 0x81, 0x15, 0x09, 0x14, 0xb2, 0x86, 0x0b, 0x8f, 0x60, 0xbe, 0x8c, 0x76,
0x20, 0x7b, 0x6b, 0x4e, 0x66, 0xa4, 0x9a, 0xde, 0xd7, 0x0e, 0x8b, 0x58, 0x10, 0xc6, 0x63, 0x28,
0xc7, 0xce, 0x0d, 0xd0, 0x67, 0x90, 0xb1, 0x4c, 0x6a, 0x56, 0xb5, 0xfd, 0xf4, 0x61, 0xa9, 0x8e,
0xc2, 0x53, 0x43, 0x08, 0xe6, 0xeb, 0xc6, 0xf7, 0xa1, 0xd4, 0x98, 0xd1, 0x71, 0x7f, 0x76, 0xc1,
0xb7, 0xa1, 0xd8, 0xb6, 0xa2, 0x84, 0xfc, 0x4b, 0x83, 0xed, 0x13, 0x7b, 0x7e, 0xe4, 0x3a, 0x97,
0xf6, 0x55, 0x83, 0x1b, 0x8b, 0x0e, 0x20, 0x35, 0x5c, 0x48, 0x93, 0x76, 0xa4, 0xf0, 0x10, 0xc3,
0x95, 0x4d, 0x0d, 0x17, 0xe8, 0x3e, 0xe4, 0x04, 0x5e, 0xda, 0x74, 0x6f, 0x19, 0xd9, 0x18, 0x51,
0x2c, 0x21, 0xa8, 0x0e, 0xc5, 0x5b, 0xa5, 0x1c, 0xb7, 0x6d, 0xa5, 0xda, 0xed, 0x0d, 0x1c, 0xc1,
0x50, 0x15, 0x72, 0x26, 0xd3, 0xfe, 0xba, 0x9a, 0x61, 0xce, 0x68, 0x6f, 0x60, 0x49, 0xa3, 0x1f,
0x42, 0xd1, 0x33, 0x17, 0x53, 0xe2, 0xd0, 0xfe, 0x75, 0x35, 0xcb, 0xa5, 0x6d, 0x4a, 0x69, 0xc2,
0x56, 0x26, 0x28, 0x44, 0x3c, 0xcd, 0x4b, 0xa7, 0x1a, 0x47, 0x50, 0x68, 0xb6, 0x07, 0x64, 0xe4,
0x13, 0x8a, 0xbe, 0x07, 0x69, 0xe2, 0x5d, 0x73, 0x2b, 0x97, 0x77, 0x63, 0xb6, 0x82, 0x76, 0x21,
0x17, 0x70, 0xa8, 0x8c, 0x85, 0xa4, 0x8c, 0x3f, 0x68, 0xb0, 0xa9, 0xa4, 0x3c, 0xf7, 0xdd, 0x99,
0x87, 0x3e, 0x87, 0x7c, 0xe0, 0x11, 0xc7, 0x22, 0xbe, 0x14, 0xb7, 0x2d, 0xc5, 0x29, 0x18, 0x56,
0xeb, 0xe8, 0x3e, 0x14, 0x7c, 0x42, 0x67, 0xbe, 0x43, 0x7c, 0xee, 0xb6, 0x15, 0xd8, 0x10, 0xc0,
0xcc, 0x64, 0x06, 0xbb, 0xbe, 0xfd, 0x5b, 0x22, 0x9d, 0x76, 0x07, 0x1d, 0x21, 0x8c, 0x1b, 0x96,
0x9d, 0x7d, 0xdf, 0x75, 0x2f, 0x3b, 0xce, 0xa5, 0xcb, 0x52, 0xc9, 0x63, 0x04, 0xd7, 0xa9, 0x88,
0x05, 0x81, 0xf6, 0xa1, 0xe4, 0xcd, 0x2e, 0x26, 0xf6, 0xa8, 0xe3, 0x78, 0x33, 0xca, 0x75, 0x28,
0xe2, 0x38, 0x0b, 0xd5, 0x20, 0x7b, 0xc5, 0xcc, 0x92, 0x27, 0xee, 0x2c, 0x9d, 0xc8, 0x4d, 0xc6,
0x02, 0x62, 0xfc, 0x06, 0xf4, 0x13, 0x7b, 0xde, 0x24, 0x9e, 0x1b, 0xd8, 0x54, 0x86, 0x7a, 0x17,
0x72, 0xe6, 0xd4, 0x9d, 0x39, 0x94, 0x1f, 0x9c, 0xc1, 0x92, 0x42, 0x75, 0x00, 0x87, 0xbc, 0x3e,
0x72, 0xa7, 0x53, 0x9b, 0x06, 0xd5, 0xd4, 0x52, 0xea, 0x86, 0x7a, 0xe3, 0x18, 0xca, 0xb0, 0xa1,
0x72, 0x62, 0xcf, 0x87, 0xac, 0x10, 0x2f, 0x89, 0x2f, 0x0f, 0x38, 0x84, 0xac, 0xcd, 0x95, 0xd7,
0xd6, 0xca, 0x10, 0x00, 0x54, 0x83, 0x9c, 0x3b, 0xa3, 0xc2, 0xce, 0x75, 0x50, 0x89, 0x30, 0x46,
0xfc, 0xa8, 0x33, 0x9b, 0x8e, 0x2d, 0xdf, 0x7c, 0xfd, 0x16, 0x5b, 0x1e, 0x43, 0x99, 0x47, 0xf4,
0xed, 0xd6, 0x24, 0x70, 0xc6, 0x2f, 0x00, 0x9d, 0xd8, 0xf3, 0x86, 0x0a, 0x99, 0x3c, 0xe5, 0x11,
0x94, 0x58, 0x14, 0x95, 0xb0, 0xf5, 0x66, 0xc5, 0x61, 0xc6, 0xdf, 0x52, 0x50, 0x64, 0xc2, 0x84,
0x8c, 0x2d, 0x48, 0x51, 0x51, 0xb3, 0x59, 0x9c, 0xa2, 0x0b, 0xf4, 0x05, 0xe4, 0x46, 0xbc, 0x0a,
0x65, 0x9a, 0xed, 0xae, 0xa8, 0x4e, 0xdb, 0x75, 0x58, 0x51, 0x09, 0x1c, 0x7a, 0x08, 0x79, 0x4b,
0x04, 0x52, 0x46, 0xfe, 0xc3, 0x68, 0x4b, 0x22, 0xc2, 0xed, 0x0d, 0xac, 0x90, 0xe8, 0x31, 0x14,
0x5e, 0x4b, 0x97, 0xf1, 0x2a, 0x2d, 0xd5, 0xab, 0xd1, 0xae, 0xa4, 0x33, 0xdb, 0x1b, 0x38, 0xc4,
0xb2, 0x7d, 0x54, 0x46, 0x55, 0x16, 0x70, 0x6c, 0x5f, 0x32, 0xde, 0x6c, 0x9f, 0xc2, 0xa2, 0x1f,
0xc7, 0x4b, 0x22, 0xc7, 0x37, 0x7e, 0x14, 0x6d, 0x5c, 0x72, 0x2c, 0xeb, 0x02, 0x21, 0x3a, 0xea,
0x02, 0x6d, 0x40, 0xd2, 0x9e, 0x7e, 0x2c, 0xed, 0xf7, 0xa0, 0xe0, 0xb8, 0x94, 0xb4, 0xcd, 0x60,
0x2c, 0x2b, 0x26, 0xa4, 0x63, 0x69, 0x20, 0xea, 0x45, 0x52, 0xc6, 0x5f, 0x34, 0xb8, 0xa7, 0x8c,
0x8c, 0xcb, 0x32, 0xa0, 0x4c, 0x7d, 0x42, 0xb0, 0xeb, 0xd2, 0x98, 0xbc, 0x04, 0x0f, 0x1d, 0xc0,
0xa6, 0x33, 0x9b, 0x4c, 0xec, 0x4b, 0x9b, 0xf8, 0x1c, 0x24, 0x44, 0x27, 0x99, 0xe8, 0x01, 0xa0,
0xd0, 0x82, 0x01, 0xcb, 0x24, 0x0e, 0x15, 0x0d, 0x69, 0xc5, 0x4a, 0x4c, 0xd3, 0x4c, 0x42, 0xd3,
0x1a, 0xf0, 0xcb, 0xcd, 0xa6, 0x0d, 0x91, 0xc0, 0x65, 0xd0, 0x5e, 0x4a, 0xb5, 0xb4, 0x97, 0x8c,
0x7a, 0x25, 0xcf, 0xd7, 0x5e, 0x19, 0xff, 0xd4, 0xa0, 0xaa, 0x42, 0xc0, 0xed, 0x79, 0x5f, 0xd3,
0xaa, 0x90, 0x17, 0xc7, 0xbe, 0x94, 0x42, 0x15, 0x19, 0xad, 0xbc, 0x92, 0x36, 0x28, 0x72, 0x8d,
0xa1, 0x99, 0xb5, 0x86, 0xde, 0x71, 0x5f, 0x76, 0x85, 0xfb, 0x8c, 0x3f, 0x69, 0xf0, 0x91, 0x32,
0xa5, 0xc7, 0xeb, 0xfc, 0x5d, 0x43, 0xfe, 0xbf, 0xd8, 0x50, 0x87, 0xa2, 0x35, 0x16, 0x5d, 0x32,
0x90, 0xd5, 0xb0, 0xba, 0x7b, 0x46, 0x30, 0xe3, 0x1f, 0x1a, 0xec, 0x84, 0x69, 0xfb, 0xbe, 0x8e,
0x3e, 0x84, 0x6d, 0x33, 0xb6, 0x97, 0xdd, 0xad, 0x42, 0xd9, 0x65, 0x36, 0x73, 0x57, 0xc8, 0x8a,
0xa5, 0x50, 0x92, 0xf9, 0xbe, 0x41, 0x30, 0xf6, 0x01, 0x5a, 0x73, 0x3b, 0xa0, 0xdf, 0xb0, 0xba,
0x8a, 0x8d, 0x17, 0xda, 0x61, 0x41, 0x8e, 0x17, 0x9f, 0x81, 0x2e, 0xfa, 0xd5, 0xd0, 0x27, 0xe4,
0x98, 0x98, 0xb7, 0x24, 0x39, 0x86, 0x94, 0x25, 0xee, 0x53, 0xd8, 0x8e, 0x70, 0xcc, 0xbe, 0xd5,
0xb0, 0x3f, 0x6b, 0x71, 0x5c, 0xdf, 0x77, 0x6f, 0x09, 0x8b, 0xa2, 0x9f, 0x74, 0x52, 0x48, 0xb3,
0x35, 0x7e, 0xed, 0x0d, 0x88, 0xb8, 0x02, 0x8a, 0x38, 0xa4, 0xd1, 0x77, 0x01, 0x3c, 0xd1, 0x59,
0x2d, 0x32, 0xe7, 0xfe, 0xd8, 0xc4, 0x31, 0x0e, 0xfa, 0x0e, 0x14, 0x9d, 0xd9, 0x54, 0xe8, 0xcc,
0x7d, 0xb0, 0x89, 0x23, 0x06, 0xcb, 0x82, 0x31, 0x99, 0x78, 0xc4, 0x0f, 0x64, 0xe6, 0x29, 0xd2,
0x68, 0x41, 0x89, 0x29, 0xc7, 0x1b, 0x36, 0xb9, 0x79, 0x9b, 0x7a, 0x13, 0x62, 0x5e, 0xc6, 0xca,
0x3f, 0xa4, 0x8d, 0x03, 0x28, 0x73, 0x9f, 0xd9, 0x01, 0xc5, 0x24, 0xf0, 0xd8, 0x75, 0xce, 0x5c,
0x10, 0xc8, 0xe9, 0x4d, 0x10, 0x46, 0x13, 0xb6, 0xfa, 0x62, 0xce, 0x79, 0x41, 0x16, 0x7d, 0xd3,
0xf6, 0x59, 0x07, 0xf0, 0x4c, 0x3e, 0x66, 0x89, 0xd3, 0x24, 0xc5, 0xce, 0xe2, 0x57, 0x51, 0x94,
0x24, 0x21, 0x6d, 0x1c, 0x40, 0x4e, 0xe6, 0xc9, 0x9b, 0xfa, 0xc2, 0xc7, 0x90, 0xef, 0xfb, 0xf6,
0x2d, 0x83, 0xc5, 0x43, 0xad, 0x26, 0x49, 0x17, 0xd0, 0x60, 0x6c, 0xfa, 0x44, 0x64, 0xb6, 0x52,
0xe7, 0x10, 0xf2, 0x9e, 0xd8, 0x24, 0x67, 0xa3, 0x2d, 0x35, 0x6a, 0x09, 0x2e, 0x56, 0xcb, 0xe8,
0x47, 0x50, 0xf2, 0xc9, 0x88, 0xd8, 0xb7, 0xb6, 0x73, 0xd5, 0xbf, 0x96, 0xd7, 0xd6, 0xd2, 0x60,
0x16, 0x47, 0x18, 0xbf, 0xd7, 0xa0, 0xd2, 0x18, 0x8d, 0x58, 0xed, 0x31, 0x61, 0xe6, 0x88, 0xdb,
0xf9, 0x15, 0x80, 0x17, 0x7a, 0x44, 0x9e, 0xf9, 0x81, 0x92, 0x92, 0x70, 0x15, 0x8e, 0x01, 0x51,
0x03, 0xb6, 0x82, 0x84, 0xf6, 0x52, 0x01, 0x75, 0xbb, 0xdc, 0x35, 0x0d, 0x2f, 0x6d, 0x30, 0x7e,
0x09, 0x95, 0x33, 0x73, 0x32, 0x21, 0xb4, 0x61, 0x59, 0xbe, 0xd4, 0x08, 0xd5, 0x85, 0xfd, 0xe6,
0x48, 0xe9, 0xa2, 0xee, 0xb9, 0x3b, 0x9a, 0x63, 0x05, 0x64, 0xde, 0x35, 0x2d, 0xcb, 0x97, 0x9e,
0xe7, 0xdf, 0xc6, 0xdf, 0x35, 0x00, 0x71, 0x54, 0xd3, 0xa4, 0x26, 0xab, 0x67, 0x35, 0xdf, 0x8a,
0xba, 0x17, 0x91, 0x48, 0x32, 0x59, 0x0f, 0x11, 0xc3, 0x64, 0xa2, 0x39, 0x24, 0x78, 0xab, 0x7a,
0x48, 0x7a, 0x75, 0x0f, 0x59, 0x73, 0xb7, 0xb0, 0x42, 0x62, 0x6d, 0x13, 0x9b, 0x8e, 0xe5, 0x4e,
0x65, 0x35, 0xc4, 0x38, 0xc6, 0x39, 0x54, 0x5a, 0xce, 0xc8, 0xb5, 0x88, 0x15, 0x33, 0xa0, 0x0a,
0x79, 0x22, 0x98, 0x52, 0x75, 0x45, 0xa2, 0xfb, 0x90, 0xf7, 0xcd, 0xd7, 0x0c, 0x24, 0x43, 0xa0,
0x1e, 0x4b, 0xd1, 0x6e, 0xac, 0x10, 0xc6, 0xaf, 0xb8, 0x6c, 0x7f, 0xe1, 0xd1, 0x98, 0xec, 0x68,
0x72, 0xd7, 0xe2, 0x93, 0xfb, 0xfb, 0x67, 0xd8, 0xef, 0x34, 0xa8, 0x34, 0xc9, 0xbb, 0x8a, 0x7f,
0x02, 0xdb, 0xd1, 0x66, 0xdf, 0x8e, 0x72, 0x68, 0x39, 0xe5, 0x97, 0x61, 0xea, 0x2d, 0x92, 0x5e,
0xf7, 0x16, 0x31, 0xfe, 0xa3, 0xc1, 0xb6, 0xc8, 0x2d, 0xde, 0x9b, 0xf8, 0x7c, 0xff, 0xa6, 0xdb,
0x8b, 0xf7, 0x2e, 0x79, 0x11, 0xca, 0xa8, 0x47, 0x0c, 0x75, 0x19, 0x2c, 0xcf, 0x13, 0x49, 0x26,
0x8b, 0x90, 0x7a, 0xd5, 0x88, 0x78, 0x87, 0x8f, 0x18, 0x76, 0x03, 0x8a, 0xec, 0x55, 0xbd, 0x4f,
0x92, 0xe8, 0x73, 0xc8, 0x05, 0xd4, 0xa4, 0xb3, 0x80, 0xcf, 0x66, 0xd1, 0x3b, 0xb7, 0xeb, 0x52,
0x32, 0xe0, 0x0b, 0x58, 0x02, 0xd8, 0x83, 0x98, 0xa9, 0x5b, 0xcd, 0xaf, 0x8b, 0x31, 0x5f, 0x36,
0xce, 0x94, 0xe1, 0xcd, 0x8b, 0x13, 0x5b, 0x18, 0x5e, 0x83, 0x8c, 0xed, 0x5c, 0xba, 0xb2, 0x9e,
0xd4, 0x60, 0xbb, 0xe4, 0x1e, 0xcc, 0x31, 0x4c, 0x55, 0x3a, 0x17, 0x1d, 0x5e, 0x5e, 0xe3, 0x92,
0x34, 0xfe, 0xad, 0xa9, 0x72, 0xe5, 0x72, 0x2d, 0x32, 0x97, 0xdd, 0xfa, 0x5b, 0xe7, 0xd4, 0xdd,
0x84, 0x53, 0xb3, 0xa1, 0x07, 0x77, 0x20, 0x2b, 0xf0, 0x79, 0xce, 0x16, 0x04, 0xd3, 0xd2, 0xb2,
0x7d, 0x22, 0x5e, 0xe6, 0x05, 0xbe, 0x12, 0x31, 0x8c, 0x9f, 0x27, 0xf2, 0x88, 0x5f, 0x2c, 0x3f,
0x88, 0x5f, 0x2c, 0xeb, 0xfd, 0x29, 0x2f, 0x9c, 0x03, 0xd8, 0x12, 0x2b, 0x98, 0xdc, 0xb0, 0x3e,
0xb7, 0xfa, 0xaf, 0x02, 0x86, 0x5d, 0x81, 0x6a, 0x39, 0xe6, 0xc5, 0x84, 0xc8, 0x26, 0x87, 0x03,
0x1a, 0xf6, 0x36, 0x2d, 0xea, 0x6d, 0x8c, 0x67, 0x07, 0xbd, 0x17, 0xdc, 0xa7, 0x05, 0xcc, 0xbf,
0x91, 0x0e, 0xe9, 0x69, 0x70, 0x25, 0x9d, 0xc8, 0x3e, 0x8d, 0x63, 0xf8, 0x70, 0x95, 0x4c, 0x66,
0xc2, 0x97, 0x89, 0xff, 0x21, 0x1f, 0x27, 0x2c, 0x58, 0xd6, 0x40, 0x6a, 0xd8, 0x05, 0x38, 0x76,
0x47, 0xe6, 0x84, 0x3d, 0x37, 0xe6, 0x4c, 0x83, 0xb1, 0x0a, 0x79, 0x19, 0xf3, 0x6f, 0xe6, 0xf6,
0x31, 0xb1, 0xaf, 0xc6, 0x62, 0xe8, 0x4f, 0x63, 0x49, 0x31, 0xb7, 0xdb, 0xe1, 0xc8, 0x90, 0xc6,
0x82, 0x30, 0xfe, 0xa8, 0x41, 0x99, 0xcb, 0x12, 0x17, 0xf6, 0x4d, 0x3c, 0xf3, 0xb4, 0x44, 0xe6,
0x85, 0x87, 0xc9, 0xf6, 0xbe, 0x74, 0x58, 0x7a, 0xf5, 0x61, 0x99, 0xd8, 0x61, 0x51, 0xe4, 0xb3,
0x6b, 0x23, 0x9f, 0x5b, 0x8e, 0xfc, 0x23, 0xd8, 0x8c, 0xe9, 0x17, 0x78, 0xe8, 0x13, 0x48, 0xd3,
0xb9, 0x8a, 0xba, 0xaa, 0xbf, 0xc8, 0x27, 0x98, 0xad, 0x1a, 0x27, 0x50, 0x91, 0xae, 0x63, 0xc1,
0xc6, 0x24, 0x98, 0x4d, 0xfe, 0x9f, 0x18, 0x76, 0xe0, 0x1e, 0x26, 0x37, 0x77, 0x92, 0xa2, 0x0e,
0x79, 0x9f, 0x8b, 0x56, 0xea, 0x54, 0x63, 0x1d, 0x33, 0x71, 0x36, 0x56, 0xc0, 0xda, 0xaf, 0x01,
0xa2, 0xbf, 0x67, 0xa8, 0x04, 0xf9, 0x66, 0xab, 0xdf, 0x1b, 0x74, 0x86, 0xfa, 0x06, 0x2a, 0x43,
0xe1, 0xac, 0x33, 0x6c, 0x37, 0x71, 0xe3, 0x4c, 0xd7, 0x50, 0x05, 0x36, 0x87, 0xb8, 0xd1, 0x1d,
0x3c, 0x6b, 0xe1, 0x4e, 0xb7, 0x7f, 0x3a, 0xd4, 0x53, 0x08, 0xc1, 0x96, 0x62, 0xf5, 0x4e, 0x87,
0x8c, 0x97, 0x46, 0x9b, 0x50, 0x6c, 0x9c, 0x0e, 0xdb, 0x3d, 0xdc, 0x39, 0x6f, 0xe9, 0x99, 0xda,
0x4f, 0xa0, 0x18, 0xfe, 0xc5, 0x63, 0xd2, 0x4f, 0xbb, 0x2f, 0xba, 0xbd, 0xb3, 0xae, 0xbe, 0x81,
0x00, 0x72, 0x4f, 0x8f, 0x07, 0x0f, 0xbf, 0xfe, 0x5a, 0xd7, 0xd4, 0xf7, 0x93, 0x2f, 0xf5, 0x14,
0x2a, 0x42, 0xf6, 0x69, 0xb7, 0xfe, 0xd5, 0x63, 0x3d, 0x5d, 0x6b, 0x70, 0x5f, 0x47, 0xff, 0xcb,
0x98, 0xf0, 0xf0, 0x27, 0x97, 0xbe, 0x81, 0xb6, 0x00, 0xa2, 0xff, 0x72, 0x42, 0xc5, 0x7e, 0xfc,
0xe2, 0xd6, 0x53, 0xb5, 0x4f, 0x78, 0x3a, 0x85, 0x4f, 0x75, 0x94, 0x87, 0x74, 0xc3, 0xb2, 0xc4,
0xf1, 0x4d, 0x32, 0x21, 0x94, 0xe8, 0x5a, 0xed, 0x09, 0x40, 0xd4, 0x59, 0x99, 0x02, 0xa7, 0xdd,
0x66, 0xeb, 0x99, 0x00, 0x3d, 0xc3, 0xbd, 0xf3, 0x56, 0x57, 0xd7, 0x50, 0x01, 0x32, 0xbd, 0x7e,
0xab, 0x2b, 0x34, 0x3c, 0x3a, 0xee, 0x0d, 0x5a, 0x7a, 0xba, 0xf6, 0x53, 0xf8, 0x80, 0x3d, 0xd0,
0x65, 0x25, 0x07, 0x23, 0xd3, 0x91, 0x42, 0x0a, 0x90, 0xe9, 0x34, 0x8f, 0x5b, 0xc2, 0x8b, 0x83,
0xa3, 0x46, 0xb7, 0xdb, 0xe9, 0x3e, 0xd7, 0x35, 0x46, 0x3d, 0xeb, 0x74, 0x3b, 0x83, 0x76, 0xab,
0xa9, 0xa7, 0xea, 0x7f, 0xd5, 0x00, 0xa6, 0xf6, 0x5c, 0x0d, 0x39, 0x8f, 0x60, 0xfb, 0xf9, 0x92,
0x1c, 0x75, 0x8b, 0x61, 0x72, 0xd3, 0xb5, 0x27, 0x7b, 0x7a, 0x44, 0x0e, 0xa8, 0x6f, 0x3b, 0x57,
0xc6, 0x06, 0xfa, 0x02, 0x4a, 0x62, 0x0b, 0xb3, 0xe1, 0x9d, 0x76, 0xfc, 0x0c, 0x36, 0x13, 0xb9,
0x83, 0xb6, 0x23, 0x10, 0x6f, 0x46, 0x7b, 0x7b, 0x11, 0x63, 0x39, 0xcb, 0x8c, 0x8d, 0x8b, 0x1c,
0xff, 0x8d, 0xfb, 0xf0, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x14, 0x2c, 0xb6, 0xdb, 0xfb, 0x15,
0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConnInterface
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion6
// MixPrivacyClient is the client API for MixPrivacy service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type MixPrivacyClient interface {
// 扫描UTXO以及获取扫描UTXO后的状态
GetRescanStatus(ctx context.Context, in *types.ReqNil, opts ...grpc.CallOption) (*types.ReqString, error)
// 使能隐私账户
RescanNotes(ctx context.Context, in *types.ReqNil, opts ...grpc.CallOption) (*types.ReqString, error)
// 创建隐私交易
EnablePrivacy(ctx context.Context, in *types.ReqAddrs, opts ...grpc.CallOption) (*ReqEnablePrivacyRst, error)
}
type mixPrivacyClient struct {
cc grpc.ClientConnInterface
}
func NewMixPrivacyClient(cc grpc.ClientConnInterface) MixPrivacyClient {
return &mixPrivacyClient{cc}
}
func (c *mixPrivacyClient) GetRescanStatus(ctx context.Context, in *types.ReqNil, opts ...grpc.CallOption) (*types.ReqString, error) {
out := new(types.ReqString)
err := c.cc.Invoke(ctx, "/types.mixPrivacy/GetRescanStatus", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *mixPrivacyClient) RescanNotes(ctx context.Context, in *types.ReqNil, opts ...grpc.CallOption) (*types.ReqString, error) {
out := new(types.ReqString)
err := c.cc.Invoke(ctx, "/types.mixPrivacy/RescanNotes", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *mixPrivacyClient) EnablePrivacy(ctx context.Context, in *types.ReqAddrs, opts ...grpc.CallOption) (*ReqEnablePrivacyRst, error) {
out := new(ReqEnablePrivacyRst)
err := c.cc.Invoke(ctx, "/types.mixPrivacy/EnablePrivacy", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MixPrivacyServer is the server API for MixPrivacy service.
type MixPrivacyServer interface {
// 扫描UTXO以及获取扫描UTXO后的状态
GetRescanStatus(context.Context, *types.ReqNil) (*types.ReqString, error)
// 使能隐私账户
RescanNotes(context.Context, *types.ReqNil) (*types.ReqString, error)
// 创建隐私交易
EnablePrivacy(context.Context, *types.ReqAddrs) (*ReqEnablePrivacyRst, error)
}
// UnimplementedMixPrivacyServer can be embedded to have forward compatible implementations.
type UnimplementedMixPrivacyServer struct {
}
func (*UnimplementedMixPrivacyServer) GetRescanStatus(ctx context.Context, req *types.ReqNil) (*types.ReqString, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetRescanStatus not implemented")
}
func (*UnimplementedMixPrivacyServer) RescanNotes(ctx context.Context, req *types.ReqNil) (*types.ReqString, error) {
return nil, status.Errorf(codes.Unimplemented, "method RescanNotes not implemented")
}
func (*UnimplementedMixPrivacyServer) EnablePrivacy(ctx context.Context, req *types.ReqAddrs) (*ReqEnablePrivacyRst, error) {
return nil, status.Errorf(codes.Unimplemented, "method EnablePrivacy not implemented")
}
func RegisterMixPrivacyServer(s *grpc.Server, srv MixPrivacyServer) {
s.RegisterService(&_MixPrivacy_serviceDesc, srv)
}
func _MixPrivacy_GetRescanStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(types.ReqNil)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MixPrivacyServer).GetRescanStatus(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/types.mixPrivacy/GetRescanStatus",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MixPrivacyServer).GetRescanStatus(ctx, req.(*types.ReqNil))
}
return interceptor(ctx, in, info, handler)
}
func _MixPrivacy_RescanNotes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(types.ReqNil)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MixPrivacyServer).RescanNotes(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/types.mixPrivacy/RescanNotes",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MixPrivacyServer).RescanNotes(ctx, req.(*types.ReqNil))
}
return interceptor(ctx, in, info, handler)
}
func _MixPrivacy_EnablePrivacy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(types.ReqAddrs)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MixPrivacyServer).EnablePrivacy(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/types.mixPrivacy/EnablePrivacy",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MixPrivacyServer).EnablePrivacy(ctx, req.(*types.ReqAddrs))
}
return interceptor(ctx, in, info, handler)
}
var _MixPrivacy_serviceDesc = grpc.ServiceDesc{
ServiceName: "types.mixPrivacy",
HandlerType: (*MixPrivacyServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetRescanStatus",
Handler: _MixPrivacy_GetRescanStatus_Handler,
},
{
MethodName: "RescanNotes",
Handler: _MixPrivacy_RescanNotes_Handler,
},
{
MethodName: "EnablePrivacy",
Handler: _MixPrivacy_EnablePrivacy_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "mix.proto",
} }
...@@ -5,8 +5,12 @@ ...@@ -5,8 +5,12 @@
package types package types
import ( import (
"encoding/hex"
"encoding/json"
"reflect" "reflect"
"github.com/pkg/errors"
log "github.com/33cn/chain33/common/log/log15" log "github.com/33cn/chain33/common/log/log15"
"github.com/33cn/chain33/types" "github.com/33cn/chain33/types"
) )
...@@ -84,3 +88,120 @@ func (p *MixType) GetTypeMap() map[string]int32 { ...@@ -84,3 +88,120 @@ func (p *MixType) GetTypeMap() map[string]int32 {
func (p *MixType) GetPayload() types.Message { func (p *MixType) GetPayload() types.Message {
return &MixAction{} return &MixAction{}
} }
//
//func DecodeDepositInput(input string) (*DepositPublicInput, error) {
// var v DepositPublicInput
// data, err := hex.DecodeString(input)
// if err != nil {
// return nil, errors.Wrapf(err, "decode string=%s", input)
// }
// err = json.Unmarshal(data, &v)
// if err != nil {
// return nil, errors.Wrapf(err, "unmarshal string=%s", input)
// }
//
// return &v, nil
//}
//
//func DecodeWithdrawInput(input string) (*WithdrawPublicInput, error) {
// var v WithdrawPublicInput
// data, err := hex.DecodeString(input)
// if err != nil {
// return nil, errors.Wrapf(err, "decode string=%s", input)
// }
// err = json.Unmarshal(data, &v)
// if err != nil {
// return nil, errors.Wrapf(err, "unmarshal string=%s", input)
// }
//
// return &v, nil
//}
//
//
//func DecodeTransferInput(input string) (*TransferInputPublicInput, error) {
// var v TransferInputPublicInput
// data, err := hex.DecodeString(input)
// if err != nil {
// return nil, errors.Wrapf(err, "decode string=%s", input)
// }
// err = json.Unmarshal(data, &v)
// if err != nil {
// return nil, errors.Wrapf(err, "unmarshal string=%s", input)
// }
//
// return &v, nil
//}
//
//func DecodeTransferOut(input string) (*TransferOutputPublicInput, error) {
// var v TransferOutputPublicInput
// data, err := hex.DecodeString(input)
// if err != nil {
// return nil, errors.Wrapf(err, "decode string=%s", input)
// }
// err = json.Unmarshal(data, &v)
// if err != nil {
// return nil, errors.Wrapf(err, "unmarshal string=%s", input)
// }
//
// return &v, nil
//}
//
//func DecodeAuthorizeInput(input string) (*AuthorizePublicInput, error) {
// var v AuthorizePublicInput
// data, err := hex.DecodeString(input)
// if err != nil {
// return nil, errors.Wrapf(err, "decode string=%s", input)
// }
// err = json.Unmarshal(data, &v)
// if err != nil {
// return nil, errors.Wrapf(err, "unmarshal string=%s", input)
// }
//
// return &v, nil
//}
func DecodePubInput(ty VerifyType, input string) (interface{}, error) {
data, err := hex.DecodeString(input)
if err != nil {
return nil, errors.Wrapf(err, "decode string=%s", input)
}
switch ty {
case VerifyType_DEPOSIT:
var v DepositPublicInput
err = json.Unmarshal(data, &v)
if err != nil {
return nil, errors.Wrapf(err, "unmarshal string=%s", input)
}
return &v, nil
case VerifyType_WITHDRAW:
var v WithdrawPublicInput
err = json.Unmarshal(data, &v)
if err != nil {
return nil, errors.Wrapf(err, "unmarshal string=%s", input)
}
return &v, nil
case VerifyType_TRANSFERINPUT:
var v TransferInputPublicInput
err = json.Unmarshal(data, &v)
if err != nil {
return nil, errors.Wrapf(err, "unmarshal string=%s", input)
}
return &v, nil
case VerifyType_TRANSFEROUTPUT:
var v TransferOutputPublicInput
err = json.Unmarshal(data, &v)
if err != nil {
return nil, errors.Wrapf(err, "unmarshal string=%s", input)
}
return &v, nil
case VerifyType_AUTHORIZE:
var v AuthorizePublicInput
err = json.Unmarshal(data, &v)
if err != nil {
return nil, errors.Wrapf(err, "unmarshal string=%s", input)
}
return &v, nil
}
return nil, types.ErrInvalidParam
}
package wallet
import (
mixtypes "github.com/33cn/plugin/plugin/dapp/mix/types"
"github.com/consensys/gurvy/bn256/fr"
"github.com/consensys/gurvy/bn256/twistededwards"
)
type curveBn256ECDH struct {
}
// NewCurve25519ECDH creates a new ECDH instance that uses djb's curve25519
// elliptical curve.
func NewCurveBn256ECDH() ECDH {
return &curveBn256ECDH{}
}
func (e *curveBn256ECDH) GenerateKey(generator []byte) (*mixtypes.PrivKey, *mixtypes.PubKey) {
var sk fr.Element
if len(generator) <= 0 {
sk.SetRandom()
} else {
sk.SetBytes(generator)
}
ed := twistededwards.GetEdwardsCurve()
var point twistededwards.Point
point.ScalarMul(&ed.Base, sk)
priv := &mixtypes.PrivKey{
Data: sk.String(),
}
pub := &mixtypes.PubKey{
X: point.X.String(),
Y: point.Y.String(),
}
return priv, pub
}
func (e *curveBn256ECDH) GenerateSharedSecret(priv *mixtypes.PrivKey, pub *mixtypes.PubKey) ([]byte, error) {
var point, pubPoint twistededwards.Point
pubPoint.X.SetString(pub.X)
pubPoint.Y.SetString(pub.Y)
var frPriv fr.Element
frPriv.SetString(priv.Data)
point.ScalarMul(&pubPoint, frPriv)
return point.X.Bytes(), nil
}
package wallet
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestGenerateSharedSecret(t *testing.T) {
bn256 := NewCurveBn256ECDH()
pri1, pub1 := bn256.GenerateKey(nil)
pri2, pub2 := bn256.GenerateKey(nil)
s1, _ := bn256.GenerateSharedSecret(pri1, pub2)
s2, _ := bn256.GenerateSharedSecret(pri2, pub1)
assert.Equal(t, s1, s2)
}
package wallet
import (
mixtypes "github.com/33cn/plugin/plugin/dapp/mix/types"
)
// The main interface for ECDH key exchange.
type ECDH interface {
GenerateKey([]byte) (*mixtypes.PrivKey, *mixtypes.PubKey)
GenerateSharedSecret(*mixtypes.PrivKey, *mixtypes.PubKey) ([]byte, error)
}
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package wallet
import (
"github.com/33cn/chain33/types"
mixTy "github.com/33cn/plugin/plugin/dapp/mix/types"
)
func (policy *mixPolicy) On_ShowAccountPrivacyInfo(req *types.ReqString) (types.Message, error) {
return policy.getAccountPrivacyKey(req.Data)
}
func (policy *mixPolicy) On_ShowAccountNoteInfo(req *types.ReqAddrs) (types.Message, error) {
return policy.showAccountNoteInfo(req.Addrs)
}
func (policy *mixPolicy) On_GetRescanStatus(in *types.ReqNil) (types.Message, error) {
return &types.ReqString{Data: policy.getRescanStatus()}, nil
}
//重新扫描所有notes
func (policy *mixPolicy) On_RescanNotes(in *types.ReqNil) (types.Message, error) {
err := policy.tryRescanNotes()
if err != nil {
bizlog.Error("rescanUTXOs", "err", err.Error())
}
return &types.ReqString{Data: "ok"}, err
}
func (policy *mixPolicy) On_EnablePrivacy(req *types.ReqAddrs) (types.Message, error) {
return policy.enablePrivacy(req.Addrs)
}
func (policy *mixPolicy) On_EncodeSecretData(req *mixTy.SecretData) (types.Message, error) {
return encodeSecretData(req)
}
func (policy *mixPolicy) On_EncryptSecretData(req *mixTy.EncryptSecretData) (types.Message, error) {
return encryptSecretData(req)
}
func (policy *mixPolicy) On_DecryptSecretData(req *mixTy.DecryptSecretData) (types.Message, error) {
return decryptSecretData(req)
}
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package wallet
import "fmt"
const (
prefix = "MixCoin-"
// PrivacyDBVersion 隐私交易运行过程中,需要使用到钱包数据库存储的数据库版本信息的KEY值
MixDBVersion = prefix + "DBVersion"
// Privacy4Addr 存储隐私交易保存账户的隐私公钥对信息的KEY值
// KEY值格式为 Privacy4Addr-账号地址
// VALUE值格式为 types.WalletAccountPrivacy, 存储隐私公钥对
Mix4Addr = prefix + "Addr"
//
MixPrivacyEnable = prefix + "PrivacyEnable"
//current rescan notes status
MixRescanStatus = prefix + "RescanStatus"
MixCommitHash = prefix + "CommitHash"
MixNullifier = prefix + "Nullifier"
)
// calcPrivacyAddrKey 获取隐私账户私钥对保存在钱包中的索引串
func calcMixAddrKey(addr string) []byte {
return []byte(fmt.Sprintf("%s-%s", Mix4Addr, addr))
}
func calcMixPrivacyEnable() []byte {
return []byte(MixPrivacyEnable)
}
func calcRescanNoteStatus() []byte {
return []byte(MixRescanStatus)
}
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package wallet
import (
"bytes"
"fmt"
"math/big"
"github.com/33cn/chain33/system/dapp"
"github.com/pkg/errors"
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/common/crypto"
"github.com/33cn/chain33/types"
wcom "github.com/33cn/chain33/wallet/common"
mixTy "github.com/33cn/plugin/plugin/dapp/mix/types"
mimcbn256 "github.com/consensys/gnark/crypto/hash/mimc/bn256"
fr_bn256 "github.com/consensys/gurvy/bn256/fr"
)
// newPrivacyWithPrivKey create privacy from private key
//payment, payPrivKey=hash(privkey), payPubkey=hash(payPrivKey)
//DH crypt key, prikey=payPrikey, pubKey=payPrikey*G
func newPrivacyWithPrivKey(privKey []byte) (*mixTy.AccountPrivacyKey, error) {
payPrivacyKey := MimcHashByte([][]byte{privKey})
paymentKey := &mixTy.PaymentKeyPair{}
paymentKey.SpendKey = getFrString(payPrivacyKey)
paymentKey.PayKey = getFrString(MimcHashByte([][]byte{payPrivacyKey}))
shareSecretKey := &mixTy.ShareSecretKeyPair{}
ecdh := NewCurveBn256ECDH()
shareSecretKey.PrivKey, shareSecretKey.ReceivingPk = ecdh.GenerateKey(payPrivacyKey)
privacy := &mixTy.AccountPrivacyKey{}
privacy.PaymentKey = paymentKey
privacy.ShareSecretKey = shareSecretKey
return privacy, nil
}
//CEC加密需要保证明文是秘钥的倍数,如果不是,则需要填充明文,在解密时候把填充物去掉
//填充算法有pkcs5,pkcs7, 比如Pkcs5的思想填充的值为填充的长度,比如加密he,不足8
//则填充为he666666, 解密后直接算最后一个值为6,把解密值的后6个Byte去掉即可
func pKCS5Padding(plainText []byte, blockSize int) []byte {
if blockSize < 32 {
blockSize = 32
}
padding := blockSize - (len(plainText) % blockSize)
fmt.Println("pading", "passsize", blockSize, "plaintext", len(plainText), "pad", padding)
padText := bytes.Repeat([]byte{byte(padding)}, padding)
fmt.Println("padding", padding, "text", common.ToHex(padText[:]))
newText := append(plainText, padText...)
return newText
}
func pKCS5UnPadding(plainText []byte) ([]byte, error) {
length := len(plainText)
number := int(plainText[length-1])
if number > length {
return nil, types.ErrInvalidParam
}
return plainText[:length-number], nil
}
func encryptDataWithPadding(password, data []byte) []byte {
paddingText := pKCS5Padding(data, len(password))
return wcom.CBCEncrypterPrivkey(password, paddingText)
}
func encryptData(receiverPubKey *mixTy.PubKey, data []byte) (*mixTy.PubKey, []byte, error) {
ecdh := NewCurveBn256ECDH()
//generate ephemeral priv/pub key
ephPriv, ephPub := ecdh.GenerateKey(nil)
password, _ := ecdh.GenerateSharedSecret(ephPriv, receiverPubKey)
return ephPub, encryptDataWithPadding(password, data), nil
}
func decryptDataWithPading(password, data []byte) ([]byte, error) {
plainData := wcom.CBCDecrypterPrivkey(password, data)
return pKCS5UnPadding(plainData)
}
func decryptData(selfPrivKey *mixTy.PrivKey, oppositePubKey *mixTy.PubKey, cryptData []byte) ([]byte, error) {
ecdh := NewCurveBn256ECDH()
password, _ := ecdh.GenerateSharedSecret(selfPrivKey, oppositePubKey)
return decryptDataWithPading(password, cryptData)
}
func getByte(v string) []byte {
var fr fr_bn256.Element
fr.SetString(v)
return fr.Bytes()
}
func getFrString(v []byte) string {
var f fr_bn256.Element
f.SetBytes(v)
return f.String()
}
func MimcHashString(params []string) []byte {
var sum []byte
for _, k := range params {
fmt.Println("input:", k)
sum = append(sum, getByte(k)...)
}
hash := mimcHashCalc(sum)
fmt.Println("hash=", getFrString(hash))
return hash
}
func MimcHashByte(params [][]byte) []byte {
var sum []byte
for _, k := range params {
sum = append(sum, k...)
}
hash := mimcHashCalc(sum)
fmt.Println("hash=", getFrString(hash))
return hash
}
func mimcHashCalc(sum []byte) []byte {
return mimcbn256.Sum("seed", sum)
}
func (policy *mixPolicy) getPrivKeyByAddr(addr string) (crypto.PrivKey, error) {
//获取指定地址在钱包里的账户信息
Accountstor, err := policy.store.GetAccountByAddr(addr)
if err != nil {
bizlog.Error("ProcSendToAddress", "GetAccountByAddr err:", err)
return nil, err
}
//通过password解密存储的私钥
prikeybyte, err := common.FromHex(Accountstor.GetPrivkey())
if err != nil || len(prikeybyte) == 0 {
bizlog.Error("ProcSendToAddress", "FromHex err", err)
return nil, err
}
operater := policy.getWalletOperate()
password := []byte(operater.GetPassword())
privkey := wcom.CBCDecrypterPrivkey(password, prikeybyte)
//通过privkey生成一个pubkey然后换算成对应的addr
cr, err := crypto.New(types.GetSignName("", types.SECP256K1))
if err != nil {
bizlog.Error("ProcSendToAddress", "err", err)
return nil, err
}
priv, err := cr.PrivKeyFromBytes(privkey)
if err != nil {
bizlog.Error("ProcSendToAddress", "PrivKeyFromBytes err", err)
return nil, err
}
return priv, nil
}
func (policy *mixPolicy) getAccountPrivacyKey(addr string) (*mixTy.WalletAddrPrivacy, error) {
if data, _ := policy.store.getAccountPrivacy(addr); data != nil {
privacyInfo := &mixTy.AccountPrivacyKey{}
password := []byte(policy.getWalletOperate().GetPassword())
decrypted, err := decryptDataWithPading(password, data)
if err != nil {
return policy.savePrivacyPair(addr)
}
//有可能修改了秘钥,如果解密失败,需要重新设置
err = types.Decode(decrypted, privacyInfo)
if err != nil {
return policy.savePrivacyPair(addr)
}
return &mixTy.WalletAddrPrivacy{Privacy: privacyInfo, Addr: addr}, nil
}
return policy.savePrivacyPair(addr)
}
func (policy *mixPolicy) savePrivacyPair(addr string) (*mixTy.WalletAddrPrivacy, error) {
priv, err := policy.getPrivKeyByAddr(addr)
if err != nil {
return nil, errors.Wrapf(err, "savePrivacyPair addr=%s", addr)
}
bizlog.Info("savePrivacyPair", "pri", common.ToHex(priv.Bytes()), "addr", addr)
newPrivacy, err := newPrivacyWithPrivKey(priv.Bytes())
if err != nil {
return nil, err
}
password := []byte(policy.getWalletOperate().GetPassword())
bizlog.Info("savePrivacyPair", "newprivacy", newPrivacy.PaymentKey.PayKey, "password", common.ToHex(password))
encryptered := encryptDataWithPadding(password, types.Encode(newPrivacy))
bizlog.Info("savePrivacyPair--2")
//save the privacy created to wallet db
policy.store.setAccountPrivacy(addr, encryptered)
return &mixTy.WalletAddrPrivacy{Privacy: newPrivacy, Addr: addr}, nil
}
//查询钱包里面所有的地址对应的PrivacyKeys
func (policy *mixPolicy) getWalletPrivacyKeys() ([]*mixTy.WalletAddrPrivacy, error) {
//通过Account前缀查找获取钱包中的所有账户信息
WalletAccStores, err := policy.store.GetAccountByPrefix("Account")
if err != nil || len(WalletAccStores) == 0 {
bizlog.Info("getPrivacyKeyPairs", "store getAccountByPrefix error", err)
return nil, err
}
var infoPriRes []*mixTy.WalletAddrPrivacy
for _, AccStore := range WalletAccStores {
if len(AccStore.Addr) != 0 {
if privacyInfo, err := policy.getAccountPrivacyKey(AccStore.Addr); err == nil {
infoPriRes = append(infoPriRes, privacyInfo)
}
}
}
if 0 == len(infoPriRes) {
bizlog.Error("mixCoin getPrivacyKeyPairs null")
return nil, nil
}
return infoPriRes, nil
}
func (policy *mixPolicy) getRescanStatus() string {
status := policy.store.getRescanNoteStatus()
return mixTy.MixWalletRescanStatus(status).String()
}
func (policy *mixPolicy) tryRescanNotes() error {
//未使能,直接使能
if !policy.store.getPrivacyEnable() {
//policy.store.enablePrivacy()
return errors.Wrap(types.ErrNotAllow, "privacy need enable firstly")
}
operater := policy.getWalletOperate()
if operater.IsWalletLocked() {
return types.ErrWalletIsLocked
}
status := policy.store.getRescanNoteStatus()
if status == int32(mixTy.MixWalletRescanStatus_SCANNING) {
return errors.Wrap(types.ErrNotAllow, "mix wallet is scanning")
}
policy.store.setRescanNoteStatus(int32(mixTy.MixWalletRescanStatus_SCANNING))
go policy.rescanNotes()
return nil
}
//从localdb中把Mix合约的交易按升序都获取出来依次处理
func (policy *mixPolicy) rescanNotes() {
var txInfo mixTy.LocalMixTx
i := 0
operater := policy.getWalletOperate()
for {
select {
case <-operater.GetWalletDone():
return
default:
}
//首先从execs模块获取地址对应的所有UTXOs,
// 1 先获取隐私合约地址相关交易
var reqInfo mixTy.MixTxListReq
reqInfo.Direction = 0
reqInfo.Count = int32(MaxTxHashsPerTime)
if i == 0 {
reqInfo.Height = -1
} else {
reqInfo.Height = txInfo.GetHeight()
reqInfo.TxIndex = dapp.HeightIndexStr(txInfo.GetHeight(), txInfo.GetIndex())
}
i++
//请求交易信息
msg, err := operater.GetAPI().Query(mixTy.MixX, "ListMixTxs", &reqInfo)
if err != nil {
bizlog.Error("ListMixTxs", "error", err, "height", reqInfo.Height, "index", reqInfo.TxIndex)
break
}
mixTxInfos := msg.(*mixTy.MixTxListResp)
if mixTxInfos == nil {
bizlog.Info("privacy ReqTxInfosByAddr ReplyTxInfos is nil")
break
}
txcount := len(mixTxInfos.Txs)
var ReqHashes types.ReqHashes
ReqHashes.Hashes = make([][]byte, len(mixTxInfos.Txs))
for index, tx := range mixTxInfos.Txs {
ReqHashes.Hashes[index] = tx.GetHash()
}
if txcount > 0 {
txInfo.Hash = mixTxInfos.Txs[txcount-1].GetHash()
txInfo.Height = mixTxInfos.Txs[txcount-1].GetHeight()
txInfo.Index = mixTxInfos.Txs[txcount-1].GetIndex()
}
policy.getPrivacyTxDetailByHashs(&ReqHashes)
if txcount < int(MaxTxHashsPerTime) {
break
}
}
policy.store.setRescanNoteStatus(int32(mixTy.MixWalletRescanStatus_FINISHED))
return
}
func (policy *mixPolicy) getPrivacyTxDetailByHashs(ReqHashes *types.ReqHashes) {
//通过txhashs获取对应的txdetail
txDetails, err := policy.getWalletOperate().GetAPI().GetTransactionByHash(ReqHashes)
if err != nil {
bizlog.Error("getPrivacyTxDetailByHashs", "GetTransactionByHash error", err)
return
}
for _, tx := range txDetails.Txs {
policy.processMixTx(tx.Tx, tx.Height, tx.Index)
}
}
func (policy *mixPolicy) enablePrivacy(addrs []string) (*mixTy.ReqEnablePrivacyRst, error) {
if 0 == len(addrs) {
WalletAccStores, err := policy.store.GetAccountByPrefix("Account")
if err != nil || len(WalletAccStores) == 0 {
bizlog.Info("enablePrivacy", "GetAccountByPrefix:err", err)
return nil, types.ErrNotFound
}
for _, WalletAccStore := range WalletAccStores {
bizlog.Info("enablePrivacy", "addr", WalletAccStore.Addr)
addrs = append(addrs, WalletAccStore.Addr)
}
} else {
addrs = append(addrs, addrs...)
bizlog.Info("enablePrivacy", "addrs", addrs)
}
var rep mixTy.ReqEnablePrivacyRst
for _, addr := range addrs {
str := ""
isOK := true
_, err := policy.getAccountPrivacyKey(addr)
if err != nil {
isOK = false
str = err.Error()
}
priAddrResult := &mixTy.PrivacyAddrResult{
Addr: addr,
IsOK: isOK,
Msg: str,
}
rep.Results = append(rep.Results, priAddrResult)
}
policy.store.enablePrivacy()
return &rep, nil
}
func (policy *mixPolicy) showAccountNoteInfo(addrs []string) (*mixTy.WalletIndexResp, error) {
var resps mixTy.WalletIndexResp
for _, addr := range addrs {
var req mixTy.WalletMixIndexReq
req.Account = addr
resp, err := policy.listMixInfos(&req)
if err != nil {
return nil, err
}
resps.Datas = append(resps.Datas, resp.(*mixTy.WalletIndexResp).Datas...)
}
return &resps, nil
}
//对secretData 编码为string,同时增加随机值
func encodeSecretData(secret *mixTy.SecretData) (*mixTy.EncodedSecretData, error) {
if secret == nil {
return nil, errors.Wrap(types.ErrInvalidParam, "para is nil")
}
if len(secret.PaymentPubKey) <= 0 {
return nil, errors.Wrap(types.ErrInvalidParam, "spendPubKey is nil")
}
var val big.Int
ret, succ := val.SetString(secret.Amount, 10)
if !succ {
return nil, errors.Wrapf(types.ErrInvalidParam, "wrong amount = %s", secret.Amount)
}
if ret.Sign() <= 0 {
return nil, errors.Wrapf(types.ErrInvalidParam, "amount = %s, need bigger than 0", secret.Amount)
}
//获取随机值
var fr fr_bn256.Element
fr.SetRandom()
secret.NoteRandom = fr.String()
code := types.Encode(secret)
var resp mixTy.EncodedSecretData
resp.Encoded = common.ToHex(code)
resp.RawData = secret
return &resp, nil
}
//产生随机秘钥和receivingPk对data DH加密,返回随机秘钥的公钥
func encryptSecretData(req *mixTy.EncryptSecretData) (*mixTy.DHSecret, error) {
secret, err := common.FromHex(req.Secret)
if err != nil {
return nil, errors.Wrap(err, "decode secret")
}
epk, crypt, err := encryptData(req.ReceivingPk, secret)
if err != nil {
return nil, errors.Wrap(err, "encrypt")
}
return &mixTy.DHSecret{Epk: epk, Secret: common.ToHex(crypt)}, nil
}
func decryptSecretData(req *mixTy.DecryptSecretData) (*mixTy.SecretData, error) {
secret, err := common.FromHex(req.Secret)
if err != nil {
return nil, errors.Wrap(err, "decode req.secret")
}
decrypt, err := decryptData(req.ReceivingPriKey, req.Epk, secret)
if err != nil {
return nil, errors.Wrap(err, "decrypt secret")
}
var raw mixTy.SecretData
err = types.Decode(decrypt, &raw)
if err != nil {
return nil, errors.Wrap(mixTy.ErrDecryptDataFail, "decode decrypt.secret")
}
return &raw, nil
}
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package wallet
import (
"encoding/hex"
commondb "github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/common/db/table"
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types"
mixTy "github.com/33cn/plugin/plugin/dapp/mix/types"
"github.com/pkg/errors"
)
func (p *mixPolicy) execAutoLocalMix(tx *types.Transaction, receiptData *types.ReceiptData, index int, height int64) (*types.LocalDBSet, error) {
set, err := p.execLocalMix(tx, receiptData, height, int64(index))
if err != nil {
return set, err
}
dbSet := &types.LocalDBSet{}
dbSet.KV = p.store.AddRollbackKV(tx, tx.Execer, set.KV)
return dbSet, nil
}
func (p *mixPolicy) execLocalMix(tx *types.Transaction, receiptData *types.ReceiptData, height, index int64) (*types.LocalDBSet, error) {
if receiptData.Ty != types.ExecOk {
return nil, types.ErrInvalidParam
}
if !p.store.getPrivacyEnable() {
return nil, nil
}
return p.processMixTx(tx, height, index)
}
func (p *mixPolicy) processMixTx(tx *types.Transaction, height, index int64) (*types.LocalDBSet, error) {
var v mixTy.MixAction
err := types.Decode(tx.Payload, &v)
if err != nil {
bizlog.Error("execLocalMix decode", "hash", tx.Hash(), "err", err)
return nil, types.ErrInvalidParam
}
table := NewMixTable(p.getWalletOperate().GetDBStore())
switch v.GetTy() {
//deposit 匹配newcommits,属于自己的存到数据库
case mixTy.MixActionDeposit:
p.processDeposit(v.GetDeposit(), dapp.HeightIndexStr(height, index), table)
//根据withdraw nullifier hash 更新数据状态为USED
case mixTy.MixActionWithdraw:
var nulls []string
for _, m := range v.GetWithdraw().SpendCommits {
out, err := mixTy.DecodePubInput(mixTy.VerifyType_WITHDRAW, m.PublicInput)
if err != nil {
bizlog.Error("processWithdraw decode", "pubInput", m.PublicInput)
continue
}
nulls = append(nulls, out.(*mixTy.WithdrawPublicInput).NullifierHash)
}
p.processNullifiers(nulls, table)
//nullifier hash更新为used, newcommit解密存储
case mixTy.MixActionTransfer:
p.processTransfer(v.GetTransfer(), dapp.HeightIndexStr(height, index), table)
//查看本地authSpend hash是否hit, 是则更新为OPEN状态
case mixTy.MixActionAuth:
p.processAuth(v.GetAuthorize(), table)
}
kvs, err := table.Save()
if err != nil {
bizlog.Error("execLocalMix table save", "hash", tx.Hash(), "err", err)
return nil, err
}
dbSet := &types.LocalDBSet{}
dbSet.KV = append(dbSet.KV, kvs...)
return dbSet, nil
}
func (p *mixPolicy) processDeposit(deposit *mixTy.MixDepositAction, heightIndex string, table *table.Table) {
for _, m := range deposit.NewCommits {
data, err := mixTy.DecodePubInput(mixTy.VerifyType_DEPOSIT, m.PublicInput)
if err != nil {
bizlog.Error("processDeposit decode", "pubInput", m.PublicInput)
continue
}
input := data.(*mixTy.DepositPublicInput)
p.processSecretGroup(input.NoteHash, m.Group, heightIndex, table)
}
}
func (p *mixPolicy) processTransfer(transfer *mixTy.MixTransferAction, heightIndex string, table *table.Table) {
var nulls []string
for _, m := range transfer.Input {
data, err := mixTy.DecodePubInput(mixTy.VerifyType_TRANSFERINPUT, m.PublicInput)
if err != nil {
bizlog.Error("processTransfer.input decode", "pubInput", m.PublicInput)
continue
}
input := data.(*mixTy.TransferInputPublicInput)
nulls = append(nulls, input.NullifierHash)
}
p.processNullifiers(nulls, table)
for _, m := range transfer.Output {
data, err := mixTy.DecodePubInput(mixTy.VerifyType_TRANSFEROUTPUT, m.PublicInput)
if err != nil {
bizlog.Error("processTransfer.output decode", "pubInput", m.PublicInput)
continue
}
input := data.(*mixTy.TransferOutputPublicInput)
p.processSecretGroup(input.NoteHash, input.DhSecrets, heightIndex, table)
}
}
func (p *mixPolicy) processAuth(auth *mixTy.MixAuthorizeAction, table *table.Table) {
for _, m := range auth.AuthCommits {
out, err := mixTy.DecodePubInput(mixTy.VerifyType_AUTHORIZE, m.PublicInput)
if err != nil {
bizlog.Error("processAuth decode", "pubInput", m.PublicInput)
continue
}
input := out.(*mixTy.AuthorizePublicInput)
updateAuthSpend(table, input.AuthorizeSpendHash)
}
}
func (p *mixPolicy) processNullifiers(nulls []string, table *table.Table) {
for _, n := range nulls {
err := updateNullifier(table, n)
if err != nil {
bizlog.Error("processNullifiers", "nullifier", n, "err", err)
}
}
}
func updateNullifier(ldb *table.Table, nullifier string) error {
xs, err := ldb.ListIndex("nullifier", []byte(nullifier), nil, 1, 0)
if err != nil || len(xs) != 1 {
bizlog.Error("updateNullifier update query List failed", "key", nullifier, "err", err, "len", len(xs))
return nil
}
u, ok := xs[0].Data.(*mixTy.WalletDbMixInfo)
if !ok {
bizlog.Error("updateNullifier update decode failed", "data", xs[0].Data)
return nil
}
u.Info.Status = mixTy.NoteStatus_CLOSE
return ldb.Update([]byte(u.TxIndex), u)
}
func updateAuthSpend(ldb *table.Table, authSpend string) error {
xs, err := ldb.ListIndex("authSpendHash", []byte(authSpend), nil, 1, 0)
if err != nil || len(xs) != 1 {
bizlog.Error("updateAuthSpend update query List failed", "key", authSpend, "err", err, "len", len(xs))
return nil
}
u, ok := xs[0].Data.(*mixTy.WalletDbMixInfo)
if !ok {
bizlog.Error("updateAuthSpend update decode failed", "data", xs[0].Data)
return nil
}
u.Info.Status = mixTy.NoteStatus_OPEN
return ldb.Update([]byte(u.TxIndex), u)
}
func (e *mixPolicy) listMixInfos(req *mixTy.WalletMixIndexReq) (types.Message, error) {
if req == nil {
return nil, types.ErrInvalidParam
}
localDb := e.getWalletOperate().GetDBStore()
query := NewMixTable(localDb).GetQuery(commondb.NewKVDB(localDb))
var primary []byte
indexName := ""
if len(req.NoteHash) > 0 {
indexName = "noteHash"
} else if len(req.Nullifier) > 0 {
indexName = "nullifier"
} else if len(req.AuthSpendHash) > 0 {
indexName = "authSpendHash"
} else if len(req.Spender) > 0 {
indexName = "spender"
} else if len(req.Account) > 0 {
indexName = "account"
} else if req.Status > 0 {
indexName = "status"
}
cur := &MixRow{
WalletDbMixInfo: &mixTy.WalletDbMixInfo{Info: &mixTy.WalletIndexInfo{
NoteHash: req.NoteHash,
Nullifier: req.Nullifier,
AuthSpendHash: req.AuthSpendHash,
Spender: req.Spender,
Account: req.Account,
Status: mixTy.NoteStatus(req.Status),
}},
}
prefix, err := cur.Get(indexName)
if err != nil {
bizlog.Error("listMixInfos Get", "indexName", indexName, "err", err)
return nil, err
}
rows, err := query.ListIndex(indexName, prefix, primary, req.Count, req.Direction)
if err != nil {
bizlog.Error("listMixInfos query failed", "indexName", indexName, "prefix", prefix, "key", string(primary), "err", err)
return nil, err
}
if len(rows) == 0 {
return nil, types.ErrNotFound
}
var rep mixTy.WalletIndexResp
for _, row := range rows {
r, ok := row.Data.(*mixTy.WalletIndexInfo)
if !ok {
bizlog.Error("listMixInfos", "err", "bad row type")
return nil, types.ErrDecode
}
rep.Datas = append(rep.Datas, r)
}
return &rep, nil
}
func (e *mixPolicy) execAutoDelLocal(tx *types.Transaction) (*types.LocalDBSet, error) {
kvs, err := e.store.DelRollbackKV(tx, tx.Execer)
if err != nil {
return nil, err
}
dbSet := &types.LocalDBSet{}
dbSet.KV = append(dbSet.KV, kvs...)
return dbSet, nil
}
func (p *mixPolicy) addTable(info *mixTy.WalletIndexInfo, heightIndex string, table *table.Table) {
r := &mixTy.WalletDbMixInfo{
Info: info,
TxIndex: heightIndex + info.NoteHash,
}
err := table.Replace(r)
if err != nil {
bizlog.Error("addTable", "notehash", info.NoteHash, "err", err)
}
}
func (p *mixPolicy) processSecretGroup(noteHash string, secretGroup *mixTy.DHSecretGroup, heightIndex string, table *table.Table) {
if secretGroup == nil {
bizlog.Info("noteHash secretGroup null", "noteHash", noteHash)
return
}
privacyKeys, err := p.getWalletPrivacyKeys()
if err != nil || privacyKeys == nil {
bizlog.Error("processSecretGroup.getPrivacyPairs", "notehash", noteHash, "err", err)
return
}
//可能自己账户里面既有spender,也有returner 或authorize,都要解一遍
info, err := p.decodeSecret(noteHash, secretGroup.Spender, privacyKeys)
if err != nil {
bizlog.Info("processSecretGroup.spender", "err", err)
}
if info != nil {
p.addTable(info, heightIndex, table)
}
info, err = p.decodeSecret(noteHash, secretGroup.Returner, privacyKeys)
if err != nil {
bizlog.Info("processSecretGroup.Returner", "err", err)
}
if info != nil {
p.addTable(info, heightIndex, table)
}
info, err = p.decodeSecret(noteHash, secretGroup.Authorize, privacyKeys)
if err != nil {
bizlog.Info("processSecretGroup.Authorize", "err", err)
}
if info != nil {
p.addTable(info, heightIndex, table)
}
}
func (p *mixPolicy) decodeSecret(noteHash string, dhSecret *mixTy.DHSecret, privacyKeys []*mixTy.WalletAddrPrivacy) (*mixTy.WalletIndexInfo, error) {
if dhSecret == nil {
return nil, errors.Wrapf(types.ErrEmpty, "secret nil for notehash=%s", noteHash)
}
tempPubKey := &mixTy.PubKey{X: dhSecret.Epk.X, Y: dhSecret.Epk.Y}
for _, key := range privacyKeys {
cryptData, err := hex.DecodeString(dhSecret.Secret)
if err != nil {
return nil, errors.Wrapf(err, "decode for notehash=%s,crypt=%s", noteHash, dhSecret.Secret)
}
decryptData, err := decryptData(key.Privacy.ShareSecretKey.PrivKey, tempPubKey, cryptData)
if err != nil {
return nil, errors.Wrapf(err, "decrypt for notehash=%s,crypt=%s", noteHash, dhSecret.Secret)
}
var rawData mixTy.SecretData
err = types.Decode(decryptData, &rawData)
if err != nil {
bizlog.Info("processSecret.DecrypterPrivkey", "err", err)
continue
}
if rawData.PaymentPubKey == key.Privacy.PaymentKey.PayKey ||
rawData.ReturnPubKey == key.Privacy.PaymentKey.PayKey ||
rawData.AuthorizePubKey == key.Privacy.PaymentKey.PayKey {
//decrypted, save database
var info mixTy.WalletIndexInfo
info.NoteHash = noteHash
info.Nullifier = getFrString(MimcHashString([]string{rawData.NoteRandom}))
//如果自己是spender,则记录有关spenderAuthHash,如果是returner,则记录returnerAuthHash
//如果授权为spenderAuthHash,则spender更新本地为OPEN,returner侧仍为FROZEN,花费后,两端都变为USED
//如果授权为returnerAuthHash,则returner更新本地为OPEN,spender侧仍为FROZEN,
if rawData.PaymentPubKey == key.Privacy.PaymentKey.PayKey {
info.Spender = rawData.PaymentPubKey
info.AuthSpendHash = getFrString(MimcHashString([]string{rawData.PaymentPubKey, rawData.Amount, rawData.NoteRandom}))
} else if rawData.ReturnPubKey == key.Privacy.PaymentKey.PayKey {
info.Spender = rawData.ReturnPubKey
info.AuthSpendHash = getFrString(MimcHashString([]string{rawData.ReturnPubKey, rawData.Amount, rawData.NoteRandom}))
}
info.Status = mixTy.NoteStatus_OPEN
if len(rawData.AuthorizePubKey) > 0 {
info.Status = mixTy.NoteStatus_FROZEN
}
//账户地址
info.Account = key.Addr
return &info, nil
}
}
return nil, nil
}
package wallet
import (
"encoding/hex"
"testing"
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/types"
mixTy "github.com/33cn/plugin/plugin/dapp/mix/types"
"github.com/stretchr/testify/assert"
)
func TestNewPrivacyWithPrivKey(t *testing.T) {
prikey := "4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01"
keyByte, err := hex.DecodeString(prikey)
assert.Equal(t, nil, err)
pairs, err := newPrivacyWithPrivKey(keyByte)
assert.Equal(t, nil, err)
t.Log("payPri", pairs.PaymentKey.SpendKey, "payPub", pairs.PaymentKey.PayKey, "crytoPub", pairs.ShareSecretKey.ReceivingPk, "crytoPri", pairs.ShareSecretKey.PrivKey.Data)
prikey2 := "1257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01"
keyByte2, err := hex.DecodeString(prikey2)
assert.Equal(t, nil, err)
pairs2, err := newPrivacyWithPrivKey(keyByte2)
assert.Equal(t, nil, err)
t.Log("payPri", pairs2.PaymentKey.SpendKey, "payPub", pairs2.PaymentKey.PayKey, "crytoPub", pairs2.ShareSecretKey.ReceivingPk, "crytoPri", pairs2.ShareSecretKey.PrivKey.Data)
secret1 := &mixTy.SecretData{
PaymentPubKey: "13735985067536865723202617343666111332145536963656464451727087263423649028705",
ReturnPubKey: "16067249407809359746114321133992130903102335882983385972747813693681808870497",
AuthorizePubKey: "13519883267141251871527102103999205179714486518503885909948192364772977661583",
NoteRandom: "2824204835",
Amount: "28242048",
}
//secret2 := &mixTy.CryptoData{
// SpendPubKey:"18829345085195922012068709111582461121107908772422825655963168999800303848486",
// ReturnPubKey:"16067249407809359746114321133992130903102335882983385972747813693681808870497",
// AuthorizePubKey:"13519883267141251871527102103999205179714486518503885909948192364772977661583",
// NoteRandom:"2824204835",
// Amount:"28242048",
//}
pub1, cryptData1, err := encryptData(pairs.ShareSecretKey.ReceivingPk, types.Encode(secret1))
assert.Nil(t, err)
decryData1, err := decryptData(pairs.ShareSecretKey.PrivKey, pub1, cryptData1)
assert.Nil(t, err)
var val mixTy.SecretData
err = types.Decode(decryData1, &val)
assert.Nil(t, err)
assert.Equal(t, secret1.PaymentPubKey, val.PaymentPubKey)
}
func TestEncrypt(t *testing.T) {
secret1 := &mixTy.SecretData{
PaymentPubKey: "13735985067536865723202617343666111332145536963656464451727087263423649028705",
ReturnPubKey: "16067249407809359746114321133992130903102335882983385972747813693681808870497",
AuthorizePubKey: "13519883267141251871527102103999205179714486518503885909948192364772977661583",
NoteRandom: "2824204835",
Amount: "28242048",
}
password := "1314fuzamei"
cryptData := encryptDataWithPadding([]byte(password), types.Encode(secret1))
decryptData, err := decryptDataWithPading([]byte(password), cryptData)
assert.Nil(t, err)
var raw mixTy.SecretData
err = types.Decode(decryptData, &raw)
assert.Nil(t, err)
assert.Equal(t, raw.PaymentPubKey, secret1.PaymentPubKey)
}
func TestEncodeSecretData(t *testing.T) {
secret := &mixTy.SecretData{
PaymentPubKey: "13735985067536865723202617343666111332145536963656464451727087263423649028705",
ReturnPubKey: "16067249407809359746114321133992130903102335882983385972747813693681808870497",
AuthorizePubKey: "13519883267141251871527102103999205179714486518503885909948192364772977661583",
Amount: "28242048",
}
ret, err := encodeSecretData(secret)
assert.Nil(t, err)
t.Log(ret)
//test encryp data
prikey := "4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01"
keyByte, err := hex.DecodeString(prikey)
assert.Equal(t, nil, err)
privacy, err := newPrivacyWithPrivKey(keyByte)
assert.Equal(t, nil, err)
req := &mixTy.EncryptSecretData{ReceivingPk: privacy.ShareSecretKey.ReceivingPk, Secret: ret.Encode}
dhSecret, err := encryptSecretData(req)
assert.Nil(t, err)
t.Log(dhSecret)
data, err := common.FromHex(dhSecret.Secret)
assert.Nil(t, err)
rawData, err := decryptData(privacy.ShareSecretKey.PrivKey, dhSecret.Epk, data)
assert.Nil(t, err)
var rawSecret mixTy.SecretData
types.Decode(rawData, &rawSecret)
assert.Equal(t, rawSecret.PaymentPubKey, secret.PaymentPubKey)
}
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of policy source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package wallet
import (
"sync"
"github.com/33cn/chain33/common/crypto"
"github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/common/log/log15"
"github.com/33cn/chain33/types"
wcom "github.com/33cn/chain33/wallet/common"
mixTy "github.com/33cn/plugin/plugin/dapp/mix/types"
)
var (
bizlog = log15.New("module", "wallet.mix")
// MaxTxHashsPerTime 单词处理的最大哈希书
MaxTxHashsPerTime int64 = 100
// maxTxNumPerBlock 单个区块最大数
maxTxNumPerBlock int64 = types.MaxTxsPerBlock
)
func init() {
wcom.RegisterPolicy(mixTy.MixX, New())
}
// New 创建一盒钱包业务策略
func New() wcom.WalletBizPolicy {
return &mixPolicy{
mtx: &sync.Mutex{},
rescanwg: &sync.WaitGroup{},
}
}
type mixPolicy struct {
mtx *sync.Mutex
store *mixStore
walletOperate wcom.WalletOperate
rescanwg *sync.WaitGroup
}
func (policy *mixPolicy) setWalletOperate(walletBiz wcom.WalletOperate) {
policy.mtx.Lock()
defer policy.mtx.Unlock()
policy.walletOperate = walletBiz
}
func (policy *mixPolicy) getWalletOperate() wcom.WalletOperate {
policy.mtx.Lock()
defer policy.mtx.Unlock()
return policy.walletOperate
}
// Init 初始化处理
func (policy *mixPolicy) Init(walletOperate wcom.WalletOperate, sub []byte) {
policy.setWalletOperate(walletOperate)
policy.store = newStore(walletOperate.GetDBStore())
}
// OnCreateNewAccount 在账号创建时做一些处理
func (policy *mixPolicy) OnCreateNewAccount(acc *types.Account) {
}
// OnImportPrivateKey 在私钥导入时做一些处理
func (policy *mixPolicy) OnImportPrivateKey(acc *types.Account) {
}
// OnAddBlockFinish 在区块被添加成功时做一些处理
func (policy *mixPolicy) OnAddBlockFinish(block *types.BlockDetail) {
}
// OnDeleteBlockFinish 在区块被删除成功时做一些处理
func (policy *mixPolicy) OnDeleteBlockFinish(block *types.BlockDetail) {
}
// OnClose 在钱包关闭时做一些处理
func (policy *mixPolicy) OnClose() {
}
// OnSetQueueClient 在钱包消息队列初始化时做一些处理
func (policy *mixPolicy) OnSetQueueClient() {
}
// OnWalletLocked 在钱包加锁时做一些处理
func (policy *mixPolicy) OnWalletLocked() {
}
// OnWalletUnlocked 在钱包解锁时做一些处理
func (policy *mixPolicy) OnWalletUnlocked(WalletUnLock *types.WalletUnLock) {
}
// OnAddBlockTx 响应区块交易添加的处理
func (policy *mixPolicy) OnAddBlockTx(block *types.BlockDetail, tx *types.Transaction, index int32, dbBatch db.Batch) *types.WalletTxDetail {
dbSet, err := policy.execAutoLocalMix(tx, block.Receipts[index], int(index), block.Block.Height)
if err != nil {
return nil
}
for _, kv := range dbSet.KV {
dbBatch.Set(kv.Key, kv.Value)
}
// 自己处理掉所有事务,部需要外部处理了
return nil
}
// OnDeleteBlockTx 响应删除区块交易的处理
func (policy *mixPolicy) OnDeleteBlockTx(block *types.BlockDetail, tx *types.Transaction, index int32, dbBatch db.Batch) *types.WalletTxDetail {
dbSet, err := policy.execAutoDelLocal(tx)
if err != nil {
return nil
}
for _, kv := range dbSet.KV {
dbBatch.Set(kv.Key, kv.Value)
}
return nil
}
// Call 调用隐私的方法
func (policy *mixPolicy) Call(funName string, in types.Message) (ret types.Message, err error) {
switch funName {
case "GetScanFlag":
isok := policy.store.getRescanNoteStatus() == int32(mixTy.MixWalletRescanStatus_SCANNING)
ret = &types.Reply{IsOk: isok}
default:
err = types.ErrNotSupport
}
return
}
// SignTransaction 对隐私交易进行签名
func (policy *mixPolicy) SignTransaction(key crypto.PrivKey, req *types.ReqSignRawTx) (needSysSign bool, signtxhex string, err error) {
return false, "", types.ErrNotSupport
}
package wallet
import (
"fmt"
"github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/common/db/table"
"github.com/33cn/chain33/types"
mix "github.com/33cn/plugin/plugin/dapp/mix/types"
)
/*
table struct
data: self consens stage
index: status
*/
var boardOpt = &table.Option{
Prefix: "LODB-mixcoin",
Name: "wallet",
Primary: "heightindex",
Index: []string{
"noteHash",
"nullifier",
"authSpendHash",
"spender",
"account",
"status"},
}
//NewStageTable 新建表
func NewMixTable(kvdb db.KV) *table.Table {
rowmeta := NewMixRow()
table, err := table.NewTable(rowmeta, kvdb, boardOpt)
if err != nil {
panic(err)
}
return table
}
//MixRow table meta 结构
type MixRow struct {
*mix.WalletDbMixInfo
}
//NewStageRow 新建一个meta 结构
func NewMixRow() *MixRow {
return &MixRow{WalletDbMixInfo: &mix.WalletDbMixInfo{}}
}
//CreateRow 新建数据行(注意index 数据一定也要保存到数据中,不能就保存heightindex)
func (r *MixRow) CreateRow() *table.Row {
return &table.Row{Data: &mix.WalletDbMixInfo{}}
}
//SetPayload 设置数据
func (r *MixRow) SetPayload(data types.Message) error {
if d, ok := data.(*mix.WalletDbMixInfo); ok {
r.WalletDbMixInfo = d
return nil
}
return types.ErrTypeAsset
}
//Get 按照indexName 查询 indexValue
func (r *MixRow) Get(key string) ([]byte, error) {
switch key {
case "heightindex":
return []byte(r.TxIndex), nil
case "noteHash":
return []byte(r.Info.NoteHash), nil
case "authSpendHash":
return []byte(r.Info.AuthSpendHash), nil
case "spender":
return []byte(r.Info.Spender), nil
case "account":
return []byte(r.Info.Account), nil
case "status":
return []byte(fmt.Sprintf("%2d", r.Info.Status)), nil
default:
return nil, types.ErrNotFound
}
}
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package wallet
import (
"github.com/33cn/chain33/common/db"
system "github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types"
wcom "github.com/33cn/chain33/wallet/common"
mixTy "github.com/33cn/plugin/plugin/dapp/mix/types"
)
func newStore(db db.DB) *mixStore {
return &mixStore{Store: wcom.NewStore(db)}
}
// mixStore 隐私交易数据库存储操作类
type mixStore struct {
*wcom.Store
}
//
//func (store *mixStore) getAccountByPrefix(addr string) ([]*types.WalletAccountStore, error) {
// if len(addr) == 0 {
// bizlog.Error("getAccountByPrefix addr is nil")
// return nil, types.ErrInvalidParam
// }
// list := store.NewListHelper()
// accbytes := list.PrefixScan([]byte(addr))
// if len(accbytes) == 0 {
// bizlog.Error("getAccountByPrefix addr not exist")
// return nil, types.ErrAccountNotExist
// }
// WalletAccountStores := make([]*types.WalletAccountStore, len(accbytes))
// for index, accbyte := range accbytes {
// var walletaccount types.WalletAccountStore
// err := proto.Unmarshal(accbyte, &walletaccount)
// if err != nil {
// bizlog.Error("GetAccountByAddr", "proto.Unmarshal err:", err)
// return nil, types.ErrUnmarshal
// }
// WalletAccountStores[index] = &walletaccount
// }
// return WalletAccountStores, nil
//}
func (store *mixStore) getAccountPrivacy(addr string) ([]byte, error) {
if len(addr) == 0 {
return nil, types.ErrInvalidParam
}
return store.Get(calcMixAddrKey(addr))
}
//
//func (store *mixStore) getAccountByAddr(addr string) (*types.WalletAccountStore, error) {
// var account types.WalletAccountStore
// if len(addr) == 0 {
// bizlog.Error("GetAccountByAddr addr is nil")
// return nil, types.ErrInvalidParam
// }
// data, err := store.Get(calcMixAddrKey(addr))
// if data == nil || err != nil {
// if err != db.ErrNotFoundInDb {
// bizlog.Debug("GetAccountByAddr addr", "err", err)
// }
// return nil, types.ErrAddrNotExist
// }
//
// err = types.Decode(data, &account)
// if err != nil {
// bizlog.Error("GetAccountByAddr", "proto.Unmarshal err:", err)
// return nil, types.ErrUnmarshal
// }
// return &account, nil
//}
func (store *mixStore) setAccountPrivacy(addr string, data []byte) error {
if len(addr) == 0 {
bizlog.Error("SetWalletAccountPrivacy addr is nil")
return types.ErrInvalidParam
}
if len(data) == 0 {
bizlog.Error("SetWalletAccountPrivacy privacy is nil")
return types.ErrInvalidParam
}
store.GetDB().Set(calcMixAddrKey(addr), data)
//newbatch := store.NewBatch(true)
//newbatch.Set(calcMixAddrKey(addr), data)
//newbatch.Write()
return nil
}
func (store *mixStore) enablePrivacy() {
newbatch := store.NewBatch(true)
newbatch.Set(calcMixPrivacyEnable(), []byte("true"))
newbatch.Write()
}
func (store *mixStore) getPrivacyEnable() bool {
_, err := store.Get(calcMixPrivacyEnable())
if err != nil {
return false
}
return true
}
func (store *mixStore) setRescanNoteStatus(status int32) {
newbatch := store.NewBatch(true)
newbatch.Set(calcRescanNoteStatus(), []byte(mixTy.MixWalletRescanStatus(status).String()))
newbatch.Write()
}
func (store *mixStore) getRescanNoteStatus() int32 {
v, err := store.Get(calcRescanNoteStatus())
if err != nil {
return int32(mixTy.MixWalletRescanStatus_IDLE)
}
return mixTy.MixWalletRescanStatus_value[string(v)]
}
//AddRollbackKV add rollback kv
func (d *mixStore) AddRollbackKV(tx *types.Transaction, execer []byte, kvs []*types.KeyValue) []*types.KeyValue {
k := types.CalcRollbackKey(types.GetRealExecName(execer), tx.Hash())
kvc := system.NewKVCreator(d.GetDB(), types.CalcLocalPrefix(execer), k)
kvc.AddListNoPrefix(kvs)
kvc.AddRollbackKV()
return kvc.KVList()
}
//DelRollbackKV del rollback kv when exec_del_local
func (d *mixStore) DelRollbackKV(tx *types.Transaction, execer []byte) ([]*types.KeyValue, error) {
krollback := types.CalcRollbackKey(types.GetRealExecName(execer), tx.Hash())
kvc := system.NewKVCreator(d.GetDB(), types.CalcLocalPrefix(execer), krollback)
kvs, err := kvc.GetRollbackKVList()
if err != nil {
return nil, err
}
for _, kv := range kvs {
kvc.AddNoPrefix(kv.Key, kv.Value)
}
kvc.DelRollbackKV()
return kvc.KVList(), nil
}
...@@ -63,4 +63,114 @@ ...@@ -63,4 +63,114 @@
|bindCoins|int|绑定挖矿冻结币的份额,需冻结平行链原生代币,解绑定不需要此配置| |bindCoins|int|绑定挖矿冻结币的份额,需冻结平行链原生代币,解绑定不需要此配置|
|targetNode|string|绑定目标共识节点,需要是共识账户组的成员| |targetNode|string|绑定目标共识节点,需要是共识账户组的成员|
## 挖矿奖励的转出
1.查询挖矿奖励
>挖矿产生的奖励在平行链的paracross 执行器中
```
{
"method": "Chain33.GetBalance",
"params": [{
"addresses": ["{共识账户地址}"],
"execer": "user.p.para.paracross"
}]
}
1. cli命令方法
./chain33-cli --rpc_laddr http://localhost:8901 account balance -a 1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4
{
"addr": "1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4",
"execAccount": [
{
"execer": "user.p.para.paracross",
"account": {
"balance": "2227.0000",
"frozen": "0.0000"
}
}
]
}
2. rpc方法:
curl -ksd '{"method":"Chain33.GetBalance","params":[{"addresses":["1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4"],"execer":"user.p.para.paracross"}]}' http://172.28.0.2:8901
响应:
{
"result": [{
"currency": 0,
"balance": 227500000000,
"frozen": 0,
"addr": "1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4"
}],
}
```
2.转出挖矿奖励
>需要从平行链执行器paracross下把奖励 withdraw出到平行链coins合约的签名地址下
```
1. cli命令方式:
./chain33-cli --rpc_laddr http://localhost:8801 --paraName {平行链title} send coins withdraw -a {数量} -e user.p.para.paracross -k ${私钥}
例:
./chain33-cli --rpc_laddr http://localhost:8801 --paraName user.p.para. send coins withdraw -a 2000000000 -e user.p.para.paracross -k ${私钥}
响应:
./chain33-cli --rpc_laddr http://localhost:8901 account balance -a 1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4
{
"addr": "1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4",
"execAccount": [
{
"execer": "user.p.para.paracross",
"account": {
"balance": "1032.0000",
"frozen": "0.0000"
}
},
{
"execer": "user.p.para.coins",
"account": {
"balance": "2020.0000",
"frozen": "0.0000"
}
}
]
}
注:user.p.para.coins下就是自己的余额
rpc方法
1.创建交易:
{
"method": "Chain33.CreateRawTransaction",
"params": [{
"to": "19WJJv96nKAU4sHFWqGmsqfjxd37jazqii",
"amount": 2000000000,
"fee": 2000000,
"isWithdraw": true,
"execName": "user.p.para.paracross",
"execer": "user.p.para.coins"
}]
}
注释:
1) "to": "19WJJv96nKAU4sHFWqGmsqfjxd37jazqii", 平行链paracross执行器地址,不需要修改
2) amount,fee需要自己设置
2.签名
{
"method": "Chain33.SignRawTx",
"params": [{
"privkey": "{私钥}",
"txHex": "{交易数据}",
"expire": "120s"
}]
}
3.发送交易
{
"method": "Chain33.SendTransaction",
"params": [{
"data": "{签名数据}"
}]
}
```
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