Hyperledger Sawtooth 中 protobuf 中的编码和创建函数有什么区别?

What is the difference between encode and create functions in protobuf in Hyperledger Sawtooth?

在为 Hyperledger Sawtooth 编写客户端应用程序时, protobuf.Transaction.create() 用于创建交易和 protobuf.TransactionHeader.encode() 用于创建 TransactionHeader。

那么这两个函数到底有什么区别呢?

交易 header 编码方法将交易 header 编码为 base64 编码字节的字符串。

交易包含交易header、交易负载(应用程序数据)和header的签名。 create 方法从 header 和有效负载和签名创建它。

这是一个说明这一点的简单应用程序(使用 protobuf 分支):

https://github.com/danintel/sawtooth-cookiejar/tree/protobuf