OH Week1 Overview
HomeWork 架設私有區塊鏈發送第一筆交易
Overview
1 Install Geth
Windows 在這裡下載並選擇相對應的版本。 https://geth.ethereum.org/downloads/#
使用以下指令測試是否安裝成功。
MacOSX 也可以直接使用:
2 Create Directory Structure
隨意建立一個資料夾,假設叫做「myPrivateChain」,進入該資料夾當作我們目前的專案位置。
3 Create a Genesis Configuration
建立創世區塊的參數用檔案,將其命名為 genesis.json
。
EIPs 是以太坊中的一套標準,內容會包含 core protocol specifications、用戶 API、和合約標準。
gas 是一個在與合約進行交易時的內部價格,當我們傳送一些指令給 Ethereum Virtual Machine (EVM) 來進行交易或與合約互動時就會消耗一定量的 gas。
4 Initialize the genesis.json
初始化,輸入以下指令來建立初始區塊。
--datadir data
: 使區塊儲存於 data 資料夾中。
5 Start!
啟動私有鏈
networkid 選項後面跟一個數字,指定這個私有鏈的網絡 ID 為 123456。
更多參數(查看 go 之後有些已不能使用)
如果要查看更多的參數可以參閱 Management-APIs
6 Attach Javascript Console
在這個交互式的 Javascript 執行環境中,>
是命令提示符。在這個環境裡也內置了一些用來操作以太坊的 Javascript 對象,可以直接使用這些對象:
也可以在 GO-Ethereum 的官方文件找到一些指令!
7 Management the Private Chain
查看所有帳號還有帳號存款,accounts 是一個陣列所以也可以使用[] 陣列取值運算子來取用
,也可以使用新變數來表示帳號字串:
查看節點資訊(如果要使用更多 admin 指令可以參閱在 go-ethereum 的 Wiki):
建立新帳戶,其中的字串為預設密碼:
查看礦工帳號,系統預設礦工帳號會是第一個帳號:
8 Transfer Ether
解鎖帳號。每次進行交易都需要解鎖帳號,這邊的 myEthereumAddress
要填入想要交易的帳號,也可以使用 eth.accounts[1]
取用所有帳號裡面的任一個:
之後出現的 Passphrase
就是輸入密碼的意思,輸入創建晃時的密碼就可以成功解鎖!
發送交易,我們想要將 eth.accounts[1]
的錢錢匯給 myEthereumAddress
:
這裡需要注意的是如果匯出帳戶沒錢也會出現錯誤!
此時來查看 myEthereumAddress
的餘額:
發現沒有被處理,此時我們可以查看 txpool 來驗證,發現其中有一條 pending 的交易,pending 就表示已提交但還未被處理的交易。
要使交易被處理就需要挖礦啦,詳情請看下個章節!
9 Mining Time
我們可以使用以下指令來更改礦工帳號,這樣挖礦時錢就會轉到對應的帳號。
我們可以執行以下步驟,首先語法 miner.start(1)
會開始挖礦,最後 miner.stop()
就是停止挖礦。
其中 miner.start(1)
的參數為 CPU 使用數。
挖礦結束後再回來查看一次 txpool,發現 pending 的交易數量為 0。
再查看一次接受轉帳的帳戶是否有收到匯款了!
同時我們也可以使用以下指令來查看區塊數量。
MetaMask & Other Wallets
以太坊上我們可以將加密資產流動分散式帳本運作的過程
有別於直接把資產儲存在交易所內
以太坊錢包用途
疑問:
私鑰安全性
某天網站或 APP 關閉
常見的以太坊錢包如下:
MyEtherWallet
TrustWallet
MyCrypto
Opera
Jaxx
MetaMask
NFT Website
NFT 的詳細內容跟原理下禮拜會介紹。這邊主要聚焦在 NFT 網站架設計畫,了解這些網站的設計想法對未來發行 NFT 以及建置 DApp 有很大的幫助,同時也是很好的練習方法!
Marketing and Social Media
社群媒體連結按鈕
Twitter 塑造社群形象,華人常用 Facebook 粉絲專頁。
Discord 營造社群氛圍和向心力,以及辦理小型活動。
Instagram 提供社群速食內容。
Roadmap 和 Timeline
Interaction VIP/Owners Area
空投
發行實體或虛擬的周邊
下一波或新產品 Mint 的優先權
團隊介紹
Email 訂閱
NFT DataBase
Gallery or Information DB Example
Leader Board or Rank List
dAPP
Implement
「在 NFT 商品網站中與以太坊錢包 - MetaMask 連動,並且認證錢包登入者是否持有我們發行的 NFT。後讓登入者進入 NFT holders 的專屬 VIP 區域進行互動。」以及「產品上鏈工程 & 實作 Minting dAPP」
Login Flow (Login System) (react.js, MetaMask@onboarding, web3.js)
Tokens Owner Check Flow (Verify System) (react.js, web3.js, ethers.js, opensea.js)
Produce NFT Flow (python, JavaScript)
Deploy NFT Flow (Solidity, Etherscan)
Minting dAPP Flow (react.js, web3.js, ethers.js, Solidity)
Reference and Some Resources
論壇、群組或者是學習資源
Metamask
JSON RPC
Injecting Web3
Chain Types
https://www.abmedia.io/consortium-blockchain
https://www.potatomedia.co/post/34cd8fac-94d7-44bf-b532-3426b79f31a7
PoS, PoW, PoA
https://www.itread01.com/content/1547701572.html
https://matters.news/@BitGinko/po-w-po-s-po-a-po-xxx-%E5%85%B1%E8%AD%98%E6%A9%9F%E5%88%B6%E7%9A%84%E6%B7%B1%E5%85%A5%E6%8E%A2%E8%A8%8E-%E4%BA%8C-bafyreidounsizvez6wwr244tkwzixponesv4qroskpfbqhrd4b4l6phpzu
https://ictjournal.itri.org.tw/Content/Messagess/contents.aspx?MSID=744257557510131250&MmmID=654304432061644411
https://0xzx.com/zh-tw/201911202124375577.html
http://blog.udn.com/oec1020/134016099
論壇
https://ethereum.stackexchange.com/
Quora
Chainlink
StackOverflow
programmerall.com
programmer.help
https://news.ycombinator.com/news
HW Reference:
http://netkiller.sourceforge.net/blockchain/ethereum/genesis.json.html
https://dotblogs.com.tw/explooosion/2018/07/29/172031
https://medium.facilelogin.com/build-your-own-blockchain-b8eaeea2f891
https://www.books.com.tw/products/0010798325
https://learnblockchain.cn/2018/03/18/create_private_blockchain/
https://medium.com/samumu-clan/%E7%94%A8-geth-%E6%9E%B6%E8%A8%AD%E7%A7%81%E6%9C%89%E9%8F%88-41a2baa0efd8
https://medium.com/swlh/how-to-set-up-a-private-ethereum-blockchain-c0e74260492c
https://www.cnblogs.com/soowin/p/14328195.html
https://ithelp.ithome.com.tw/2020ironman/articles/2255?page=1
https://medium.com/swlh/how-to-set-up-a-private-ethereum-blockchain-c0e74260492c
https://www.section.io/engineering-education/how-to-build-your-own-private-blockchain/
https://medium.com/samumu-clan/%E7%94%A8-geth-%E6%9E%B6%E8%A8%AD%E7%A7%81%E6%9C%89%E9%8F%88-41a2baa0efd8
https://medium.facilelogin.com/build-your-own-blockchain-b8eaeea2f891
https://souptacular.gitbooks.io/ethereum-tutorials-and-tips-by-hudson/content/private-chain.html
https://www.antiersolutions.com/
Windows
https://medium.com/%E4%B8%80%E5%80%8B%E5%AE%B9%E6%98%93%E5%81%A5%E5%BF%98%E7%9A%84%E5%A4%A7%E5%AD%B8%E7%94%9F/5%E5%88%86%E9%90%98%E5%BB%BA%E7%AB%8B%E4%BB%A5%E5%A4%AA%E5%9D%8A%E7%A7%81%E6%9C%89%E9%8F%88-%E4%BB%A5poa%E5%85%B1%E8%AD%98%E7%82%BA%E4%BE%8B-part-1-c6e9daad71a7
https://merehead.com/blog/how-to-create-private-ethereum-blockchain/
https://programmer.help/blogs/build-ethereum-private-chain-windows.html
Mac OS X
https://learnblockchain.cn/2018/03/18/create_private_blockchain/
https://notes.andywu.tw/2018/%E5%BB%BA%E7%AB%8B%E4%BB%A5%E5%A4%AA%E5%9D%8A%E7%A7%81%E6%9C%89%E9%8F%88%E4%B8%80/
https://programmerall.com/article/3909456580/
https://github.com/chafey/ethereum-private-network
UNIX - GNU/Linux, Ubuntu
https://medium.com/@pradeep_thomas/how-to-setup-your-own-private-ethereum-network-f80bc6aea088
https://ithelp.ithome.com.tw/articles/10203475
https://arctouch.com/blog/how-to-set-up-ethereum-blockchain/
Last updated