本節主要就是一個新手教學,讓人先了解遊戲玩法及闖關模式,只要對MetaMask及JavaScript, console等有基本認識就不會有難度。如果在本節已經感到困難,建議先學習基礎的JavaScript知識再來挑戰。
打開Developer Console (F12) ,輸入
player
會回傳當前錢包地址。
依步驟了解指令用法,按 Get new instance 開始闖關。MetaMask會彈出交易請求,確認以部署關卡合約,關卡正式開始。
打開Developer Console (F12) ,依次輸入:
> await contract.info()
< "You will find what you need in info1()."
> await contract.info1()
< "Try info2(), but with "hello" as a parameter."
> await contract.info2("hello")
< "The property infoNum holds the number of the next info method to call."
> await contract.infoNum()
< BN {negative: 0, words: [42, empty], length: 1, red: null}
> await contract.info42()
< "theMethodName is the name of the next method."
> await contract.theMethodName()
< "The method name is method7123949."
> await contract.method7123949()
< "If you know the password, submit it to authenticate()."
> await contract.password()
< "ethernaut0"
> await contract.authenticate("ethernaut0")
最後會彈出一個MetaMask的交易請求,確認後再按Submit instance,再確認後Console會彈出 “You have completed this level!!!” 即本關完成。