第一句子网 - 唯美句子、句子迷、好句子大全
第一句子网 > Solidity编程 二 之Solidity安装

Solidity编程 二 之Solidity安装

时间:2022-08-10 23:05:51

相关推荐

Solidity编程 二 之Solidity安装

Remix

如果你只是想尝试用solidity编写小的合约,你可以使用Remix, 不需要安装。如果你想使用离线版本,可以到 /ethereum/browser-solidity/tree/gh-pages下载zip文件使用。

Npm/ Node.js

这是最快速,便捷的方式安装本地Solidity.Emscripten提供了一个跨平台的js库,可以把C++的源码编译成JavaScript.当然也可以在项目里直接使用(如Remix)。Solc-js可以通过npm安装:

npm install -g solc

Docker

我们提供了最新的docker编译,stable分支包含了release版本,而每日编译分支可能包含不稳定的代码。

安装命令

docker run ethereum/solc:stable solc --version

二进制包

Ubuntu的PPAs,最新的版本

sudo add-apt-repository ppa:ethereum/ethereumsudo apt-get updatesudo apt-get install solc

如果你想使用最新的开发版本:

sudo add-apt-repository ppa:ethereum/ethereumsudo add-apt-repository ppa:ethereum/ethereum-devsudo apt-get updatesudo apt-get install solc

Arch Linux也有安装包,albeit限制了最新使用版本

pacman -S solidity-git

如果你想安装特定版本的Solidity,可以直接通过Github安装Homebrew。地址为:

/ethereum/homebrew-ethereum/commits/master/solidity.rb

通过brew安装

brew unlink solidity# Install 0.4.8brew install /ethereum/homebrew-ethereum/77cce03da9f289e5a3ffe579840d3c5dc0a62717/solidity.rb

通过源码编译

clone 代码:

git clone --recursive /ethereum/solidity.gitcd solidity

如果你想开发Solidity,可以fork Solidity,添加自己的fork分支来进行开发

cd soliditygit remote add personal git@:[username]/solidity.git

Solidity有submodules,确保所有的submodules是被正确加载的。

git submodule update --init --recursive

MacOS的要求

需要安装最新的Xcode。如果你是第一次安装Xcode,或是已经安装了最新版本,在使用命令行前,需要进行license授权

sudo xcodebuild -license accept

Windows的要求

需要安装Git for Window, CMake,VS

我们现在提供了一键安装。使用

./scripts/install_deps.sh

或是

scripts\install_deps.bat(在Windows)

命令行编译

使用

mkdir buildcd buildcmake .. && make

或是更简单的:

#note: this will install binaries solc and soltest at usr/local/bin./scripts/build.sh

在windows系统上:

mkdir buildcd buildcmake -G "Visual Studio 14 Win64" ..

或者可以在windows上使用命令行:

cmake --build . --config RelWithDebInfo

欢迎大家关注微信号:蜗牛讲技术。扫下面的二维码

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。