BlockChain <- SC_Transaction <-> SmartContact -> DVM
SC_Transaction
// this structure is json/msgpack encodeable to enable seamless RPC support
// this is passes as tx data
type SC_Transaction struct {
SC string `msgpack:"SC,omitempty" json:"sc,omitempty"` // smart contract to be installed is provided here
SCID crypto.Key `msgpack:"I,omitempty" json:"scid,omitempty"` // to which smart contract is the entrypoint directed, 64 bytes hex
EntryPoint string `msgpack:"E,omitempty" json:"entrypoint,omitempty"`
Params map[string]string `msgpack:"P,omitempty" json:"params,omitempty"`// all parameters in named form
Value uint64 `msgpack:"-" json:"value,omitempty"` // DERO to transfer to SC
}
这里的 SC
表示智能合约源代码(字符串,没有结构),区别于后面的 SmartContract
那是可解析执行代码(结构化数据)。
Verify_SC_Signature
// verifies a SC signature
先简单验证数据的完整性,然后基于密码学用公钥验证签名。
有意思的是:DERO 签名的时候使用到了“密钥镜像”做为被签名数据的来源之一,以防止重放攻击。