-
Notifications
You must be signed in to change notification settings - Fork 255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
区块链支持多种地址格式 #1181
Comments
主要看下根据地址确定地址类型是否需要通用化, 其他基本没问题
|
This was referenced Mar 2, 2022
Closed
bysomeone
added a commit
to bysomeone/chain33
that referenced
this issue
Mar 21, 2022
bysomeone
added a commit
to bysomeone/chain33
that referenced
this issue
Mar 21, 2022
vipwzw
pushed a commit
that referenced
this issue
Mar 21, 2022
🎉 This issue has been resolved in version 1.67.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
目前区块链大部分情况下只有一种地址,比如 eth,所有的合约和普通地址都是 0x开头的hex 格式的地址。长度20个字节。对比特币之类的来说,有两类地址,一类是 1开头的普通地址,一类是 3开头的多重签名地址。
考虑到更好的兼容性,比如在做以太坊二层链的时候,我们希望用户的资产能保存在以太坊地址上,我们希望能扩展地址的格式。
主要支持两种格式:
一种是 base58 的地址,这类地址,比如比特币,比特币多重签名,莱特币,都用的是这类地址,区别是version 版本不同,比特币是10多重签名 是 5,判断地址类型的时候,可以通过 decode base58 来判断。
一种是hex 开头的地址,也就是以太坊地址,通过0x 前缀,以及hex的长度,可以判断出地址类型。
example:
address_type=['eth'] 只支持以太坊格式地址
address_type=['base58,0', 'base58,5', 'base58,9', 'eth'] 支持base58 版本号 0 ,5, 9 支持 以太坊格式。
指定合约地址类型:合约地址只能固定一种类型,不能多种格式。
检查签名的时候要根据from to 地址不同,做不一样的处理。比如from 是 eth 类型,就要把公钥转化成 eth 地址,比较是否相同,然后检查签名是否正确,其他地址类型也是相同的。
允许后期通过 mver 增加地址类型,参考其他的配置,但是不允许减少地址类型,需要对配置文件进行检查,因为减少地址类型,意味着在原来地址格式下的资产都不能用。
对地址模块进行插件化设计,允许添加更多地址类型。
比如 币安链的 bnb+base58的地址类型:
bnb136ns6lfw4zs5hg4n85vdthaad7hq5m4gtkgf23
The text was updated successfully, but these errors were encountered: