diff --git a/.buildinfo b/.buildinfo new file mode 100644 index 0000000..1690419 --- /dev/null +++ b/.buildinfo @@ -0,0 +1,4 @@ +# Sphinx build info version 1 +# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. +config: 44002d3c86e6c237a7943c4af682f5c2 +tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/_images/docs-logo.png b/_images/docs-logo.png new file mode 100644 index 0000000..e7f96c8 Binary files /dev/null and b/_images/docs-logo.png differ diff --git a/_sources/all_moccasin_toml_parameters.rst.txt b/_sources/all_moccasin_toml_parameters.rst.txt new file mode 100644 index 0000000..076a6e7 --- /dev/null +++ b/_sources/all_moccasin_toml_parameters.rst.txt @@ -0,0 +1,39 @@ +All moccasin toml parameters +=========================== + +.. code-block:: toml + + # Changes the names and locations of specific directories in your project + [project] + src = "contracts" + out = "build" + script = "scripts" + lib = "dependencies" + # You can have pip-style dependencies and also github-style dependencies + # These are going to be dependencies for your vyper contracts + dependencies = ["snekmate==0.1.0", "pcaversaccio/snekmate@0.1.0"] + installer = "uv" + + # Add network settings to easily interact with networks + [networks.sepolia] + url = "https://ethereum-sepolia-rpc.publicnode.com" + chain_id = 11155111 + is_fork = false + is_zksync = false + # This is the name of the account that will be unlocked when running on this network + default_account_name = "anvil" + # If you don't provide a password or private key, moccasin will prompt you to unlock it + # If you do, it will unlock it automatically + # But be careful about storing passwords and private keys! NEVER store them in plain text + unsafe_password_file = "/home/user/.moccasin/password" # Replace with actual path + + [networks.sepolia.extra_data] + my_key = "{$ETHERSCAN_API_KEY}" + + # It might be a good idea to place addresses in here! + [networks.mainnet.extra_data] + usdc = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" + + # Put whatever else you want in here + [extra_data] + hi = "hello" \ No newline at end of file diff --git a/_sources/cli_commands.rst.txt b/_sources/cli_commands.rst.txt new file mode 100644 index 0000000..841ed34 --- /dev/null +++ b/_sources/cli_commands.rst.txt @@ -0,0 +1,8 @@ +mox +### + +.. argparse:: + :module: moccasin_wrapper_for_docs + :func: get_main_parser + :prog: mox + \ No newline at end of file diff --git a/_sources/common-errors.rst.txt b/_sources/common-errors.rst.txt new file mode 100644 index 0000000..5943e5d --- /dev/null +++ b/_sources/common-errors.rst.txt @@ -0,0 +1,7 @@ +Common Errors +============= + +ValueError: .eoa not defined! +---------------------------------------------------------------------------- + +This is the most common error you'll run into, and it means you'll need to add an account to your `moccasin.toml`. You can do this by following the :doc:`wallet ` guide. \ No newline at end of file diff --git a/_sources/console.rst.txt b/_sources/console.rst.txt new file mode 100644 index 0000000..f1326e9 --- /dev/null +++ b/_sources/console.rst.txt @@ -0,0 +1,10 @@ +Console +####### + +You can enter a python shell with the `console` command. This will start a python shell with the `moccasin` module loaded, so you can interact with your contracts directly. + +.. code-block:: bash + + mox console + +Press `q` and hit `ENTER` to exit the console. \ No newline at end of file diff --git a/_sources/dependencies.rst.txt b/_sources/dependencies.rst.txt new file mode 100644 index 0000000..605f11c --- /dev/null +++ b/_sources/dependencies.rst.txt @@ -0,0 +1,103 @@ +Dependencies +############ + + +Moccasin allows for working with either: + +- :ref:`Installing from GitHub repositories ` + +- :ref:`Installing Python PyPI packages ` (these are your "normal" pip packages) + + +.. _installing_github_dependencies: + +Installing GitHub Dependencies +============================== + +To install a package from GitHub, you can run the following: + +.. code-block:: bash + + mox install ORG/REPO[@VERSION] + +For example: + +.. code-block:: bash + + # Without a version + mox install pcaversaccio/snekmate + # With a version + mox install pcaversaccio/snekmate@0.1.0 + +This will create an entry in your `moccasin.toml` file that looks like this: + +.. code-block:: toml + + [project] + dependencies = [ + "pcaversaccio/snekmate@0.1.0", + ] + +Which follows the same syntax that `pip` and `uv` to do installs from GitHub repositories. This will also download the GitHub repository into your `lib` folder. + +You can then use these packages in your vyper contracts, for example in an miniaml ERC20 vyper contract: + +.. code-block:: python + + from lib.snekmate.auth import ownable as ow + initializes: ow + + from lib.snekmate.tokens import erc20 + initializes: erc20[ownable := ow] + exports: erc20.__interface__ + + @deploy + @payable + def __init__(): + erc20.__init__("my_token", "MT", 18, "my_token_dapp", "0x02") + ow.__init__() + + +.. _installing_pip_dependencies: + + +Installing pip/PyPI Dependencies +================================ + +Moccasin let's you directly install and work with PyPI packages as you would any other python package. PyPi dependencies in moccasin are by default powered by the `uv `_ tool. In order to use this, you need to have the `uv` tool installed. However, you can change this setting to `pip` in your `moccasin.tom`. + +.. code-block:: toml + + [project] + installer = "pip" # change/add this setting + +As of today, `moccasin` supports: + +- `pip` + +- `uv` + +You can also directly install and work with PyPI packages as you would any other python package. To install a package from PyPI, you can run the following: + +.. code-block:: bash + + mox install PACKAGE + +For example: + +.. code-block:: bash + + mox install snekmate + +.. note:: + + Snekmate is both a `pypi `_ and a GitHub package. + +This will create an entry in your `moccasin.toml` file that looks like this: + +.. code-block:: toml + + [project] + dependencies = [ + "snekmate==0.1.0", + ] diff --git a/_sources/index.rst.txt b/_sources/index.rst.txt new file mode 100644 index 0000000..9781708 --- /dev/null +++ b/_sources/index.rst.txt @@ -0,0 +1,36 @@ +.. image:: _static/docs-logo.png + :width: 140px + :alt: Moccasin logo + :align: center + + +Moccasin +###### + +Moccasin is a fast, pythonic smart contract development framework heavily powered by `titanoboa `_. + + +.. note:: + + This project is under active development. + +How to read the documentation +============================= + +The moccasin documentation is written in a way that assumes you are on a MacOS or Linux-like system. If you are using windows, we recommend you watch the first `10 minutes of this WSL tutorial `_ and work with WSL. WSL stands for "Windows Subsystem for Linux" and it allows you to run a Linux commands on Windows machine. + +Why Moccasin? +=========== + +We think web3 needs the following: + +1. A python smart contract development framework. + a. We need this because python is the 2nd most popular language on earth, and is the number one choice for artificial intelligence and new computer engineers! +2. An easy way to run devops on contracts. + a. Running scripts to interact with contracts needs to be easy in a language that humans can understand. +3. And finally... it needs to be fast! + +Then, we have some fun plans for AI, formal verification, fuzzing, and more in the future of moccasin, so stay tuned! + + +Head over to :doc:`installing moccasin ` to get started. \ No newline at end of file diff --git a/_sources/installing-moccasin.rst.txt b/_sources/installing-moccasin.rst.txt new file mode 100644 index 0000000..80209f1 --- /dev/null +++ b/_sources/installing-moccasin.rst.txt @@ -0,0 +1,118 @@ +.. _install: + +Installing Moccasin +################# + +There are a few things you'll need on your machine before you can install Moccasin. Please install the appropriate tools from the `Prerequisites`_ section. Once you have those, the recommended way to :ref:`install Moccasin is via uv `. + +Prerequisites +============= + +1. Python 3.11 or later + +.. _installation-with-uv: + +Installation with uv +-------------------- + +For those unfamiliar, `uv `_ is a fast python package manager, and that helps us install moccasin into it's own isolated virtual environment, so we don't get any weird dependency conflicts with other python packages. It's similar to `pip` and `pipx` if you've used them before. It even comes with some `pip` compatibility, will tools like `uv pip install`. + +It's highly recommended you understand how `virtual environments `_ work as well. + +The easiest way to install `uv` is: + +.. code-block:: bash + + curl -LsSf https://astral.sh/uv/install.sh | sh + +But you can head over to the `uv installation instructions `_ for more options. If you don't have at least Python 3.11 installed, you'll need to install that first. + +.. code-block:: bash + + uv python install 3.11 + +Then, to install moccasin with `uv`, run: + +.. code-block:: bash + + uv tool install moccasin + +Once installed, to verify that Moccasin is installed, you can run: + +.. code-block:: bash + + mox --version + +And see an output like: + +.. code-block:: bash + + Moccasin CLI v0.1.0 + +.. _installation-with-pipx: + +Installation with pipx +---------------------- + +Pipx is a tool to help you install and run end-user applications written in Python. It's roughly similar to macOS's ``brew``, JavaScript's ``npx``, and Linux's ``apt``. + +``pipx`` installs Moccasin into a virtual environment and makes it available directly from the commandline. Once installed, you will never have to activate a virtual environment prior to using Moccasin. + +``pipx`` does not ship with Python. If you have not used it before you will probably need to install it. + +You can either head over to the `pipx installation instructions `_ or follow along below. + +To install ``pipx``: + +.. code-block:: bash + + python -m pip install --user pipx + python -m pipx ensurepath + +.. note:: + + You may need to restart your terminal after installing `pipx`. + +To install moccasin then with `pipx`: + +.. code-block:: bash + + pipx install moccasin + +Once installed, you can run the following command to verify that Moccasin is installed: + +.. code-block:: bash + + mox --version + +And see an output like: + +.. code-block:: bash + + Moccasin CLI v0.1.0 + +Installation with pip +--------------------- + +You can install with `pip`, and if you do so, it's highly recommended you understand how `virtual environments `_ work. + +To install with `pip`: + +.. code-block:: bash + + pip install moccasin + +From source +----------- + +To install from source, you'll need the `uv tool installed `_. Once installed, you can run: + +.. code-block:: bash + + git clone https://github.com/cyfrin/moccasin + cd moccasin + uv sync + source .venv/bin/activate + uv pip install -e . + +And you will have `mox` in your virtual environment created from the `uv` tool. It's highly recommended you understand how `virtual environments `_ work. diff --git a/_sources/moccasin_toml.rst.txt b/_sources/moccasin_toml.rst.txt new file mode 100644 index 0000000..728c1d2 --- /dev/null +++ b/_sources/moccasin_toml.rst.txt @@ -0,0 +1,45 @@ +moccasin.toml +############## + +The `moccasin.toml` file created is our configuration file. In this file we can have: + +- project and layout settings + +- network settings + +- dependencies settings + +- extra data + +A `moccasin.toml` file can look like this: + +.. code-block:: toml + + [project] + src = "contracts" + + [networks.sepolia] + url = "https://ethereum-sepolia-rpc.publicnode.com" + chain_id = 11155111 + + [extra_data] + my_key = "{$ETHERSCAN_API_KEY}" + + +You can learn more about each of the sections of the `moccasin.toml` file in their respective documentation. + +- `Project `_ +- `Network `_ +- `Dependencies `_ + +You can also see a full example of a `moccasin.toml` in the :doc:`all moccasin toml parameters ` documentation. + +Extra Data +========== + +Extra data is a dictionary of data where you can put whatever you'd like. You can access it from your scripts with: + +.. code-block:: python + + from moccasin import config + print(config.get_config().extra_data["my_key"]) \ No newline at end of file diff --git a/_sources/networks.rst.txt b/_sources/networks.rst.txt new file mode 100644 index 0000000..419ea74 --- /dev/null +++ b/_sources/networks.rst.txt @@ -0,0 +1,37 @@ +Networks +======== + +Networks in `moccasin` are identified in your `moccasin.toml`. The complete list of options you can set for your network can be identified in the example here: + +.. code-block:: toml + + [networks.sepolia] + url = "https://ethereum-sepolia-rpc.publicnode.com" + chain_id = 11155111 + is_fork = false + is_zksync = false + default_account_name = "anvil" + unsafe_password_file = "~/.moccasin/password" + extra_data = { "my_key" = "{$ETHERSCAN_API_KEY}" } + +Let's walk through what each of these options mean. + +- `url`: The URL of the network you are connecting to. +- `chain_id`: The chain ID of the network you are connecting to. +- `is_fork`: If you are forking a network, set this to `true`. +- `is_zksync`: If you are connecting to a zkSync network, set this to `true`. +- `default_account_name`: The default account name to use when deploying contracts. This will be the name of your account you created with your :doc:`wallet ` command. +- `unsafe_password_file`: The location of the password file for your account. This is a file that contains the password for your account. BE SURE TO NEVER PUSH THIS PASSWORD TO GITHUB IF YOU USE THIS. +- extra-data: This is a dictionary of extra data you can use in your contracts. + +You'll notice there is no `private-key`. We highly discourage having private keys in plain text. + +When working with a network from the command line, for example to :doc:`run a script + + + + + + + + + + + + +
+
+
+ + + + moccasin + +
+ +
+
+
+
+
+
+
+ + + + +
+
+
+
+

