Vyper¶
| Pinned compiler | 0.4.3+commit.bff19ea2 (Windows exe SHA-256 4878e251…7c9a) |
| EVM target | --evm-version cancun (or london) |
| Status | ✅ Tested: compile, deploy, call on chain 77240 (CLI); Wallet Studio Vyper support is on an unreleased branch |
Install¶
python3 -m venv .venv && . .venv/bin/activate
pip install vyper==0.4.3
vyper --version # 0.4.3+commit.bff19ea2
The pinned Vyper LICENSE contains terms beyond stock Apache-2.0; read it before redistributing the compiler.
Example¶
Counter.vy
# pragma version 0.4.3
# Starter counter (Vyper 0.4.3). Unaudited example.
event Incremented:
value: uint256
CREATOR: public(immutable(address))
count: uint256
@deploy
def __init__():
CREATOR = msg.sender
@external
def increment():
self.count += 1
log Incremented(value=self.count)
@view
@external
def get() -> uint256:
return self.count
Compile, ABI, deploy¶
vyper --evm-version cancun -f bytecode Counter.vy > Counter.bin
vyper -f abi Counter.vy > Counter.abi.json # Vyper generates the ABI
TX=$(cast send --async --keystore "$KEYSTORE" --password-file "$PASSWORD_FILE" --rpc-url "$RPC" --create "$(cat Counter.bin)")
cast receipt "$TX" contractAddress --rpc-url "$RPC"
Measured: 207 runtime bytes, 98,394 deployment gas, 44,431 gas for increment().
Security caveats¶
- Vyper had compiler bugs in older versions (notably reentrancy-lock miscompilation in 0.2.15–0.3.0); stay on the pinned version and read its advisories.
@nonreentrantand bounded loops are language features — use them rather than hand-rolled guards.- Verification works the same way as Solidity (compare runtime bytes; Vyper immutables are appended to runtime code).
Sources at 72057fe3ec: contracts/studio/compilers.json · developers/examples/languages/Counter.vy
Found a problem? Report a documentation issue · Build testnet-rc1+72057fe3ec