# 开发智能合约的极简主义配置:vscode+remix+github **Published by:** [choovybi](https://paragraph.com/@choovybi/) **Published on:** 2022-10-25 **URL:** https://paragraph.com/@choovybi/vscode-remix-github ## Content ⌈工欲善其事,必先利其器⌋,本文将介绍一套极简的智能合约开发配置,只需要vscode、remix和github就能够进行以太坊合约的开发、部署、测试和代码保存,欢迎交流。vscode编辑器下载智能合约开发主要使用solidity语言,本文选用插件丰富的vscode作为编辑器,点击下载vscode。选择合适的下载版本安装插件vscode下载安装后,点击左侧扩展,在上方依次搜索并安装⌈Chinese(Simplified)⌋、⌈Ethereum Remix⌋和⌈solidity⌋三个插件,之后重启vscode。vscode安装插件指定workspace新建一个文件夹作为workspace,vscode重启如下所示,依次⌈打开文件夹⌋-⌈选择新建的文件夹⌋-⌈新建文件⌋-⌈命名XXX.sol⌋,之后就可以正常编写sol文件,⌈solidity⌋插件会提供语法高亮等支持。新建workspace和.sol文件remix合约编写完成后需要remix进行编译、部署和测试。开启本地remix⌈Ethereum Remix⌋-⌈Start remixed client⌋-⌈Start⌋开启本地连接,值得一提⌈Ethereum Remix⌋也可以本地编译,但要注意编译器版本与sol文件中的匹配。start remixed clientremix连接本地打开remix主页,⌈File explorer⌋-⌈Workspace⌋-⌈connect to localhost⌋连接到本地workspace。连接到本地编译⌈Solidity complier⌋-⌈更改complier version⌋-⌈Compile⌋进行sol文件编译,没有弹出红色error则编译成功,或者也可以⌈Ctrl + s⌋快速编译。编译sol文件部署⌈Deploy & run transactions⌋-⌈选择环境(VM)⌋-⌈选择部署者账号⌋-⌈选择部署的合约⌋-⌈Deploy⌋部署者将合约部署在指定的环境。合约部署测试部署之后的合约可以⌈选择账户⌋-⌈选择金额⌋-⌈调用函数⌋来进行交互,测试智能合约的功能是否正常实现。合约交互github合约测试成功以后可以上传到github的gist保存。Personal Access Tokens打开github网页,⌈Tokens(classic)⌋-⌈命名⌋-⌈选择到期时间⌋-⌈勾选gits⌋-⌈Generate Token⌋生成github的access token,立即复制token。生成Personal Access Token代码保存回到remix主页,⌈Settings⌋-⌈粘贴TOKEN⌋-⌈填写Github用户名、邮箱⌋-⌈Save⌋保存access token。保存GitHub Access Token⌈右键文件⌋-⌈Publish file to gist⌋将合约文件上传到gist,进入www.gist.github.com/username网页(username是个人的github名称)即可查看刚才上传到gist的文件。上传到gist尾记在remix中,部署在VM环境的合约可以进行测试,部署在MetaMask、Wallet Connect、Layer 2等环境的合约可以供他人使用,后者可能会造成巨大的经济损失,需要开发者额外注意。 今天就到这里,再见。Subscribe参考文章 https://remix-ide.readthedocs.io/en/latest/ https://solidity-cn.readthedocs.io/zh/develop/ https://code.visualstudio.com/docs https://docs.github.com/cn/pages ## Publication Information - [choovybi](https://paragraph.com/@choovybi/): Publication homepage - [All Posts](https://paragraph.com/@choovybi/): More posts from this publication - [RSS Feed](https://api.paragraph.com/blogs/rss/@choovybi): Subscribe to updates - [Twitter](https://twitter.com/choovybi): Follow on Twitter