以太坊的Transcation结构如下:
// 以下为交易本身数据信息
let accountNonce: UInt64
let price: BigInt
let gasLimit: BigInt
let recipient: Address
let amount: BigUInt
var payload: Data?
// 以下为签名信息
var V: BigInt
var R: BigInt
var S: BigInt
对交易签名步骤如下:
- 对交易本身进行rlp编码,再对rlp编码进行keccak256哈希
- 对第一步的结果进行椭圆曲线ecdsa的签名
- 对第二步的结果进行拆解,分别赋值到V R S中
最终V R S即为签名信息,可以从V R S得到发送者的地址
作者:Xiao_Li
链接:https://www.jianshu.com/p/9b225033762e
來源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。