ethereum/EIPs-191 Signed Data Standard
https://github.com/ethereum/EIPs/blob/master/EIPS/eip-191.md
| eip | title | author | status | type | category | created |
|---|---|---|---|---|---|---|
|
191
|
Signed Data Standard
|
Martin Holst Swende (@holiman), Nick Johnson <arachnid@notdot.net>
|
Draft
|
Standards Track
|
ERC
|
2016-01-20
|
摘要
这个ERC提议了一个关于如何在以太坊合约中处理签名数据的详细说明。
动机
一些接受presigned交易的多签名钱包应用已经出现了。一笔presigned交易就是一堆二进制的signed_data,同时包含签名(r, s, v)。因为对signed_data的解释并不具体,导致了一些问题:
- 标准的以太坊交易可以作为
signed_data提交。一笔以太坊交易可以拆解成这几个组件:RLP<nonce, gasPrice, startGas, to, value, data>(这里被称为RLPdata),r,s,v。如果对signed_data没有句法约束,这就意味着RLPdata可以用作句法有效的presigned交易。 - 多签名钱包同样也有问题:
presigned交易并不和一个特定的validator绑定在一起,举一个特定钱包的例子:i. 用户
A,B和C有2/3-钱包Xii. 用户
A,B和D有2/3-钱包Yiii. 用户
A和B提交了一个presigned交易给Xiv. 攻击者可以复用他们的给X的
presigned交易,然后提交给Y。
说明
我们为signed_data提议了以下格式:
0x19 <1 byte version> <version specific data> <data to sign>.
版本0对于版本特定数据有<20字节地址>,这个地址就是预期的验证者。在多签名钱包的例子中,就是钱包自己的地址。
最初的0x19字节用来确保signed_data不是有效的RLP
对于单个值为[0x00, 0x7f]的字节,字节的RLP编码就是它本身
这意味着任何signed_data不能是一个RLP结构,而是1个字节的RLP,后面再加上一些别的内容。
因此,任何ERC-191 signed_data永远不会是一笔以太坊交易。
额外地,之所以用0x19是因为自从ethereum/go-ethereum#2940,下面的一行文字会在personal_sign方法中预添加在要签名的hash数据之前:
"\x19Ethereum Signed Message:\n" + len(message).
因此,使用0x19是为了可以扩展这个模式,通过定义一个版本 0x45(E)来处理这种类型的签名。
版本字节登记
| Version byte | EIP | Description |
|---|---|---|
0x00 |
191 | Data with intended validator |
0x01 |
712 | Structured data |
0x45 |
191 | personal_sign messages |
就是如果版本为0x00,那么后面还会跟着intened validator(address),然后才是data
如果是0x01,那么后面后面跟着的就是结构化数据,什么是结构化数据,看EIP-721
如果是0x45,那么后面后面跟着的就是进行personal_sign后的信息
ethereum/EIPs-191 Signed Data Standard的更多相关文章
- ethereum/EIPs-1077 Executable Signed Messages
https://github.com/alexvandesande/EIPs/blob/ee2347027e94b93708939f2e448447d030ca2d76/EIPS/eip-1077.m ...
- ethereum/EIPs-712 Ethereum typed structured data hashing and signing
https://github.com/ethereum/EIPs/blob/master/EIPS/eip-712.md eip title author discussions-to status ...
- ethereum/EIPs-1078 Universal login / signup using ENS subdomains
https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1078.md eip title author discussions-to status ...
- ethereum/EIPs-1271 smart contract
https://github.com/PhABC/EIPs/blob/is-valid-signature/EIPS/eip-1271.md Standard Signature Validation ...
- ethereum/EIPs-725
https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md eip title author discussions-to status ...
- Ethereum White Paper
https://github.com/ethereum/wiki/wiki/White-Paper White Paper EditNew Page James Ray edited this pag ...
- go ethereum源码分析 PartIV Transaction相关
核心数据结构: core.types.transaction.go type Transaction struct { data txdata // caches hash atomic.Value ...
- ethereum/EIPs-1
https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1.md 介绍了什么是EIP等等的详细信息: eip title status type a ...
- solidity return data和revert/require的reason string的获得
前言: 在使用solidity写智能合约的时候,会使用到revert和require来进行断言,比如: require(tokenOwner[tokenId] == 0x0,'this is not ...
随机推荐
- Install/Remove of the Service Denied!
在windos 的cmd下安装mysql 在mysql的bin目录下面执行: mysqld --install 报错: 信息如下一: Install/Remove of the Service Den ...
- When should you use a class vs a struct in C++?
Question: In what scenarios is it better to use a struct vs a class in C++? Answer: The only differe ...
- Linux Centos下安装jdk
1.准备工作 https://www.cnblogs.com/dddyyy/p/9746942.html 上面这篇博客讲了如何安装linux 你想安装的jdk(对应版本的jdk) 连接Linux的软件 ...
- JavaScript有这几种测试
译者按: 也许你讨厌测试,但是你不得不面对它,所以至少区分一下单元测试.集成测试与功能测试?对吧... 原文: What are Unit Testing, Integration Testing a ...
- 纯CSS绘制mac代码
1.效果图 2.代码 <!doctype html> <html lang="en"> <head> <meta charset=&quo ...
- centos7学习笔记-安装后的一些配置
我的邮箱地址:zytrenren@163.com欢迎大家交流学习纠错! 一.允许普通用户使用sudo root用户下运行 visudo 在root ALL=(ALL)ALL下面添加 username ...
- c语言学习笔记-continue
我的邮箱地址:zytrenren@163.com欢迎大家交流学习纠错! 一.continue函数意义 用于跳过本次循环余下语句,转去判断是否需要执行下次循环 二.continue使用案例 编写代码,对 ...
- The open source JavaScript graphing library that powers Plotly
https://plot.ly/javascript/time-series/ https://plot.ly/javascript/ https://github.com/plotly/plotly ...
- mysql学习目录
MySQL数据库 mysql 之库, 表的简易操作 mysql之行(记录)的详细操作 mysql之单表查询 mysql之多表查询 Navicat安装及简单使用 mysql之Navicat工具.pymy ...
- vue 环境的搭建及初始化项目
其实超级简单,虽然网上很多,但是我顺便记录下相当于做笔记吧 1nodejs 的安装, 在node官网下载,点击安装,安装的时候最好选择路径在d盘 2设置环境变量 我的电脑-->属性-->系 ...