cosmos-sdk 开发流程
2018-11-09 09:37:33 6 举报
登录查看完整内容
cosmos
作者其他创作
大纲/内容
// 创建一个新的链
// 注册消息
// 签名、构建发送消息并提交
cmd/gaia/app/app.go@NewGaiaApp
func NewSaveBiz()func (msg SaveBiz) Type()func (msg SaveBiz) GetMsg()func (msg SaveBiz) GetSignBytes()func (msg SaveBiz) ValidateBasic()func (msg SaveBiz) GetSigners()func (msg SaveBiz) GetSignatures()
mytx.RegisterWire(cdc)
tendermint core
gameHub
SignAndBuild()-MarshalBinary:@L21BroadcastTx()BroadcastTxCommit()
mytx/client/sendtx.go@SendTxCmd
BuildMsg()
x/mytx/msg.go
交易结束
mytx/client/context/helper.go
// 将用户输入的数据构建成消息
BlockChain
// 签名并广播交易
MarshalBinary()// golang obj-json string
// 构建交易
KVStore
// 消息处理
EnsureSignBuildBroadcast()
Cosmos-SDK 自定义消息处理流程
app
entChain
cdc := MakeCodec()var app = &GaiaApp{ keyMytx: sdk.NewKVStoreKey(\"mytx\")}... ...app.Router(). AddRoute(\"mytx\
// 为新消息类型增加命令行参数
cmd/gaia/cmd/gaiad/main.go
用户
x/mytx/client/utils.go@BuildMsg
cmd/gaia/app/app.go@MakeCodec
// 处理新增客户端命令
Gaiacli
// 实现消息所需接口
github.com/tendermint/go-amino/amino.go
cmd := &cobra.Command{ Use: \"mytx\
app.NewGaiaApp
x/mybiz/handler.go@NewHandler()
cmd/gaia/cmd/gaiacli/main.go@main
Unmarshal:json string - golang objectMarshal: golang object - json string输入密码:client/context/helper.go@EnsureSignBuildBroadcast
mytx/wire.go@RegisterWire
// 设置Store和Router
Gaiad
收藏
0 条评论
回复 删除
下一页