Hi-Etherã§å°ã話é¡ã«åºã¦ããuPortãå®éã«è§¦ã£ã¦ã¿ã¾ããã
uPort Developer Portal
uPortã®èª¬æã«ã¤ãã¦ã®èª¬æã¯ãã¡ãã®ããã°ã綺éºã«ã¾ã¨ã¾ã£ã¦ã¾ãã®ã§ãåç
§ãã ããã
zoom-blc.com
ä»åã¯uPort AppManagerã使ã£ã¦Uport Appãèªä½ããæé ã«ã¤ãã¦ã¾ã¨ãã¾ããã
ä½æ¥æé ã¨ãã¦ã¯ä¸è¨ã®å
¬å¼ããã¥ã¡ã³ããè¦ãªããé²ãã¾ããã
http://developer.uport.me/guides.html
1. uPort Mobile Appã®ã¤ã³ã¹ãã¼ã«
ã¾ãã¯ãææã¡ã®ã¹ãã(Android / iOS)ã«uPortã¢ããªãã¤ã³ã¹ãã¼ã«ãã¾ããuPortã§ã¯EOAã§ã¯ãªãã¦ã¼ã¶ã«IDãå²ãå½ã¦ãæ¹éã®ãããä½ããã®deviceãéãã¦Identityãåå¾ããæ¹éã®ããã§ããuPort IDãçæããããã«ã¯SMSãåãåããé»è©±çªå·ãå¿ è¦ã¨ãªãã¾ãã
ããã¯ã¾ãé»è©±åç·ã®å¥ç´ã確èªãããã¨ã§â人âãåºå¥ããã¿ããªã¤ã¡ã¼ã¸ã§ããããï¼ã¡ãªã¿ã«ï¼ã¤ã®é»è©±çªå·ã§è¤æ°ã®IDãåå¾ã§ãã¾ãããªã®ã§ã¢ã«ã¦ã³ãå¶éã«ä½¿ã£ã¦ãããã§ã¯ãªãããã§ãã
å人æ å ±ã®ç»é²
ã¢ãã¤ã«ã¢ããªã®Topç»é¢ãã My Information -> å³ä¸ã«ããEIDTããæ¼ä¸ã§å人æ
å ±ã追å ç»é²ã§ãã¾ãã
ãã®å¦çã¯å¿
é ã§ã¯ããã¾ããã
ç·¨éç»é¢ã§ã¯emailãavaterçã®æ
å ±ãç»é²ã§ãã¾ããããAndroidçã®ã¢ããªã ã¨ããã®å
¥åãã£ã¼ã«ããå£ãã¦ãããã§ãå
¥åä¸ã®æåã表示ããã¾ããï¼æ±ãç»é²èªä½ã¯ã§ãããã§ããã©ãã
2. IPFSã¸ã®ç»é²ã®ç¢ºèª
uPort Identityãä½æããã¨IPFSã«ã¦ã¼ã¶æ
å ±ãã¢ãããã¼ããããããã§ãã
medium.com
IPFSã¸ã®ç»é²ãå®äºãããã©ããã¯ãã¢ãã¤ã«ã¢ããªã®å³ä¸ã®ãã¿ã³ããã¡ãã¥ãéãã¦ã Advanced -> uPort IDãéãã¨ç¢ºèªã§ãã¾ãã
IPFS Profile ã«ä½ããã®æååãè¨é²ããã¦ããã°IPFSã¸ã®è¨é²ãå®äºãã¦ãã¾ãã
ã¡ãªã¿ã«ãIPFSã¸è¨é²ããã¦ããªãã¨ã¢ããªé£æºãRequest Credentialsï¼ãã°ã¤ã³çãªæ©è½ï¼ã使ãã¾ãããé£æºããã¢ããªãé示ãããæ
å ±ãæ¤è¨¼ããããã«IPFSä¸ã«è¨é²ãããå
¬ééµã使ã£ã¦ããããã ã¨æããã¾ããï¼ãã®è¾ºã®ä»çµã¿ã¯ã¾ã 詳ãã調ã¹åãã¦ãªãã®ã§ééã£ã¦ããããï¼
IPFSã¸ã®è¨é²ã¯å¤åï¼æ¥ãããå¾
ã¤ã¨å®äºããããï¼ã¡ãã£ã¨ããããããªãã§ããããã¯ãã¼ã³å´ã«åé¡ããã£ã¦ä»èª¿æ»ä¸çãªIssueãããã¾ããã
github.com
åã¯ç¿æ¥ã«ã¯IPFSã¸è¨é²ããã¦ãã¾ããã
3. uPort AppManagerã§ã¢ããªãä½æãã
uPortã¨é£æºããã¢ããªãä½æããããã«ã¯uPort AppManagerã«å¿
è¦äºé
ãå
¥åãã¦ãsign keyãçæãã¦ãããå¿
è¦ãããã¾ãã
ã¤ã¾ããsign keyã®çæï¼ã¢ããªã®ç»é²ï¼ä½æ ã§ãã
ã§ãuPort AppManagerã使ãããã«ã¯uPort Identityãå¿
è¦ã¨ãªãã¾ãã
AppManagerã«ãã°ã¤ã³ãã
uPort IDã¯åå¾æ¸ã¿ã§ãã®ã§ãæ©éuPort AppManagerã«ãã°ã¤ã³ãã¾ãã以ä¸ã®URLã¸ã¢ã¯ã»ã¹ãã¦ãã ããããã®ä½æ¥ã¯PCã§è¡ã£ã¦ãããã§ããï¼åæ£ç°å¢ï¼ï¼ä»¥éã¯PCä¸ã§uPort AppManagerãéãã¦ããåæã§æ¸ãã¦ãã¾ãã
Uport App Manager
ãããªç»é¢ã表示ããã¾ãã
ä¸ã®éããã¿ã³ãæ¼ä¸ããã¨ä¸è¨ã®ããã«QRã³ã¼ãã表示ããã¾ãã®ã§ããããã¹ããã®uPort Mobile Appã§ã¹ãã£ã³ãã¦èªè¨¼ãã¾ãã
# ã¹ããã§éãã¦ãå ´åã¯ãã¿ã³æ¼ä¸ã§uPort Mobile Appãèµ·åããèªè¨¼è¨±å¯ãæ±ããããã¨æãã¾ãã
ã¹ããã¢ããªããQRã³ã¼ããã¹ãã£ã³ããã«ã¯Topç»é¢ã®å·¦ä¸ã«ããQRã³ã¼ãç»åã®ãã¿ã³ãæ¼ä¸ãã«ã¡ã©ãèµ·åããã¾ãã
QRã³ã¼ããã¹ãã£ã³ããã¨ä¸è¨ã®ããã«uPort AppManagerãæ
å ±é示ãè¦æ±ãã¦ã¾ããã¼ã£ã¦ããç»é¢ãåºãã®ã§ãå³ã®Continueãã¿ã³ãæ¼ä¸ãã¾ãã
ããã§ããããå¾
ã£ã¦ãContinueãã¿ã³ãæå¹åãããªãå ´åã¯ãã¾ã IPFSã¸ã®è¨é²ãå®äºãã¦ããªãããã§ãããã¨ãªããå¾
ã¡ã¾ãããã
AppManagerã§ã¢ããªæ å ±ãç»é²ãã
QRã³ã¼ãã§èªè¨¼ããAppManagerã¸ã®æ
å ±é示ãacceptããã¨ãPCå´ã®ç»é¢ãAppManagerã®Topç»é¢ã¸ èªåçã«åãæ¿ããã¾ãã
AppManagerã«ã¢ããªã®æ å ±ãå ¥åãã¦sign keyãçºè¡ãã
App Nameã¨Descriptionãè¨å ¥ãã¦ä½æãã¾ããä½ææã«ä½åº¦ãuPort Mobile Appã§ã®èªè¨¼ãæ±ãããã¾ããTransactionã¸ã®signã®ç¢ºèªã¨ããªã®ã§ãå¤åãuPort-registerã¸ã®ç»é²ã¨ãããããå¦çãè¡ããã¦ããã£ã½ãã§ãã
ä½æãå®äºããã¨ä¸è¨ã®ãããªç»é¢ã表示ããã¾ãã
Click Here for your App Codeãæ¼ä¸ãã¦ã¢ããªã®ããã®javascriptã³ã¼ãã表示ãããã³ãã¼&ãã¼ã¹ããã¦ãã®ã³ã¼ããä¿åãã¦ããã¦ãã ããããã®ã³ã¼ããä»AppManagerã«ç»é²ãä½æããã¢ããªã®åºæ¬çãªã³ã¼ãã¨ãªãã¾ãã
以ä¸ã§uPort Appã®ä½æã¨ç»é²ã¯å®äºã§ãã次ã¯ããã§çºè¡ãããã³ã¼ãã使ã£ã¦uPortã¨é£æºããèªä½ã®ã¢ããªãä½æãã¦ããã¾ãã
4. èªä½ã¢ããªãä½æãã
uPort AppManagerã§æ°ããã¢ããªãç»é²ããã¨ãã«è¡¨ç¤ºããããµã³ãã«ã³ã¼ããå
ã«å®éã«ã¢ããªãä½ã£ã¦ããã¾ãã
uPortã¨é£æºãããããã®ã©ã¤ãã©ãªã§ããuport-connectã¯node moduleã¨ãã¦å
¬éããã¦ããã®ã§ãä»åã¯Javascriptã使ã£ã¦ã¢ããªãä½æãã¾ãã
ä»åä½ãã¢ããªã®ã¤ã¡ã¼ã¸ã¯
- ã¢ããªããuPortã®ã¢ã«ã¦ã³ãæ å ±ã®é示ããªã¯ã¨ã¹ã
- ã¦ã¼ã¶ã¯ã¢ãã¤ã«ã¢ããªã§QRã³ã¼ããèªã¿åã£ã¦æ å ±é示ãªã¯ã¨ã¹ããacceptãã
- ã¢ããªå´ã®ç»é¢ã§uPortã®ã¢ã«ã¦ã³ãæ å ±ã表示
ã¨ãããã®ãä½ãã¾ããã¡ãªã¿ã«ãã®æµãã¯ä»ã®webã¢ããªã§ããã¨ããã®ãã°ã¤ã³å¦ççãªãã®ã«ç¸å½ãã¾ãã常ã«å¿ è¦ãªå¦çã§ãããåºæ¬ä¸ã®åºæ¬ã¿ãããªãã®ã§ãã
nodeã®ããã¸ã§ã¯ããä½æ
javascriptãªã¢ããªãªã®ã§ã¾ãã¯nodeããã¸ã§ã¯ããä½æãã¾ããnodeã®ç°å¢ã¯ãããããç¨æãã¦ããã¦ãã ããã
mkdir uport-sample cd uport-sample npm init
ã¨ãã¦ãuport-sampleãã£ã¬ã¯ããªä»¥ä¸ã«nodeããã¸ã§ã¯ããä½æãã¾ããããã¸ã§ã¯ãã®è¨å®ã¯ããã©ã«ãã®ã¾ã¾ã§OKã§ãã
http-serverãã¤ã³ã¹ãã¼ã«
ã¨ããããä½ãããã®httpãµã¼ããèµ·åãã¦ã¢ã¯ã»ã¹ãããã®ã§ãä¸çªã·ã³ãã«ãªhttp-serverã¢ã¸ã¥ã¼ã«ã使ãã¾ãã
# å¾ã§ç¢ºèªãã¦ã¿ããå¥ã«webãµã¼ãçµç±ã§ã¢ã¯ã»ã¹ããå¿
è¦ã¯ãªãã£ãã½ãã
npm i http-server
ã§ã¤ã³ã¹ãã¼ã«ãã¾ãã
èµ·åã¯
node_module/.bin/http-server -p 3000
ã§3000çãã¼ãã§èµ·åãã¾ãã
ç»é¢ã¨appç¨ã®jsãã¡ã¤ã«ãä½æ
uPort App Managerãæ示ããã³ã¼ãã¯importå¼ã使ã£ã¦ãã¦ãã®ã¾ã¾ã ã¨åããªãã®ã§ãimporté¨åãç·¨éãã¾ãã
ã¾ããä»åã¯uPortã®ã¢ã«ã¦ã³ãæ
å ±é示è¦æ±ã ãããããªãã®ã§ãattentCredentialsé¨åã¯ã³ã¡ã³ãã¢ã¦ããã¾ãã
ã§ãããããããã£ã¦ä»¥ä¸ã®ãããªindex.htmlã¨sample.jsãä½æãã¾ããã
gist.github.com
uportã¨é£æºããããã«ã¯uport-connectã¢ã¸ã¥ã¼ã«ãå¿
è¦ãªã®ã§index.htmlã§ãã¼ããã¦ãã¾ãã
以ä¸ã§ã¢ããªã¯å®æã§ããå®éã«åããã¦ã¢ã«ã¦ã³ãæ
å ±ãåå¾ã§ããã試ãã¦ã¿ã¦ãã ããã
3000çãã¼ãã§http-serverãèµ·åãã¦ã以ä¸ã®URLã«ã¢ã¯ã»ã¹ããã¨è¡¨ç¤ºãããã¨æãã¾ãã
http://127.0.0.1:3000/
ã¾ã¨ã
å®éã«ã¢ããªãä½æããåã¯ãQRã³ã¼ãã®è¡¨ç¤ºã¨ã¦ã¼ã¶ãacceptããå¾ã®ç»é¢ã®åãæ¿ãé¨åãä½ããªãã¨ãããªãããããã©ããããã ãªãã¨æã£ã¦ããã®ã§ãããuport-connectã¢ã¸ã¥ã¼ã«ããããã®ç»é¢ã¯å ¨é¨èªåã§çæãã¦ãããã®ã§å ¨ãããã©ãããããã¾ããã§ããï¼ï¼ãããï¼
ãµã³ãã«ã¢ããªã®ä½æãéãã¦æ¹ãã¦ç解ããã®ã§ãããuPortã¨é£æºããå ´åå¿
ãã¦ã¼ã¶ã®æ¿èªãå¿
è¦ã«ãªãã¾ããããã¯ã¾ãã«èªå·±ä¸»æ¨©åã®IDãµã¼ãã¹ã ãªã¨æãã¾ããã
ã¾ãããµã¼ãã¹ãããã¤ãå´ããè¦ã¦ããã¦ã¼ã¶ãã¢ã«ã¦ã³ãæ
å ±ãç»é²ããã®ã§ã¯ãªãããã¾ã§uPortãä»ãã¦åå¾ãã¦ããã®ã§ãã¦ã¼ã¶ã¼èªèº«ãèªåã®æ
å ±ãç¶æ³ã«åããã¦å½ããã¨ãé常ã«é£ãããªã£ã¦ããã¨ããã®ã大ããªå©ç¹ã ã¨æãã¾ããã
ä»åã¯ãã°ã¤ã³ã«ç¸å½ããã¢ã«ã¦ã³ãæ å ±ã®é示å¦çé¨åã®æ©è½ã ãç©ã¢ããªã®ä½ãæ¹ã«ã¤ãã¦åãæ¥ãã¾ã¨ãã¾ãããå¼ãç¶ããattentCredentialãèªä½ã®ã¹ãã³ã³ã¨ã®é£æºæ¹æ³ãªã©ã調æ»ãã¦ã¾ã¨ãã¦ãããã¨æãã¾ãã