Code Monkey home page Code Monkey logo

autotx's Introduction

AutoTx

Discord | โญ the repo !

AutoTx is a personal assistant that plans and proposes on-chain transactions for you. These tx bundles are submitted to a smart account so users can easily execute them.

Warning

This project is still early and experimental. Exercise caution when using real funds.

How It Works

AutoTx employs a multi-agent orchestration architecture to easily compose functionality. Given a user's prompt, it will first create a plan for how it will satisfy the user's intents. During the plan's execution, individual agents are used to complete tasks described within the plan.

Agents can add transactions to the bundle, which will later be proposed to the user's smart account for final approval before on-chain execution. Currently AutoTx supports Safe smart accounts. AutoTx uses a locally-stored private key to submit transactions to the user's smart account. AutoTx can create a new smart account for the user, or connect to an existing account (instructions below).

Agents

Below is a list of existing and anticipated agents that AutoTx can use. If you'd like to help build one of these agents, see the How To Contribute section below.

Agent Description Status
Send Tokens Send tokens (ERC20 & ETH) to a receiving address. ๐Ÿš€
Swap Tokens Swap from one token to another. Currently integrated with Uniswap. ๐Ÿš€
Token Research Research tokens, liquidity, prices, graphs, etc. ๐Ÿšง spec
Earn Yield Stake assets to earn yield. ๐Ÿ“ draft
Bridge Tokens Bridge tokens from one chain to another. ๐Ÿ“ draft
NFTs Basic NFT integration: mint, transfer, set approval, etc. ๐Ÿ“ draft
NFT Market NFT marketplace functionality: list, bid, etc. ๐Ÿ’ญ
LP Provide liquidity to AMMs. ๐Ÿ’ญ
Governance Vote or delegate in DAOs. ๐Ÿ’ญ
Predict Generate future predictions based on research. ๐Ÿ’ญ
Donate Donate to public goods projects. ๐Ÿ’ญ
Invest Participate in LBPs, IDOs, etc. ๐Ÿ’ญ
Social Use social networks (ex: Farcaster). ๐Ÿ’ญ

Getting Started

Pre-Requisites

Please install the following:

Installation

  1. Clone the repository via git clone https://github.com/polywrap/AutoTx and cd AutoTx into the directory.
  2. Create a new .env file via cp .env.example .env
  3. Find the line that says OPENAI_API_KEY=, and add your unique OpenAI API Key OPENAI_API_KEY=sk-..., OpenAI API Base OPENAI_API_BASE & OPENAI_BASE_URL(Only for Openai API compatibility, like LLMs hosted by vllm and Ollama) and OPENAI_MODEL_NAME.
  4. Find the line that says CHAIN_RPC_URL=, and add your unique Ethereum RPC URL CHAIN_RPC_URL=https://mainnet.infura.io/v3/... (see https://www.infura.io/)
  5. Start a new poetry shell poetry shell
  6. Install python dependencies poetry install

Run The Agent

  1. AutoTx requires a fork of the blockchain network you want to transact with. You can start the fork by running poetry run start-fork, and stop it with poetry run stop-fork. This command requires Docker to be running on your computer.
  2. Run poetry run ask and provide a prompt for AutoTx to work on solving for you (example: Send 1 ETH to vitalik.eth). The --prompt "..." option can be used for non-interactive startup. The --non-interactive (or -n) flag will disable all requests for user input, including the final approval of the transaction plan.

Test Offline

By default, if the SMART_ACCOUNT_ADDRESS environment variable is not defined, AutoTx will create and execute transactions within an offline test environment. This test environment includes a new smart account, as well as a development address with test ETH for tx execution.

Connect a Smart Account

AutoTx can be connected to your existing smart account by doing the following:

  1. Set the SMART_ACCOUNT_ADDRESS to the address of your smart account in your .env. This tells AutoTx which account it should interact with.

  2. AutoTx's agent address, which it generates locally, must be set as a signer in your Safe's configuration to allow it to create transactions on behalf of the smart account. To get this address, run poetry run agent address.

  3. Update the CHAIN_RPC_URL value in your .env with the correct RPC URL of the network where your smart account is deployed.

Prompts

AutoTx currently supports prompts such as:

  • Send 1 ETH to vitalik.eth
  • Buy 100 USDC with ETH
  • Swap ETH to 0.05 WBTC, then swap WBTC to 1000 USDC, and finally send 50 USDC to 0x...

Future possibilities:

  • Buy me 5 small cap AI tokens
  • Send the most popular meme coin to vitalik.eth
  • Purchase mainnet ETH with my USDC on optimism
  • What proposals are being voted on right now?
  • Donate $100 to environmental impact projects.

How To Contribute

Interested in contributing to AutoTx? There's no shortage of agents to build! Additionally, checkout the repository's issues that will remain updated with the project's latest developments. Connect with us on Discord if you have any questions or ideas to share.

Adding Agents

To add agents to AutoTx, we recommend starting with the ExampleAgent.py starter template. From there you'll want to:

  1. Implement the tools (functions) you want the agent to be able to call.
  2. Add all tools to the agent's tools=[...] array.
  3. Add your new agent to AutoTx's constructor in cli.py.

Testing Agents

Tests are located in the ./autotx/tests directory.

Use the following commands to run your tests:

# run all tests
poetry run pytest -s

# run a specific file
poetry run pytest -s ./autotx/tests/file_name.py

# run a specific test
poetry run pytest -s ./autotx/tests/file_name.py::function_name

Additionally you can run benchmarks to measure consistency:

# run tests in a directory with 5 iterations each
python benchmarks.py ./autotx/tests/dir_name 5

# run tests in a file with 5 iterations each
python benchmarks.py ./autotx/tests/file_name.py 5

# run a specific test with 5 iterations
python benchmarks.py ./autotx/tests/file_name.py::function_name 5

Need Help?

Join our Discord community for support and discussions.

Join us on Discord

If you have questions or encounter issues, please don't hesitate to create a new issue to get support.

autotx's People

Contributors

nerfzael avatar cbrzn avatar dorgjelli avatar namesty avatar kongzii avatar fromcsuzhou avatar rihp avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.