Documentation ¶
Index ¶
- Variables
- func HashToInt(hash []byte, c elliptic.Curve) *big.Int
- func PublicKeyImpl(Sign SignData, hash common.Hash) ([]byte, error)
- func PublicKeyVerify(pd *PublicKeyData) (result int)
- type BetData
- type BetSignData
- type CallCardData
- type Card
- type ChangeSeatData
- type CheckOutData
- type CheckOutKeyData
- type CheckOutOriginalData
- type CheckOutSignData
- type DealCardData
- type DealOP
- type DealOPBackup
- type DeskCommonData
- type DeskID
- type EcPoint
- type EcPointData
- type FinalShuffSignData
- type GameBetData
- type Judgment
- type KeyCardData
- type KeyType
- type LeaveData
- type LogicData
- type MsgAck
- type MsgCodeType
- type MsgData
- type MsgWrap
- func (msg *MsgWrap) Hash() common.Hash
- func (msg *MsgWrap) PublicKey() ([]byte, error)
- func (msg *MsgWrap) Signature(ks *keystore.KeyStore, address common.Address) error
- func (msg *MsgWrap) SignatureInter(ks *keystore.KeyStore, address common.Address) error
- func (msg *MsgWrap) VerifySignature() bool
- func (msg *MsgWrap) VerifySignatureInter() bool
- type NotaireContext
- type NotairePK
- type NotaireSign
- type NotifyNotaryData
- type PointPair
- type PublicKey
- type PublicKeyData
- type SeatID
- type SettleSignData
- type ShuffleData
- type ShuffleDataRsp
- type SignData
- type SitData
- type SitReusltData
- type StatusData
- type SumpointSignData
- type SumpublicKeySignData
- type UserID
- type Witness
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrInvalidSig = errors.New("invalid transaction v, r, s values")
)
Functions ¶
func PublicKeyVerify ¶
func PublicKeyVerify(pd *PublicKeyData) (result int)
Types ¶
type BetSignData ¶
type CallCardData ¶
callCardData 收到callCardData更新牌点游标
type ChangeSeatData ¶
type CheckOutData ¶
type CheckOutData struct { CokData CheckOutKeyData CooData CheckOutOriginalData Sign []byte //对CooData 的签名 }
type CheckOutKeyData ¶
CheckOutKeyData 弃牌玩家发出的密钥
type CheckOutOriginalData ¶
type CheckOutOriginalData struct { DeskID []byte ID SeatID CsData CheckOutSignData }
type CheckOutSignData ¶
type DealCardData ¶
type DealCardData struct { Cursor []uint SeatTo SeatID Open bool DeskID string Signs string ID SeatID }
dealCardData 给自己发明牌或者发公共明牌时才发消息
type DealOPBackup ¶
type DeskCommonData ¶
type DeskCommonData struct { Points []*PointPair //洗完后的牌点点对 //不能用map,map无法用rlp编码, PointSumMapCard []EcPoint //同OriginalPoint,只是没转换成点对,不需要转换成点对 PublicCards []Card //桌子上公共的牌,从消息列表中无法获取的 BetData []GameBetData BetData2 []byte CurTurn SeatID FoldSeats []SeatID //FoldSeats跟FoldMsg相当于map FoldMsg []MsgWrap }
用于下注共识签名和公证,与其它阶段的区分开,下注前的阶段的只需要一个数据,后面都需要多个
type EcPoint ¶
type EcPoint struct { //X, Y *big.Int PointBytes [65]byte //secp256k1.S256().Marshal(point.X, point.Y) }
func PointVerify ¶
func PointVerify(pd *EcPointData) (result int, ep []*EcPoint)
type EcPointData ¶
ecPointData 牌点消息
type FinalShuffSignData ¶
type GameBetData ¶
type KeyCardData ¶
type KeyCardData struct { Cursor []uint K []*PublicKey E []*big.Int Z []*big.Int OP uint SeatTo SeatID DeskID []byte ID SeatID }
keyCardData 收到dealCardData 找出对应牌点的密钥,发回去。
type KeyType ¶
type KeyType = ecdsa.PrivateKey
type LogicData ¶
type LogicData struct { SrcSeat SeatID Code MsgCodeType Data []byte }
type MsgAck ¶
type MsgAck struct { Deskid DeskID DestSeat SeatID SrcSeat SeatID MsgCode MsgCodeType //消息类型 code = 自定义的消息类型 SeqNum uint32 }
type MsgCodeType ¶
type MsgCodeType = uint64
const ( // Protocol messages belonging to poker1 StatusMsgCode MsgCodeType = 0x00 TransferMsgCode MsgCodeType = 0x01 AckMsgCode MsgCodeType = 0x02 DiffMsgCode MsgCodeType = 0x03 //提交分歧给公证者 NotifySubmitMsgCode MsgCodeType = 0x04 //通知另一方提交公证 //游戏开始前座位与状态消息 SitDownMsgCode MsgCodeType = 0x10 SitDownResultMsgCode MsgCodeType = 0x11 OnSitDownMsgCode MsgCodeType = 0x12 LeaveMsgCode MsgCodeType = 0x13 ChangeSeatMsgCode MsgCodeType = 0x14 ChangeSeatResultMsgCode MsgCodeType = 0x15 )
for message wrap
const ( GameMsgWapDataCode MsgCodeType = 0x20 //游戏层消息包装 EcPointDataCode MsgCodeType = 0x21 //牌点生成消息 SumPointSignDataCode MsgCodeType = 0x22 //牌点和签名消息 PublicKeyDataCode MsgCodeType = 0x23 //生成公钥消息 SumpublicKeySignDataCode MsgCodeType = 0x24 //公钥和签名消息 ShuffleDataCode MsgCodeType = 0x25 //洗牌消息 FinalshuffleSignDataCode MsgCodeType = 0x26 //最终洗牌结果签名消息 KeyCardDataCode MsgCodeType = 0x27 // 密钥消息 )
for gamengine
type MsgWrap ¶
type MsgWrap struct { GameAddress common.Address Deskid DeskID //桌子ID Hand uint64 //局数 DestSeats []SeatID //期望接收消息的位置 SrcSeat SeatID //发送消息的位置 Handler SeatID //需要处理的位置 MsgCode MsgCodeType //消息类型 send code = 自定义的消息类型 ack code =2 SeqNum uint32 //消息序号 //Data interface{} Data []byte //消息内容 Sign SignData //签名 InterSign SignData //inter签名 }
func (*MsgWrap) Hash ¶
Hash returns the hash to be sned by the sender. It does not uniquely identify the transaction.
func (*MsgWrap) SignatureInter ¶
func (*MsgWrap) VerifySignature ¶
func (*MsgWrap) VerifySignatureInter ¶
type NotaireContext ¶
type NotaireContext struct { GameAddress common.Address //标识游戏,公证者可根据此项下载lua代码,还有房间abi等 Version uint8 Wt *Witness // From SeatID //谁提交上来的 Hand uint32 MsgList []MsgWrap //上一次共识到现在出现异常时收集的消息列表 DeskID []byte //牌点求和哈希值 TableCtr uint64 //合约中table id Sign SignData //签名 }
func (*NotaireContext) Hash ¶
func (nc *NotaireContext) Hash() common.Hash
Hash returns the hash to be sned by the sender. It does not uniquely identify the transaction.
func (*NotaireContext) PublicKey ¶
func (nc *NotaireContext) PublicKey() ([]byte, error)
func (*NotaireContext) VerifySignature ¶
func (nc *NotaireContext) VerifySignature() bool
type NotaireSign ¶
type NotifyNotaryData ¶
type PublicKeyData ¶
publicKeyData 公钥消息
type SeatID ¶
type SeatID = uint8 //int8无法序列化
SeatID int//http://colobu.com/2017/06/26/learn-go-type-aliases/ 了解 Go 1.9 的类型别名
type SettleSignData ¶
type ShuffleData ¶
shuffleData 洗牌消息
type SitData ¶
type SitData struct { GameAddress common.Address Desk DeskID Seat SeatID ID UserID Address common.Address }
SitData 成员是要公开的,即首字母大写,否则会失败
type SitReusltData ¶
type SitReusltData struct {
SeatList []*SitData
}
type StatusData ¶
statusData is the network packet for the status message.
type SumpointSignData ¶
type SumpublicKeySignData ¶
sumpublicKeyDataRsp 公钥求和生成共识
Click to show internal directories.
Click to hide internal directories.