titanoboa-zksync


Nametitanoboa-zksync JSON
Version 0.2.6 PyPI version JSON
download
home_pageNone
SummaryA Zksync plugin for the Titanoboa Vyper interpreter
upload_time2024-11-03 18:29:34
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseMIT License Copyright (c) 2024 Daniel Schiavini Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords ethereum evm smart contract development vyper zksync
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # titanoboa-zksync
A Zksync plugin for the Titanoboa Vyper interpreter


## Installation

First install the following dependencies, depending on your system:

#### Google Colab
For Google Colab: The following dependencies should be downloaded automatically.

#### Zkvyper Compiler
We use the [era-compiler-vyper](https://github.com/matter-labs/era-compiler-vyper) a.k.a. `zkvyper`: to compile Vyper code to ZkSync-compatible bytecode.

1. Download the latest binary from the [zkvyper-bin repository](https://github.com/matter-labs/zkvyper-bin) and rename it as `zkvyper`.
 
2. On Linux/macOS, mark the binary as executable:
`chmod a+x <path to file>`

3. On macOS, the binary may need to have its quarantine attribute cleared: 
`xattr -d com.apple.quarantine <path to file>`

Then, make sure this is available in your system PATH.

#### ZkSync Node

If you want to test with forks or a local test node, you will need to install the ZkSync [era-test-node](https://github.com/matter-labs/era-test-node/releases).

1. Download `era-test-node` from latest [Release](https://github.com/matter-labs/era-test-node/releases/latest)

2. Extract the binary and mark as executable:
   ```bash
   tar xz -f era_test_node.tar.gz -C /usr/local/bin/
   chmod +x /usr/local/bin/era_test_node
   ```

Then, make sure this is available in your system PATH.

#### Install the plugin
Finally, install the package:

```bash
pip install titanoboa-zksync
```

## Usage
The usage of this plugin is similar to the original [Titanoboa interpreter](https://github.com/vyperlang/titanoboa).

### Configuring the environment
#### In Python:

```python
import boa_zksync

boa_zksync.set_zksync_env("<rpc_url>")  # use RPC
boa_zksync.set_zksync_fork("<rpc_url>")  # fork from the mainnet
boa_zksync.set_zksync_test_env()  # run a local test node
```

#### In JupyterLab or Google Colab:
```python
import boa, boa_zksync
from boa.integrations.jupyter import BrowserSigner

# use the browser signer and RPC:
boa_zksync.set_zksync_browser_env()  # use the browser signer and RPC
boa.env.set_chain_id(324)  # Set the chain ID to the ZkSync network

# use the browser signer and a custom RPC:
boa_zksync.set_zksync_env("<rpc_url>")
boa.env.set_eoa(BrowserSigner())
```

### Interacting with the network

```python
import boa, boa_zksync

constructor_args, address = [], "0x1234..."

boa_zksync.set_zksync_test_env()  # configure the environment, see previous section

# Load a contract from source code and deploy
boa.loads("contract source code", *constructor_args)

# Load a contract from file and deploy
contract = boa.load("path/to/contract.vy", *constructor_args)

# Load a contract from source file but don't deploy yet
deployer = boa.loads_partial("source code")
deployer.deploy(*constructor_args)  # Deploy the contract
deployer.at(address) # Connect a contract to an existing address

# Load a contract from source file but don't deploy yet
deployer = boa.loads_partial("source code")
deployer.deploy(*constructor_args)  # Deploy the contract
deployer.at(address) # Connect a contract to an existing address

# Run the given source code directly
boa.eval("source code")
```

### Limitations
- `# pragma optimize gas` is not supported by Zksync

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "titanoboa-zksync",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "ethereum, evm, smart contract, development, vyper, zksync",
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/a6/5d/0452ffabdc75602e2a1746287d55dc75b1a6c50b3008b0fd21b69eefb99d/titanoboa_zksync-0.2.6.tar.gz",
    "platform": null,
    "description": "# titanoboa-zksync\nA Zksync plugin for the Titanoboa Vyper interpreter\n\n\n## Installation\n\nFirst install the following dependencies, depending on your system:\n\n#### Google Colab\nFor Google Colab: The following dependencies should be downloaded automatically.\n\n#### Zkvyper Compiler\nWe use the [era-compiler-vyper](https://github.com/matter-labs/era-compiler-vyper) a.k.a. `zkvyper`: to compile Vyper code to ZkSync-compatible bytecode.\n\n1. Download the latest binary from the [zkvyper-bin repository](https://github.com/matter-labs/zkvyper-bin) and rename it as `zkvyper`.\n \n2. On Linux/macOS, mark the binary as executable:\n`chmod a+x <path to file>`\n\n3. On macOS, the binary may need to have its quarantine attribute cleared: \n`xattr -d com.apple.quarantine <path to file>`\n\nThen, make sure this is available in your system PATH.\n\n#### ZkSync Node\n\nIf you want to test with forks or a local test node, you will need to install the ZkSync [era-test-node](https://github.com/matter-labs/era-test-node/releases).\n\n1. Download `era-test-node` from latest [Release](https://github.com/matter-labs/era-test-node/releases/latest)\n\n2. Extract the binary and mark as executable:\n   ```bash\n   tar xz -f era_test_node.tar.gz -C /usr/local/bin/\n   chmod +x /usr/local/bin/era_test_node\n   ```\n\nThen, make sure this is available in your system PATH.\n\n#### Install the plugin\nFinally, install the package:\n\n```bash\npip install titanoboa-zksync\n```\n\n## Usage\nThe usage of this plugin is similar to the original [Titanoboa interpreter](https://github.com/vyperlang/titanoboa).\n\n### Configuring the environment\n#### In Python:\n\n```python\nimport boa_zksync\n\nboa_zksync.set_zksync_env(\"<rpc_url>\")  # use RPC\nboa_zksync.set_zksync_fork(\"<rpc_url>\")  # fork from the mainnet\nboa_zksync.set_zksync_test_env()  # run a local test node\n```\n\n#### In JupyterLab or Google Colab:\n```python\nimport boa, boa_zksync\nfrom boa.integrations.jupyter import BrowserSigner\n\n# use the browser signer and RPC:\nboa_zksync.set_zksync_browser_env()  # use the browser signer and RPC\nboa.env.set_chain_id(324)  # Set the chain ID to the ZkSync network\n\n# use the browser signer and a custom RPC:\nboa_zksync.set_zksync_env(\"<rpc_url>\")\nboa.env.set_eoa(BrowserSigner())\n```\n\n### Interacting with the network\n\n```python\nimport boa, boa_zksync\n\nconstructor_args, address = [], \"0x1234...\"\n\nboa_zksync.set_zksync_test_env()  # configure the environment, see previous section\n\n# Load a contract from source code and deploy\nboa.loads(\"contract source code\", *constructor_args)\n\n# Load a contract from file and deploy\ncontract = boa.load(\"path/to/contract.vy\", *constructor_args)\n\n# Load a contract from source file but don't deploy yet\ndeployer = boa.loads_partial(\"source code\")\ndeployer.deploy(*constructor_args)  # Deploy the contract\ndeployer.at(address) # Connect a contract to an existing address\n\n# Load a contract from source file but don't deploy yet\ndeployer = boa.loads_partial(\"source code\")\ndeployer.deploy(*constructor_args)  # Deploy the contract\ndeployer.at(address) # Connect a contract to an existing address\n\n# Run the given source code directly\nboa.eval(\"source code\")\n```\n\n### Limitations\n- `# pragma optimize gas` is not supported by Zksync\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Daniel Schiavini  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "A Zksync plugin for the Titanoboa Vyper interpreter",
    "version": "0.2.6",
    "project_urls": null,
    "split_keywords": [
        "ethereum",
        " evm",
        " smart contract",
        " development",
        " vyper",
        " zksync"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "698cce01a3cc97953301417213e6d62680bc53d7990b5c98b21664917184a17a",
                "md5": "bad99dc6f28c27fe7b3187e57339ee34",
                "sha256": "0c259c4346dffa4b477b2bedc708188cabe84f53f005fb5bc47f0bccbb7e73aa"
            },
            "downloads": -1,
            "filename": "titanoboa_zksync-0.2.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bad99dc6f28c27fe7b3187e57339ee34",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 25288,
            "upload_time": "2024-11-03T18:29:32",
            "upload_time_iso_8601": "2024-11-03T18:29:32.904065Z",
            "url": "https://files.pythonhosted.org/packages/69/8c/ce01a3cc97953301417213e6d62680bc53d7990b5c98b21664917184a17a/titanoboa_zksync-0.2.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a65d0452ffabdc75602e2a1746287d55dc75b1a6c50b3008b0fd21b69eefb99d",
                "md5": "7e531e3e2bba13a0f753a8f6512cf953",
                "sha256": "64281a2bae6d63285e5f4af5ebe3b5b5c0198a8f94510bc47af3d76f988f9631"
            },
            "downloads": -1,
            "filename": "titanoboa_zksync-0.2.6.tar.gz",
            "has_sig": false,
            "md5_digest": "7e531e3e2bba13a0f753a8f6512cf953",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 25870,
            "upload_time": "2024-11-03T18:29:34",
            "upload_time_iso_8601": "2024-11-03T18:29:34.782572Z",
            "url": "https://files.pythonhosted.org/packages/a6/5d/0452ffabdc75602e2a1746287d55dc75b1a6c50b3008b0fd21b69eefb99d/titanoboa_zksync-0.2.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-03 18:29:34",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "titanoboa-zksync"
}
        
Elapsed time: 1.36893s