All moccasin toml parameters

+
# Changes the names and locations of specific directories in your project
+[project]
+src = "contracts"
+out = "build"
+script = "scripts"
+lib = "dependencies"
+# You can have pip-style dependencies and also github-style dependencies
+# These are going to be dependencies for your vyper contracts
+dependencies = ["snekmate==0.1.0", "pcaversaccio/snekmate@0.1.0"]
+installer = "uv"
+
+# Add network settings to easily interact with networks
+[networks.sepolia]
+url = "https://ethereum-sepolia-rpc.publicnode.com"
+chain_id = 11155111
+is_fork = false
+is_zksync = false
+# This is the name of the account that will be unlocked when running on this network
+default_account_name = "anvil"
+# If you don't provide a password or private key, moccasin will prompt you to unlock it
+# If you do, it will unlock it automatically
+# But be careful about storing passwords and private keys! NEVER store them in plain text
+unsafe_password_file = "/home/user/.moccasin/password"  # Replace with actual path
+
+[networks.sepolia.extra_data]
+my_key = "{$ETHERSCAN_API_KEY}"
+
+# It might be a good idea to place addresses in here!
+[networks.mainnet.extra_data]
+usdc = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
+
+# Put whatever else you want in here
+[extra_data]
+hi = "hello"
+
+
+
+ +
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/cli_commands.html b/cli_commands.html new file mode 100644 index 0000000..e75d48f --- /dev/null +++ b/cli_commands.html @@ -0,0 +1,977 @@ + + + + + mox - moccasin documentation + + + + + + + + + + + + +
+
+
+ + + + moccasin + +
+ +
+
+
+
+
+
+
+ + + + +
+
+
+
+

mox

+

🐍 Pythonic Smart Contract Development Framework

+

+
usage: mox [-h] [-d] [-q]
+           {init,compile,build,test,run,script,deploy,wallet,console,install,purge,config,explorer}
+           ...
+
+
+
+

Positional Arguments

+
+
command
+

Possible choices: init, compile, build, test, run, script, deploy, wallet, console, install, purge, config, explorer

+
+
+
+
+

Named Arguments

+
+
-d, --debug
+

Run in debug mode

+

Default: False

+
+
-q, --quiet
+

Suppress all output except errors

+

Default: False

+
+
+
+
+

Sub-commands

+
+

init

+

This will create a basic directory structure at the path you specific, which looks like: +. +├── README.md +├── moccasin.toml +├── script +│ └── deploy.py +├── src +│ └── Counter.vy +└── tests

+
+

├── conftest.py +└── test_counter.py

+
+
mox init [-h] [-d] [-q] [-f] [--vscode] [path]
+
+
+
+

Positional Arguments

+
+
path
+

Path of the new project, defaults to current directory.

+

Default: .

+
+
+
+
+

Named Arguments

+
+
-d, --debug
+

Run in debug mode

+

Default: False

+
+
-q, --quiet
+

Suppress all output except errors

+

Default: False

+
+
-f, --force
+

Overwrite existing project.

+

Default: False

+
+
--vscode
+

Add a .vscode/settings.json file.

+

Default: False

+
+
+
+
+
+

compile (build)

+

Compiles all Vyper contracts in the project.

+

This command will: +1. Find all .vy files in the src/ directory +2. Compile each file using the Vyper compiler +3. Output the compiled artifacts to the out/ directory

+

Use this command to prepare your contracts for deployment or testing.

+
mox compile [-h] [-d] [-q]
+
+
+
+

Named Arguments

+
+
-d, --debug
+

Run in debug mode

+

Default: False

+
+
-q, --quiet
+

Suppress all output except errors

+

Default: False

+
+
+
+
+
+

test

+

Runs pytest with boa context.

+
mox test [-h] [-d] [-q] [--fork] [--network NETWORK | --url URL] [-k [K]]
+         [--coverage COVERAGE] [-m [M]] [-x] [-s] [--capture  [CAPTURE]]
+         [--lf] [--cache-clear] [--disable-warnings] [--full-trace] [--pdb]
+         [file_or_dir]
+
+
+
+

Positional Arguments

+
+
file_or_dir
+

Name of the test or folder to run tests on, or the path to your script.

+
+
+
+
+

Named Arguments

+
+
-d, --debug
+

Run in debug mode

+

Default: False

+
+
-q, --quiet
+

Suppress all output except errors

+

Default: False

+
+
--fork
+

If you want to fork the RPC.

+

Default: False

+
+
--network
+

Alias of the network (from the moccasin.toml).

+
+
--url, --rpc
+

RPC URL to run the script on.

+
+
-k
+
+
Only run tests which match the given substring expression. An expression is a Python evaluable expression where all names are

substring-matched against test names and their parent classes. Example: -k ‘test_method or test_other’ matches all test functions and +classes whose name contains ‘test_method’ or ‘test_other’, while -k ‘not test_method’ matches those that don’t contain ‘test_method’ in +their names. -k ‘not test_method and not test_other’ will eliminate the matches. Additionally keywords are matched to classes and +functions containing extra names in their ‘extra_keyword_matches’ set, as well as functions which have names assigned directly to them. +The matching is case-insensitive.

+
+
+
+
--coverage
+

Run tests with coverage

+
+
-m
+

Only run tests matching given mark expression. For example: -m ‘mark1 and not mark2’.

+
+
-x, --exitfirst
+

Exit instantly on first error or failed test.

+

Default: False

+
+
-s
+

Shortcut for –capture=no

+

Default: False

+
+
--capture
+

Per-test capturing method: one of fd|sys|no|tee-sys

+
+
--lf, --last-failed
+

Rerun only the tests that failed at the last run (or all if none failed).

+

Default: False

+
+
--cache-clear
+

Remove all cache contents at start of test run.

+

Default: False

+
+
--disable-warnings, --disable-pytest-warnings
+

Disable warnings summary.

+

Default: False

+
+
--full-trace
+

Don’t cut any tracebacks (default is to cut)

+

Default: False

+
+
--pdb
+

Start the debugger for each test that fails.

+

Default: False

+
+
+
+
+
+

run (script)

+

Runs a script with the project’s context.

+
mox run [-h] [-d] [-q] [--fork] [--network NETWORK | --url URL]
+        [--account ACCOUNT | --private-key PRIVATE_KEY]
+        [--password PASSWORD | --password-file-path PASSWORD_FILE_PATH]
+        script_name_or_path
+
+
+
+

Positional Arguments

+
+
script_name_or_path
+

Name of the script in the script folder, or the path to your script.

+

Default: './script/deploy.py'

+
+
+
+
+

Named Arguments

+
+
-d, --debug
+

Run in debug mode

+

Default: False

+
+
-q, --quiet
+

Suppress all output except errors

+

Default: False

+
+
--fork
+

If you want to fork the RPC.

+

Default: False

+
+
--network
+

Alias of the network (from the moccasin.toml).

+
+
--url, --rpc
+

RPC URL to run the script on.

+
+
--account
+

Keystore account you want to use.

+
+
--private-key
+

Private key you want to use to get an unlocked account.

+
+
--password
+

Password for the keystore account.

+
+
--password-file-path
+

Path to the file containing the password for the keystore account.

+
+
+
+
+
+

deploy

+

Deploys a contract named in the config with a deploy script.

+
mox deploy [-h] [-d] [-q] [--fork] [--network NETWORK | --url URL]
+           [--account ACCOUNT | --private-key PRIVATE_KEY]
+           [--password PASSWORD | --password-file-path PASSWORD_FILE_PATH]
+           contract_name
+
+
+
+

Positional Arguments

+
+
contract_name
+

Name of contract in your moccasin.toml to deploy.

+
+
+
+
+

Named Arguments

+
+
-d, --debug
+

Run in debug mode

+

Default: False

+
+
-q, --quiet
+

Suppress all output except errors

+

Default: False

+
+
--fork
+

If you want to fork the RPC.

+

Default: False

+
+
--network
+

Alias of the network (from the moccasin.toml).

+
+
--url, --rpc
+

RPC URL to run the script on.

+
+
--account
+

Keystore account you want to use.

+
+
--private-key
+

Private key you want to use to get an unlocked account.

+
+
--password
+

Password for the keystore account.

+
+
--password-file-path
+

Path to the file containing the password for the keystore account.

+
+
+
+
+
+

wallet

+

Wallet management utilities.

+
mox wallet [-h] [-d] [-q]
+           {list,ls,generate,g,new,import,i,add,inspect,decrypt,dk,delete,d}
+           ...
+
+
+
+

Positional Arguments

+
+
wallet_command
+

Possible choices: list, ls, generate, g, new, import, i, add, inspect, decrypt, dk, delete, d

+
+
+
+
+

Named Arguments

+
+
-d, --debug
+

Run in debug mode

+

Default: False

+
+
-q, --quiet
+

Suppress all output except errors

+

Default: False

+
+
+
+
+

Sub-commands

+
+
list (ls)
+

List all the accounts in the keystore default directory

+
mox wallet list [-h]
+
+
+
+
+
generate (g, new)
+

Create a new account with a random private key

+
mox wallet generate [-h] [--save]
+                    [--password PASSWORD | --password-file PASSWORD_FILE]
+                    name
+
+
+
+
Positional Arguments
+
+
name
+

Name of account

+
+
+
+
+
Named Arguments
+
+
--save
+

Save to keystore

+

Default: False

+
+
--password
+

Password for the keystore

+
+
--password-file
+

File containing the password for the keystore

+
+
+
+
+
+
import (i, add)
+

Import a private key into an encrypted keystore

+
mox wallet import [-h] name
+
+
+
+
Positional Arguments
+
+
name
+

Name of account to import

+
+
+
+
+
+
inspect
+

View the JSON of a keystore file

+
mox wallet inspect [-h] keystore_file_name
+
+
+
+
Positional Arguments
+
+
keystore_file_name
+

Name of keystore file

+
+
+
+
+
+
decrypt (dk)
+

Decrypt a keystore file to get the private key

+
mox wallet decrypt [-h]
+                   [--password PASSWORD | --password-file-path PASSWORD_FILE_PATH]
+                   [--print-key]
+                   keystore_file_name
+
+
+
+
Positional Arguments
+
+
keystore_file_name
+

Name of the keystore file to decrypt

+
+
+
+
+
Named Arguments
+
+
--password
+

Password for the keystore account.

+
+
--password-file-path
+

Path to the file containing the password for the keystore account.

+
+
--print-key, -p
+

Print the private key to the console

+

Default: False

+
+
+
+
+
+
delete (d)
+

Delete a keystore file

+
mox wallet delete [-h] keystore_file_name
+
+
+
+
Positional Arguments
+
+
keystore_file_name
+

Name of keystore file

+
+
+
+
+
+
+
+

console

+

BETA, USE AT YOUR OWN RISK: Interact with the network in a python shell.

+
mox console [-h] [-d] [-q] [--fork] [--network NETWORK | --url URL]
+
+
+
+

Named Arguments

+
+
-d, --debug
+

Run in debug mode

+

Default: False

+
+
-q, --quiet
+

Suppress all output except errors

+

Default: False

+
+
--fork
+

If you want to fork the RPC.

+

Default: False

+
+
--network
+

Alias of the network (from the moccasin.toml).

+
+
--url, --rpc
+

RPC URL to run the script on.

+
+
+
+
+
+

install

+

Installs the project’s dependencies. The first argument is the requirements, given as a pip-compatible strings and/or moccasin github formatted dependencies. +- Pip-compatible strings download dependencies as regular python packages from PyPI. +- Moccasin github formatted dependencies download dependencies from the Moccasin github repository.

+

Moccasin github formatted dependencies are formatted as:

+

GITHUB_ORG/GITHUB_REPO@[@VERSION]

+

Where: +- GITHUB_ORG is the github organization or user that owns the repository. +- GITHUB_REPO is the name of the repository. +- VERSION is the optional version of the repository to download. If not provided, the latest version is downloaded.

+

Examples: +- pcaversaccio/snekmate@0.1.0 # Moccasin GitHub formatted dependency +- snekmate==0.1.0 # Pip-compatible string

+
mox install [-h] [-d] [-q] [requirements ...]
+
+
+
+

Positional Arguments

+
+
requirements
+

Requirements, given as a pip-compatible strings and/or moccasin github formatted dependencies.

+
+
+
+
+

Named Arguments

+
+
-d, --debug
+

Run in debug mode

+

Default: False

+
+
-q, --quiet
+

Suppress all output except errors

+

Default: False

+
+
+
+
+
+

purge

+

Purge the given dependency.

+
mox purge [-h] [-d] [-q] packages [packages ...]
+
+
+
+

Positional Arguments

+
+
packages
+

Package name, given as a pip-compatible string and/or moccasin github formatted dependency.

+
+
+
+
+

Named Arguments

+
+
-d, --debug
+

Run in debug mode

+

Default: False

+
+
-q, --quiet
+

Suppress all output except errors

+

Default: False

+
+
+
+
+
+

config

+

View the Moccasin configuration.

+
mox config [-h] [-d] [-q]
+
+
+
+

Named Arguments

+
+
-d, --debug
+

Run in debug mode

+

Default: False

+
+
-q, --quiet
+

Suppress all output except errors

+

Default: False

+
+
+
+
+
+

explorer

+

Work with block explorers to get data.

+
mox explorer [-h] [-d] [-q] {fetch,get,list} ...
+
+
+
+

Positional Arguments

+
+
explorer_command
+

Possible choices: fetch, get, list

+
+
+
+
+

Named Arguments

+
+
-d, --debug
+

Run in debug mode

+

Default: False

+
+
-q, --quiet
+

Suppress all output except errors

+

Default: False

+
+
+
+
+

Sub-commands

+
+
fetch (get)
+

Retreive the ABI of a contract from a block explorer.

+

This command will attempt to use the environment variable ETHERSCAN_API_KEY as the API key for Etherscan. If this environment variable is not set, you can provide the API key as an argument to the command.

+
mox explorer fetch [-h] [-d] [-q] [--name NAME] [--api-key API_KEY]
+                   [--ignore-config] [--save-abi-path SAVE_ABI_PATH] [--save]
+                   [--uri URI | --network NETWORK]
+                   address
+
+
+
+
Positional Arguments
+
+
address
+

The address you want to pull from.

+
+
+
+
+
Named Arguments
+
+
-d, --debug
+

Run in debug mode

+

Default: False

+
+
-q, --quiet
+

Suppress all output except errors

+

Default: False

+
+
--name
+

Optional name for the contract.

+
+
--api-key, --explorer-api-key
+

API key for the block explorer.

+
+
--ignore-config, -i
+

Don’t pull values from the config.

+

Default: False

+
+
--save-abi-path
+

Location to save the returned abi. This will only be applied if you also add the ‘–save’ flag.

+
+
--save
+

If added, the ABI will be saved to the ‘save-abi-path’ given in the command line or config.

+

Default: False

+
+
--uri
+

API URI endpoint for explorer.

+
+
--network
+

Name/alias of the network (from the moccasin.toml). If chain_id is set in the config, you may also use that.

+
+
+
+
+
+
list
+

List all natively supported block explorers and chains.

+
mox explorer list [-h] [--by-id] [--json]
+
+
+
+
Named Arguments
+
+
--by-id
+

List by chain id.

+

Default: False

+
+
--json
+

Format as json.

+

Default: False

+
+
+
+
+
+
+
+
+ +
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/common-errors.html b/common-errors.html new file mode 100644 index 0000000..28a56d1 --- /dev/null +++ b/common-errors.html @@ -0,0 +1,206 @@ + + + + + Common Errors - moccasin documentation + + + + + + + + + + + + +
+
+
+ + + + moccasin + +
+ +
+
+
+
+
+
+
+ + + + +
+
+
+
+

Common Errors

+
+

ValueError: <boa.network.NetworkEnv object at 0xXXXXXXXXX>.eoa not defined!

+

This is the most common error you’ll run into, and it means you’ll need to add an account to your moccasin.toml. You can do this by following the wallet guide.

+
+
+ +
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/console.html b/console.html new file mode 100644 index 0000000..d9d98ff --- /dev/null +++ b/console.html @@ -0,0 +1,212 @@ + + + + + Console - moccasin documentation + + + + + + + + + + + + +
+
+
+ + + + moccasin + +
+ +
+
+
+
+
+
+
+ + + + +
+
+
+
+

Console

+

You can enter a python shell with the console command. This will start a python shell with the moccasin module loaded, so you can interact with your contracts directly.

+
mox console
+
+
+

Press q and hit ENTER to exit the console.

+
+ +
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/dependencies.html b/dependencies.html new file mode 100644 index 0000000..4a4f0b6 --- /dev/null +++ b/dependencies.html @@ -0,0 +1,285 @@ + + + + + Dependencies - moccasin documentation + + + + + + + + + + + + +
+
+
+ + + + moccasin + +
+ +
+
+
+
+
+
+
+ + + + +
+
+
+
+

Dependencies

+

Moccasin allows for working with either:

+ +
+

Installing GitHub Dependencies

+

To install a package from GitHub, you can run the following:

+
mox install ORG/REPO[@VERSION]
+
+
+

For example:

+
# Without a version
+mox install pcaversaccio/snekmate
+# With a version
+mox install pcaversaccio/snekmate@0.1.0
+
+
+

This will create an entry in your moccasin.toml file that looks like this:

+
[project]
+dependencies = [
+    "pcaversaccio/snekmate@0.1.0",
+]
+
+
+

Which follows the same syntax that pip and uv to do installs from GitHub repositories. This will also download the GitHub repository into your lib folder.

+

You can then use these packages in your vyper contracts, for example in an miniaml ERC20 vyper contract:

+
from lib.snekmate.auth import ownable as ow
+initializes: ow
+
+from lib.snekmate.tokens import erc20
+initializes: erc20[ownable := ow]
+exports: erc20.__interface__
+
+@deploy
+@payable
+def __init__():
+    erc20.__init__("my_token", "MT", 18, "my_token_dapp", "0x02")
+    ow.__init__()
+
+
+
+
+

Installing pip/PyPI Dependencies

+

Moccasin let’s you directly install and work with PyPI packages as you would any other python package. PyPi dependencies in moccasin are by default powered by the uv tool. In order to use this, you need to have the uv tool installed. However, you can change this setting to pip in your moccasin.tom.

+
[project]
+installer = "pip" # change/add this setting
+
+
+

As of today, moccasin supports:

+
    +
  • pip

  • +
  • uv

  • +
+

You can also directly install and work with PyPI packages as you would any other python package. To install a package from PyPI, you can run the following:

+
mox install PACKAGE
+
+
+

For example:

+
mox install snekmate
+
+
+
+

Note

+

Snekmate is both a pypi and a GitHub package.

+
+

This will create an entry in your moccasin.toml file that looks like this:

+
[project]
+dependencies = [
+    "snekmate==0.1.0",
+]
+
+
+
+
+ +
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/genindex.html b/genindex.html new file mode 100644 index 0000000..14356d1 --- /dev/null +++ b/genindex.html @@ -0,0 +1,101 @@ + + + + + Index - moccasin documentation + + + + + + + + +
+
+
+ + + + moccasin + +
+ +
+
+
+
+
+
+
+
+ + +

Index

+ +
+ +
+ + +
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..2a043db --- /dev/null +++ b/index.html @@ -0,0 +1,245 @@ + + + + + Moccasin - moccasin documentation + + + + + + + + + + + + +
+
+
+ + + + moccasin + +
+ +
+
+
+
+
+
+
+ + + + +
+
+
+ Moccasin logo + +
+

Moccasin

+

Moccasin is a fast, pythonic smart contract development framework heavily powered by titanoboa.

+
+

Note

+

This project is under active development.

+
+
+

How to read the documentation

+

The moccasin documentation is written in a way that assumes you are on a MacOS or Linux-like system. If you are using windows, we recommend you watch the first 10 minutes of this WSL tutorial and work with WSL. WSL stands for “Windows Subsystem for Linux” and it allows you to run a Linux commands on Windows machine.

+
+
+

Why Moccasin?

+

We think web3 needs the following:

+
    +
  1. +
    A python smart contract development framework.
      +
    1. We need this because python is the 2nd most popular language on earth, and is the number one choice for artificial intelligence and new computer engineers!

    2. +
    +
    +
    +
  2. +
  3. +
    An easy way to run devops on contracts.
      +
    1. Running scripts to interact with contracts needs to be easy in a language that humans can understand.

    2. +
    +
    +
    +
  4. +
  5. And finally… it needs to be fast!

  6. +
+

Then, we have some fun plans for AI, formal verification, fuzzing, and more in the future of moccasin, so stay tuned!

+

Head over to installing moccasin to get started.

+
+
+ +
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/installing-moccasin.html b/installing-moccasin.html new file mode 100644 index 0000000..c0bff99 --- /dev/null +++ b/installing-moccasin.html @@ -0,0 +1,296 @@ + + + + + Installing Moccasin - moccasin documentation + + + + + + + + + + + + +
+
+
+ + + + moccasin + +
+ +
+
+
+
+
+
+
+ + + + +
+
+
+
+

Installing Moccasin

+

There are a few things you’ll need on your machine before you can install Moccasin. Please install the appropriate tools from the Prerequisites section. Once you have those, the recommended way to install Moccasin is via uv.

+
+

Prerequisites

+
    +
  1. Python 3.11 or later

  2. +
+
+

Installation with uv

+

For those unfamiliar, uv is a fast python package manager, and that helps us install moccasin into it’s own isolated virtual environment, so we don’t get any weird dependency conflicts with other python packages. It’s similar to pip and pipx if you’ve used them before. It even comes with some pip compatibility, will tools like uv pip install.

+

It’s highly recommended you understand how virtual environments work as well.

+

The easiest way to install uv is:

+
curl -LsSf https://astral.sh/uv/install.sh | sh
+
+
+

But you can head over to the uv installation instructions for more options. If you don’t have at least Python 3.11 installed, you’ll need to install that first.

+
uv python install 3.11
+
+
+

Then, to install moccasin with uv, run:

+
uv tool install moccasin
+
+
+

Once installed, to verify that Moccasin is installed, you can run:

+
mox --version
+
+
+

And see an output like:

+
Moccasin CLI v0.1.0
+
+
+
+
+

Installation with pipx

+

Pipx is a tool to help you install and run end-user applications written in Python. It’s roughly similar to macOS’s brew, JavaScript’s npx, and Linux’s apt.

+

pipx installs Moccasin into a virtual environment and makes it available directly from the commandline. Once installed, you will never have to activate a virtual environment prior to using Moccasin.

+

pipx does not ship with Python. If you have not used it before you will probably need to install it.

+

You can either head over to the pipx installation instructions or follow along below.

+

To install pipx:

+
python -m pip install --user pipx
+python -m pipx ensurepath
+
+
+
+

Note

+

You may need to restart your terminal after installing pipx.

+
+

To install moccasin then with pipx:

+
pipx install moccasin
+
+
+

Once installed, you can run the following command to verify that Moccasin is installed:

+
mox --version
+
+
+

And see an output like:

+
Moccasin CLI v0.1.0
+
+
+
+
+

Installation with pip

+

You can install with pip, and if you do so, it’s highly recommended you understand how virtual environments work.

+

To install with pip:

+
pip install moccasin
+
+
+
+
+

From source

+

To install from source, you’ll need the uv tool installed. Once installed, you can run:

+
git clone https://github.com/cyfrin/moccasin
+cd moccasin
+uv sync
+source .venv/bin/activate
+uv pip install -e .
+
+
+

And you will have mox in your virtual environment created from the uv tool. It’s highly recommended you understand how virtual environments work.

+
+
+
+ +
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/moccasin_toml.html b/moccasin_toml.html new file mode 100644 index 0000000..6e71d4c --- /dev/null +++ b/moccasin_toml.html @@ -0,0 +1,244 @@ + + + + + moccasin.toml - moccasin documentation + + + + + + + + + + + + +
+
+
+ + + + moccasin + +
+ +
+
+
+
+
+
+
+ + + + +
+
+
+
+

moccasin.toml

+

The moccasin.toml file created is our configuration file. In this file we can have:

+
    +
  • project and layout settings

  • +
  • network settings

  • +
  • dependencies settings

  • +
  • extra data

  • +
+

A moccasin.toml file can look like this:

+
[project]
+src = "contracts"
+
+[networks.sepolia]
+url = "https://ethereum-sepolia-rpc.publicnode.com"
+chain_id = 11155111
+
+[extra_data]
+my_key = "{$ETHERSCAN_API_KEY}"
+
+
+

You can learn more about each of the sections of the moccasin.toml file in their respective documentation.

+ +

You can also see a full example of a moccasin.toml in the all moccasin toml parameters documentation.

+
+

Extra Data

+

Extra data is a dictionary of data where you can put whatever you’d like. You can access it from your scripts with:

+
from moccasin import config
+print(config.get_config().extra_data["my_key"])
+
+
+
+
+ +
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/networks.html b/networks.html new file mode 100644 index 0000000..a99239a --- /dev/null +++ b/networks.html @@ -0,0 +1,235 @@ + + + + + Networks - moccasin documentation + + + + + + + + + + + + +
+
+
+ + + + moccasin + +
+ +
+
+
+
+
+
+
+ + + + +
+
+
+
+

Networks

+

Networks in moccasin are identified in your moccasin.toml. The complete list of options you can set for your network can be identified in the example here:

+
[networks.sepolia]
+url = "https://ethereum-sepolia-rpc.publicnode.com"
+chain_id = 11155111
+is_fork = false
+is_zksync = false
+default_account_name = "anvil"
+unsafe_password_file = "~/.moccasin/password"
+extra_data = { "my_key" = "{$ETHERSCAN_API_KEY}" }
+
+
+

Let’s walk through what each of these options mean.

+
    +
  • url: The URL of the network you are connecting to.

  • +
  • chain_id: The chain ID of the network you are connecting to.

  • +
  • is_fork: If you are forking a network, set this to true.

  • +
  • is_zksync: If you are connecting to a zkSync network, set this to true.

  • +
  • default_account_name: The default account name to use when deploying contracts. This will be the name of your account you created with your wallet command.

  • +
  • unsafe_password_file: The location of the password file for your account. This is a file that contains the password for your account. BE SURE TO NEVER PUSH THIS PASSWORD TO GITHUB IF YOU USE THIS.

  • +
  • extra-data: This is a dictionary of extra data you can use in your contracts.

  • +
+

You’ll notice there is no private-key. We highly discourage having private keys in plain text.

+

When working with a network from the command line, for example to run a script you can pass the –network flag via the command line, and it will load the data from the network in your moccasin.toml.

+

For example, if you wanted to run a script on the sepolia network, you would run:

+
moccasin run my_script --network sepolia
+
+
+

Since in our example we passed both a default_account_name and a unsafe_password_file, moccasin will automatically unlock the account for you. If you don’t pass a default_account_name or a unsafe_password_file, moccasin will error saying it cannot find your account.

+
+ +
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/objects.inv b/objects.inv new file mode 100644 index 0000000..a3d8f5a Binary files /dev/null and b/objects.inv differ diff --git a/project.html b/project.html new file mode 100644 index 0000000..5de5a42 --- /dev/null +++ b/project.html @@ -0,0 +1,237 @@ + + + + + Project Layout - moccasin documentation + + + + + + + + + + + + +
+
+
+ + + + moccasin + +
+ +
+
+
+
+
+
+
+ + + + +
+
+
+
+

Project Layout

+

A typical moccasin project is structured as follows:

+
.
+├── README.md
+├── moccasin.toml
+├── script/
+├── src/
+├── tests/
+└── out/
+
+
+

Where:

+
    +
  • README.md is a markdown file that you can use to describe your project.

  • +
  • moccasin.toml is a configuration file that moccasin uses to manage the project.

  • +
  • script is a directory that contains python scripts that you can use to deploy your project.

  • +
  • src is a directory that contains your vyper smart contracts.

  • +
  • tests is a directory that contains your tests.

  • +
  • out is an optional directory that contains the compiled contracts. In moccasin and titanoboa, contracts are compiled on the fly!

  • +
+
+

Changing your layout

+

If you wanted to adjust your contracts location, for example, have your smart contracts folder be named contracts instead of src, you’d update your moccasin.toml file to reflect this change:

+
[project]
+src = "contracts"
+
+
+
+
+ +
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/quickstart.html b/quickstart.html new file mode 100644 index 0000000..f18ef5e --- /dev/null +++ b/quickstart.html @@ -0,0 +1,310 @@ + + + + + Quickstart - moccasin documentation + + + + + + + + + + + + +
+
+
+ + + + moccasin + +
+ +
+
+
+
+
+
+
+ + + + +
+
+
+
+

Quickstart

+
+

Creating a new project

+

To create a new project, you can run the following command:

+
mox init my_project
+
+
+

And this will create a new project in a new my_project directory. If you want to create a project in a directory that already has files/folders in it, run:

+
mox init my_project --force
+
+
+

Let’s check out the files and folders moccasin has created:

+
+

Note

+

MacOS users may need to install tree with brew install tree.

+
+

Run the following commands:

+
cd my_project
+tree .
+
+
+

You’ll get an output like:

+
.
+├── README.md
+├── moccasin.toml
+├── script
+│   ├── __init__.py
+│   └── deploy.py
+├── src
+│   └── Counter.vy
+└── tests
+    ├── conftest.py
+    └── test_counter.py
+
+
+

This is a minimal project structure that moccasin creates.

+
    +
  • README.md is a markdown file that you can use to describe your project.

  • +
  • moccasin.toml is a configuration file that moccasin uses to manage the project.

  • +
  • script is a directory that contains scripts that you can use to deploy your project.

  • +
  • src is a directory that contains your vyper smart contracts.

  • +
  • tests is a directory that contains your tests.

  • +
+
+
+

Deploying a contract

+

Now, unlike other frameworks, with moccasin, we never need to compile! Moccasin uses titanoboa under the hood to compile contracts quickly on the fly. Let’s open our deploy.py file and look inside.

+
from src import Counter
+
+def deploy():
+    counter = Counter.deploy()
+    print("Starting count: ", counter.number())
+    counter.increment()
+    print("Ending count: ", counter.number())
+    return counter
+
+def moccasin_main():
+    return deploy()
+
+
+

We can see a python script that will:

+
    +
  1. Deploy our Counter contract.

  2. +
  3. Print the starting count inside the contract.

  4. +
  5. Increment the count.

  6. +
  7. Print the ending count inside the contract.

  8. +
+

We can run this script to the titanoboa pyevm (a local network that simulates ethereum) by running:

+
mox run deploy
+
+
+

And we’ll get an output like:

+
Running run command...
+Starting count:  0
+Ending count:  1
+
+
+

Awesome! This is how easy it is to run scripts with your smart contracts.

+
+
+

Running tests

+

Under the hood, moccasin uses pytest, and you can use a lot of your favorite pytest command line commands. If you just run:

+
mox test
+
+
+

You’ll get an output like:

+
Running test command...
+=================================== test session starts ===================================
+platform darwin -- Python 3.11.9, pytest-8.3.2, pluggy-1.5.0
+rootdir: /your/path/my_project
+plugins: cov-5.0.0, hypothesis-6.108.5, titanoboa-0.2.1
+collected 1 item
+
+tests/test_counter.py .                                                             [100%]
+
+==================================== 1 passed in 0.01s ====================================
+
+
+
+
+ +
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/script.html b/script.html new file mode 100644 index 0000000..8afa973 --- /dev/null +++ b/script.html @@ -0,0 +1,287 @@ + + + + + Scripting - moccasin documentation + + + + + + + + + + + + +
+
+
+ + + + moccasin + +
+ +
+
+
+
+
+
+
+ + + + +
+
+
+
+

Scripting

+

Scripts are ways to deploy and work with contracts. You can either reference them by path or by name. For example, if your directory looks like this:

+
.
+├── README.md
+├── moccasin.toml
+├── script
+   └── deploy.py
+├── src
+   └── Counter.vy
+└── tests
+    ├── conftest.py
+    └── test_counter.py
+
+
+

You can run the deploy.py script with either:

+
mox run deploy
+
+
+

or

+
mox run ./script/deploy.py
+
+
+
+

Importing from src

+

You can directly import contracts from the src folder into your scripts, and interact with them! Let’s say you have a Counter contract in your src folder:

+
from src import Counter
+
+def deploy():
+    counter = Counter.deploy()
+    print("Starting count: ", counter.number())
+    counter.increment()
+    print("Ending count: ", counter.number())
+    return counter
+
+deploy()
+
+
+
+
+

Networking

+

If you have networks defined in your moccasin.toml, you can directly work with the network in your scripts. For example, if you have a sepolia network defined in your moccasin.toml:

+
mox run deploy --network sepolia
+
+
+
+
+

moccasin_main

+

In your scripts, the moccasin_main function is special, if you have a function with this name in your script, moccasin will run this function by default after running the script like a regular python file. For example, you could also do this:

+
from src import Counter
+
+def deploy():
+    counter = Counter.deploy()
+    print("Starting count: ", counter.number())
+    counter.increment()
+    print("Ending count: ", counter.number())
+    return counter
+
+deploy()
+
+
+

And it would do the same as the following.

+
from src import Counter
+
+def deploy():
+    counter = Counter.deploy()
+    print("Starting count: ", counter.number())
+    counter.increment()
+    print("Ending count: ", counter.number())
+    return counter
+
+def moccasin_main():
+    deploy()
+
+
+

