Commit 659d1455 authored by suyanlong's avatar suyanlong

😘 insteadof go mod path

parent 502e5138
Language: 'Proto'
BasedOnStyle: 'LLVM'
AccessModifierOffset: '-1'
AlignAfterOpenBracket: 'Align'
AlignConsecutiveAssignments: 'true'
AlignConsecutiveDeclarations: 'true'
AlignEscapedNewlinesLeft: 'true'
AlignOperands: 'true'
AlignTrailingComments: 'true'
AllowAllParametersOfDeclarationOnNextLine: 'true'
AllowShortBlocksOnASingleLine: 'true'
AllowShortCaseLabelsOnASingleLine: 'true'
ColumnLimit: '200'
IndentWidth: '4'
ContinuationIndentWidth: '4'
TabWidth: '4'
TabWidth: '4'
ReflowComments: 'true'
SortIncludes: 'true'
AllowShortFunctionsOnASingleLine: 'Empty'
AllowShortIfStatementsOnASingleLine: 'true'
test/*
plugins/build
Dockerfile
\ No newline at end of file
root = true
[*]
charset = utf-8
end_of_line = LF
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 8
[Makefile]
indent_size = 4
indent_style = tab
[*.md]
trim_trailing_whitespace = false
[*.go]
indent_style = tab
[*.yml]
indent_style = space
indent_size = 2
[*.sh]
indent_style = space
indent_size = 2
.DS_Store
.idea/*
*.tar
logs/*
internal/repo/a_repo-packr.go
bin
cover.out
coverage.out
coverage.txt
cover.html
imports/imports.go
goent.mod
goent.sum
testdata/
!internal/checker/testdata
pkg/filter/build/
# golang1.17.1 or latest
# 1. make help
# 2. make build
# ...
.PHONY: all build test fmt vet clean help
RED=\033[0;31m
GREEN=\033[0;32m
BLUE=\033[0;34m
NC=\033[0m
build:
@go mod tidy -v
@go build -v ./...
@printf "${GREEN}Build successfully!${NC}\n"
.PHONY: test fmt_proto fmt_shell check checkgofmt
help: Makefile
@echo "Choose a command run:"
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'
## make test: Run go unittest
test:
go generate ./...
@$(GO) test ${TEST_PKGS} -count=1
mod:
sed "s?)?$(MODS)\n)?" go.mod
## make linter: Run golanci-lint
linter:
golangci-lint run
golangci-lint run -E goimports -E bodyclose --skip-dirs-use-default
fmt_proto: ## go fmt protobuf file
@find . -name '*.proto' -not -path "./vendor/*" | xargs clang-format -i
fmt_shell: ## check shell file
@find . -name '*.sh' -not -path "./vendor/*" | xargs shfmt -w -s -i 4 -ci -bn
fmt_go: fmt_shell ## go fmt
@go fmt ./...
@find . -name '*.go' -not -path "./vendor/*" | xargs goimports -l -w
goimports:fmt
@CGO_ENABLED=1 goimports-reviser -dir-path ./ -project-name gitlab.33.cn/link33/chain33-sdk-go -ignore-dir mock -rm-unused -set-alias -format
fmt: fmt_proto fmt_shell ## go fmt
@go fmt ./...
@find . -name '*.go' -not -path "./vendor/*" | xargs goimports -l -w
@gofumpt -l -w .
clean:
@go clean
build-dep:
@go install golang.org/x/tools/cmd/goimports@latest
@go install github.com/suyanlong/aligner@latest
@go install mvdan.cc/gofumpt@latest
@go install mvdan.cc/sh/v3/cmd/shfmt@latest
@go install mvdan.cc/sh/v3/cmd/gosh@latest
@go install mvdan.cc/unparam@latest
@go install github.com/incu6us/goimports-reviser@master
@go install github.com/psampaz/go-mod-outdated@v0.8.0
# @apt install clang-format or brew isntall clang-format
# @apt install shellcheck or brew install shellcheck
aligner:
@aligner -r -c "//" -e ".go" comment
aligner-check:
@aligner -r -c "//" -e ".go" check
checkgofmt: ## get all go files and run go fmt on them
@files=$$(find . -name '*.go' -not -path "./vendor/*" | xargs gofmt -l -s); if [ -n "$$files" ]; then \
echo "Error: 'make fmt' needs to be run on:"; \
find . -name '*.go' -not -path "./vendor/*" | xargs gofmt -l -s ;\
exit 1; \
fi;
@files=$$(find . -name '*.go' -not -path "./vendor/*" | xargs goimports -l -w); if [ -n "$$files" ]; then \
echo "Error: 'make fmt' needs to be run on:"; \
find . -name '*.go' -not -path "./vendor/*" | xargs goimports -l -w ;\
exit 1; \
fi;
check: aligner-check checkgofmt
modmated:
@go list -u -m -json all | go-mod-outdated
......@@ -2,32 +2,33 @@ package sdk
import (
"errors"
"github.com/33cn/chain33-sdk-go/crypto"
"github.com/33cn/chain33-sdk-go/crypto/ed25519"
"github.com/33cn/chain33-sdk-go/crypto/gm"
"github.com/33cn/chain33-sdk-go/types"
log "github.com/inconshreveable/log15"
"gitlab.33.cn/link33/chain33-sdk-go/crypto"
"gitlab.33.cn/link33/chain33-sdk-go/crypto/ed25519"
"gitlab.33.cn/link33/chain33-sdk-go/crypto/gm"
"gitlab.33.cn/link33/chain33-sdk-go/types"
)
type Account struct {
PrivateKey []byte
PublicKey []byte
Address string
SignType string
PrivateKey []byte
PublicKey []byte
Address string
SignType string
}
var rlog = log.New("module", "chain33 adk")
func NewAccount(signType string) (*Account, error) {
if signType == "" {
signType = crypto.SECP256K1
if signType == "" {
signType = crypto.SECP256K1
}
account := Account{}
account.SignType = signType
if signType == crypto.SECP256K1 {
account.PrivateKey = crypto.GeneratePrivateKey()
account.PublicKey = crypto.PubKeyFromPrivate(account.PrivateKey)
account.PublicKey = crypto.PubKeyFromPrivate(account.PrivateKey)
addr, err := crypto.PubKeyToAddress(account.PublicKey)
if err != nil {
......@@ -75,7 +76,7 @@ func NewAccountFromLocal(signType string, filePath string) (*Account, error) {
account.SignType = signType
if signType == crypto.SECP256K1 {
//TODO
// TODO
return nil, errors.New("not support")
} else if signType == crypto.SM2 {
content, err := types.ReadFile(filePath)
......@@ -84,7 +85,7 @@ func NewAccountFromLocal(signType string, filePath string) (*Account, error) {
return nil, err
}
keyBytes,err := types.FromHex(string(content))
keyBytes, err := types.FromHex(string(content))
if err != nil {
rlog.Error("GetKeyByte.FromHex.", "error", err.Error())
return nil, err
......
package client
const (
Chain33_Lock = "Chain33.Lock"
Chain33_UnLock = "Chain33.UnLock"
......@@ -40,4 +41,4 @@ const (
Chain33_Query = "Chain33.Query"
Para_IsSync = "paracross.IsSync"
Chain33_IsSync = "Chain33.IsSync"
)
\ No newline at end of file
)
......@@ -11,18 +11,18 @@ import (
"encoding/json"
"errors"
"fmt"
sdk "github.com/33cn/chain33-sdk-go"
"github.com/33cn/chain33-sdk-go/crypto"
"github.com/33cn/chain33-sdk-go/dapp/broker"
"github.com/33cn/chain33-sdk-go/dapp/storage"
"github.com/33cn/chain33-sdk-go/event"
"github.com/33cn/chain33-sdk-go/types"
"github.com/golang/protobuf/proto"
"time"
"io/ioutil"
"net/http"
"strings"
"time"
"github.com/golang/protobuf/proto"
sdk "gitlab.33.cn/link33/chain33-sdk-go"
"gitlab.33.cn/link33/chain33-sdk-go/crypto"
"gitlab.33.cn/link33/chain33-sdk-go/dapp/broker"
"gitlab.33.cn/link33/chain33-sdk-go/dapp/storage"
"gitlab.33.cn/link33/chain33-sdk-go/event"
"gitlab.33.cn/link33/chain33-sdk-go/types"
)
// JSONClient a object of jsonclient
......@@ -48,7 +48,7 @@ func NewJSONClient(prefix, url string) (*JSONClient, error) {
// New produce a jsonclient by perfix and url
func new(prefix, url string, tlsVerify bool) (*JSONClient, error) {
httpcli := http.DefaultClient
if strings.Contains(url, "https") { //暂不校验tls证书
if strings.Contains(url, "https") { // 暂不校验tls证书
httpcli = &http.Client{Transport: &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: !tlsVerify}}}
}
return &JSONClient{
......@@ -129,7 +129,7 @@ func (client *JSONClient) Call(method string, params, resp interface{}) error {
type ParseFunc func(result json.RawMessage) (interface{}, error)
//回调函数,用于自定义解析返回得result数据
// 回调函数,用于自定义解析返回得result数据
func (client *JSONClient) CallBack(method string, params interface{}, parseFunc ParseFunc) (interface{}, error) {
method = addPrefix(client.prefix, method)
req := &clientRequest{}
......@@ -184,9 +184,9 @@ func (client *JSONClient) SendTransaction(signedTx string) (string, error) {
return res, nil
}
//SendTransactionSync
func (client *JSONClient) SendTransactionSync(privkey string,tx *types.Transaction) (*Response, error) {
//签名
// SendTransactionSync
func (client *JSONClient) SendTransactionSync(privkey string, tx *types.Transaction) (*Response, error) {
// 签名
hexbytes, _ := types.FromHex(privkey)
sdk.Sign(tx, hexbytes, crypto.SECP256K1, nil)
signedTx := types.ToHexPrefix(types.Encode(tx))
......@@ -199,7 +199,7 @@ func (client *JSONClient) SendTransactionSync(privkey string,tx *types.Transacti
if err != nil {
return nil, err
}
return &Response{OK:true,Message:res,Data:types.Encode(tx)}, nil
return &Response{OK: true, Message: res, Data: types.Encode(tx)}, nil
}
// 查询交易
......@@ -250,6 +250,7 @@ func (client *JSONClient) QueryHeadersByHeight(height int64) (*Headers, error) {
}
return &res, nil
}
func (client *JSONClient) QueryIsSync() (bool, error) {
var res bool
err := client.Call(Para_IsSync, nil, &res)
......@@ -277,6 +278,7 @@ func (client *JSONClient) QueryNetInfo() (*NodeNetinfo, error) {
}
return &res, nil
}
func (client *JSONClient) QueryMempool(jrpcURl string) (*ReplyTxList, error) {
var res ReplyTxList
params := types.ReqNil{}
......@@ -287,7 +289,7 @@ func (client *JSONClient) QueryMempool(jrpcURl string) (*ReplyTxList, error) {
return &res, nil
}
//获取区块信息
// 获取区块信息
func (client *JSONClient) QueryBlockInfo(start, end int64, isDetail bool) (*BlockDetails, error) {
var res BlockDetails
params := BlockParam{Start: start, End: end, Isdetail: isDetail}
......@@ -297,25 +299,25 @@ func (client *JSONClient) QueryBlockInfo(start, end int64, isDetail bool) (*Bloc
}
return &res, nil
}
//调用chaincode
func (client *JSONClient) Invoke(requst *Request,privateKey string) (*Response, error) {
//FIXME 这里需完善
if requst.Exec == storage.StorageX{
switch requst.Fcn {
case "set","ContentStorage":
tx,err:=storage.CreateContentStorageTx(client.prefix,0,string(requst.Args[0]),nil,string(requst.Args[1]))
if err!=nil {
return nil,err
// 调用chaincode
func (client *JSONClient) Invoke(requst *Request, privateKey string) (*Response, error) {
// FIXME 这里需完善
if requst.Exec == storage.StorageX {
switch requst.Fcn {
case "set", "ContentStorage":
tx, err := storage.CreateContentStorageTx(client.prefix, 0, string(requst.Args[0]), nil, string(requst.Args[1]))
if err != nil {
return nil, err
}
return client.SendTransactionSync(privateKey,tx)
return client.SendTransactionSync(privateKey, tx)
}
}
return nil, fmt.Errorf("not matching execution or method!")
}
// TODO 执行请求
func (client *JSONClient) Execute(requst *Request) (*Response, error) {
//err := client.Call(Chain33_QueryTransaction, query, &detail)
//if err != nil {
// return nil, err
......@@ -330,7 +332,7 @@ func (client *JSONClient) RegisterTxEvent(start int64, ccID, eventFilter string)
ch := make(chan *event.CCEvent)
resCh := make(chan event.Registration)
errCh := make(chan error)
//FIXME 这里实现是以联盟链方式,联盟链没有回滚,所以这里暂时按高度拉去处理
// FIXME 这里实现是以联盟链方式,联盟链没有回滚,所以这里暂时按高度拉去处理
go func(ch chan<- *event.CCEvent, closeCh <-chan event.Registration, errCh chan<- error) {
height := start
HERE:
......@@ -357,7 +359,7 @@ func (client *JSONClient) RegisterTxEvent(start int64, ccID, eventFilter string)
for _, item := range blockInfo.Items {
for i, tx := range item.Block.Txs {
if tx.Execer == ccID && item.Receipts[i].Ty == types.ExecOk {
//todo 这里需要重新弄成通用处理
// todo 这里需要重新弄成通用处理
if tx.Execer == broker.BrokerX {
var brokerAction types.BrokerAction
err := types.Decode(tx.Payload, &brokerAction)
......@@ -371,7 +373,6 @@ func (client *JSONClient) RegisterTxEvent(start int64, ccID, eventFilter string)
ch <- ccEvent
}
}
}
}
}
......@@ -381,7 +382,6 @@ func (client *JSONClient) RegisterTxEvent(start int64, ccID, eventFilter string)
case <-closeCh:
break
}
}
}(ch, resCh, errCh)
return resCh, ch, nil
......@@ -442,7 +442,6 @@ func (client *JSONClient) QueryOutterMeta() (*types.Meta, error) {
}
func (client *JSONClient) QueryCallBackMeta() (*types.Meta, error) {
jsonraw, err := json.Marshal(&types.QueryNilParam{})
if err != nil {
return nil, err
......@@ -479,7 +478,6 @@ func (client *JSONClient) QueryOutMessage(inServicePair string, index uint64) (*
}
func (client *JSONClient) QueryInMessage(inServicePair string, index uint64) (*types.Response, error) {
jsonraw, err := json.Marshal(&types.QueryInMessage{InServicePair: inServicePair, SequenceNum: index})
if err != nil {
return nil, err
......@@ -498,7 +496,6 @@ func (client *JSONClient) QueryInMessage(inServicePair string, index uint64) (*t
}
func (client *JSONClient) QueryBrokerInfo() (*types.BrokerInfo, error) {
jsonraw, err := json.Marshal(&types.QueryNilParam{})
if err != nil {
return nil, err
......
......@@ -106,6 +106,7 @@ type Header struct {
TxCount int64 `json:"txCount"`
Hash string `json:"hash"`
}
type ReceiptLog struct {
Ty int32 `json:"ty"`
Log string `json:"log"`
......@@ -158,7 +159,7 @@ type ReplyTxInfo struct {
}
type TransactionDetails struct {
//Txs []*Transaction `json:"txs"`
// Txs []*Transaction `json:"txs"`
Txs []*TransactionDetail `protobuf:"bytes,1,rep,name=txs" json:"txs"`
}
......@@ -173,9 +174,11 @@ type ReplyHash struct {
type ReplyHashes struct {
Hashes []string `json:"hashes"`
}
type PeerList struct {
Peers []*Peer `json:"peers"`
}
type Peer struct {
Addr string `json:"addr"`
Port int32 `json:"port"`
......@@ -189,6 +192,7 @@ type Peer struct {
type WalletAccounts struct {
Wallets []*WalletAccount `protobuf:"bytes,1,rep,name=wallets" json:"wallets"`
}
type WalletAccount struct {
Acc *Account `protobuf:"bytes,1,opt,name=acc" json:"acc"`
Label string `protobuf:"bytes,2,opt,name=label" json:"label"`
......@@ -200,10 +204,12 @@ type Account struct {
Frozen int64 `protobuf:"varint,3,opt,name=frozen" json:"frozen"`
Addr string `protobuf:"bytes,4,opt,name=addr" json:"addr"`
}
type Reply struct {
IsOk bool `protobuf:"varint,1,opt,name=isOk" json:"isOK"`
Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg"`
}
type Headers struct {
Items []*Header `protobuf:"bytes,1,rep,name=items" json:"items"`
}
......@@ -222,9 +228,11 @@ type ReqWalletTransactionList struct {
Count int32 `json:"count"`
Direction int32 `json:"direction"`
}
type WalletTxDetails struct {
TxDetails []*WalletTxDetail `protobuf:"bytes,1,rep,name=txDetails" json:"txDetails"`
}
type WalletTxDetail struct {
Tx *Transaction `protobuf:"bytes,1,opt,name=tx" json:"tx"`
Receipt *ReceiptDataResult `protobuf:"bytes,2,opt,name=receipt" json:"receipt"`
......@@ -346,8 +354,9 @@ type Request struct {
Fcn string `json:"fcn"`
Args [][]byte `json:"args"`
}
type Response struct {
OK bool `json:"ok"`
Message string `json:"message"`
Data []byte `json:"data"`
}
\ No newline at end of file
}
......@@ -3,10 +3,11 @@ package crypto
import (
"crypto/sha256"
"fmt"
"github.com/mr-tron/base58/base58"
)
//不同币种的前缀版本号
// 不同币种的前缀版本号
var coinPrefix = map[string][]byte{
"BTC": {0x00},
"BCH": {0x00},
......@@ -18,27 +19,27 @@ var coinPrefix = map[string][]byte{
var addrSeed = []byte("address seed bytes for public key")
//MaxExecNameLength 执行器名最大长度
// MaxExecNameLength 执行器名最大长度
const MaxExecNameLength = 100
func PubKeyToAddress(pub []byte) (addr string, err error) {
if len(pub) != 33 && len(pub) != 65 { //压缩格式 与 非压缩格式
if len(pub) != 33 && len(pub) != 65 { // 压缩格式 与 非压缩格式
return "", fmt.Errorf("invalid public key byte")
}
//添加版本号
// 添加版本号
hash160res := append(coinPrefix["BTY"], Rimp160(pub)...)
//添加校验码
// 添加校验码
cksum := checksum(hash160res)
address := append(hash160res, cksum[:]...)
//地址进行base58编码
// 地址进行base58编码
addr = base58.Encode(address)
return
}
//checksum: first four bytes of double-SHA256.
// checksum: first four bytes of double-SHA256.
func checksum(input []byte) (cksum [4]byte) {
h := sha256.New()
_, err := h.Write(input)
......@@ -77,4 +78,4 @@ func GetExecAddress(name string) string {
addr := base58.Encode(ad[:])
return addr
}
\ No newline at end of file
}
......@@ -102,4 +102,4 @@ func AESCBCPKCS7Decrypt(key, src []byte) ([]byte, error) {
func GenetateAESKey() []byte {
return getRandBytes(AESPrivateKeyLength)
}
\ No newline at end of file
}
......@@ -3,13 +3,14 @@ package crypto
import (
"bytes"
"crypto/rand"
secp256k1 "github.com/btcsuite/btcd/btcec"
)
var (
SECP256K1 = "secp256k1"
SM2 = "sm2"
ED25519 = "ed25519" //TODO
ED25519 = "ed25519" // TODO
)
func GeneratePrivateKey() []byte {
......@@ -61,4 +62,4 @@ func getRandBytes(numBytes int) []byte {
panic("Panic on a Crisis" + err.Error())
}
return b
}
\ No newline at end of file
}
package crypto
import "github.com/33cn/chain33-sdk-go/types"
import "gitlab.33.cn/link33/chain33-sdk-go/types"
func EncodeCertToSignature(signBytes, cert, uid []byte) []byte {
var certSignature types.CertSignature
......
package crypto
package crypto
import (
"fmt"
"github.com/33cn/chain33-sdk-go/crypto/ed25519"
"github.com/33cn/chain33-sdk-go/crypto/gm"
"github.com/33cn/chain33-sdk-go/types"
"github.com/stretchr/testify/assert"
"testing"
"github.com/stretchr/testify/assert"
"gitlab.33.cn/link33/chain33-sdk-go/crypto/ed25519"
"gitlab.33.cn/link33/chain33-sdk-go/crypto/gm"
"gitlab.33.cn/link33/chain33-sdk-go/types"
)
func TestAES(t *testing.T) {
var text = "hello aes"
var key = getRandBytes(16)
text := "hello aes"
key := getRandBytes(16)
cipherText, err := AESCBCPKCS7Encrypt(key, []byte(text))
if err != nil {
......@@ -35,7 +36,6 @@ func TestSign(t *testing.T) {
sig := Sign(msg, priv)
fmt.Printf("sig = %x\n", sig)
}
func TestSM2(t *testing.T) {
......@@ -48,7 +48,7 @@ func TestSM2(t *testing.T) {
msg := []byte("sign test")
sig, _ := gm.SM2Sign(msg, priv,nil)
sig, _ := gm.SM2Sign(msg, priv, nil)
fmt.Printf("sig = %x\n", sig)
result := gm.SM2Verify(pub, msg, nil, sig)
......
......@@ -17,10 +17,11 @@ import (
"crypto/rand"
"crypto/sha512"
"crypto/subtle"
"github.com/33cn/chain33-sdk-go/crypto/ed25519/edwards25519"
"gitlab.33.cn/link33/chain33-sdk-go/crypto/ed25519/edwards25519"
)
//const
// const
const (
PublicKeySize = 32
PrivateKeySize = 64
......
......@@ -16,12 +16,12 @@ var d2 = FieldElement{
-21827239, -5839606, -30745221, 13898782, 229458, 15978800, -12551817, -6495438, 29715968, 9444199,
}
//SqrtM1 ...
// SqrtM1 ...
var SqrtM1 = FieldElement{
-32595792, -7943725, 9377950, 3500415, 12389472, -272473, -25146209, -2005654, 326686, 11406482,
}
//A ...
// A ...
var A = FieldElement{
486662, 0, 0, 0, 0, 0, 0, 0, 0, 0,
}
......
......@@ -22,18 +22,18 @@ type FieldElement [10]int32
var zero FieldElement
//FeZero 0
// FeZero 0
func FeZero(fe *FieldElement) {
copy(fe[:], zero[:])
}
//FeOne 1
// FeOne 1
func FeOne(fe *FieldElement) {
FeZero(fe)
fe[0] = 1
}
//FeAdd +
// FeAdd +
func FeAdd(dst, a, b *FieldElement) {
dst[0] = a[0] + b[0]
dst[1] = a[1] + b[1]
......@@ -47,7 +47,7 @@ func FeAdd(dst, a, b *FieldElement) {
dst[9] = a[9] + b[9]
}
//FeSub -
// FeSub -
func FeSub(dst, a, b *FieldElement) {
dst[0] = a[0] - b[0]
dst[1] = a[1] - b[1]
......@@ -61,7 +61,7 @@ func FeSub(dst, a, b *FieldElement) {
dst[9] = a[9] - b[9]
}
//FeCopy 复制
// FeCopy 复制
func FeCopy(dst, src *FieldElement) {
copy(dst[:], src[:])
}
......@@ -99,7 +99,7 @@ func load4(in []byte) int64 {
return r
}
//FeFromBytes ...
// FeFromBytes ...
func FeFromBytes(dst *FieldElement, src *[32]byte) {
h0 := load4(src[:])
h1 := load3(src[4:]) << 6
......@@ -227,14 +227,14 @@ func FeToBytes(s *[32]byte, h *FieldElement) {
s[31] = byte(h[9] >> 18)
}
//FeIsNegative 是否为负
// FeIsNegative 是否为负
func FeIsNegative(f *FieldElement) byte {
var s [32]byte
FeToBytes(&s, f)
return s[0] & 1
}
//FeIsNonZero 是否为非0
// FeIsNonZero 是否为非0
func FeIsNonZero(f *FieldElement) int32 {
var s [32]byte
FeToBytes(&s, f)
......@@ -266,7 +266,7 @@ func FeNeg(h, f *FieldElement) {
h[9] = -f[9]
}
//FeCombine 拼接
// FeCombine 拼接
func FeCombine(h *FieldElement, h0, h1, h2, h3, h4, h5, h6, h7, h8, h9 int64) {
var c0, c1, c2, c3, c4, c5, c6, c7, c8, c9 int64
......@@ -514,7 +514,7 @@ func FeSquare2(h, f *FieldElement) {
FeCombine(h, h0, h1, h2, h3, h4, h5, h6, h7, h8, h9)
}
//FeInvert 反转
// FeInvert 反转
func FeInvert(out, z *FieldElement) {
var t0, t1, t2, t3 FieldElement
var i int
......@@ -640,39 +640,39 @@ func fePow22523(out, z *FieldElement) {
// CompletedGroupElement: ((X:Z),(Y:T)) satisfying x=X/Z, y=Y/T
// PreComputedGroupElement: (y+x,y-x,2dxy)
//ProjectiveGroupElement (X:Y:Z) satisfying x=X/Z, y=Y/Z
// ProjectiveGroupElement (X:Y:Z) satisfying x=X/Z, y=Y/Z
type ProjectiveGroupElement struct {
X, Y, Z FieldElement
}
//ExtendedGroupElement (X:Y:Z:T) satisfying x=X/Z, y=Y/Z, XY=ZT
// ExtendedGroupElement (X:Y:Z:T) satisfying x=X/Z, y=Y/Z, XY=ZT
type ExtendedGroupElement struct {
X, Y, Z, T FieldElement
}
//CompletedGroupElement ((X:Z),(Y:T)) satisfying x=X/Z, y=Y/T
// CompletedGroupElement ((X:Z),(Y:T)) satisfying x=X/Z, y=Y/T
type CompletedGroupElement struct {
X, Y, Z, T FieldElement
}
//PreComputedGroupElement (y+x,y-x,2dxy)
// PreComputedGroupElement (y+x,y-x,2dxy)
type PreComputedGroupElement struct {
yPlusX, yMinusX, xy2d FieldElement
}
//CachedGroupElement 缓存
// CachedGroupElement 缓存
type CachedGroupElement struct {
yPlusX, yMinusX, Z, T2d FieldElement
}
//Zero 0
// Zero 0
func (p *ProjectiveGroupElement) Zero() {
FeZero(&p.X)
FeOne(&p.Y)
FeOne(&p.Z)
}
//Double x2
// Double x2
func (p *ProjectiveGroupElement) Double(r *CompletedGroupElement) {
var t0 FieldElement
......@@ -687,7 +687,7 @@ func (p *ProjectiveGroupElement) Double(r *CompletedGroupElement) {
FeSub(&r.T, &r.T, &r.Z)
}
//ToBytes ...
// ToBytes ...
func (p *ProjectiveGroupElement) ToBytes(s *[32]byte) {
var recip, x, y FieldElement
......@@ -698,7 +698,7 @@ func (p *ProjectiveGroupElement) ToBytes(s *[32]byte) {
s[31] ^= FeIsNegative(&x) << 7
}
//Zero 0
// Zero 0
func (p *ExtendedGroupElement) Zero() {
FeZero(&p.X)
FeOne(&p.Y)
......@@ -706,14 +706,14 @@ func (p *ExtendedGroupElement) Zero() {
FeZero(&p.T)
}
//Double x2
// Double x2
func (p *ExtendedGroupElement) Double(r *CompletedGroupElement) {
var q ProjectiveGroupElement
p.ToProjective(&q)
q.Double(r)
}
//ToCached 缓存
// ToCached 缓存
func (p *ExtendedGroupElement) ToCached(r *CachedGroupElement) {
FeAdd(&r.yPlusX, &p.Y, &p.X)
FeSub(&r.yMinusX, &p.Y, &p.X)
......@@ -721,14 +721,14 @@ func (p *ExtendedGroupElement) ToCached(r *CachedGroupElement) {
FeMul(&r.T2d, &p.T, &d2)
}
//ToProjective ...
// ToProjective ...
func (p *ExtendedGroupElement) ToProjective(r *ProjectiveGroupElement) {
FeCopy(&r.X, &p.X)
FeCopy(&r.Y, &p.Y)
FeCopy(&r.Z, &p.Z)
}
//ToBytes 字节化
// ToBytes 字节化
func (p *ExtendedGroupElement) ToBytes(s *[32]byte) {
var recip, x, y FieldElement
......@@ -739,7 +739,7 @@ func (p *ExtendedGroupElement) ToBytes(s *[32]byte) {
s[31] ^= FeIsNegative(&x) << 7
}
//FromBytes ...
// FromBytes ...
func (p *ExtendedGroupElement) FromBytes(s *[32]byte) bool {
var u, v, v3, vxx, check FieldElement
......@@ -786,14 +786,14 @@ func (p *ExtendedGroupElement) FromBytes(s *[32]byte) bool {
return true
}
//ToProjective ...
// ToProjective ...
func (p *CompletedGroupElement) ToProjective(r *ProjectiveGroupElement) {
FeMul(&r.X, &p.X, &p.T)
FeMul(&r.Y, &p.Y, &p.Z)
FeMul(&r.Z, &p.Z, &p.T)
}
//ToExtended 扩展
// ToExtended 扩展
func (p *CompletedGroupElement) ToExtended(r *ExtendedGroupElement) {
FeMul(&r.X, &p.X, &p.T)
FeMul(&r.Y, &p.Y, &p.Z)
......@@ -801,14 +801,14 @@ func (p *CompletedGroupElement) ToExtended(r *ExtendedGroupElement) {
FeMul(&r.T, &p.X, &p.Y)
}
//Zero 0
// Zero 0
func (p *PreComputedGroupElement) Zero() {
FeOne(&p.yPlusX)
FeOne(&p.yMinusX)
FeZero(&p.xy2d)
}
//GeAdd +
// GeAdd +
func GeAdd(r *CompletedGroupElement, p *ExtendedGroupElement, q *CachedGroupElement) {
geAdd(r, p, q)
}
......@@ -972,7 +972,7 @@ func negative(b int32) int32 {
return (b >> 31) & 1
}
//PreComputedGroupElementCMove ...
// PreComputedGroupElementCMove ...
func PreComputedGroupElementCMove(t, u *PreComputedGroupElement, b int32) {
FeCMove(&t.yPlusX, &u.yPlusX, b)
FeCMove(&t.yMinusX, &u.yMinusX, b)
......@@ -1479,7 +1479,7 @@ func ScMulAdd(s, a, b, c *[32]byte) {
s[31] = byte(s11 >> 17)
}
//ScMulSub The scalars are GF(2^252 + 27742317777372353535851937790883648493).
// ScMulSub The scalars are GF(2^252 + 27742317777372353535851937790883648493).
// Input:
// a[0]+256*a[1]+...+256^31*a[31] = a
// b[0]+256*b[1]+...+256^31*b[31] = b
......@@ -1912,7 +1912,7 @@ func ScMulSub(s, a, b, c *[32]byte) {
s[31] = byte(s11 >> 17)
}
//ScReduce Input:
// ScReduce Input:
// s[0]+256*s[1]+...+256^63*s[63] = s
// ProtoToJson:
// s[0]+256*s[1]+...+256^31*s[31] = s mod l
......@@ -2235,7 +2235,7 @@ func ScReduce(out *[32]byte, s *[64]byte) {
out[31] = byte(s11 >> 17)
}
//ScAdd Input:
// ScAdd Input:
// s[0]+256*s[1]+...+256^31*s[31] = a
// s[0]+256*s[1]+...+256^31*s[31] = b
// ProtoToJson:
......@@ -2474,7 +2474,7 @@ func ScAdd(out *[32]byte, a, b *[32]byte) {
out[31] = byte((s11 >> 17))
}
//ScSub Input:
// ScSub Input:
// s[0]+256*s[1]+...+256^31*s[31] = a
// s[0]+256*s[1]+...+256^31*s[31] = b
// ProtoToJson:
......@@ -2717,7 +2717,7 @@ func signum(a int64) int64 {
return (a >> 63) - ((-a) >> 63)
}
//ScCheck 检查
// ScCheck 检查
func ScCheck(s *[32]byte) bool {
s0 := load4(s[:])
s1 := load4(s[4:])
......
......@@ -8,7 +8,7 @@ Package edwards25519 将edwards25519中的差异代码移动到本处进行差
package edwards25519
import (
"github.com/33cn/chain33-sdk-go/crypto/sha3"
"gitlab.33.cn/link33/chain33-sdk-go/crypto/sha3"
)
var (
......@@ -26,10 +26,10 @@ var (
feFFFB4 = FieldElement{-21786234, -12173074, 21573800, 4524538, -4645904, 16204591, 8012863, -8444712, 3212926, 6885324}
)
//DsmPreCompGroupElement ...
// DsmPreCompGroupElement ...
type DsmPreCompGroupElement [8]CachedGroupElement
//FromCompletedGroupElement ...
// FromCompletedGroupElement ...
func (e *ExtendedGroupElement) FromCompletedGroupElement(p *CompletedGroupElement) {
FeMul(&e.X, &p.X, &p.T)
FeMul(&e.Y, &p.Y, &p.Z)
......@@ -37,7 +37,7 @@ func (e *ExtendedGroupElement) FromCompletedGroupElement(p *CompletedGroupElemen
FeMul(&e.T, &p.X, &p.Y)
}
//Zero 0
// Zero 0
func (c *CachedGroupElement) Zero() {
FeOne(&c.yPlusX)
FeOne(&c.yMinusX)
......@@ -45,7 +45,7 @@ func (c *CachedGroupElement) Zero() {
FeZero(&c.T2d)
}
//FeToBytesV1 ...
// FeToBytesV1 ...
func FeToBytesV1(s *[32]byte, h *FieldElement) {
var q int32
h0 := h[0]
......@@ -137,14 +137,14 @@ func FeToBytesV1(s *[32]byte, h *FieldElement) {
s[31] = byte(h9 >> 18)
}
//FeIsNegativeV1 是否为负
// FeIsNegativeV1 是否为负
func FeIsNegativeV1(f *FieldElement) byte {
var s [32]byte
FeToBytesV1(&s, f)
return s[0] & 1
}
//FeIsNonZeroV1 是否非0
// FeIsNonZeroV1 是否非0
func FeIsNonZeroV1(f *FieldElement) int32 {
var s [32]byte
FeToBytesV1(&s, f)
......@@ -158,7 +158,7 @@ func FeIsNonZeroV1(f *FieldElement) int32 {
return int32(x & 1)
}
//GeDoubleScalarmultPrecompVartime ...
// GeDoubleScalarmultPrecompVartime ...
func GeDoubleScalarmultPrecompVartime(r *ProjectiveGroupElement, a *[32]byte, A *ExtendedGroupElement, b *[32]byte, Bi *DsmPreCompGroupElement) {
var aslide, bslide [256]int8
var Ai DsmPreCompGroupElement // A,3A,5A,7A,9A,11A,13A,15A
......@@ -223,7 +223,7 @@ func checkFieldElement(x, y, w *FieldElement, r *ProjectiveGroupElement) int {
return 0
}
//FeDivPowm1 ...
// FeDivPowm1 ...
func FeDivPowm1(r, u, v *FieldElement) {
var v3, uv7, t0, t1, t2 FieldElement
var i int
......@@ -335,7 +335,7 @@ func geFromfeFrombytesVartime(r *ProjectiveGroupElement, s *[32]byte) {
FeMul(&r.X, &r.X, &r.Z)
}
//HashToEc ...
// HashToEc ...
func HashToEc(key []byte, res *ExtendedGroupElement) {
var point ProjectiveGroupElement
var point2 CompletedGroupElement
......@@ -345,7 +345,7 @@ func HashToEc(key []byte, res *ExtendedGroupElement) {
point2.ToExtended(res)
}
//CachedGroupElementCMove ...
// CachedGroupElementCMove ...
func CachedGroupElementCMove(t, u *CachedGroupElement, b int32) {
FeCMove(&t.yPlusX, &u.yPlusX, b)
FeCMove(&t.yMinusX, &u.yMinusX, b)
......@@ -359,7 +359,7 @@ func negative8(b int8) byte {
return byte(x)
}
//GeScalarMult Preconditions:
// GeScalarMult Preconditions:
// a[31] <= 127
func GeScalarMult(r *ProjectiveGroupElement, a *[32]byte, A *ExtendedGroupElement) {
var e [64]int8
......@@ -416,7 +416,7 @@ func GeScalarMult(r *ProjectiveGroupElement, a *[32]byte, A *ExtendedGroupElemen
}
}
//ScIsNonZero ...
// ScIsNonZero ...
func ScIsNonZero(s *[32]byte) int32 {
var x uint8
for _, b := range s {
......@@ -428,7 +428,7 @@ func ScIsNonZero(s *[32]byte) int32 {
return int32(x & 1)
}
//GeFromBytesVartime ...
// GeFromBytesVartime ...
func GeFromBytesVartime(p *ExtendedGroupElement, s *[32]byte) bool {
var u, v, vxx, check FieldElement
......@@ -520,7 +520,7 @@ func GeFromBytesVartime(p *ExtendedGroupElement, s *[32]byte) bool {
return true
}
//GeDsmPrecomp ...
// GeDsmPrecomp ...
func GeDsmPrecomp(r *DsmPreCompGroupElement, s *ExtendedGroupElement) {
var t CompletedGroupElement
var s2, u ExtendedGroupElement
......
......@@ -5,16 +5,17 @@ import (
"crypto/elliptic"
"crypto/rand"
"fmt"
"math/big"
"github.com/btcsuite/btcd/btcec"
"github.com/tjfoc/gmsm/sm2"
"math/big"
)
const (
SM2PrivateKeyLength = 32
)
var DefaultUID = []byte{0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38}
var DefaultUID = []byte{0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38}
func getRandBytes(numBytes int) []byte {
b := make([]byte, numBytes)
......@@ -44,12 +45,12 @@ func parsePubKey(pubKeyStr []byte) (key *sm2.PublicKey) {
return sm2.Decompress(pubKeyStr)
}
//SerializePublicKey 公钥序列化
// SerializePublicKey 公钥序列化
func SerializePublicKey(p *sm2.PublicKey) []byte {
return sm2.Compress(p)
}
//SerializePrivateKey 私钥序列化
// SerializePrivateKey 私钥序列化
func SerializePrivateKey(p *sm2.PrivateKey) []byte {
b := make([]byte, 0, SM2PrivateKeyLength)
return paddedAppend(SM2PrivateKeyLength, b, p.D.Bytes())
......@@ -141,7 +142,7 @@ func SM2Verify(publicKey []byte, msg []byte, uid []byte, sig []byte) bool {
pub := parsePubKey(publicKey[:])
r, s, err := DeserializeSignature(sig)
if err != nil {
fmt.Errorf("unmarshal sign failed:"+err.Error())
fmt.Errorf("unmarshal sign failed:" + err.Error())
return false
}
......@@ -163,4 +164,4 @@ func SM2Decrypt(privateKey []byte, data []byte) ([]byte, error) {
func PubKeyFromPrivate(privKey []byte) []byte {
_, pub := PrivKeyFromBytes(sm2.P256Sm2(), privKey)
return SerializePublicKey(pub)
}
\ No newline at end of file
}
......@@ -2,7 +2,7 @@ package gm
import "github.com/tjfoc/gmsm/sm3"
//SM3Hash 加密算法
// SM3Hash 加密算法
func SM3Hash(msg []byte) []byte {
c := sm3.New()
c.Write(msg)
......
package gm
import (
"github.com/tjfoc/gmsm/sm4"
"log"
"github.com/tjfoc/gmsm/sm4"
)
const (
......@@ -33,4 +34,4 @@ func SM4Decrypt(key []byte, data []byte) []byte {
c.Decrypt(cipher, data)
return cipher
}
\ No newline at end of file
}
......@@ -3,10 +3,10 @@ package crypto
import (
"crypto/sha256"
"encoding/binary"
"golang.org/x/crypto/ripemd160"
)
func Sha256(b []byte) []byte {
hasher := sha256.New()
hasher.Write(b)
......@@ -42,7 +42,7 @@ func Rimp160(b []byte) []byte {
}
func intToBytes(x int) []byte {
var buf = make([]byte, 4)
buf := make([]byte, 4)
binary.BigEndian.PutUint32(buf, uint32(x))
return buf
......@@ -51,7 +51,7 @@ func intToBytes(x int) []byte {
func KDF(x []byte, length int) []byte {
var c []byte
var ct = 1
ct := 1
h := sha256.New()
for i, j := 0, (length+31)/32; i < j; i++ {
h.Reset()
......@@ -67,4 +67,4 @@ func KDF(x []byte, length int) []byte {
}
return c
}
\ No newline at end of file
}
......@@ -6,7 +6,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !amd64 appengine gccgo
//go:build !amd64 || appengine || gccgo
// +build !amd64 appengine gccgo
package sha3
......
......@@ -6,6 +6,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build amd64 && !appengine && !gccgo
// +build amd64,!appengine,!gccgo
package sha3
......
......@@ -6,6 +6,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build go1.4
// +build go1.4
package sha3
......
......@@ -37,6 +37,7 @@ const (
func newHashShake128() hash.Hash {
return &state{rate: 168, dsbyte: 0x1f, outputLen: 512}
}
func newHashShake256() hash.Hash {
return &state{rate: 136, dsbyte: 0x1f, outputLen: 512}
}
......
......@@ -6,6 +6,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build (!amd64 && !386 && !ppc64le) || appengine
// +build !amd64,!386,!ppc64le appengine
package sha3
......@@ -17,4 +18,4 @@ var (
copyOutUnaligned = copyOutGeneric
)
//const xorImplementationUnaligned = "generic"
// const xorImplementationUnaligned = "generic"
......@@ -6,6 +6,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build (amd64 || 386 || ppc64le) && !appengine
// +build amd64 386 ppc64le
// +build !appengine
......@@ -59,4 +60,4 @@ var (
copyOut = copyOutUnaligned
)
//const xorImplementationUnaligned = "unaligned"
// const xorImplementationUnaligned = "unaligned"
package broker
import (
"github.com/33cn/chain33-sdk-go/crypto"
"github.com/33cn/chain33-sdk-go/types"
"math/rand"
"time"
"gitlab.33.cn/link33/chain33-sdk-go/crypto"
"gitlab.33.cn/link33/chain33-sdk-go/types"
)
//构造发布跨链交易事件交易
func EmitInterchainEvent(paraName,dstServiceID ,funcName string,args[]string,txType uint64)(*types.Transaction,error){
// 构造发布跨链交易事件交易
func EmitInterchainEvent(paraName, dstServiceID, funcName string, args []string, txType uint64) (*types.Transaction, error) {
//目的链ID,固定格式0x000001
//string dstServiceID = 2;
////源链ID,固定格式0x000002
......@@ -19,7 +20,7 @@ func EmitInterchainEvent(paraName,dstServiceID ,funcName string,args[]string,txT
//string func = 5;
////参数列表
//repeated string args = 6;
payload := &types.BrokerAction{Ty:TyEmitInterchainEventAction,Value:&types.BrokerAction_EmitInterchainEvent{EmitInterchainEvent:&types.InterchainEvent{DstServiceID:dstServiceID,Type:txType,Func:funcName,Args:args}}}
payload := &types.BrokerAction{Ty: TyEmitInterchainEventAction, Value: &types.BrokerAction_EmitInterchainEvent{EmitInterchainEvent: &types.InterchainEvent{DstServiceID: dstServiceID, Type: txType, Func: funcName, Args: args}}}
if paraName == "" {
tx := &types.Transaction{Execer: []byte(BrokerX), Payload: types.Encode(payload), Fee: 1e5, Nonce: rand.Int63n(time.Now().UnixNano()), To: Addr}
return tx, nil
......@@ -29,8 +30,8 @@ func EmitInterchainEvent(paraName,dstServiceID ,funcName string,args[]string,txT
}
}
//构造更新Index交易
func UpdateIndex(paraName,srcServiceID,dstServiceID string,sequenceNum,reqType uint64,response *types.Response)(*types.Transaction,error){
// 构造更新Index交易
func UpdateIndex(paraName, srcServiceID, dstServiceID string, sequenceNum, reqType uint64, response *types.Response) (*types.Transaction, error) {
////当前链已经处理到的位置
//uint64 sequenceNum = 1;
////目的链服务ID,固定格式0x000001
......@@ -41,7 +42,7 @@ func UpdateIndex(paraName,srcServiceID,dstServiceID string,sequenceNum,reqType u
//uint64 reqType =4;
////响应信息
//Response response = 5;
payload :=&types.BrokerAction{Ty:TyUpdateIndexAction,Value:&types.BrokerAction_UpdateIndex{UpdateIndex:&types.UpdateIndex{DstServiceID:dstServiceID,SrcServiceID:srcServiceID,ReqType:reqType,SequenceNum:sequenceNum,Response:response}}}
payload := &types.BrokerAction{Ty: TyUpdateIndexAction, Value: &types.BrokerAction_UpdateIndex{UpdateIndex: &types.UpdateIndex{DstServiceID: dstServiceID, SrcServiceID: srcServiceID, ReqType: reqType, SequenceNum: sequenceNum, Response: response}}}
if paraName == "" {
tx := &types.Transaction{Execer: []byte(BrokerX), Payload: types.Encode(payload), Fee: 1e5, Nonce: rand.Int63n(time.Now().UnixNano()), To: Addr}
return tx, nil
......@@ -49,4 +50,4 @@ func UpdateIndex(paraName,srcServiceID,dstServiceID string,sequenceNum,reqType u
tx := &types.Transaction{Execer: []byte(paraName + BrokerX), Payload: types.Encode(payload), Fee: 1e5, Nonce: rand.Int63n(time.Now().UnixNano()), To: crypto.GetExecAddress(paraName + BrokerX)}
return tx, nil
}
}
\ No newline at end of file
}
......@@ -14,26 +14,25 @@ const (
NameUpdateIndexAction = "UpdateIndex"
NameEmitInterchainEventAction = "EmitInterchainEvent"
FuncNamePollingEvent = "PollingEvent"
FuncNameQueryInnerMeta = "QueryInnerMeta"
FuncNameQueryOutterMeta = "QueryOutterMeta"
FuncNameQueryCallBackMeta = "QueryCallBackMeta"
FuncNameQueryInMessage = "QueryInMessage"
FuncNameQueryOutMessage = "QueryOutMessage"
FuncNameQueryBrokerInfo = "GetBrokerInfo"
FuncNamePollingEvent = "PollingEvent"
FuncNameQueryInnerMeta = "QueryInnerMeta"
FuncNameQueryOutterMeta = "QueryOutterMeta"
FuncNameQueryCallBackMeta = "QueryCallBackMeta"
FuncNameQueryInMessage = "QueryInMessage"
FuncNameQueryOutMessage = "QueryOutMessage"
FuncNameQueryBrokerInfo = "GetBrokerInfo"
)
//BrokerX 执行器名称定义
// BrokerX 执行器名称定义
const BrokerX = "broker"
const Addr = "1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs"
var (
//定义actionMap
ActionMap = map[string]int32{
NameInitAction: TyInitAction,
NameRegisterAction: TyRegisterAction,
NameAuditAction: TyAuditAction,
NameUpdateIndexAction: TyUpdateIndexAction,
NameEmitInterchainEventAction: TyEmitInterchainEventAction,
}
)
// 定义actionMap
var ActionMap = map[string]int32{
NameInitAction: TyInitAction,
NameRegisterAction: TyRegisterAction,
NameAuditAction: TyAuditAction,
NameUpdateIndexAction: TyUpdateIndexAction,
NameEmitInterchainEventAction: TyEmitInterchainEventAction,
}
package cert
import (
sdk "github.com/33cn/chain33-sdk-go"
"github.com/33cn/chain33-sdk-go/crypto"
"github.com/33cn/chain33-sdk-go/types"
"math/rand"
"time"
sdk "gitlab.33.cn/link33/chain33-sdk-go"
"gitlab.33.cn/link33/chain33-sdk-go/crypto"
"gitlab.33.cn/link33/chain33-sdk-go/types"
)
func CreateCertNormalTx(paraName string, privateKey []byte, cert []byte, uid []byte, key string, value []byte) (*types.Transaction, error) {
......@@ -16,7 +17,7 @@ func CreateCertNormalTx(paraName string, privateKey []byte, cert []byte, uid []b
Value: value,
},
},
Ty: CertActionNormal,
Ty: CertActionNormal,
}
var tx *types.Transaction
......@@ -27,7 +28,7 @@ func CreateCertNormalTx(paraName string, privateKey []byte, cert []byte, uid []b
}
var err error
tx,err = sdk.Sign(tx, privateKey, crypto.SM2, uid)
tx, err = sdk.Sign(tx, privateKey, crypto.SM2, uid)
if err != nil {
return nil, err
}
......
package cert
import (
sdk "github.com/33cn/chain33-sdk-go"
"github.com/33cn/chain33-sdk-go/client"
"github.com/33cn/chain33-sdk-go/crypto"
"github.com/33cn/chain33-sdk-go/types"
"github.com/stretchr/testify/assert"
"testing"
"time"
"github.com/stretchr/testify/assert"
sdk "gitlab.33.cn/link33/chain33-sdk-go"
"gitlab.33.cn/link33/chain33-sdk-go/client"
"gitlab.33.cn/link33/chain33-sdk-go/crypto"
"gitlab.33.cn/link33/chain33-sdk-go/types"
)
var (
url = "http://127.0.0.1:8801"
keyFilePath = "./test/keystore/5c3682a5719cf5bc1bd6280938670c3acfcb67cc15744a7b9b348066795a4e62_sk"
url = "http://127.0.0.1:8801"
keyFilePath = "./test/keystore/5c3682a5719cf5bc1bd6280938670c3acfcb67cc15744a7b9b348066795a4e62_sk"
certFilePath = "./test/signcerts/user1@org1-cert.pem"
)
func TestCreateCertNormalTx(t *testing.T) {
account,err := sdk.NewAccountFromLocal(crypto.SM2, keyFilePath)
account, err := sdk.NewAccountFromLocal(crypto.SM2, keyFilePath)
assert.Nil(t, err)
certByte,err := types.ReadFile(certFilePath)
certByte, err := types.ReadFile(certFilePath)
assert.Nil(t, err)
tx, err := CreateCertNormalTx("", account.PrivateKey, certByte, []byte("cert test"), "key1", []byte("value1"))
......@@ -40,5 +41,4 @@ func TestCreateCertNormalTx(t *testing.T) {
detail, err := jsonclient.QueryTransaction(txhash)
assert.Nil(t, err)
assert.Equal(t, types.ExecOk, int(detail.Receipt.Ty))
}
......@@ -3,10 +3,11 @@ package dapp
import (
"encoding/json"
"fmt"
"github.com/33cn/chain33-sdk-go/client"
. "github.com/33cn/chain33-sdk-go/dapp/broker"
"github.com/33cn/chain33-sdk-go/dapp/storage"
"github.com/33cn/chain33-sdk-go/types"
"gitlab.33.cn/link33/chain33-sdk-go/client"
. "gitlab.33.cn/link33/chain33-sdk-go/dapp/broker"
"gitlab.33.cn/link33/chain33-sdk-go/dapp/storage"
"gitlab.33.cn/link33/chain33-sdk-go/types"
. "github.com/bitly/go-simplejson"
)
......@@ -25,7 +26,7 @@ func QueryStorageByKey(prefix, url, key string) (*types.Storage, error) {
FuncName: storage.FuncNameQueryStorage,
Payload: jsonraw,
}
//var storage types.Storage
// var storage types.Storage
data, err := jsonClient.CallBack("Chain33.Query", query, ParseStorage)
if err != nil {
return nil, err
......@@ -33,7 +34,7 @@ func QueryStorageByKey(prefix, url, key string) (*types.Storage, error) {
return data.(*types.Storage), nil
}
//回调解析函数
// 回调解析函数
func ParseStorage(raw json.RawMessage) (interface{}, error) {
js, err := NewJson(raw)
if err != nil {
......
......@@ -2,10 +2,11 @@ package storage
import (
"fmt"
"github.com/33cn/chain33-sdk-go/crypto"
. "github.com/33cn/chain33-sdk-go/types"
"math/rand"
"time"
"gitlab.33.cn/link33/chain33-sdk-go/crypto"
. "gitlab.33.cn/link33/chain33-sdk-go/types"
)
/*
......@@ -25,15 +26,16 @@ func CreateContentStorageTx(paraName string, op int32, key string, content []byt
if op != 0 && op != 1 {
return nil, fmt.Errorf("unknow op..,op only 0 or 1,please check!")
}
payload := &StorageAction{Ty: TyContentStorageAction, Value: &StorageAction_ContentStorage{&ContentOnlyNotaryStorage{
Content: content,
Op: op,
Key: key,
Value: value,
XXX_NoUnkeyedLiteral: struct{}{},
XXX_unrecognized: nil,
XXX_sizecache: 0,
}},
payload := &StorageAction{
Ty: TyContentStorageAction, Value: &StorageAction_ContentStorage{&ContentOnlyNotaryStorage{
Content: content,
Op: op,
Key: key,
Value: value,
XXX_NoUnkeyedLiteral: struct{}{},
XXX_unrecognized: nil,
XXX_sizecache: 0,
}},
}
if paraName == "" {
tx := &Transaction{Execer: []byte(StorageX), Payload: Encode(payload), Fee: 1e5, Nonce: rand.Int63n(time.Now().UnixNano()), To: Addr}
......@@ -44,16 +46,17 @@ func CreateContentStorageTx(paraName string, op int32, key string, content []byt
}
}
//链接存证 paraName 平行链前缀,如果是主链则为空字符串,key唯一性,如果不填默认采用txhash为key
// 链接存证 paraName 平行链前缀,如果是主链则为空字符串,key唯一性,如果不填默认采用txhash为key
func CreateLinkStorageTx(paraName string, key string, link []byte, value string) (*Transaction, error) {
payload := &StorageAction{Ty: TyLinkStorageAction, Value: &StorageAction_LinkStorage{&LinkNotaryStorage{
Link: link,
Key: key,
Value: value,
XXX_NoUnkeyedLiteral: struct{}{},
XXX_unrecognized: nil,
XXX_sizecache: 0,
}},
payload := &StorageAction{
Ty: TyLinkStorageAction, Value: &StorageAction_LinkStorage{&LinkNotaryStorage{
Link: link,
Key: key,
Value: value,
XXX_NoUnkeyedLiteral: struct{}{},
XXX_unrecognized: nil,
XXX_sizecache: 0,
}},
}
if paraName == "" {
tx := &Transaction{Execer: []byte(StorageX), Payload: Encode(payload), Fee: 1e5, Nonce: rand.Int63(), To: Addr}
......@@ -64,16 +67,17 @@ func CreateLinkStorageTx(paraName string, key string, link []byte, value string)
}
}
//hash存证
// hash存证
func CreateHashStorageTx(paraName string, key string, hash []byte, value string) (*Transaction, error) {
payload := &StorageAction{Ty: TyHashStorageAction, Value: &StorageAction_HashStorage{&HashOnlyNotaryStorage{
Hash: hash,
Key: key,
Value: value,
XXX_NoUnkeyedLiteral: struct{}{},
XXX_unrecognized: nil,
XXX_sizecache: 0,
}},
payload := &StorageAction{
Ty: TyHashStorageAction, Value: &StorageAction_HashStorage{&HashOnlyNotaryStorage{
Hash: hash,
Key: key,
Value: value,
XXX_NoUnkeyedLiteral: struct{}{},
XXX_unrecognized: nil,
XXX_sizecache: 0,
}},
}
if paraName == "" {
tx := &Transaction{Execer: []byte(StorageX), Payload: Encode(payload), Fee: 1e5, Nonce: rand.Int63(), To: Addr}
......@@ -84,18 +88,19 @@ func CreateHashStorageTx(paraName string, key string, hash []byte, value string)
}
}
//隐私加密存储
// 隐私加密存储
func CreateEncryptStorageTx(paraName string, key string, contentHash, encryptContent, nonce []byte, value string) *Transaction {
payload := &StorageAction{Ty: TyEncryptStorageAction, Value: &StorageAction_EncryptStorage{&EncryptNotaryStorage{
ContentHash: contentHash,
EncryptContent: encryptContent,
Nonce: nonce,
Key: key,
Value: value,
XXX_NoUnkeyedLiteral: struct{}{},
XXX_unrecognized: nil,
XXX_sizecache: 0,
}},
payload := &StorageAction{
Ty: TyEncryptStorageAction, Value: &StorageAction_EncryptStorage{&EncryptNotaryStorage{
ContentHash: contentHash,
EncryptContent: encryptContent,
Nonce: nonce,
Key: key,
Value: value,
XXX_NoUnkeyedLiteral: struct{}{},
XXX_unrecognized: nil,
XXX_sizecache: 0,
}},
}
if paraName == "" {
tx := &Transaction{Execer: []byte(StorageX), Payload: Encode(payload), Fee: 1e5, Nonce: rand.Int63(), To: Addr}
......@@ -106,18 +111,19 @@ func CreateEncryptStorageTx(paraName string, key string, contentHash, encryptCon
}
}
//分享隐私加密存储
// 分享隐私加密存储
func CreateEncryptShareStorageTx(paraName string, key string, contentHash, encryptContent, publickey []byte, value string) *Transaction {
payload := &StorageAction{Ty: TyEncryptShareStorageAction, Value: &StorageAction_EncryptShareStorage{&EncryptShareNotaryStorage{
ContentHash: contentHash,
EncryptContent: encryptContent,
PubKey: publickey,
Key: key,
Value: value,
XXX_NoUnkeyedLiteral: struct{}{},
XXX_unrecognized: nil,
XXX_sizecache: 0,
}},
payload := &StorageAction{
Ty: TyEncryptShareStorageAction, Value: &StorageAction_EncryptShareStorage{&EncryptShareNotaryStorage{
ContentHash: contentHash,
EncryptContent: encryptContent,
PubKey: publickey,
Key: key,
Value: value,
XXX_NoUnkeyedLiteral: struct{}{},
XXX_unrecognized: nil,
XXX_sizecache: 0,
}},
}
if paraName == "" {
tx := &Transaction{Execer: []byte(StorageX), Payload: Encode(payload), Fee: 1e5, Nonce: rand.Int63(), To: Addr}
......
package storage
import (
sdk "github.com/33cn/chain33-sdk-go"
"github.com/33cn/chain33-sdk-go/client"
"github.com/33cn/chain33-sdk-go/crypto"
"github.com/33cn/chain33-sdk-go/types"
. "github.com/33cn/chain33-sdk-go/dapp"
"github.com/stretchr/testify/assert"
"testing"
"time"
"github.com/stretchr/testify/assert"
sdk "gitlab.33.cn/link33/chain33-sdk-go"
"gitlab.33.cn/link33/chain33-sdk-go/client"
"gitlab.33.cn/link33/chain33-sdk-go/crypto"
. "gitlab.33.cn/link33/chain33-sdk-go/dapp"
"gitlab.33.cn/link33/chain33-sdk-go/types"
)
var (
......@@ -18,7 +18,7 @@ var (
)
func TestCreateContentStorageTx(t *testing.T) {
//第一次存储
// 第一次存储
tx, err := CreateContentStorageTx("", OpCreate, "", []byte("hello"), "")
assert.Nil(t, err)
hexbytes, _ := types.FromHex(privkey)
......@@ -34,7 +34,7 @@ func TestCreateContentStorageTx(t *testing.T) {
detail, err := jsonclient.QueryTransaction(txhash)
assert.Nil(t, err)
assert.Equal(t, types.ExecOk, int(detail.Receipt.Ty))
//查询
// 查询
storage, err := QueryStorageByKey("", url, txhash)
assert.Nil(t, err)
assert.Equal(t, []byte("hello"), storage.GetContentStorage().Content)
......@@ -50,14 +50,13 @@ func TestCreateContentStorageTx(t *testing.T) {
//storage,err=QueryStorageByKey("",url,txhash)
//assert.Nil(t,err)
//assert.Equal(t,[]byte("hello,world"),storage.GetContentStorage().Content)
}
//hash,or link 存证
// hash,or link 存证
func TestCreateHashStorageTx(t *testing.T) {
tx, err := CreateHashStorageTx("", "", []byte("123456harrylee"), "")
assert.Nil(t, err)
//签名
// 签名
hexbytes, _ := types.FromHex(privkey)
sdk.Sign(tx, hexbytes, crypto.SECP256K1, nil)
txhash := types.ToHexPrefix(sdk.Hash(tx))
......@@ -71,13 +70,13 @@ func TestCreateHashStorageTx(t *testing.T) {
detail, err := jsonclient.QueryTransaction(txhash)
assert.Nil(t, err)
assert.Equal(t, types.ExecOk, int(detail.Receipt.Ty))
//查询
// 查询
storage, err := QueryStorageByKey("", url, txhash)
assert.Nil(t, err)
assert.Equal(t, []byte("123456harrylee"), storage.GetHashStorage().Hash)
}
//hash,or link 存证
// hash,or link 存证
func TestCreateLinkStorageTx(t *testing.T) {
tx, err := CreateLinkStorageTx("", "", []byte("hello"), "")
assert.Nil(t, err)
......@@ -103,5 +102,4 @@ func TestByteFromHex(t *testing.T) {
t.Error(err)
}
t.Log(string(data))
}
......@@ -5,9 +5,9 @@ import (
"math/rand"
"time"
sdk "github.com/33cn/chain33-sdk-go"
"github.com/33cn/chain33-sdk-go/crypto"
"github.com/33cn/chain33-sdk-go/types"
sdk "gitlab.33.cn/link33/chain33-sdk-go"
"gitlab.33.cn/link33/chain33-sdk-go/crypto"
"gitlab.33.cn/link33/chain33-sdk-go/types"
)
var r *rand.Rand
......@@ -47,7 +47,7 @@ func CreateWasmCallTx(paraName, contract, method string, param []int64, env []st
Contract: contract,
Method: method,
Parameters: param,
Env: env,
Env: env,
},
},
}
......
package event
type CCEvent struct {
//交易哈希
// 交易哈希
TxID string
//执行器名称,也可能是合约地址
// 执行器名称,也可能是合约地址
CCID string
//事件名称,go中表示actionName
// 事件名称,go中表示actionName
EventName string
//信息载体
// 信息载体
Payload []byte
//交易所在区块高度
// 交易所在区块高度
BlockNumber uint64
}
type Registration interface{}
type EventService interface {
//注册区块监听
//RegisterBlockEvent(filter ...BlockFilter) (chan <-Registration, <-chan *BlockEvent, error)
//注册交易时间监听
RegisterTxEvent(ccID, eventFilter string) (chan <-Registration,<-chan *CCEvent, error)
type (
Registration interface{}
EventService interface {
// 注册区块监听
// RegisterBlockEvent(filter ...BlockFilter) (chan <-Registration, <-chan *BlockEvent, error)
}
\ No newline at end of file
// 注册交易时间监听
RegisterTxEvent(ccID, eventFilter string) (chan<- Registration, <-chan *CCEvent, error)
}
)
module github.com/33cn/chain33-sdk-go
module gitlab.33.cn/link33/chain33-sdk-go
go 1.12
......@@ -19,7 +19,7 @@ require (
golang.org/x/net v0.0.0-20191105084925-a882066a44e0 // indirect
golang.org/x/text v0.3.2 // indirect
google.golang.org/grpc v1.29.1
google.golang.org/protobuf v1.25.0
google.golang.org/protobuf v1.25.0 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
gopkg.in/yaml.v2 v2.2.4 // indirect
)
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
github.com/bitly/go-simplejson v0.5.0 h1:6IH+V8/tVMab511d5bn4M7EwGXZf9Hj6i2xSwkNEM+Y=
......@@ -18,9 +17,7 @@ github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46f
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495 h1:6IyqGr3fnd0tM3YxipK27TUskaOVUjU2nG45yzwcQKY=
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
......@@ -28,7 +25,6 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
......@@ -37,8 +33,6 @@ github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfb
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/protobuf v1.3.4 h1:87PNWwrRvUSnqS4dlcBU/ftvOIBep4sYuBLlh6rX2wk=
github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
......@@ -48,12 +42,11 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD
github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/inconshreveable/log15 v0.0.0-20201112154412-8562bdadbbac h1:n1DqxAo4oWPMvH1+v+DLYlMCecgumhhgnxAPdqDIFHI=
github.com/inconshreveable/log15 v0.0.0-20201112154412-8562bdadbbac/go.mod h1:cOaXtrgN4ScfRrD9Bre7U1thNq5RtJ8ZoP4iXVGRj6o=
......@@ -77,13 +70,11 @@ github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1Cpa
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/tjfoc/gmsm v1.3.2 h1:7JVkAn5bvUJ7HtU08iW6UiD+UTmJTIToHCfeFzkcCxM=
github.com/tjfoc/gmsm v1.3.2/go.mod h1:HaUcFuY0auTiaHB9MHFGCPx5IaLhTUd2atbCFBQXn9w=
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44 h1:9lP3x0pW80sDI6t1UMSLA4to18W7R7imwAI/sWS9S8Q=
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191219195013-becbf705a915 h1:aJ0ex187qoXrJHPo8ZasVTASQB7llQP6YeNzgDALPRk=
......@@ -97,14 +88,12 @@ golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73r
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20191105084925-a882066a44e0 h1:QPlSTtPE2k6PZPasQUbzuK3p9JbS+vMXYVto8g/yrsg=
golang.org/x/net v0.0.0-20191105084925-a882066a44e0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
......@@ -120,13 +109,12 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135 h1:5Beo0mZN8dRzgrMMkDp0jc8YXQKx9DiJ2k1dkvGsn5A=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
......@@ -142,21 +130,16 @@ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQ
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
......
......@@ -5,16 +5,17 @@ import (
"crypto/sha256"
"errors"
"fmt"
"github.com/33cn/chain33-sdk-go/crypto"
"github.com/33cn/chain33-sdk-go/types"
secp256k1 "github.com/btcsuite/btcd/btcec"
"math/big"
secp256k1 "github.com/btcsuite/btcd/btcec"
"gitlab.33.cn/link33/chain33-sdk-go/crypto"
"gitlab.33.cn/link33/chain33-sdk-go/types"
)
var baseN = secp256k1.S256().Params().N
const (
encKeyLength = 16 // 对称秘钥长度,兼容jdk
encKeyLength = 16 // 对称秘钥长度,兼容jdk
)
type KFrag struct {
......@@ -63,8 +64,8 @@ func (p *EccPoit) MulInt(i *big.Int) *EccPoit {
func (p *EccPoit) ToPublicKey() *secp256k1.PublicKey {
return &secp256k1.PublicKey{
X: p.x,
Y: p.y,
X: p.x,
Y: p.y,
Curve: secp256k1.S256(),
}
}
......@@ -86,7 +87,7 @@ func hashToModInt(digest []byte) *big.Int {
func makeShamirPolyCoeff(threshold int) []*big.Int {
coeffs := make([]*big.Int, threshold-1)
for i,_ := range coeffs {
for i := range coeffs {
coeffs[i] = new(big.Int).SetBytes(crypto.GeneratePrivateKey())
}
......@@ -184,15 +185,15 @@ func GenerateKeyFragments(privOwner []byte, pubRecipient []byte, numSplit, thres
kFrags := make([]*KFrag, numSplit)
if numSplit == 1 {
id := getRandomInt(baseN.BitLen()-1)
id := getRandomInt(baseN.BitLen() - 1)
kFrags[0] = &KFrag{Random: id.String(), Value: f0.String(), PrecurPub: precurPub}
} else {
coeffs := makeShamirPolyCoeff(threshold)
coeffs = append(coeffs, f0)
// rk[i] = f2*id^2 + f1*id + f0
for i, _ := range kFrags {
id := getRandomInt(baseN.BitLen()-1)
for i := range kFrags {
id := getRandomInt(baseN.BitLen() - 1)
dShareHash := sha256.New()
dShareHash.Write(precursor.X.Bytes())
dShareHash.Write(pubRecipientKey.X.Bytes())
......@@ -241,14 +242,14 @@ func AssembleReencryptFragment(privRecipient []byte, reKeyFrags []*ReKeyFrag) ([
var eFinal, vFinal *EccPoit
ids := make([]*big.Int, len(reKeyFrags))
for x, _ := range ids {
for x := range ids {
xs := sha256.New()
xs.Write(precursorPubKey.X.Bytes())
xs.Write(privRecipientKey.X.Bytes())
xs.Write(dh_Bob_poit_x)
random, ret := new(big.Int).SetString(reKeyFrags[x].Random, 10)
if !ret {
fmt.Errorf("AssembleReencryptFragment.get value int",)
fmt.Errorf("AssembleReencryptFragment.get value int")
return nil, errors.New("get big int value from keyFragment failed")
}
xs.Write(random.Bytes())
......@@ -280,4 +281,4 @@ func AssembleReencryptFragment(privRecipient []byte, reKeyFrags []*ReKeyFrag) ([
share_key := crypto.KDF(result.ToPublicKey().SerializeCompressed(), encKeyLength)
return share_key, nil
}
\ No newline at end of file
}
......@@ -2,45 +2,46 @@ package sdk
import (
"fmt"
"github.com/33cn/chain33-sdk-go/client"
"github.com/33cn/chain33-sdk-go/crypto"
"github.com/33cn/chain33-sdk-go/types"
"github.com/stretchr/testify/assert"
"testing"
"github.com/stretchr/testify/assert"
"gitlab.33.cn/link33/chain33-sdk-go/client"
"gitlab.33.cn/link33/chain33-sdk-go/crypto"
"gitlab.33.cn/link33/chain33-sdk-go/types"
)
type ReqSendKeyFragment struct {
PubOwner string `protobuf:"bytes,1,opt,name=pubOwner,proto3" json:"pubOwner,omitempty"`
PubRecipient string `protobuf:"bytes,2,opt,name=pubRecipient,proto3" json:"pubRecipient,omitempty"`
PubProofR string `protobuf:"bytes,3,opt,name=pubProofR,proto3" json:"pubProofR,omitempty"`
PubProofU string `protobuf:"bytes,4,opt,name=pubProofU,proto3" json:"pubProofU,omitempty"`
Random string `protobuf:"bytes,5,opt,name=random,proto3" json:"random,omitempty"`
Value string `protobuf:"bytes,6,opt,name=value,proto3" json:"value,omitempty"`
Expire int64 `protobuf:"varint,7,opt,name=expire,proto3" json:"expire,omitempty"`
DhProof string `protobuf:"bytes,8,opt,name=dhProof,proto3" json:"dhProof,omitempty"`
PrecurPub string `protobuf:"bytes,9,opt,name=precurPub,proto3" json:"precurPub,omitempty"`
PubOwner string `protobuf:"bytes,1,opt,name=pubOwner,proto3" json:"pubOwner,omitempty"`
PubRecipient string `protobuf:"bytes,2,opt,name=pubRecipient,proto3" json:"pubRecipient,omitempty"`
PubProofR string `protobuf:"bytes,3,opt,name=pubProofR,proto3" json:"pubProofR,omitempty"`
PubProofU string `protobuf:"bytes,4,opt,name=pubProofU,proto3" json:"pubProofU,omitempty"`
Random string `protobuf:"bytes,5,opt,name=random,proto3" json:"random,omitempty"`
Value string `protobuf:"bytes,6,opt,name=value,proto3" json:"value,omitempty"`
Expire int64 `protobuf:"varint,7,opt,name=expire,proto3" json:"expire,omitempty"`
DhProof string `protobuf:"bytes,8,opt,name=dhProof,proto3" json:"dhProof,omitempty"`
PrecurPub string `protobuf:"bytes,9,opt,name=precurPub,proto3" json:"precurPub,omitempty"`
}
type ReqReeencryptParam struct {
PubOwner string `protobuf:"bytes,1,opt,name=pubOwner,proto3" json:"pubOwner,omitempty"`
PubRecipient string `protobuf:"bytes,2,opt,name=pubRecipient,proto3" json:"pubRecipient,omitempty"`
PubOwner string `protobuf:"bytes,1,opt,name=pubOwner,proto3" json:"pubOwner,omitempty"`
PubRecipient string `protobuf:"bytes,2,opt,name=pubRecipient,proto3" json:"pubRecipient,omitempty"`
}
type RepReeencrypt struct {
ReKeyR string `protobuf:"bytes,1,opt,name=reKeyR,proto3" json:"reKeyR,omitempty"`
ReKeyU string `protobuf:"bytes,2,opt,name=reKeyU,proto3" json:"reKeyU,omitempty"`
Random string `protobuf:"bytes,3,opt,name=random,proto3" json:"random,omitempty"`
PrecurPub string `protobuf:"bytes,4,opt,name=precurPub,proto3" json:"precurPub,omitempty"`
ReKeyR string `protobuf:"bytes,1,opt,name=reKeyR,proto3" json:"reKeyR,omitempty"`
ReKeyU string `protobuf:"bytes,2,opt,name=reKeyU,proto3" json:"reKeyU,omitempty"`
Random string `protobuf:"bytes,3,opt,name=random,proto3" json:"random,omitempty"`
PrecurPub string `protobuf:"bytes,4,opt,name=precurPub,proto3" json:"precurPub,omitempty"`
}
func TestPre(t *testing.T) {
privOwner,_ := types.FromHex("6d52c4680c00dcdb9d904dc6878a8e1c753ecf9c43a48499d819fdc0eafa4639")
pubOwner,_ := types.FromHex("02e5fdf78aded517e3235c2276ed0e020226c55835dea7b8306f2e8d3d99d2d4f4")
serverPub,_ := types.FromHex("02005d3a38feaff00f1b83014b2602d7b5b39506ddee7919dd66539b5428358f08")
privOwner, _ := types.FromHex("6d52c4680c00dcdb9d904dc6878a8e1c753ecf9c43a48499d819fdc0eafa4639")
pubOwner, _ := types.FromHex("02e5fdf78aded517e3235c2276ed0e020226c55835dea7b8306f2e8d3d99d2d4f4")
serverPub, _ := types.FromHex("02005d3a38feaff00f1b83014b2602d7b5b39506ddee7919dd66539b5428358f08")
privRecipient, _ := types.FromHex("841e3b4ab211eecfccb475940171150fd1536cb656c870fe95d206ebf9732b6c")
pubRecipient, _ := types.FromHex("03b9d801f88c38522a9bf786f23544259d516ee0d1f6699f926f891ac3fb92c6d9")
msg := "hello proxy-re-encrypt"
serverList := []string {"http://192.168.0.155:11801", "http://192.168.0.155:11802", "http://192.168.0.155:11803"}
serverList := []string{"http://192.168.0.155:11801", "http://192.168.0.155:11802", "http://192.168.0.155:11803"}
enKey, pub_r, pub_u := GeneratePreEncryptKey(pubOwner)
cipher, err := crypto.AESCBCPKCS7Encrypt(enKey, []byte(msg))
......@@ -80,12 +81,12 @@ func TestPre(t *testing.T) {
}
param := &ReqReeencryptParam{
PubOwner: types.ToHex(pubOwner),
PubRecipient: types.ToHex(pubRecipient),
PubOwner: types.ToHex(pubOwner),
PubRecipient: types.ToHex(pubRecipient),
}
var rekeys = make([]*ReKeyFrag, 2)
for i:=0; i < 2; i++ {
rekeys := make([]*ReKeyFrag, 2)
for i := 0; i < 2; i++ {
jclient, err := client.NewJSONClient("Pre", serverList[i])
if err != nil {
panic(err)
......@@ -100,7 +101,7 @@ func TestPre(t *testing.T) {
PrecurPub: result.PrecurPub,
}
}
encKey,err := AssembleReencryptFragment(privRecipient, rekeys)
encKey, err := AssembleReencryptFragment(privRecipient, rekeys)
if err != nil {
panic(err)
}
......
syntax = "proto3";
package types;
//option go_package = "../types";
// option go_package = "../types";
message BrokerAction {
oneof value {
Register register = 1;
Audit audit = 2;
Register register = 1;
Audit audit = 2;
InterchainEvent emitInterchainEvent = 3;
UpdateIndex updateIndex =4;
UpdateIndex updateIndex = 4;
}
int32 ty = 5;
}
......@@ -18,75 +18,75 @@ message Register {
//审核
message Audit {
//业务合约名称
//业务合约名称
string exectorName = 1;
//状态码 0表示正在审核,1表示审核通过,2表示审核失败
//状态码 0表示正在审核,1表示审核通过,2表示审核失败
string status = 2;
}
// 轮循事件
message PollingEvent {
Meta meta = 1;
Meta meta = 1;
}
// 更新跨链事件索引
message UpdateIndex {
//当前链已经处理到的位置
uint64 sequenceNum = 1;
uint64 sequenceNum = 1;
//目的链服务ID,固定格式0x000001
string dstServiceID = 2;
string dstServiceID = 2;
//源链ID,固定格式0x000002
string srcServiceID = 3;
string srcServiceID = 3;
//请求类型 0表示信息流入 1表示信息流出 2表示回滚
uint64 reqType =4;
uint64 reqType = 4;
//响应信息
Response response = 5;
Response response = 5;
}
// 跨链事件
message InterchainEvent {
//索引值,这个有系统自动生成
uint64 index = 1;
uint64 index = 1;
//目的链ID,固定格式0x000001
string dstServiceID = 2;
string dstServiceID = 2;
//源链ID,固定格式0x000002
string srcServiceID = 3;
string srcServiceID = 3;
//跨链交易类型 0表示storage,1表示coins,2表示token......
uint64 type =4;
uint64 type = 4;
//调用方法
string func = 5;
string func = 5;
//参数列表
repeated string args = 6;
repeated string args = 6;
//状态 0表示开始处理 1表示跨链成功 2表示跨链失败
int32 status = 7;
int32 status = 7;
}
//ReceiptBrokerLog
message ReceiptBrokerLog{
// ReceiptBrokerLog
message ReceiptBrokerLog {
oneof value {
Register register = 1;
Audit audit = 2;
Register register = 1;
Audit audit = 2;
InterchainEvent emitInterchainEvent = 3;
UpdateIndex updateIndex =4;
UpdateIndex updateIndex = 4;
}
int32 ty = 5;
}
service broker {}
//查询跨出事件
message QueryInterchainEvent{
uint64 index =1;
message QueryInterchainEvent {
uint64 index = 1;
//目的链ID,固定格式0x000001
string dstServiceID = 2;
string dstServiceID = 2;
//源链ID,固定格式0x000002
string srcServiceID = 3;
string srcServiceID = 3;
}
//跨链事件列表
message InterChainEventList{
repeated InterchainEvent list =1;
message InterChainEventList {
repeated InterchainEvent list = 1;
}
////根据状态查看跨链事件
//message QueryInterchainEventList {
// message QueryInterchainEventList {
// //事件状态必填(默认是0,只查询待处理状态的事件)
// int32 status = 1;
// // 主键索引
......@@ -97,46 +97,40 @@ message InterChainEventList{
// int32 direction = 4;
//}
////跨链事件列表
//message InterchainEventList {
// message InterchainEventList {
// repeated InterchainEvent list = 1;
// string primaryKey = 2;
//}
message QueryOutterMeta{
}
message QueryInnerMeta{
message QueryOutterMeta {}
}
message QueryNilParam{
}
message QueryInnerMeta {}
message QueryNilParam {}
message QueryInMessage{
message QueryInMessage {
string inServicePair = 1;
uint64 sequenceNum = 2;
uint64 sequenceNum = 2;
}
message QueryOutMessage{
message QueryOutMessage {
string inServicePair = 1;
uint64 sequenceNum = 2;
uint64 sequenceNum = 2;
}
message Meta {
map<string,uint64> meta = 1;
map<string, uint64> meta = 1;
}
message BrokerInfo {
//跨链协议版本ID
string bxhId =1;
string bxhId = 1;
//应用链ID
string appChainId = 2;
}
message Response{
message Response {
// A status code that should follow the HTTP status codes.
int32 status = 1;
// A message associated with the response code.
string message = 2;
// A payload that can be used to include metadata with this response.
bytes payload = 3;
bytes payload = 3;
}
\ No newline at end of file
syntax = "proto3";
package types;
//option go_package = "github.com/33cn/chain33/types";
// option go_package = "github.com/33cn/chain33/types";
message Reply {
bool isOk = 1;
......
......@@ -31,7 +31,7 @@ message ContentOnlyNotaryStorage {
//自定义的主键,可以为空,如果没传,则用txhash为key
string key = 2;
// Op 0表示创建 1表示追加add
int32 op = 3;
int32 op = 3;
//字符串值
string value = 4;
}
......@@ -109,5 +109,4 @@ message BatchReplyStorage {
repeated Storage storages = 1;
}
message ReceiptStorage {
}
\ No newline at end of file
message ReceiptStorage {}
\ No newline at end of file
......@@ -3,46 +3,45 @@ syntax = "proto3";
package types;
message wasmAction {
oneof value {
wasmCreate create = 1;
wasmCall call = 2;
}
int32 ty = 3;
oneof value {
wasmCreate create = 1;
wasmCall call = 2;
}
int32 ty = 3;
}
message wasmCreate {
string name = 1;
bytes code = 2;
string name = 1;
bytes code = 2;
}
message wasmCall {
string contract = 1;
string method = 2;
repeated int64 parameters = 3;
repeated string env = 4;
string contract = 1;
string method = 2;
repeated int64 parameters = 3;
repeated string env = 4;
}
message queryCheckContract {
string name = 1;
string name = 1;
}
message customLog {
repeated string info = 1;
repeated string info = 1;
}
message createContractLog {
string name = 1;
string code = 2;
string name = 1;
string code = 2;
}
message callContractLog {
string contract = 1;
string method = 2;
int32 result = 3;
string contract = 1;
string method = 2;
int32 result = 3;
}
message localDataLog {
bytes key = 1;
bytes value = 2;
bytes key = 1;
bytes value = 2;
}
......@@ -2,10 +2,11 @@ package sdk
import (
"errors"
"github.com/33cn/chain33-sdk-go/crypto"
"github.com/33cn/chain33-sdk-go/crypto/ed25519"
"github.com/33cn/chain33-sdk-go/crypto/gm"
. "github.com/33cn/chain33-sdk-go/types"
"gitlab.33.cn/link33/chain33-sdk-go/crypto"
"gitlab.33.cn/link33/chain33-sdk-go/crypto/ed25519"
"gitlab.33.cn/link33/chain33-sdk-go/crypto/gm"
. "gitlab.33.cn/link33/chain33-sdk-go/types"
)
func Sign(tx *Transaction, privateKey []byte, signType string, uid []byte) (*Transaction, error) {
......@@ -42,9 +43,9 @@ func Sign(tx *Transaction, privateKey []byte, signType string, uid []byte) (*Tra
data := Encode(tx)
signature := ed25519.Sign(data, privateKey)
tx.Signature = &Signature{
Ty: 2,
Pubkey: pub,
Signature: signature,
Ty: 2,
Pubkey: pub,
Signature: signature,
}
} else {
return nil, errors.New("sign type not support")
......@@ -74,4 +75,4 @@ func Hash(tx *Transaction) []byte {
copytx.Header = nil
data := Encode(copytx)
return crypto.Sha256(data)
}
\ No newline at end of file
}
......@@ -6,15 +6,18 @@ package types
import (
context "context"
fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto"
grpc "google.golang.org/grpc"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
var (
_ = proto.Marshal
_ = fmt.Errorf
_ = math.Inf
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
......@@ -22,7 +25,7 @@ var _ = math.Inf
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
//option go_package = "../types";
// option go_package = "../types";
type BrokerAction struct {
// Types that are valid to be assigned to Value:
// *BrokerAction_Register
......@@ -46,15 +49,19 @@ func (*BrokerAction) Descriptor() ([]byte, []int) {
func (m *BrokerAction) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_BrokerAction.Unmarshal(m, b)
}
func (m *BrokerAction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_BrokerAction.Marshal(b, m, deterministic)
}
func (m *BrokerAction) XXX_Merge(src proto.Message) {
xxx_messageInfo_BrokerAction.Merge(m, src)
}
func (m *BrokerAction) XXX_Size() int {
return xxx_messageInfo_BrokerAction.Size(m)
}
func (m *BrokerAction) XXX_DiscardUnknown() {
xxx_messageInfo_BrokerAction.DiscardUnknown(m)
}
......@@ -143,7 +150,7 @@ func (*BrokerAction) XXX_OneofWrappers() []interface{} {
// 业务合约注册模型: 0表示正在审核,1表示审核通过,2表示审核失败
type Register struct {
//业务合约名称
// 业务合约名称
ExectorName string `protobuf:"bytes,1,opt,name=exectorName,proto3" json:"exectorName,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
......@@ -160,15 +167,19 @@ func (*Register) Descriptor() ([]byte, []int) {
func (m *Register) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Register.Unmarshal(m, b)
}
func (m *Register) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Register.Marshal(b, m, deterministic)
}
func (m *Register) XXX_Merge(src proto.Message) {
xxx_messageInfo_Register.Merge(m, src)
}
func (m *Register) XXX_Size() int {
return xxx_messageInfo_Register.Size(m)
}
func (m *Register) XXX_DiscardUnknown() {
xxx_messageInfo_Register.DiscardUnknown(m)
}
......@@ -182,11 +193,11 @@ func (m *Register) GetExectorName() string {
return ""
}
//审核
// 审核
type Audit struct {
//业务合约名称
// 业务合约名称
ExectorName string `protobuf:"bytes,1,opt,name=exectorName,proto3" json:"exectorName,omitempty"`
//状态码 0表示正在审核,1表示审核通过,2表示审核失败
// 状态码 0表示正在审核,1表示审核通过,2表示审核失败
Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
......@@ -203,15 +214,19 @@ func (*Audit) Descriptor() ([]byte, []int) {
func (m *Audit) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Audit.Unmarshal(m, b)
}
func (m *Audit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Audit.Marshal(b, m, deterministic)
}
func (m *Audit) XXX_Merge(src proto.Message) {
xxx_messageInfo_Audit.Merge(m, src)
}
func (m *Audit) XXX_Size() int {
return xxx_messageInfo_Audit.Size(m)
}
func (m *Audit) XXX_DiscardUnknown() {
xxx_messageInfo_Audit.DiscardUnknown(m)
}
......@@ -250,15 +265,19 @@ func (*PollingEvent) Descriptor() ([]byte, []int) {
func (m *PollingEvent) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PollingEvent.Unmarshal(m, b)
}
func (m *PollingEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_PollingEvent.Marshal(b, m, deterministic)
}
func (m *PollingEvent) XXX_Merge(src proto.Message) {
xxx_messageInfo_PollingEvent.Merge(m, src)
}
func (m *PollingEvent) XXX_Size() int {
return xxx_messageInfo_PollingEvent.Size(m)
}
func (m *PollingEvent) XXX_DiscardUnknown() {
xxx_messageInfo_PollingEvent.DiscardUnknown(m)
}
......@@ -274,15 +293,15 @@ func (m *PollingEvent) GetMeta() *Meta {
// 更新跨链事件索引
type UpdateIndex struct {
//当前链已经处理到的位置
// 当前链已经处理到的位置
SequenceNum uint64 `protobuf:"varint,1,opt,name=sequenceNum,proto3" json:"sequenceNum,omitempty"`
//目的链服务ID,固定格式0x000001
// 目的链服务ID,固定格式0x000001
DstServiceID string `protobuf:"bytes,2,opt,name=dstServiceID,proto3" json:"dstServiceID,omitempty"`
//源链ID,固定格式0x000002
// 源链ID,固定格式0x000002
SrcServiceID string `protobuf:"bytes,3,opt,name=srcServiceID,proto3" json:"srcServiceID,omitempty"`
//请求类型 0表示信息流入 1表示信息流出 2表示回滚
// 请求类型 0表示信息流入 1表示信息流出 2表示回滚
ReqType uint64 `protobuf:"varint,4,opt,name=reqType,proto3" json:"reqType,omitempty"`
//响应信息
// 响应信息
Response *Response `protobuf:"bytes,5,opt,name=response,proto3" json:"response,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
......@@ -299,15 +318,19 @@ func (*UpdateIndex) Descriptor() ([]byte, []int) {
func (m *UpdateIndex) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UpdateIndex.Unmarshal(m, b)
}
func (m *UpdateIndex) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_UpdateIndex.Marshal(b, m, deterministic)
}
func (m *UpdateIndex) XXX_Merge(src proto.Message) {
xxx_messageInfo_UpdateIndex.Merge(m, src)
}
func (m *UpdateIndex) XXX_Size() int {
return xxx_messageInfo_UpdateIndex.Size(m)
}
func (m *UpdateIndex) XXX_DiscardUnknown() {
xxx_messageInfo_UpdateIndex.DiscardUnknown(m)
}
......@@ -351,19 +374,19 @@ func (m *UpdateIndex) GetResponse() *Response {
// 跨链事件
type InterchainEvent struct {
//索引值,这个有系统自动生成
// 索引值,这个有系统自动生成
Index uint64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
//目的链ID,固定格式0x000001
// 目的链ID,固定格式0x000001
DstServiceID string `protobuf:"bytes,2,opt,name=dstServiceID,proto3" json:"dstServiceID,omitempty"`
//源链ID,固定格式0x000002
// 源链ID,固定格式0x000002
SrcServiceID string `protobuf:"bytes,3,opt,name=srcServiceID,proto3" json:"srcServiceID,omitempty"`
//跨链交易类型 0表示storage,1表示coins,2表示token......
// 跨链交易类型 0表示storage,1表示coins,2表示token......
Type uint64 `protobuf:"varint,4,opt,name=type,proto3" json:"type,omitempty"`
//调用方法
// 调用方法
Func string `protobuf:"bytes,5,opt,name=func,proto3" json:"func,omitempty"`
//参数列表
// 参数列表
Args []string `protobuf:"bytes,6,rep,name=args,proto3" json:"args,omitempty"`
//状态 0表示开始处理 1表示跨链成功 2表示跨链失败
// 状态 0表示开始处理 1表示跨链成功 2表示跨链失败
Status int32 `protobuf:"varint,7,opt,name=status,proto3" json:"status,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
......@@ -380,15 +403,19 @@ func (*InterchainEvent) Descriptor() ([]byte, []int) {
func (m *InterchainEvent) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_InterchainEvent.Unmarshal(m, b)
}
func (m *InterchainEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_InterchainEvent.Marshal(b, m, deterministic)
}
func (m *InterchainEvent) XXX_Merge(src proto.Message) {
xxx_messageInfo_InterchainEvent.Merge(m, src)
}
func (m *InterchainEvent) XXX_Size() int {
return xxx_messageInfo_InterchainEvent.Size(m)
}
func (m *InterchainEvent) XXX_DiscardUnknown() {
xxx_messageInfo_InterchainEvent.DiscardUnknown(m)
}
......@@ -444,7 +471,7 @@ func (m *InterchainEvent) GetStatus() int32 {
return 0
}
//ReceiptBrokerLog
// ReceiptBrokerLog
type ReceiptBrokerLog struct {
// Types that are valid to be assigned to Value:
// *ReceiptBrokerLog_Register
......@@ -468,15 +495,19 @@ func (*ReceiptBrokerLog) Descriptor() ([]byte, []int) {
func (m *ReceiptBrokerLog) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReceiptBrokerLog.Unmarshal(m, b)
}
func (m *ReceiptBrokerLog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReceiptBrokerLog.Marshal(b, m, deterministic)
}
func (m *ReceiptBrokerLog) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReceiptBrokerLog.Merge(m, src)
}
func (m *ReceiptBrokerLog) XXX_Size() int {
return xxx_messageInfo_ReceiptBrokerLog.Size(m)
}
func (m *ReceiptBrokerLog) XXX_DiscardUnknown() {
xxx_messageInfo_ReceiptBrokerLog.DiscardUnknown(m)
}
......@@ -563,12 +594,12 @@ func (*ReceiptBrokerLog) XXX_OneofWrappers() []interface{} {
}
}
//查询跨出事件
// 查询跨出事件
type QueryInterchainEvent struct {
Index uint64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
//目的链ID,固定格式0x000001
// 目的链ID,固定格式0x000001
DstServiceID string `protobuf:"bytes,2,opt,name=dstServiceID,proto3" json:"dstServiceID,omitempty"`
//源链ID,固定格式0x000002
// 源链ID,固定格式0x000002
SrcServiceID string `protobuf:"bytes,3,opt,name=srcServiceID,proto3" json:"srcServiceID,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
......@@ -585,15 +616,19 @@ func (*QueryInterchainEvent) Descriptor() ([]byte, []int) {
func (m *QueryInterchainEvent) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_QueryInterchainEvent.Unmarshal(m, b)
}
func (m *QueryInterchainEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_QueryInterchainEvent.Marshal(b, m, deterministic)
}
func (m *QueryInterchainEvent) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryInterchainEvent.Merge(m, src)
}
func (m *QueryInterchainEvent) XXX_Size() int {
return xxx_messageInfo_QueryInterchainEvent.Size(m)
}
func (m *QueryInterchainEvent) XXX_DiscardUnknown() {
xxx_messageInfo_QueryInterchainEvent.DiscardUnknown(m)
}
......@@ -621,7 +656,7 @@ func (m *QueryInterchainEvent) GetSrcServiceID() string {
return ""
}
//跨链事件列表
// 跨链事件列表
type InterChainEventList struct {
List []*InterchainEvent `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
......@@ -639,15 +674,19 @@ func (*InterChainEventList) Descriptor() ([]byte, []int) {
func (m *InterChainEventList) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_InterChainEventList.Unmarshal(m, b)
}
func (m *InterChainEventList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_InterChainEventList.Marshal(b, m, deterministic)
}
func (m *InterChainEventList) XXX_Merge(src proto.Message) {
xxx_messageInfo_InterChainEventList.Merge(m, src)
}
func (m *InterChainEventList) XXX_Size() int {
return xxx_messageInfo_InterChainEventList.Size(m)
}
func (m *InterChainEventList) XXX_DiscardUnknown() {
xxx_messageInfo_InterChainEventList.DiscardUnknown(m)
}
......@@ -693,15 +732,19 @@ func (*QueryOutterMeta) Descriptor() ([]byte, []int) {
func (m *QueryOutterMeta) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_QueryOutterMeta.Unmarshal(m, b)
}
func (m *QueryOutterMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_QueryOutterMeta.Marshal(b, m, deterministic)
}
func (m *QueryOutterMeta) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryOutterMeta.Merge(m, src)
}
func (m *QueryOutterMeta) XXX_Size() int {
return xxx_messageInfo_QueryOutterMeta.Size(m)
}
func (m *QueryOutterMeta) XXX_DiscardUnknown() {
xxx_messageInfo_QueryOutterMeta.DiscardUnknown(m)
}
......@@ -724,15 +767,19 @@ func (*QueryInnerMeta) Descriptor() ([]byte, []int) {
func (m *QueryInnerMeta) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_QueryInnerMeta.Unmarshal(m, b)
}
func (m *QueryInnerMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_QueryInnerMeta.Marshal(b, m, deterministic)
}
func (m *QueryInnerMeta) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryInnerMeta.Merge(m, src)
}
func (m *QueryInnerMeta) XXX_Size() int {
return xxx_messageInfo_QueryInnerMeta.Size(m)
}
func (m *QueryInnerMeta) XXX_DiscardUnknown() {
xxx_messageInfo_QueryInnerMeta.DiscardUnknown(m)
}
......@@ -755,15 +802,19 @@ func (*QueryNilParam) Descriptor() ([]byte, []int) {
func (m *QueryNilParam) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_QueryNilParam.Unmarshal(m, b)
}
func (m *QueryNilParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_QueryNilParam.Marshal(b, m, deterministic)
}
func (m *QueryNilParam) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryNilParam.Merge(m, src)
}
func (m *QueryNilParam) XXX_Size() int {
return xxx_messageInfo_QueryNilParam.Size(m)
}
func (m *QueryNilParam) XXX_DiscardUnknown() {
xxx_messageInfo_QueryNilParam.DiscardUnknown(m)
}
......@@ -788,15 +839,19 @@ func (*QueryInMessage) Descriptor() ([]byte, []int) {
func (m *QueryInMessage) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_QueryInMessage.Unmarshal(m, b)
}
func (m *QueryInMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_QueryInMessage.Marshal(b, m, deterministic)
}
func (m *QueryInMessage) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryInMessage.Merge(m, src)
}
func (m *QueryInMessage) XXX_Size() int {
return xxx_messageInfo_QueryInMessage.Size(m)
}
func (m *QueryInMessage) XXX_DiscardUnknown() {
xxx_messageInfo_QueryInMessage.DiscardUnknown(m)
}
......@@ -835,15 +890,19 @@ func (*QueryOutMessage) Descriptor() ([]byte, []int) {
func (m *QueryOutMessage) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_QueryOutMessage.Unmarshal(m, b)
}
func (m *QueryOutMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_QueryOutMessage.Marshal(b, m, deterministic)
}
func (m *QueryOutMessage) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryOutMessage.Merge(m, src)
}
func (m *QueryOutMessage) XXX_Size() int {
return xxx_messageInfo_QueryOutMessage.Size(m)
}
func (m *QueryOutMessage) XXX_DiscardUnknown() {
xxx_messageInfo_QueryOutMessage.DiscardUnknown(m)
}
......@@ -881,15 +940,19 @@ func (*Meta) Descriptor() ([]byte, []int) {
func (m *Meta) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Meta.Unmarshal(m, b)
}
func (m *Meta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Meta.Marshal(b, m, deterministic)
}
func (m *Meta) XXX_Merge(src proto.Message) {
xxx_messageInfo_Meta.Merge(m, src)
}
func (m *Meta) XXX_Size() int {
return xxx_messageInfo_Meta.Size(m)
}
func (m *Meta) XXX_DiscardUnknown() {
xxx_messageInfo_Meta.DiscardUnknown(m)
}
......@@ -904,9 +967,9 @@ func (m *Meta) GetMeta() map[string]uint64 {
}
type BrokerInfo struct {
//跨链协议版本ID
// 跨链协议版本ID
BxhId string `protobuf:"bytes,1,opt,name=bxhId,proto3" json:"bxhId,omitempty"`
//应用链ID
// 应用链ID
AppChainId string `protobuf:"bytes,2,opt,name=appChainId,proto3" json:"appChainId,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
......@@ -923,15 +986,19 @@ func (*BrokerInfo) Descriptor() ([]byte, []int) {
func (m *BrokerInfo) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_BrokerInfo.Unmarshal(m, b)
}
func (m *BrokerInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_BrokerInfo.Marshal(b, m, deterministic)
}
func (m *BrokerInfo) XXX_Merge(src proto.Message) {
xxx_messageInfo_BrokerInfo.Merge(m, src)
}
func (m *BrokerInfo) XXX_Size() int {
return xxx_messageInfo_BrokerInfo.Size(m)
}
func (m *BrokerInfo) XXX_DiscardUnknown() {
xxx_messageInfo_BrokerInfo.DiscardUnknown(m)
}
......@@ -974,15 +1041,19 @@ func (*Response) Descriptor() ([]byte, []int) {
func (m *Response) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Response.Unmarshal(m, b)
}
func (m *Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Response.Marshal(b, m, deterministic)
}
func (m *Response) XXX_Merge(src proto.Message) {
xxx_messageInfo_Response.Merge(m, src)
}
func (m *Response) XXX_Size() int {
return xxx_messageInfo_Response.Size(m)
}
func (m *Response) XXX_DiscardUnknown() {
xxx_messageInfo_Response.DiscardUnknown(m)
}
......@@ -1082,8 +1153,10 @@ var fileDescriptor_f209535e190f2bed = []byte{
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConnInterface
var (
_ context.Context
_ 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.
......@@ -1092,8 +1165,7 @@ const _ = grpc.SupportPackageIsVersion6
// BrokerClient is the client API for Broker service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type BrokerClient interface {
}
type BrokerClient interface{}
type brokerClient struct {
cc grpc.ClientConnInterface
......@@ -1104,12 +1176,10 @@ func NewBrokerClient(cc grpc.ClientConnInterface) BrokerClient {
}
// BrokerServer is the server API for Broker service.
type BrokerServer interface {
}
type BrokerServer interface{}
// UnimplementedBrokerServer can be embedded to have forward compatible implementations.
type UnimplementedBrokerServer struct {
}
type UnimplementedBrokerServer struct{}
func RegisterBrokerServer(s *grpc.Server, srv BrokerServer) {
s.RegisterService(&_Broker_serviceDesc, srv)
......
......@@ -5,14 +5,17 @@ package types
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
proto "github.com/golang/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
var (
_ = proto.Marshal
_ = fmt.Errorf
_ = math.Inf
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
......@@ -43,15 +46,19 @@ func (*CertAction) Descriptor() ([]byte, []int) {
func (m *CertAction) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CertAction.Unmarshal(m, b)
}
func (m *CertAction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CertAction.Marshal(b, m, deterministic)
}
func (m *CertAction) XXX_Merge(src proto.Message) {
xxx_messageInfo_CertAction.Merge(m, src)
}
func (m *CertAction) XXX_Size() int {
return xxx_messageInfo_CertAction.Size(m)
}
func (m *CertAction) XXX_DiscardUnknown() {
xxx_messageInfo_CertAction.DiscardUnknown(m)
}
......@@ -143,15 +150,19 @@ func (*CertNew) Descriptor() ([]byte, []int) {
func (m *CertNew) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CertNew.Unmarshal(m, b)
}
func (m *CertNew) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CertNew.Marshal(b, m, deterministic)
}
func (m *CertNew) XXX_Merge(src proto.Message) {
xxx_messageInfo_CertNew.Merge(m, src)
}
func (m *CertNew) XXX_Size() int {
return xxx_messageInfo_CertNew.Size(m)
}
func (m *CertNew) XXX_DiscardUnknown() {
xxx_messageInfo_CertNew.DiscardUnknown(m)
}
......@@ -191,15 +202,19 @@ func (*CertUpdate) Descriptor() ([]byte, []int) {
func (m *CertUpdate) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CertUpdate.Unmarshal(m, b)
}
func (m *CertUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CertUpdate.Marshal(b, m, deterministic)
}
func (m *CertUpdate) XXX_Merge(src proto.Message) {
xxx_messageInfo_CertUpdate.Merge(m, src)
}
func (m *CertUpdate) XXX_Size() int {
return xxx_messageInfo_CertUpdate.Size(m)
}
func (m *CertUpdate) XXX_DiscardUnknown() {
xxx_messageInfo_CertUpdate.DiscardUnknown(m)
}
......@@ -239,15 +254,19 @@ func (*CertNormal) Descriptor() ([]byte, []int) {
func (m *CertNormal) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CertNormal.Unmarshal(m, b)
}
func (m *CertNormal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CertNormal.Marshal(b, m, deterministic)
}
func (m *CertNormal) XXX_Merge(src proto.Message) {
xxx_messageInfo_CertNormal.Merge(m, src)
}
func (m *CertNormal) XXX_Size() int {
return xxx_messageInfo_CertNormal.Size(m)
}
func (m *CertNormal) XXX_DiscardUnknown() {
xxx_messageInfo_CertNormal.DiscardUnknown(m)
}
......@@ -287,15 +306,19 @@ func (*CertSignature) Descriptor() ([]byte, []int) {
func (m *CertSignature) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CertSignature.Unmarshal(m, b)
}
func (m *CertSignature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CertSignature.Marshal(b, m, deterministic)
}
func (m *CertSignature) XXX_Merge(src proto.Message) {
xxx_messageInfo_CertSignature.Merge(m, src)
}
func (m *CertSignature) XXX_Size() int {
return xxx_messageInfo_CertSignature.Size(m)
}
func (m *CertSignature) XXX_DiscardUnknown() {
xxx_messageInfo_CertSignature.DiscardUnknown(m)
}
......
......@@ -5,14 +5,17 @@ package types
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
proto "github.com/golang/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
var (
_ = proto.Marshal
_ = fmt.Errorf
_ = math.Inf
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
......@@ -38,15 +41,19 @@ func (*Reply) Descriptor() ([]byte, []int) {
func (m *Reply) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Reply.Unmarshal(m, b)
}
func (m *Reply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Reply.Marshal(b, m, deterministic)
}
func (m *Reply) XXX_Merge(src proto.Message) {
xxx_messageInfo_Reply.Merge(m, src)
}
func (m *Reply) XXX_Size() int {
return xxx_messageInfo_Reply.Size(m)
}
func (m *Reply) XXX_DiscardUnknown() {
xxx_messageInfo_Reply.DiscardUnknown(m)
}
......@@ -84,15 +91,19 @@ func (*ReqString) Descriptor() ([]byte, []int) {
func (m *ReqString) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReqString.Unmarshal(m, b)
}
func (m *ReqString) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReqString.Marshal(b, m, deterministic)
}
func (m *ReqString) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReqString.Merge(m, src)
}
func (m *ReqString) XXX_Size() int {
return xxx_messageInfo_ReqString.Size(m)
}
func (m *ReqString) XXX_DiscardUnknown() {
xxx_messageInfo_ReqString.DiscardUnknown(m)
}
......@@ -123,15 +134,19 @@ func (*ReplyString) Descriptor() ([]byte, []int) {
func (m *ReplyString) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReplyString.Unmarshal(m, b)
}
func (m *ReplyString) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReplyString.Marshal(b, m, deterministic)
}
func (m *ReplyString) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReplyString.Merge(m, src)
}
func (m *ReplyString) XXX_Size() int {
return xxx_messageInfo_ReplyString.Size(m)
}
func (m *ReplyString) XXX_DiscardUnknown() {
xxx_messageInfo_ReplyString.DiscardUnknown(m)
}
......@@ -162,15 +177,19 @@ func (*ReplyStrings) Descriptor() ([]byte, []int) {
func (m *ReplyStrings) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReplyStrings.Unmarshal(m, b)
}
func (m *ReplyStrings) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReplyStrings.Marshal(b, m, deterministic)
}
func (m *ReplyStrings) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReplyStrings.Merge(m, src)
}
func (m *ReplyStrings) XXX_Size() int {
return xxx_messageInfo_ReplyStrings.Size(m)
}
func (m *ReplyStrings) XXX_DiscardUnknown() {
xxx_messageInfo_ReplyStrings.DiscardUnknown(m)
}
......@@ -201,15 +220,19 @@ func (*ReqInt) Descriptor() ([]byte, []int) {
func (m *ReqInt) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReqInt.Unmarshal(m, b)
}
func (m *ReqInt) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReqInt.Marshal(b, m, deterministic)
}
func (m *ReqInt) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReqInt.Merge(m, src)
}
func (m *ReqInt) XXX_Size() int {
return xxx_messageInfo_ReqInt.Size(m)
}
func (m *ReqInt) XXX_DiscardUnknown() {
xxx_messageInfo_ReqInt.DiscardUnknown(m)
}
......@@ -240,15 +263,19 @@ func (*Int64) Descriptor() ([]byte, []int) {
func (m *Int64) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Int64.Unmarshal(m, b)
}
func (m *Int64) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Int64.Marshal(b, m, deterministic)
}
func (m *Int64) XXX_Merge(src proto.Message) {
xxx_messageInfo_Int64.Merge(m, src)
}
func (m *Int64) XXX_Size() int {
return xxx_messageInfo_Int64.Size(m)
}
func (m *Int64) XXX_DiscardUnknown() {
xxx_messageInfo_Int64.DiscardUnknown(m)
}
......@@ -280,15 +307,19 @@ func (*ReqHash) Descriptor() ([]byte, []int) {
func (m *ReqHash) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReqHash.Unmarshal(m, b)
}
func (m *ReqHash) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReqHash.Marshal(b, m, deterministic)
}
func (m *ReqHash) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReqHash.Merge(m, src)
}
func (m *ReqHash) XXX_Size() int {
return xxx_messageInfo_ReqHash.Size(m)
}
func (m *ReqHash) XXX_DiscardUnknown() {
xxx_messageInfo_ReqHash.DiscardUnknown(m)
}
......@@ -326,15 +357,19 @@ func (*ReplyHash) Descriptor() ([]byte, []int) {
func (m *ReplyHash) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReplyHash.Unmarshal(m, b)
}
func (m *ReplyHash) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReplyHash.Marshal(b, m, deterministic)
}
func (m *ReplyHash) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReplyHash.Merge(m, src)
}
func (m *ReplyHash) XXX_Size() int {
return xxx_messageInfo_ReplyHash.Size(m)
}
func (m *ReplyHash) XXX_DiscardUnknown() {
xxx_messageInfo_ReplyHash.DiscardUnknown(m)
}
......@@ -364,15 +399,19 @@ func (*ReqNil) Descriptor() ([]byte, []int) {
func (m *ReqNil) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReqNil.Unmarshal(m, b)
}
func (m *ReqNil) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReqNil.Marshal(b, m, deterministic)
}
func (m *ReqNil) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReqNil.Merge(m, src)
}
func (m *ReqNil) XXX_Size() int {
return xxx_messageInfo_ReqNil.Size(m)
}
func (m *ReqNil) XXX_DiscardUnknown() {
xxx_messageInfo_ReqNil.DiscardUnknown(m)
}
......@@ -396,15 +435,19 @@ func (*ReqHashes) Descriptor() ([]byte, []int) {
func (m *ReqHashes) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReqHashes.Unmarshal(m, b)
}
func (m *ReqHashes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReqHashes.Marshal(b, m, deterministic)
}
func (m *ReqHashes) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReqHashes.Merge(m, src)
}
func (m *ReqHashes) XXX_Size() int {
return xxx_messageInfo_ReqHashes.Size(m)
}
func (m *ReqHashes) XXX_DiscardUnknown() {
xxx_messageInfo_ReqHashes.DiscardUnknown(m)
}
......@@ -435,15 +478,19 @@ func (*ReplyHashes) Descriptor() ([]byte, []int) {
func (m *ReplyHashes) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReplyHashes.Unmarshal(m, b)
}
func (m *ReplyHashes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReplyHashes.Marshal(b, m, deterministic)
}
func (m *ReplyHashes) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReplyHashes.Merge(m, src)
}
func (m *ReplyHashes) XXX_Size() int {
return xxx_messageInfo_ReplyHashes.Size(m)
}
func (m *ReplyHashes) XXX_DiscardUnknown() {
xxx_messageInfo_ReplyHashes.DiscardUnknown(m)
}
......@@ -475,15 +522,19 @@ func (*KeyValue) Descriptor() ([]byte, []int) {
func (m *KeyValue) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_KeyValue.Unmarshal(m, b)
}
func (m *KeyValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_KeyValue.Marshal(b, m, deterministic)
}
func (m *KeyValue) XXX_Merge(src proto.Message) {
xxx_messageInfo_KeyValue.Merge(m, src)
}
func (m *KeyValue) XXX_Size() int {
return xxx_messageInfo_KeyValue.Size(m)
}
func (m *KeyValue) XXX_DiscardUnknown() {
xxx_messageInfo_KeyValue.DiscardUnknown(m)
}
......@@ -521,15 +572,19 @@ func (*TxHash) Descriptor() ([]byte, []int) {
func (m *TxHash) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_TxHash.Unmarshal(m, b)
}
func (m *TxHash) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_TxHash.Marshal(b, m, deterministic)
}
func (m *TxHash) XXX_Merge(src proto.Message) {
xxx_messageInfo_TxHash.Merge(m, src)
}
func (m *TxHash) XXX_Size() int {
return xxx_messageInfo_TxHash.Size(m)
}
func (m *TxHash) XXX_DiscardUnknown() {
xxx_messageInfo_TxHash.DiscardUnknown(m)
}
......@@ -562,15 +617,19 @@ func (*TimeStatus) Descriptor() ([]byte, []int) {
func (m *TimeStatus) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_TimeStatus.Unmarshal(m, b)
}
func (m *TimeStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_TimeStatus.Marshal(b, m, deterministic)
}
func (m *TimeStatus) XXX_Merge(src proto.Message) {
xxx_messageInfo_TimeStatus.Merge(m, src)
}
func (m *TimeStatus) XXX_Size() int {
return xxx_messageInfo_TimeStatus.Size(m)
}
func (m *TimeStatus) XXX_DiscardUnknown() {
xxx_messageInfo_TimeStatus.DiscardUnknown(m)
}
......@@ -615,15 +674,19 @@ func (*ReqKey) Descriptor() ([]byte, []int) {
func (m *ReqKey) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReqKey.Unmarshal(m, b)
}
func (m *ReqKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReqKey.Marshal(b, m, deterministic)
}
func (m *ReqKey) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReqKey.Merge(m, src)
}
func (m *ReqKey) XXX_Size() int {
return xxx_messageInfo_ReqKey.Size(m)
}
func (m *ReqKey) XXX_DiscardUnknown() {
xxx_messageInfo_ReqKey.DiscardUnknown(m)
}
......@@ -657,15 +720,19 @@ func (*ReqRandHash) Descriptor() ([]byte, []int) {
func (m *ReqRandHash) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReqRandHash.Unmarshal(m, b)
}
func (m *ReqRandHash) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReqRandHash.Marshal(b, m, deterministic)
}
func (m *ReqRandHash) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReqRandHash.Merge(m, src)
}
func (m *ReqRandHash) XXX_Size() int {
return xxx_messageInfo_ReqRandHash.Size(m)
}
func (m *ReqRandHash) XXX_DiscardUnknown() {
xxx_messageInfo_ReqRandHash.DiscardUnknown(m)
}
......@@ -723,15 +790,19 @@ func (*VersionInfo) Descriptor() ([]byte, []int) {
func (m *VersionInfo) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_VersionInfo.Unmarshal(m, b)
}
func (m *VersionInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_VersionInfo.Marshal(b, m, deterministic)
}
func (m *VersionInfo) XXX_Merge(src proto.Message) {
xxx_messageInfo_VersionInfo.Merge(m, src)
}
func (m *VersionInfo) XXX_Size() int {
return xxx_messageInfo_VersionInfo.Size(m)
}
func (m *VersionInfo) XXX_DiscardUnknown() {
xxx_messageInfo_VersionInfo.DiscardUnknown(m)
}
......
......@@ -5,14 +5,17 @@ package types
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
proto "github.com/golang/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
var (
_ = proto.Marshal
_ = fmt.Errorf
_ = math.Inf
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
......@@ -26,9 +29,9 @@ type Transaction struct {
Signature *Signature `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"`
Fee int64 `protobuf:"varint,4,opt,name=fee,proto3" json:"fee,omitempty"`
Expire int64 `protobuf:"varint,5,opt,name=expire,proto3" json:"expire,omitempty"`
//随机ID,可以防止payload 相同的时候,交易重复
// 随机ID,可以防止payload 相同的时候,交易重复
Nonce int64 `protobuf:"varint,6,opt,name=nonce,proto3" json:"nonce,omitempty"`
//对方地址,如果没有对方地址,可以为空
// 对方地址,如果没有对方地址,可以为空
To string `protobuf:"bytes,7,opt,name=to,proto3" json:"to,omitempty"`
GroupCount int32 `protobuf:"varint,8,opt,name=groupCount,proto3" json:"groupCount,omitempty"`
Header []byte `protobuf:"bytes,9,opt,name=header,proto3" json:"header,omitempty"`
......@@ -48,15 +51,19 @@ func (*Transaction) Descriptor() ([]byte, []int) {
func (m *Transaction) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Transaction.Unmarshal(m, b)
}
func (m *Transaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Transaction.Marshal(b, m, deterministic)
}
func (m *Transaction) XXX_Merge(src proto.Message) {
xxx_messageInfo_Transaction.Merge(m, src)
}
func (m *Transaction) XXX_Size() int {
return xxx_messageInfo_Transaction.Size(m)
}
func (m *Transaction) XXX_DiscardUnknown() {
xxx_messageInfo_Transaction.DiscardUnknown(m)
}
......@@ -136,7 +143,7 @@ func (m *Transaction) GetNext() []byte {
type Signature struct {
Ty int32 `protobuf:"varint,1,opt,name=ty,proto3" json:"ty,omitempty"`
Pubkey []byte `protobuf:"bytes,2,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
//当ty为5时,格式应该用RingSignature去解析
// 当ty为5时,格式应该用RingSignature去解析
Signature []byte `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
......@@ -153,15 +160,19 @@ func (*Signature) Descriptor() ([]byte, []int) {
func (m *Signature) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Signature.Unmarshal(m, b)
}
func (m *Signature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Signature.Marshal(b, m, deterministic)
}
func (m *Signature) XXX_Merge(src proto.Message) {
xxx_messageInfo_Signature.Merge(m, src)
}
func (m *Signature) XXX_Size() int {
return xxx_messageInfo_Signature.Size(m)
}
func (m *Signature) XXX_DiscardUnknown() {
xxx_messageInfo_Signature.DiscardUnknown(m)
}
......
......@@ -6,15 +6,18 @@ package types
import (
context "context"
fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto"
grpc "google.golang.org/grpc"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
var (
_ = proto.Marshal
_ = fmt.Errorf
_ = math.Inf
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
......@@ -22,7 +25,7 @@ var _ = math.Inf
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
//后面如果有其他数据模型可继续往上面添加
// 后面如果有其他数据模型可继续往上面添加
type Storage struct {
// Types that are valid to be assigned to Value:
// *Storage_ContentStorage
......@@ -48,15 +51,19 @@ func (*Storage) Descriptor() ([]byte, []int) {
func (m *Storage) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Storage.Unmarshal(m, b)
}
func (m *Storage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Storage.Marshal(b, m, deterministic)
}
func (m *Storage) XXX_Merge(src proto.Message) {
xxx_messageInfo_Storage.Merge(m, src)
}
func (m *Storage) XXX_Size() int {
return xxx_messageInfo_Storage.Size(m)
}
func (m *Storage) XXX_DiscardUnknown() {
xxx_messageInfo_Storage.DiscardUnknown(m)
}
......@@ -196,15 +203,19 @@ func (*StorageAction) Descriptor() ([]byte, []int) {
func (m *StorageAction) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_StorageAction.Unmarshal(m, b)
}
func (m *StorageAction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_StorageAction.Marshal(b, m, deterministic)
}
func (m *StorageAction) XXX_Merge(src proto.Message) {
xxx_messageInfo_StorageAction.Merge(m, src)
}
func (m *StorageAction) XXX_Size() int {
return xxx_messageInfo_StorageAction.Size(m)
}
func (m *StorageAction) XXX_DiscardUnknown() {
xxx_messageInfo_StorageAction.DiscardUnknown(m)
}
......@@ -321,13 +332,13 @@ func (*StorageAction) XXX_OneofWrappers() []interface{} {
// 内容存证模型
type ContentOnlyNotaryStorage struct {
//长度需要小于512k
// 长度需要小于512k
Content []byte `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"`
//自定义的主键,可以为空,如果没传,则用txhash为key
// 自定义的主键,可以为空,如果没传,则用txhash为key
Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
// Op 0表示创建 1表示追加add
Op int32 `protobuf:"varint,3,opt,name=op,proto3" json:"op,omitempty"`
//字符串值
// 字符串值
Value string `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
......@@ -344,15 +355,19 @@ func (*ContentOnlyNotaryStorage) Descriptor() ([]byte, []int) {
func (m *ContentOnlyNotaryStorage) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ContentOnlyNotaryStorage.Unmarshal(m, b)
}
func (m *ContentOnlyNotaryStorage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ContentOnlyNotaryStorage.Marshal(b, m, deterministic)
}
func (m *ContentOnlyNotaryStorage) XXX_Merge(src proto.Message) {
xxx_messageInfo_ContentOnlyNotaryStorage.Merge(m, src)
}
func (m *ContentOnlyNotaryStorage) XXX_Size() int {
return xxx_messageInfo_ContentOnlyNotaryStorage.Size(m)
}
func (m *ContentOnlyNotaryStorage) XXX_DiscardUnknown() {
xxx_messageInfo_ContentOnlyNotaryStorage.DiscardUnknown(m)
}
......@@ -387,13 +402,13 @@ func (m *ContentOnlyNotaryStorage) GetValue() string {
return ""
}
//哈希存证模型,推荐使用sha256哈希,限制256位得摘要值
// 哈希存证模型,推荐使用sha256哈希,限制256位得摘要值
type HashOnlyNotaryStorage struct {
//长度固定为32字节
// 长度固定为32字节
Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
//自定义的主键,可以为空,如果没传,则用txhash为key
// 自定义的主键,可以为空,如果没传,则用txhash为key
Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
//字符串值
// 字符串值
Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
......@@ -410,15 +425,19 @@ func (*HashOnlyNotaryStorage) Descriptor() ([]byte, []int) {
func (m *HashOnlyNotaryStorage) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_HashOnlyNotaryStorage.Unmarshal(m, b)
}
func (m *HashOnlyNotaryStorage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_HashOnlyNotaryStorage.Marshal(b, m, deterministic)
}
func (m *HashOnlyNotaryStorage) XXX_Merge(src proto.Message) {
xxx_messageInfo_HashOnlyNotaryStorage.Merge(m, src)
}
func (m *HashOnlyNotaryStorage) XXX_Size() int {
return xxx_messageInfo_HashOnlyNotaryStorage.Size(m)
}
func (m *HashOnlyNotaryStorage) XXX_DiscardUnknown() {
xxx_messageInfo_HashOnlyNotaryStorage.DiscardUnknown(m)
}
......@@ -448,13 +467,13 @@ func (m *HashOnlyNotaryStorage) GetValue() string {
// 链接存证模型
type LinkNotaryStorage struct {
//存证内容的链接,可以写入URL,或者其他可用于定位源文件得线索.
// 存证内容的链接,可以写入URL,或者其他可用于定位源文件得线索.
Link []byte `protobuf:"bytes,1,opt,name=link,proto3" json:"link,omitempty"`
//源文件得hash值,推荐使用sha256哈希,限制256位得摘要值
// 源文件得hash值,推荐使用sha256哈希,限制256位得摘要值
Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"`
//自定义的主键,可以为空,如果没传,则用txhash为key
// 自定义的主键,可以为空,如果没传,则用txhash为key
Key string `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"`
//字符串值
// 字符串值
Value string `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
......@@ -471,15 +490,19 @@ func (*LinkNotaryStorage) Descriptor() ([]byte, []int) {
func (m *LinkNotaryStorage) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_LinkNotaryStorage.Unmarshal(m, b)
}
func (m *LinkNotaryStorage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_LinkNotaryStorage.Marshal(b, m, deterministic)
}
func (m *LinkNotaryStorage) XXX_Merge(src proto.Message) {
xxx_messageInfo_LinkNotaryStorage.Merge(m, src)
}
func (m *LinkNotaryStorage) XXX_Size() int {
return xxx_messageInfo_LinkNotaryStorage.Size(m)
}
func (m *LinkNotaryStorage) XXX_DiscardUnknown() {
xxx_messageInfo_LinkNotaryStorage.DiscardUnknown(m)
}
......@@ -516,15 +539,15 @@ func (m *LinkNotaryStorage) GetValue() string {
// 隐私存证模型,如果一个文件需要存证,且不公开内容,可以选择将源文件通过对称加密算法加密后上链
type EncryptNotaryStorage struct {
//存证明文内容的hash值,推荐使用sha256哈希,限制256位得摘要值
// 存证明文内容的hash值,推荐使用sha256哈希,限制256位得摘要值
ContentHash []byte `protobuf:"bytes,1,opt,name=contentHash,proto3" json:"contentHash,omitempty"`
//源文件得密文,由加密key及nonce对明文加密得到该值。
// 源文件得密文,由加密key及nonce对明文加密得到该值。
EncryptContent []byte `protobuf:"bytes,2,opt,name=encryptContent,proto3" json:"encryptContent,omitempty"`
//加密iv,通过AES进行加密时制定随机生成的iv,解密时需要使用该值
// 加密iv,通过AES进行加密时制定随机生成的iv,解密时需要使用该值
Nonce []byte `protobuf:"bytes,3,opt,name=nonce,proto3" json:"nonce,omitempty"`
//自定义的主键,可以为空,如果没传,则用txhash为key
// 自定义的主键,可以为空,如果没传,则用txhash为key
Key string `protobuf:"bytes,4,opt,name=key,proto3" json:"key,omitempty"`
//字符串值
// 字符串值
Value string `protobuf:"bytes,5,opt,name=value,proto3" json:"value,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
......@@ -541,15 +564,19 @@ func (*EncryptNotaryStorage) Descriptor() ([]byte, []int) {
func (m *EncryptNotaryStorage) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_EncryptNotaryStorage.Unmarshal(m, b)
}
func (m *EncryptNotaryStorage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_EncryptNotaryStorage.Marshal(b, m, deterministic)
}
func (m *EncryptNotaryStorage) XXX_Merge(src proto.Message) {
xxx_messageInfo_EncryptNotaryStorage.Merge(m, src)
}
func (m *EncryptNotaryStorage) XXX_Size() int {
return xxx_messageInfo_EncryptNotaryStorage.Size(m)
}
func (m *EncryptNotaryStorage) XXX_DiscardUnknown() {
xxx_messageInfo_EncryptNotaryStorage.DiscardUnknown(m)
}
......@@ -593,15 +620,15 @@ func (m *EncryptNotaryStorage) GetValue() string {
// 分享隐私存证模型,需要完备的sdk或者相应的密钥库支持
type EncryptShareNotaryStorage struct {
//存证明文内容的hash值,推荐使用sha256哈希,限制256位得摘要值
// 存证明文内容的hash值,推荐使用sha256哈希,限制256位得摘要值
ContentHash []byte `protobuf:"bytes,1,opt,name=contentHash,proto3" json:"contentHash,omitempty"`
//源文件得密文。,用公钥地址加密
// 源文件得密文。,用公钥地址加密
EncryptContent []byte `protobuf:"bytes,2,opt,name=encryptContent,proto3" json:"encryptContent,omitempty"`
//公钥
// 公钥
PubKey []byte `protobuf:"bytes,3,opt,name=pubKey,proto3" json:"pubKey,omitempty"`
//自定义的主键,可以为空,如果没传,则用txhash为key
// 自定义的主键,可以为空,如果没传,则用txhash为key
Key string `protobuf:"bytes,4,opt,name=key,proto3" json:"key,omitempty"`
//字符串值
// 字符串值
Value string `protobuf:"bytes,5,opt,name=value,proto3" json:"value,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
......@@ -618,15 +645,19 @@ func (*EncryptShareNotaryStorage) Descriptor() ([]byte, []int) {
func (m *EncryptShareNotaryStorage) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_EncryptShareNotaryStorage.Unmarshal(m, b)
}
func (m *EncryptShareNotaryStorage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_EncryptShareNotaryStorage.Marshal(b, m, deterministic)
}
func (m *EncryptShareNotaryStorage) XXX_Merge(src proto.Message) {
xxx_messageInfo_EncryptShareNotaryStorage.Merge(m, src)
}
func (m *EncryptShareNotaryStorage) XXX_Size() int {
return xxx_messageInfo_EncryptShareNotaryStorage.Size(m)
}
func (m *EncryptShareNotaryStorage) XXX_DiscardUnknown() {
xxx_messageInfo_EncryptShareNotaryStorage.DiscardUnknown(m)
}
......@@ -670,9 +701,9 @@ func (m *EncryptShareNotaryStorage) GetValue() string {
// 加密存证数据运算
type EncryptNotaryAdd struct {
//源操作数存证索引
// 源操作数存证索引
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
//待操作数据
// 待操作数据
EncryptAdd []byte `protobuf:"bytes,2,opt,name=encryptAdd,proto3" json:"encryptAdd,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
......@@ -689,15 +720,19 @@ func (*EncryptNotaryAdd) Descriptor() ([]byte, []int) {
func (m *EncryptNotaryAdd) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_EncryptNotaryAdd.Unmarshal(m, b)
}
func (m *EncryptNotaryAdd) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_EncryptNotaryAdd.Marshal(b, m, deterministic)
}
func (m *EncryptNotaryAdd) XXX_Merge(src proto.Message) {
xxx_messageInfo_EncryptNotaryAdd.Merge(m, src)
}
func (m *EncryptNotaryAdd) XXX_Size() int {
return xxx_messageInfo_EncryptNotaryAdd.Size(m)
}
func (m *EncryptNotaryAdd) XXX_DiscardUnknown() {
xxx_messageInfo_EncryptNotaryAdd.DiscardUnknown(m)
}
......@@ -718,7 +753,7 @@ func (m *EncryptNotaryAdd) GetEncryptAdd() []byte {
return nil
}
//根据txhash去状态数据库中查询存储内容
// 根据txhash去状态数据库中查询存储内容
type QueryStorage struct {
TxHash string `protobuf:"bytes,1,opt,name=txHash,proto3" json:"txHash,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
......@@ -736,15 +771,19 @@ func (*QueryStorage) Descriptor() ([]byte, []int) {
func (m *QueryStorage) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_QueryStorage.Unmarshal(m, b)
}
func (m *QueryStorage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_QueryStorage.Marshal(b, m, deterministic)
}
func (m *QueryStorage) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryStorage.Merge(m, src)
}
func (m *QueryStorage) XXX_Size() int {
return xxx_messageInfo_QueryStorage.Size(m)
}
func (m *QueryStorage) XXX_DiscardUnknown() {
xxx_messageInfo_QueryStorage.DiscardUnknown(m)
}
......@@ -758,7 +797,7 @@ func (m *QueryStorage) GetTxHash() string {
return ""
}
//批量查询有可能导致数据库崩溃
// 批量查询有可能导致数据库崩溃
type BatchQueryStorage struct {
TxHashs []string `protobuf:"bytes,1,rep,name=txHashs,proto3" json:"txHashs,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
......@@ -776,15 +815,19 @@ func (*BatchQueryStorage) Descriptor() ([]byte, []int) {
func (m *BatchQueryStorage) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_BatchQueryStorage.Unmarshal(m, b)
}
func (m *BatchQueryStorage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_BatchQueryStorage.Marshal(b, m, deterministic)
}
func (m *BatchQueryStorage) XXX_Merge(src proto.Message) {
xxx_messageInfo_BatchQueryStorage.Merge(m, src)
}
func (m *BatchQueryStorage) XXX_Size() int {
return xxx_messageInfo_BatchQueryStorage.Size(m)
}
func (m *BatchQueryStorage) XXX_DiscardUnknown() {
xxx_messageInfo_BatchQueryStorage.DiscardUnknown(m)
}
......@@ -815,15 +858,19 @@ func (*BatchReplyStorage) Descriptor() ([]byte, []int) {
func (m *BatchReplyStorage) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_BatchReplyStorage.Unmarshal(m, b)
}
func (m *BatchReplyStorage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_BatchReplyStorage.Marshal(b, m, deterministic)
}
func (m *BatchReplyStorage) XXX_Merge(src proto.Message) {
xxx_messageInfo_BatchReplyStorage.Merge(m, src)
}
func (m *BatchReplyStorage) XXX_Size() int {
return xxx_messageInfo_BatchReplyStorage.Size(m)
}
func (m *BatchReplyStorage) XXX_DiscardUnknown() {
xxx_messageInfo_BatchReplyStorage.DiscardUnknown(m)
}
......@@ -853,15 +900,19 @@ func (*ReceiptStorage) Descriptor() ([]byte, []int) {
func (m *ReceiptStorage) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReceiptStorage.Unmarshal(m, b)
}
func (m *ReceiptStorage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReceiptStorage.Marshal(b, m, deterministic)
}
func (m *ReceiptStorage) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReceiptStorage.Merge(m, src)
}
func (m *ReceiptStorage) XXX_Size() int {
return xxx_messageInfo_ReceiptStorage.Size(m)
}
func (m *ReceiptStorage) XXX_DiscardUnknown() {
xxx_messageInfo_ReceiptStorage.DiscardUnknown(m)
}
......@@ -925,8 +976,10 @@ var fileDescriptor_0d2c4ccf1453ffdb = []byte{
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConnInterface
var (
_ context.Context
_ 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.
......@@ -935,8 +988,7 @@ const _ = grpc.SupportPackageIsVersion6
// StorageClient is the client API for Storage service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type StorageClient interface {
}
type StorageClient interface{}
type storageClient struct {
cc grpc.ClientConnInterface
......@@ -947,12 +999,10 @@ func NewStorageClient(cc grpc.ClientConnInterface) StorageClient {
}
// StorageServer is the server API for Storage service.
type StorageServer interface {
}
type StorageServer interface{}
// UnimplementedStorageServer can be embedded to have forward compatible implementations.
type UnimplementedStorageServer struct {
}
type UnimplementedStorageServer struct{}
func RegisterStorageServer(s *grpc.Server, srv StorageServer) {
s.RegisterService(&_Storage_serviceDesc, srv)
......
......@@ -2,19 +2,20 @@ package types
import (
"encoding/hex"
"io/ioutil"
secp256k1 "github.com/btcsuite/btcd/btcec"
"github.com/golang/protobuf/proto"
"io/ioutil"
)
//exec type
// exec type
const (
ExecErr = 0
ExecPack = 1
ExecOk = 2
)
//FromHex hex -> []byte
// FromHex hex -> []byte
func FromHex(s string) ([]byte, error) {
if len(s) > 1 {
if s[0:2] == "0x" || s[0:2] == "0X" {
......@@ -28,7 +29,7 @@ func FromHex(s string) ([]byte, error) {
return []byte{}, nil
}
//ToHex []byte -> hex
// ToHex []byte -> hex
func ToHex(b []byte) string {
hex := hex.EncodeToString(b)
// Prefer output of "0x0" instead of "0x"
......@@ -38,7 +39,7 @@ func ToHex(b []byte) string {
return hex
}
//ToHex []byte -> hex
// ToHex []byte -> hex
func ToHexPrefix(b []byte) string {
hex := hex.EncodeToString(b)
// Prefer output of "0x0" instead of "0x"
......@@ -48,7 +49,7 @@ func ToHexPrefix(b []byte) string {
return "0x" + hex
}
//Encode 编码
// Encode 编码
func Encode(data proto.Message) []byte {
b, err := proto.Marshal(data)
if err != nil {
......@@ -57,7 +58,7 @@ func Encode(data proto.Message) []byte {
return b
}
//Decode 解码
// Decode 解码
func Decode(data []byte, msg proto.Message) error {
return proto.Unmarshal(data, msg)
}
......
......@@ -5,14 +5,17 @@ package types
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
proto "github.com/golang/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
var (
_ = proto.Marshal
_ = fmt.Errorf
_ = math.Inf
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
......@@ -41,15 +44,19 @@ func (*WasmAction) Descriptor() ([]byte, []int) {
func (m *WasmAction) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_WasmAction.Unmarshal(m, b)
}
func (m *WasmAction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_WasmAction.Marshal(b, m, deterministic)
}
func (m *WasmAction) XXX_Merge(src proto.Message) {
xxx_messageInfo_WasmAction.Merge(m, src)
}
func (m *WasmAction) XXX_Size() int {
return xxx_messageInfo_WasmAction.Size(m)
}
func (m *WasmAction) XXX_DiscardUnknown() {
xxx_messageInfo_WasmAction.DiscardUnknown(m)
}
......@@ -126,15 +133,19 @@ func (*WasmCreate) Descriptor() ([]byte, []int) {
func (m *WasmCreate) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_WasmCreate.Unmarshal(m, b)
}
func (m *WasmCreate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_WasmCreate.Marshal(b, m, deterministic)
}
func (m *WasmCreate) XXX_Merge(src proto.Message) {
xxx_messageInfo_WasmCreate.Merge(m, src)
}
func (m *WasmCreate) XXX_Size() int {
return xxx_messageInfo_WasmCreate.Size(m)
}
func (m *WasmCreate) XXX_DiscardUnknown() {
xxx_messageInfo_WasmCreate.DiscardUnknown(m)
}
......@@ -175,15 +186,19 @@ func (*WasmCall) Descriptor() ([]byte, []int) {
func (m *WasmCall) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_WasmCall.Unmarshal(m, b)
}
func (m *WasmCall) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_WasmCall.Marshal(b, m, deterministic)
}
func (m *WasmCall) XXX_Merge(src proto.Message) {
xxx_messageInfo_WasmCall.Merge(m, src)
}
func (m *WasmCall) XXX_Size() int {
return xxx_messageInfo_WasmCall.Size(m)
}
func (m *WasmCall) XXX_DiscardUnknown() {
xxx_messageInfo_WasmCall.DiscardUnknown(m)
}
......@@ -235,15 +250,19 @@ func (*QueryCheckContract) Descriptor() ([]byte, []int) {
func (m *QueryCheckContract) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_QueryCheckContract.Unmarshal(m, b)
}
func (m *QueryCheckContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_QueryCheckContract.Marshal(b, m, deterministic)
}
func (m *QueryCheckContract) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryCheckContract.Merge(m, src)
}
func (m *QueryCheckContract) XXX_Size() int {
return xxx_messageInfo_QueryCheckContract.Size(m)
}
func (m *QueryCheckContract) XXX_DiscardUnknown() {
xxx_messageInfo_QueryCheckContract.DiscardUnknown(m)
}
......@@ -274,15 +293,19 @@ func (*CustomLog) Descriptor() ([]byte, []int) {
func (m *CustomLog) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CustomLog.Unmarshal(m, b)
}
func (m *CustomLog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CustomLog.Marshal(b, m, deterministic)
}
func (m *CustomLog) XXX_Merge(src proto.Message) {
xxx_messageInfo_CustomLog.Merge(m, src)
}
func (m *CustomLog) XXX_Size() int {
return xxx_messageInfo_CustomLog.Size(m)
}
func (m *CustomLog) XXX_DiscardUnknown() {
xxx_messageInfo_CustomLog.DiscardUnknown(m)
}
......@@ -314,15 +337,19 @@ func (*CreateContractLog) Descriptor() ([]byte, []int) {
func (m *CreateContractLog) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateContractLog.Unmarshal(m, b)
}
func (m *CreateContractLog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CreateContractLog.Marshal(b, m, deterministic)
}
func (m *CreateContractLog) XXX_Merge(src proto.Message) {
xxx_messageInfo_CreateContractLog.Merge(m, src)
}
func (m *CreateContractLog) XXX_Size() int {
return xxx_messageInfo_CreateContractLog.Size(m)
}
func (m *CreateContractLog) XXX_DiscardUnknown() {
xxx_messageInfo_CreateContractLog.DiscardUnknown(m)
}
......@@ -362,15 +389,19 @@ func (*CallContractLog) Descriptor() ([]byte, []int) {
func (m *CallContractLog) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CallContractLog.Unmarshal(m, b)
}
func (m *CallContractLog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CallContractLog.Marshal(b, m, deterministic)
}
func (m *CallContractLog) XXX_Merge(src proto.Message) {
xxx_messageInfo_CallContractLog.Merge(m, src)
}
func (m *CallContractLog) XXX_Size() int {
return xxx_messageInfo_CallContractLog.Size(m)
}
func (m *CallContractLog) XXX_DiscardUnknown() {
xxx_messageInfo_CallContractLog.DiscardUnknown(m)
}
......@@ -416,15 +447,19 @@ func (*LocalDataLog) Descriptor() ([]byte, []int) {
func (m *LocalDataLog) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_LocalDataLog.Unmarshal(m, b)
}
func (m *LocalDataLog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_LocalDataLog.Marshal(b, m, deterministic)
}
func (m *LocalDataLog) XXX_Merge(src proto.Message) {
xxx_messageInfo_LocalDataLog.Merge(m, src)
}
func (m *LocalDataLog) XXX_Size() int {
return xxx_messageInfo_LocalDataLog.Size(m)
}
func (m *LocalDataLog) XXX_DiscardUnknown() {
xxx_messageInfo_LocalDataLog.DiscardUnknown(m)
}
......
package util
func ToChaincodeArgs(args ...string) [][]byte {
bargs := make([][]byte, len(args))
for i, arg := range args {
bargs[i] = []byte(arg)
}
return bargs
}
\ No newline at end of file
}
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