2vyper is an automatic verifier for smart contracts written in Vyper, based on the Viper verification infrastructure. It is being developed at the Programming Methodology Group at ETH Zurich. 2vyper was mainly developed by Robin Sierra, Christian Bräm, and Marco Eilers.
For examples of the provided specification constructs, check out the examples folder. Note that the examples are written in Vyper 0.1.0, but 2vyper supports different versions if a version pragma is set. A short overview of the most important specification constructs can be found here. For further documentation, read our paper about 2vyper’s specification constructs, Robin Sierra’s and Christian Bräm’s Master’s theses on the tool.
Dependencies (Ubuntu Linux, MacOS)
Install Java >= 11 (64 bit) and Python >= 3.7 (64 bit).
For usage with the Viper’s verification condition generation backend Carbon, you will also need to install the .NET / the Mono runtime.
Dependencies (Windows)
Install Java >= 11 (64 bit) and Python >= 3.7 (64 bit).
Install either Visual C++ Build Tools 2015 (http://go.microsoft.com/fwlink/?LinkId=691126) or Visual Studio 2015. For the latter, make sure to choose the option “Common Tools for Visual C++ 2015” in the setup (see https://blogs.msdn.microsoft.com/vcblog/2015/07/24/setup-changes-in-visual-studio-2015-affecting-c-developers/ for an explanation).
Getting Started
Clone the 2vyper repository:
git clone https://github.com/viperproject/2vyper cd 2vyper/
Create a virtual environment and activate it:
virtualenv env source env/bin/activate
Install 2vyper:
pip install .
Command Line Usage
To verify a specific file from the 2vyper directory, run:
2vyper [OPTIONS] path-to-file.vy
The following command line options are available:
``--verifier``
Selects the Viper backend to use for verification.
Possible options are ``silicon`` (for Symbolic Execution) and ``carbon``
(for Verification Condition Generation based on Boogie).
Default: ``silicon``.
``--viper-jar-path``
Sets the path to the required Viper binaries (``silicon.jar`` or
``carbon.jar``). Only the binary for the selected backend is
required. We recommend that you use the provided binary
packages installed by default, but you can or compile your own from
source.
Expects either a single path or a colon- (Unix) or semicolon-
(Windows) separated list of paths. Alternatively, the environment
variables ``SILICONJAR``, ``CARBONJAR`` or ``VIPERJAR`` can be set.
``--z3``
Sets the path of the Z3 executable. Alternatively, the
``Z3_EXE`` environment variable can be set.
``--boogie``
Sets the path of the Boogie executable. Required if the Carbon backend
is selected. Alternatively, the ``BOOGIE_EXE`` environment variable can be
set.
``--counterexample``
Produces a counterexample if the verification fails. Currently only works
with the default ``silicon`` backend.
``--vyper-root``
Sets the root directory for the Vyper compiler.
``--skip-vyper``
Skips type checking the given Vyper program using the Vyper compiler.
``--print-viper``
Print the generated Viper file to the command line.
To see all possible command line options, invoke 2vyper without arguments.
Alternative Viper Versions
To use a custom version of the Viper infrastructure, follow the instructions here. Look for sbt assembly to find instructions for packaging the required JAR files. Use the parameters mentioned above to instruct 2vyper to use your custom Viper version. Note that 2vyper may not always work with the most recent Viper version.
Troubleshooting
On Windows: During the setup, you get an error like Microsoft Visual C++ 14.0 is required. or Unable to fnd vcvarsall.bat:
Python cannot find the required Visual Studio 2015 C++ installation, make sure you have either installed the Build Tools or checked the “Common Tools” option in your regular VS 2015 installation (see above).
While verifying a file, you get a stack trace ending with something like No matching overloads found:
The version of Viper you’re using does not match your version of 2vyper. Try using the the one that comes with 2vyper instead.
Build Status
Metadata
Release files for 2vyper 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| 2vyper-0.3.0.tar.gz | 55.2 MB | Without provenance | Details for 2vyper-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| 2vyper-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for 2vyper-0.3.0-py3-none-any.whl |
Total release size: 110.4 MB
Release files / 2vyper-0.3.0.tar.gz
| Download URL | 2vyper-0.3.0.tar.gz |
|---|---|
| Size | 55.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b4e6d8470b457d43c192fffb66f7543790606ba651c6474a3d4033315c6d1bab
|
|
BLAKE2b-256 checksum How to use checksums |
56180323d9e5d453766c76385e70a03f7cdadf37b776390c9841423baa301898
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.10
|
Release files / 2vyper-0.3.0-py3-none-any.whl
| Download URL | 2vyper-0.3.0-py3-none-any.whl |
|---|---|
| Size | 55.2 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
059ef418589fafc1e881f868d6abdfa0a11ee192033e38c13cb6b49dca134f2b
|
|
BLAKE2b-256 checksum How to use checksums |
521e724ee1a950d323e7e50910be541b7af0533edb0c37b8174e9dcea29fd9c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.10
|
Security for 2vyper 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.