You can see a list of arguments in the moccasin reference documentation that you can run with your scripts.

+
+
+ +
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/search.html b/search.html new file mode 100644 index 0000000..bbae07d --- /dev/null +++ b/search.html @@ -0,0 +1,125 @@ + + + + + Search - moccasin documentation + + + + + + + + + + + + +
+
+
+ + + + moccasin + +
+ + +
+
+
+
+
+
+
+ +

Search

+ + + + +

+ Searching for multiple words only shows matches that contain + all words. +

+ + +
+ + +
+

+ + +
+ + +
+ +
+
+ + + + + + + + + + \ No newline at end of file diff --git a/searchindex.js b/searchindex.js new file mode 100644 index 0000000..9ecd505 --- /dev/null +++ b/searchindex.js @@ -0,0 +1 @@ +Search.setIndex({"alltitles": {"All moccasin toml parameters": [[0, null]], "Changing your layout": [[9, "changing-your-layout"]], "Common Errors": [[2, null]], "Console": [[3, null]], "Creating a new project": [[10, "creating-a-new-project"]], "Dependencies": [[4, null]], "Deploying a contract": [[10, "deploying-a-contract"]], "Encrypting a private key": [[14, "encrypting-a-private-key"]], "Extra Data": [[7, "extra-data"]], "From source": [[6, "from-source"]], "Getting Started": [[13, null]], "How to read the documentation": [[5, "how-to-read-the-documentation"]], "Importing from src": [[11, "importing-from-src"]], "Installation with pip": [[6, "installation-with-pip"]], "Installation with pipx": [[6, "installation-with-pipx"]], "Installation with uv": [[6, "installation-with-uv"]], "Installing GitHub Dependencies": [[4, "installing-github-dependencies"]], "Installing Moccasin": [[6, null]], "Installing pip/PyPI Dependencies": [[4, "installing-pip-pypi-dependencies"]], "Major Commands": [[13, null]], "Moccasin": [[5, null], [13, null]], "Named Arguments": [[1, "moccasin_wrapper_for_docs-get_main_parser-named-arguments"], [1, "named-arguments"], [1, "named-arguments_repeat1"], [1, "named-arguments_repeat2"], [1, "named-arguments_repeat3"], [1, "named-arguments_repeat4"], [1, "named-arguments_repeat5"], [1, "named-arguments_repeat6"], [1, "named-arguments_repeat7"], [1, "named-arguments_repeat8"], [1, "named-arguments_repeat9"], [1, "named-arguments_repeat10"], [1, "named-arguments_repeat11"], [1, "named-arguments_repeat12"], [1, "named-arguments_repeat13"], [1, "named-arguments_repeat14"]], "Networking": [[11, "networking"]], "Networks": [[8, null]], "Positional Arguments": [[1, "moccasin_wrapper_for_docs-get_main_parser-positional-arguments"], [1, "positional-arguments"], [1, "positional-arguments_repeat1"], [1, "positional-arguments_repeat2"], [1, "positional-arguments_repeat3"], [1, "positional-arguments_repeat4"], [1, "positional-arguments_repeat5"], [1, "positional-arguments_repeat6"], [1, "positional-arguments_repeat7"], [1, "positional-arguments_repeat8"], [1, "positional-arguments_repeat9"], [1, "positional-arguments_repeat10"], [1, "positional-arguments_repeat11"], [1, "positional-arguments_repeat12"], [1, "positional-arguments_repeat13"]], "Prerequisites": [[6, "prerequisites"]], "Project Layout": [[9, null]], "Project Overview": [[13, null]], "Quickstart": [[10, null]], "Reference": [[13, null]], "Running tests": [[10, "running-tests"]], "Scripting": [[11, null]], "Sub-commands": [[1, "Sub-commands"], [1, "Sub-commands_repeat1"], [1, "Sub-commands_repeat2"]], "Testing": [[12, null]], "ValueError: .eoa not defined!": [[2, "valueerror-boa-network-networkenv-object-at-0xxxxxxxxxx-eoa-not-defined"]], "Wallet": [[14, null]], "Why Moccasin?": [[5, "why-moccasin"]], "compile (build)": [[1, "compile (build)"]], "config": [[1, "config"]], "console": [[1, "console"]], "decrypt (dk)": [[1, "decrypt (dk)"]], "delete (d)": [[1, "delete (d)"]], "deploy": [[1, "deploy"]], "explorer": [[1, "explorer"]], "fetch (get)": [[1, "fetch (get)"]], "generate (g, new)": [[1, "generate (g, new)"]], "import (i, add)": [[1, "import (i, add)"]], "init": [[1, "init"]], "inspect": [[1, "inspect"]], "install": [[1, "install"]], "list": [[1, "list"]], "list (ls)": [[1, "list (ls)"]], "moccasin.toml": [[7, null]], "moccasin_main": [[11, "moccasin-main"]], "mox": [[1, null]], "purge": [[1, "purge"]], "run (script)": [[1, "run (script)"]], "test": [[1, "test"]], "wallet": [[1, "wallet"]]}, "docnames": ["all_moccasin_toml_parameters", "cli_commands", "common-errors", "console", "dependencies", "index", "installing-moccasin", "moccasin_toml", "networks", "project", "quickstart", "script", "testing", "toctree", "wallet"], "envversion": {"sphinx": 63, "sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2}, "filenames": ["all_moccasin_toml_parameters.rst", "cli_commands.rst", "common-errors.rst", "console.rst", "dependencies.rst", "index.rst", "installing-moccasin.rst", "moccasin_toml.rst", "networks.rst", "project.rst", "quickstart.rst", "script.rst", "testing.rst", "toctree.rst", "wallet.rst"], "indexentries": {}, "objects": {}, "objnames": {}, "objtypes": {}, "terms": {"": [1, 4, 6, 8, 10, 11], "0": [0, 1, 4, 6, 10, 12], "01": [10, 12], "04ea": 14, "0x02": 4, "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48": 0, "1": [0, 1, 4, 6, 10, 12, 14], "10": 5, "100": [10, 12], "108": 10, "11": [6, 10, 12], "11155111": [0, 7, 8], "112": 12, "128": 14, "18": 4, "2": [1, 10, 12], "262144": 14, "2nd": 5, "3": [1, 6, 10, 12, 14], "32": 14, "4120": 14, "5": [10, 12], "6": [10, 12], "62dbc22cce0e270a71a5ac1a8c57b04eafa215839abcbdb9f349d63b6b9e5e9f": 14, "66": 12, "71326ecf78c3a2f2087366e4516d44f1": 14, "8": [10, 12, 14], "9": 10, "A": [5, 7, 9], "AT": 1, "And": [5, 6, 10, 11, 12, 14], "As": 4, "BE": 8, "But": [0, 6], "By": 14, "For": [1, 4, 6, 8, 11], "IF": 8, "If": [0, 1, 5, 6, 8, 9, 10, 11], "In": [4, 7, 9, 11], "It": [0, 6, 14], "TO": 8, "The": [1, 5, 6, 7, 8], "Then": [5, 6], "There": 6, "These": 0, "To": [4, 6, 10], "With": 4, "__init__": [4, 10], "__interface__": 4, "abi": 1, "about": [0, 7], "access": 7, "account": [0, 1, 2, 8, 14], "account_nam": 14, "activ": [5, 6], "actual": 0, "ad": 1, "add": [0, 2, 4, 14], "addition": 1, "address": [0, 1, 14], "adjust": 9, "ae": 14, "after": [6, 11], "against": 1, "ai": 5, "alia": 1, "all": [1, 7, 12, 13, 14], "allow": [4, 5], "along": 6, "alreadi": 10, "also": [0, 1, 4, 7, 11], "an": [1, 2, 4, 5, 6, 9, 10, 12, 14], "ani": [1, 4, 6], "anvil": [0, 8], "api": 1, "api_kei": 1, "appli": 1, "applic": 6, "appropri": 6, "apt": 6, "ar": [0, 1, 4, 5, 6, 8, 9, 11], "argument": [11, 14], "artifact": 1, "artifici": 5, "ask": 14, "assert": 12, "assign": 1, "assum": 5, "astral": 6, "attempt": 1, "auth": 4, "automat": [0, 8], "avail": 6, "awesom": 10, "b55fbb0baad": 14, "b6a4": 14, "base": 12, "basic": 1, "becaus": 5, "befor": 6, "below": 6, "beta": 1, "bin": 6, "block": 1, "boa": 1, "both": [4, 8], "brew": [6, 10], "build": 0, "cach": 1, "can": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14], "cannot": 8, "captur": 1, "care": 0, "case": 1, "cd": [6, 10], "chain": [1, 8], "chain_id": [0, 1, 7, 8], "chang": [0, 4], "check": 10, "choic": [1, 5], "cipher": 14, "cipherparam": 14, "ciphertext": 14, "class": 1, "clear": 1, "cli": [6, 14], "clone": 6, "code": 12, "collect": [10, 12], "com": [0, 6, 7, 8], "come": 6, "command": [3, 5, 6, 8, 10, 12, 14], "commandlin": 6, "common": 13, "compat": [1, 6], "compil": [9, 10], "complet": 8, "comput": 5, "config": 7, "configfil": 12, "configur": [1, 7, 9, 10], "conflict": 6, "conftest": [1, 10, 11], "connect": 8, "consol": 13, "contain": [1, 8, 9, 10], "content": [1, 14], "context": 1, "contract": [0, 1, 3, 4, 5, 7, 8, 9, 11], "contract_nam": 1, "could": 11, "count": [10, 11], "counter": [1, 10, 11], "counter_contract": 12, "cov": [10, 12], "coverag": 1, "creat": [1, 4, 6, 7, 8, 14], "crypto": 14, "ctr": 14, "curl": 6, "current": 1, "cut": 1, "cyfrin": 6, "d": [7, 9, 14], "darwin": [10, 12], "data": [1, 8], "debug": [1, 14], "debugg": 1, "decc1fbd482a171578028bfb2563362b9f4857765d6247900bde22e0cd6c2c13": 14, "decrypt": 14, "def": [4, 10, 11, 12], "default": [1, 4, 8, 11, 14], "default_account_nam": [0, 8], "defin": 11, "delet": 14, "depend": [0, 1, 6, 7, 13], "deploi": [4, 8, 9, 11, 14], "deploy": 1, "describ": [9, 10], "develop": [1, 5], "devop": 5, "dictionari": [7, 8], "directli": [1, 3, 4, 6, 11], "directori": [0, 1, 9, 10, 11, 14], "disabl": 1, "discourag": 8, "dk": 14, "dklen": 14, "do": [0, 2, 4, 6, 11], "document": [7, 11], "doe": 6, "don": [0, 1, 6, 8, 14], "download": [1, 4], "e": 6, "e6966dcf6d5384f050052f71ed7bfc02": 14, "ea0a89c0": 14, "each": [1, 7, 8], "earth": 5, "easi": [5, 10], "easiest": 6, "easili": 0, "either": [4, 6, 11], "elimin": 1, "els": 0, "encrypt": 1, "end": [6, 10, 11], "endpoint": 1, "engin": 5, "ensurepath": 6, "enter": [3, 14], "entri": 4, "environ": [1, 6], "erc20": 4, "error": [1, 8, 13, 14], "ethereum": [0, 7, 8, 10], "etherscan": 1, "etherscan_api_kei": [0, 1, 7, 8], "evalu": 1, "even": 6, "ever": 14, "exampl": [1, 4, 7, 8, 9, 11], "except": [1, 14], "exist": 1, "exit": [1, 3, 14], "exitfirst": 1, "explorer_command": 1, "export": 4, "expos": 14, "express": 1, "extra": [1, 8], "extra_data": [0, 7, 8], "extra_keyword_match": 1, "f": 1, "f39fd6e51aad88f6f4ce6ab8827279cfffb92266": 14, "fail": 1, "fals": [0, 1, 8], "fast": [5, 6], "favorit": 10, "fd": 1, "few": 6, "file": [1, 4, 7, 8, 9, 10, 11, 14], "file_or_dir": 1, "final": 5, "find": [1, 8], "first": [1, 5, 6], "flag": [1, 8], "fly": [9, 10], "folder": [1, 4, 9, 10, 11], "follow": [2, 4, 5, 6, 9, 10, 11], "forc": [1, 10], "fork": [1, 8], "formal": 5, "format": 1, "found": 14, "framework": [1, 5, 10], "from": [1, 4, 7, 8, 10], "full": [1, 7], "fun": 5, "function": [1, 11], "futur": 5, "fuzz": 5, "g": 14, "gener": 14, "get": [5, 6, 10, 12, 14], "get_config": 7, "git": 6, "github": [0, 1, 6, 8], "github_org": 1, "github_repo": 1, "given": 1, "go": 0, "good": 0, "guid": 2, "h": [1, 14], "ha": 10, "have": [0, 1, 4, 5, 6, 7, 8, 9, 11, 14], "head": [5, 6], "heavili": 5, "hello": 0, "help": [6, 14], "here": [0, 8], "hi": 0, "highli": [6, 8], "hit": 3, "home": 0, "hood": [10, 12], "how": [6, 10], "howev": 4, "http": [0, 6, 7, 8], "human": 5, "hypothesi": [10, 12], "i": [0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 14], "id": [1, 8, 14], "idea": 0, "identifi": 8, "ignor": 1, "import": [4, 7, 10, 14], "increment": [10, 11, 12], "init": 10, "initi": 4, "insensit": 1, "insid": 10, "inspect": 14, "instal": [0, 5, 10, 13], "instantli": 1, "instead": 9, "instruct": 6, "intellig": 5, "interact": [0, 1, 3, 5, 11], "is_fork": [0, 8], "is_zksync": [0, 8], "isol": 6, "item": [10, 12], "iv": 14, "javascript": 6, "json": [1, 14], "just": 10, "k": 1, "kdf": 14, "kdfparam": 14, "kei": [0, 1, 8], "keystor": [1, 14], "keystore_file_nam": 1, "keyword": 1, "l": 14, "languag": 5, "last": 1, "later": 6, "latest": 1, "layout": [7, 13], "learn": 7, "least": 6, "let": [4, 8, 10, 11], "lf": 1, "lib": [0, 4], "like": [1, 4, 5, 6, 7, 10, 11, 12], "line": [1, 8, 10], "linux": [5, 6], "list": [8, 11, 14], "ll": [2, 6, 8, 10], "load": [3, 8], "local": 10, "locat": [0, 1, 8, 9], "look": [1, 4, 7, 10, 11], "lot": 10, "lssf": 6, "m": [1, 6], "mac": 14, "machin": [5, 6], "maco": [5, 6, 10], "mai": [1, 6, 10], "mainnet": 0, "make": 6, "manag": [1, 6, 9, 10, 14], "mark": 1, "mark1": 1, "mark2": 1, "markdown": [9, 10], "match": 1, "md": [1, 9, 10, 11], "mean": [2, 8], "messag": 14, "method": 1, "might": 0, "miniaml": 4, "minim": 10, "minut": 5, "moccasin": [1, 2, 3, 4, 8, 9, 10, 11, 12, 14], "moccasin_main": 10, "mode": [1, 14], "modul": 3, "more": [5, 6, 7], "most": [2, 5], "mox": [3, 4, 6, 10, 11, 12, 13, 14], "mt": 4, "my_account": 14, "my_kei": [0, 7, 8], "my_project": 10, "my_script": 8, "my_token": 4, "my_token_dapp": 4, "n": 14, "name": [0, 8, 9, 11], "nativ": 1, "need": [2, 4, 5, 6, 10], "network": [0, 1, 7, 10, 13], "never": [0, 6, 8, 10], "new": [5, 14], "none": 1, "normal": 4, "notic": 8, "now": 10, "npx": 6, "number": [5, 10, 11, 12], "onc": [6, 14], "one": [1, 5], "onli": 1, "open": 10, "option": [1, 6, 8, 9, 14], "order": 4, "org": 4, "organ": 1, "other": [4, 6, 10], "our": [7, 8, 10], "out": [0, 1, 9, 10], "output": [1, 6, 10, 12, 14], "over": [5, 6], "overwrit": 1, "ow": 4, "own": [1, 6], "ownabl": 4, "p": [1, 14], "packag": [1, 4, 6], "paramet": [7, 13], "parent": 1, "pass": [8, 10, 12], "password": [0, 1, 8, 14], "password_fil": 1, "password_file_path": 1, "path": [0, 1, 10, 11], "patrick": 12, "payabl": 4, "pcaversaccio": [0, 1, 4], "pdb": 1, "per": 1, "pip": [0, 1], "place": 0, "plain": [0, 8], "plan": 5, "platform": [10, 12], "pleas": 6, "pluggi": [10, 12], "plugin": [10, 12], "popular": 5, "posit": 14, "possibl": 1, "power": [4, 5], "prepar": 1, "press": 3, "print": [1, 7, 10, 11], "prior": 6, "privat": [0, 1, 8], "private_kei": 1, "probabl": 6, "project": [0, 1, 4, 5, 7], "prompt": [0, 14], "provid": [0, 1], "publicnod": [0, 7, 8], "pull": 1, "push": 8, "put": [0, 7], "py": [1, 10, 11, 12], "pyevm": 10, "pypi": 1, "pyproject": 12, "pytest": [1, 10, 12], "python": [1, 3, 4, 5, 6, 9, 10, 11, 12], "q": [1, 3, 14], "quickli": 10, "quickstart": 13, "quiet": [1, 14], "r": 14, "random": [1, 14], "readm": [1, 9, 10, 11], "recommend": [5, 6], "refer": 11, "reflect": 9, "regular": [1, 11, 12], "remov": 1, "replac": 0, "repo": 4, "repositori": [1, 4], "requir": 1, "rerun": 1, "respect": 7, "restart": 6, "retreiv": 1, "return": [1, 10, 11], "risk": 1, "rootdir": [10, 12], "roughli": 6, "rpc": [0, 1, 7, 8], "run": [0, 2, 4, 5, 6, 8, 11, 12, 13, 14], "sai": [8, 11], "salt": 14, "same": [4, 11], "save": 1, "save_abi_path": 1, "script": [0, 5, 7, 8, 9, 10, 14], "script_name_or_path": 1, "scrypt": 14, "section": [6, 7], "see": [6, 7, 10, 11], "sepolia": [0, 7, 8, 11], "session": [10, 12], "set": [0, 1, 4, 7, 8], "setup": 12, "sh": 6, "shell": [1, 3], "ship": 6, "shortcut": 1, "show": 14, "similar": 6, "simul": 10, "sinc": 8, "smart": [1, 5, 9, 10], "snekmat": [0, 1, 4], "so": [3, 5, 6, 12], "some": [5, 6], "special": 11, "specif": [0, 1], "src": [0, 1, 7, 9, 10], "stai": 5, "stand": 5, "start": [1, 3, 5, 10, 11, 12], "store": [0, 14], "string": 1, "structur": [1, 9, 10], "style": 0, "substr": 1, "subsystem": 5, "summari": 1, "support": [1, 4], "suppress": [1, 14], "sure": 8, "sy": 1, "sync": 6, "syntax": 4, "system": 5, "t": [0, 1, 6, 8, 14], "tee": 1, "termin": 6, "test": [9, 11, 13], "test_count": [1, 10, 11, 12], "test_fork_usdc": 12, "test_increment_on": 12, "test_increment_two": 12, "test_method": 1, "test_oth": 1, "text": [0, 8], "them": [0, 1, 6, 11], "thi": [0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 14], "thing": 6, "think": 5, "those": [1, 6], "through": 8, "titanoboa": [5, 9, 10, 12], "todai": 4, "token": 4, "tom": 4, "toml": [1, 2, 4, 8, 9, 10, 11, 12, 13], "tool": [4, 6], "trace": 1, "traceback": 1, "tree": 10, "true": 8, "tune": 5, "tutori": 5, "typic": 9, "u": 6, "under": [5, 10, 12], "understand": [5, 6], "unfamiliar": 6, "unlik": 10, "unlock": [0, 1, 8], "unsafe_password_fil": [0, 8], "updat": 9, "uri": 1, "url": [0, 1, 7, 8], "us": [1, 4, 5, 6, 8, 9, 10, 12, 14], "usag": [1, 14], "usdc": 0, "user": [0, 1, 6, 10, 12], "util": [1, 14], "uv": [0, 4], "v0": 6, "valu": 1, "variabl": 1, "ve": 6, "venv": 6, "verif": 5, "verifi": 6, "version": [1, 4, 6, 14], "via": [6, 8], "view": [1, 14], "virtual": 6, "vscode": 1, "vy": [1, 10, 11], "vyper": [0, 1, 4, 9, 10], "wai": [5, 6, 11], "walk": 8, "wallet": [2, 8, 13], "wallet_command": 1, "want": [0, 1, 8, 9, 10, 14], "warn": 1, "watch": 5, "we": [5, 6, 7, 8, 10], "web3": 5, "weird": 6, "well": [1, 6], "what": 8, "whatev": [0, 7], "when": [0, 8], "where": [1, 7, 9], "which": [1, 4], "while": 1, "whose": 1, "window": 5, "without": 4, "work": [1, 4, 5, 6, 8, 11], "would": [4, 8, 11], "written": [5, 6], "wsl": 5, "x": 1, "you": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14], "your": [0, 1, 2, 3, 4, 6, 7, 8, 10, 11, 12, 14], "zksync": 8}, "titles": ["All moccasin toml parameters", "mox", "Common Errors", "Console", "Dependencies", "Moccasin", "Installing Moccasin", "moccasin.toml", "Networks", "Project Layout", "Quickstart", "Scripting", "Testing", "Moccasin", "Wallet"], "titleterms": {"0xxxxxxxxxx": 2, "add": 1, "all": 0, "argument": 1, "boa": 2, "build": 1, "chang": 9, "command": [1, 13], "common": 2, "compil": 1, "config": 1, "consol": [1, 3], "contract": 10, "creat": 10, "d": 1, "data": 7, "decrypt": 1, "defin": 2, "delet": 1, "depend": 4, "deploi": [1, 10], "dk": 1, "document": 5, "encrypt": 14, "eoa": 2, "error": 2, "explor": 1, "extra": 7, "fetch": 1, "from": [6, 11], "g": 1, "gener": 1, "get": [1, 13], "github": 4, "how": 5, "i": 1, "import": [1, 11], "init": 1, "inspect": 1, "instal": [1, 4, 6], "kei": 14, "l": 1, "layout": 9, "list": 1, "major": 13, "moccasin": [0, 5, 6, 7, 13], "moccasin_main": 11, "mox": 1, "name": 1, "network": [2, 8, 11], "networkenv": 2, "new": [1, 10], "object": 2, "overview": 13, "paramet": 0, "pip": [4, 6], "pipx": 6, "posit": 1, "prerequisit": 6, "privat": 14, "project": [9, 10, 13], "purg": 1, "pypi": 4, "quickstart": 10, "read": 5, "refer": 13, "run": [1, 10], "script": [1, 11], "sourc": 6, "src": 11, "start": 13, "sub": 1, "test": [1, 10, 12], "toml": [0, 7], "uv": 6, "valueerror": 2, "wallet": [1, 14], "why": 5, "your": 9}}) \ No newline at end of file diff --git a/testing.html b/testing.html new file mode 100644 index 0000000..e86e90e --- /dev/null +++ b/testing.html @@ -0,0 +1,234 @@ + + + + + Testing - moccasin documentation + + + + + + + + + + + + +
+
+
+ + + + moccasin + +
+ +
+
+
+
+
+
+
+ + + + +
+
+
+
+

Testing

+

moccasin uses pytest under the hood, so you can setup your tests like regular titanoboa based python tests.

+
def test_increment_one(counter_contract):
+    counter_contract.increment()
+    assert counter_contract.number() == 2
+
+
+def test_increment_two(counter_contract):
+    counter_contract.increment()
+    counter_contract.increment()
+    assert counter_contract.number() == 3
+
+
+

And run all your tests with mox test, to get an output like:

+
Running test command...
+====================================== test session starts =======================================
+platform darwin -- Python 3.11.6, pytest-8.3.3, pluggy-1.5.0
+rootdir: /Users/patrick/code/moccasin
+configfile: pyproject.toml
+plugins: cov-5.0.0, titanoboa-0.2.2, hypothesis-6.112.0
+collected 3 items
+
+tests/test_counter.py ..                                                                   [ 66%]
+tests/test_fork_usdc.py .                                                                  [100%]
+
+======================================= 3 passed in 0.01s ========================================
+
+
+
+ +
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/toctree.html b/toctree.html new file mode 100644 index 0000000..180c4ec --- /dev/null +++ b/toctree.html @@ -0,0 +1,239 @@ + + + + + moccasin documentation + + + + + + + + + + + + +
+
+
+ + + + moccasin + +
+ +
+
+
+
+
+
+
+ + + + +
+
+
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/wallet.html b/wallet.html new file mode 100644 index 0000000..f0e4df7 --- /dev/null +++ b/wallet.html @@ -0,0 +1,283 @@ + + + + + Wallet - moccasin documentation + + + + + + + + + + + + +
+
+
+ + + + moccasin + +
+ +
+
+
+
+
+
+
+ + + + +
+
+
+
+

Wallet

+

By default, you don’t want to ever expose your private key in your scripts. You can use the wallet commands to manage your private keys and accounts.

+
$ mox wallet
+
+usage: Moccasin CLI wallet [-h] [-d] [-q] {list,ls,generate,g,new,import,i,add,inspect,decrypt,dk,delete,d} ...
+
+Wallet management utilities.
+
+positional arguments:
+{list,ls,generate,g,new,import,i,add,inspect,decrypt,dk,delete,d}
+    list (ls)           List all the accounts in the keystore default directory
+    generate (g, new)   Create a new account with a random private key
+    import (i, add)     Import a private key into an encrypted keystore
+    inspect             View the JSON of a keystore file
+    decrypt (dk)        Decrypt a keystore file to get the private key
+    delete (d)          Delete a keystore file
+
+options:
+-h, --help            show this help message and exit
+-d, --debug           Run in debug mode
+-q, --quiet           Suppress all output except errors
+
+
+
+

Encrypting a private key

+

You can encrypt a private key using the wallet import ACCOUNT_NAME command. This will create a keystore file in the default keystore directory. It will prompt you to enter your private key and password.

+
$ mox wallet import my_account
+
+Running wallet command...
+Importing private key...
+Enter your private key:  ...
+
+
+

Once you have an account, you can view it with the wallet list command.

+
$ mox wallet list
+
+Running wallet command...
+Found 1 accounts:
+my_account
+
+
+

This will encrypt your key and store it at ~/.moccasin/keystore/my_account.json. You can view the contents of the keystore file with the wallet inspect command.

+
$ mox wallet inspect my_account
+Running wallet command...
+Keystore JSON for account my_account:
+{
+    "address": "f39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
+    "crypto": {
+        "cipher": "aes-128-ctr",
+        "cipherparams": {
+            "iv": "e6966dcf6d5384f050052f71ed7bfc02"
+        },
+        "ciphertext": "decc1fbd482a171578028bfb2563362b9f4857765d6247900bde22e0cd6c2c13",
+        "kdf": "scrypt",
+        "kdfparams": {
+            "dklen": 32,
+            "n": 262144,
+            "r": 8,
+            "p": 1,
+            "salt": "71326ecf78c3a2f2087366e4516d44f1"
+        },
+        "mac": "62dbc22cce0e270a71a5ac1a8c57b04eafa215839abcbdb9f349d63b6b9e5e9f"
+    },
+    "id": "ea0a89c0-04ea-4120-b6a4-b55fbb0baade",
+    "version": 3
+}
+
+
+

You can then use these in scripts!

+
mox run deploy --account my_account
+
+
+

And it will ask you for the password to decrypt your private key.

+
+
+ +
+
+
+
+ + + + + + + + \ No newline at end of file