remix是基於瀏覽器的在線編譯器,鑑於網絡問題,可能存在登不上去的問題,因此 ,可以搭建自己本地的Remix。
本文是基於virtalbox的ubuntu1804的虛擬機環境,配置是1核2GB內存(建議內存越多越好)。
官方在線編譯器
https://ethereum.github.io/browser-solidity
https://remix.ethereum.org
推薦使用在線編譯器
- 1. 安裝本地Remix:
- 安裝
官方地址: https://github.com/ethereum/remix-ide
方式一:已經做爲npm的一個module了
apt install npm
npm install remix-ide -g
啓動命令:
remix-ide
方式二:
git clone https://github.com/ethereum/remix-ide.git
cd remix-ide
npm install
npm run build && npm run serve
-
- 本地訪問Remix:
-
- 遠端訪問特定機器的remix
本文使用npm自動安裝remix的路徑是
/usr/local/lib/node_modules/remix-ide
修改
vim /usr/local/lib/node_modules/remix-ide/bin/remix-ide
將
server.listen(8080, '127.0.0.1', function () {})
修改爲
server.listen(8080, '0.0.0.0', function () {})
之後重啓remix-ide
即可外部訪問。
-
- 界面如下
至此,Remix算是配置完成了。
- 簡單使用:
1. 點擊下拉框,可以選擇不同的版本,包括還未成熟的最新構建版本,或者是之前的版本等。 選擇release版本,如下圖所示的這些 :
2. 合約自動編譯後生成:
3. 點擊create,會在內存中將該智能合約創建一個實例,即將下面的web3 deploy代碼部署在虛擬的內存中: