MGCToken钱包生成助记词的流程分析!MGC钱包APP其实就是一个Web网站,只不过把这个网站封装成了APP。
复现MGC钱包的注册流程(含手机截图以及注册流程的抓包数据):
#第一步,输入手机号发送验证码
POST/api/sendSmsHTTP/1.1
Host:www.lianjiedu.com
Content-Type:application/x-www-form-urlencoded;charset=UTF-8
Origin:http://www.lianjiedu.com
Cookie:__jsluid=c4ff810fd0b81ee6a2a53asf5f442b05
Connection:close
Accept:application/json,text/javascript,*/*
User-Agent:Mozilla/5.0(iPhone;CPUiPhoneOS8_4likeMacOSX)AppleWebKit/600.1.4(KHTML,likeGecko)Mobile/12H143
Content-Length:122
Accept-Language:zh-cn
Accept-Encoding:gzip,deflate
area_code=%2B86&mobile=131********&style=1&lang_id=1iBH****1DDu1qS2&img_code=6460&tmp=&keyid=
#第二步,验证手机号验证码是否正确
POST/api/verify/smsHTTP/1.1
Host:www.lianjiedu.com
Content-Type:application/x-www-form-urlencoded;charset=UTF-8
Origin:http://www.lianjiedu.com
Cookie:__jsluid=c4ff810fd0b81ee6a2a53asf5f442b05
Connection:close
Accept:application/json,text/javascript,*/*
User-Agent:Mozilla/5.0(iPhone;CPUiPhoneOS8_4likeMacOSX)AppleWebKit/600.1.4(KHTML,likeGecko)Mobile/12H143
Content-Length:98
Accept-Language:zh-cn
Accept-Encoding:gzip,deflate
area_code=%2B86&mobile=131********&lang_id=1iBH****1DDu1qS2&sms_code=55826*&keyid=
#第三步,提交手机号,密码进行注册
POST/api/regHTTP/1.1
Host:www.lianjiedu.com
Content-Type:application/x-www-form-urlencoded;charset=UTF-8
Origin:http://www.lianjiedu.com
Cookie:__jsluid=c4ff810fd0b81ee6a2a53asf5f442b05
Connection:close
Accept:application/json,text/javascript,*/*
User-Agent:Mozilla/5.0(iPhone;CPUiPhoneOS8_4likeMacOSX)AppleWebKit/600.1.4(KHTML,likeGecko)Mobile/12H143
Content-Length:146
Accept-Language:zh-cn
Accept-Encoding:gzip,deflate
person=这里是邀请码&mobile=131********&area_code=%2B86&password=123456&repassword=123456&lang_id=1iBH****1DDu1qS2&sms_code=55826*&keyid=
#第四步,注册成功后,进行登陆
POST/api/loginHTTP/1.1
Host:www.lianjiedu.com
Content-Type:application/x-www-form-urlencoded;charset=UTF-8
Origin:http://www.lianjiedu.com
Cookie:__jsluid=c4ff810fd0b81ee6a2a53asf5f442b05
Connection:close
Accept:application/json,text/javascript,*/*
User-Agent:Mozilla/5.0(iPhone;CPUiPhoneOS8_4likeMacOSX)AppleWebKit/600.1.4(KHTML,likeGecko)Mobile/12H143
Content-Length:129
Accept-Language:zh-cn
Accept-Encoding:gzip,deflate
mobile=131********&lang_id=1iBH****1DDu1qS2&password=123456&area_code=%2B86&captcha=1675&tmp=&keyid=
#第五步,登陆后会让你设置交易密码
POST/api/user/tpassword/setHTTP/1.1
Host:www.lianjiedu.com
Content-Type:application/x-www-form-urlencoded;charset=UTF-8
Origin:http://www.lianjiedu.com
Cookie:__jsluid=c4ff810fd0b81ee6a2a53asf5f442b05
Connection:close
Accept:application/json,text/javascript,*/*
User-Agent:Mozilla/5.0(iPhone;CPUiPhoneOS8_4likeMacOSX)AppleWebKit/600.1.4(KHTML,likeGecko)Mobile/12H143
Content-Length:127
Accept-Language:zh-cn
Accept-Encoding:gzip,deflate
password=123456&re_password=123456&lang_id=1iBH****1DDu1qS2&keyid=注册的账号ID&token=注册的账号token
#第六步,设置好交易密码,会发送一个请求去服务器,服务器返回一个助记词给你
POST/api/user/create_mnemonicHTTP/1.1
Host:www.lianjiedu.com
Content-Type:application/x-www-form-urlencoded;charset=UTF-8
Origin:http://www.lianjiedu.com
Cookie:__jsluid=c4ff810fd0b81ee6a2a53asf5f442b05
Connection:close
Accept:application/json,text/javascript,*/*
User-Agent:Mozilla/5.0(iPhone;CPUiPhoneOS8_4likeMacOSX)AppleWebKit/600.1.4(KHTML,likeGecko)Mobile/12H143
Content-Length:92
Accept-Language:zh-cn
Accept-Encoding:gzip,deflate
keyid=注册的账号I&lang_id=1iBH****1DDu1qS2&token=注册的账号token
服务端返回的内容如下:
HTTP/1.1200OK
Date:Thu,06Jun201907:15:15GMT
Content-Type:application/json;charset=utf-8
Connection:close
Vary:Accept-Encoding
Vary:Accept-Encoding
Expires:Thu,06Jun201919:15:15GMT
Cache-Control:max-age=43200
X-Via-JSL:521820e,-
X-Cache:bypass
Content-Length:404
{"data":{"account":"0x9faD3c6731854AC22922272c53b05E966E4278cf","cid":1."mnemonic":"EmbodyHoneyDaughterFlushLayerBrickArmorPuzzleDangerLayerStartperson","pbKey":"fd4a35e8bffda4cd0edfefa5d0ad911b5a2a2fb8076e10bbd68a02c5c191591afd4a35e8b8c25fb33590f3980562b4b7923669d90206ed907d202c5c191591afd4","prKey":"6e10bbd68a02c5c1991591afd4a35e8bf202de5c610d03c63ce20fda40206ec"},"msg":"","status":1."url":""}
关于 MGC 服务端返回的JSON部分参数解释:
{
“data”: {
“account”: “0x9faD3c6731854AC22922272c53b05E966E4278cf”, //这就是你的钱包地址
“cid”: 1.
“mnemonic”: “Embody Honey Daughter Flush Layer Brick Armor Puzzle Danger Layer Start person”, //这是你的助记词
“pbKey”: “fd4a35e8bffda4cd0edfefa5d0ad911b5a2a2fb8076e10bbd68a02c5c191591afd4a35e8b8c25fb33590f3980562b4b7923669d90206ed907d202c5c191591afd4”,
“prKey”: “6e10bbd68a02c5c1991591afd4a35e8bf202de5c610d03c63ce20fda40206ec”
},
“msg”: “”,
“status”: 1.
“url”: “”
}
关于这里的助记词有几句话要说:
这里很清楚的能看到助记词是由服务端创建好之后再发给你的,也就是说,给你的助记词不仅仅只有你一个人知道,MGC钱包的服务端也会知道,因为助记词是服务端给你的。
而助记词对用户来说意味着什么?意味着钱包的所有权,所以理论上来说MGC是拥有你的钱包所有权的。
有这样一个故事,用户在MGC钱包生成了助记词,然后拿着助记词导入了去中心化钱包,然后用户正常的使用着这个钱包,并且给这个钱包充值了很多钱,有一天,用户的钱包在去中心化钱包里被盗了,而此时用户信心满满的说他从未泄露过助记词,却不曾想到这个助记词是MGC钱包给他的。
相关流程截图: