zoukankan      html  css  js  c++  java
  • Solidity编程 二 之Solidity安装

    Remix

    如果你只是想尝试用solidity编写小的合约,你可以使用Remix, 不需要安装。如果你想使用离线版本,可以到 https://github.com/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/ethereum
    sudo apt-get update
    sudo apt-get install solc
    

      

     

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

    sudo add-apt-repository ppa:ethereum/ethereum
    sudo add-apt-repository ppa:ethereum/ethereum-dev
    sudo apt-get update
    sudo apt-get install solc
    

      

     

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

     

    pacman -S solidity-git
    

      

     

     

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

    https://github.com/ethereum/homebrew-ethereum/commits/master/solidity.rb

     

    通过brew安装

     

    brew unlink solidity
    # Install 0.4.8
    brew install https://raw.githubusercontent.com/ethereum/homebrew-ethereum/77cce03da9f289e5a3ffe579840d3c5dc0a62717/solidity.rb
    

      

     

    通过源码编译

     

     clone 代码:

       

     

       git clone --recursive https://github.com/ethereum/solidity.git
       cd solidity
    

      

     

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

     

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

      

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

     

    git submodule update --init --recursive
    

      

     

    MacOS的要求

     

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

     

    sudo xcodebuild -license accept
    

      

     

    Windows的要求

     

      需要安装Git for Window, CMake,VS2015

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

     

    ./scripts/install_deps.sh
    

      

    或是 

     

    scriptsinstall_deps.bat(在Windows)
    

      

     

    命令行编译

     

    使用

     

    mkdir build
    cd build
    cmake .. && make
     
    

      

    或是更简单的:

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

      

     

    在windows系统上:

    mkdir build
    cd build
    cmake -G "Visual Studio 14 2015 Win64" ..
    

      

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

    cmake --build . --config RelWithDebInfo
    

      


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

  • 相关阅读:
    服务部署 RPC vs RESTful
    模拟浏览器之从 Selenium 到splinter
    windows程序设计 vs2012 新建win32项目
    ubuntu python 安装numpy,scipy.pandas.....
    vmvare 将主机的文件复制到虚拟机系统中 安装WMware tools
    ubuntu 修改root密码
    python 定义类 简单使用
    python 定义函数 两个文件调用函数
    python 定义函数 调用函数
    python windows 安装gensim
  • 原文地址:https://www.cnblogs.com/StephenWu/p/6791490.html
Copyright © 2011-2022 走看看