{"id":19390329,"url":"https://github.com/nucypher/atxm","last_synced_at":"2025-04-24T00:31:14.286Z","repository":{"id":221073881,"uuid":"753342379","full_name":"nucypher/ATxM","owner":"nucypher","description":"Automatic Transaction Machine 🏧 🔁","archived":false,"fork":false,"pushed_at":"2024-07-31T06:25:37.000Z","size":1662,"stargazers_count":3,"open_issues_count":3,"forks_count":3,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-04-12T21:37:58.746Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://pypi.org/project/atxm/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nucypher.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-05T23:34:40.000Z","updated_at":"2024-07-31T06:24:22.000Z","dependencies_parsed_at":"2024-02-06T02:43:31.091Z","dependency_job_id":"b31e7f7f-6509-41f6-8013-8359cc3b6ff1","html_url":"https://github.com/nucypher/ATxM","commit_stats":null,"previous_names":["nucypher/atxm"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nucypher%2FATxM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nucypher%2FATxM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nucypher%2FATxM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nucypher%2FATxM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nucypher","download_url":"https://codeload.github.com/nucypher/ATxM/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250539363,"owners_count":21447294,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T10:20:17.546Z","updated_at":"2025-04-24T00:31:13.532Z","avatar_url":"https://github.com/nucypher.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Automatic Tx Machine 🏧\n========================\n\n[![Tests](https://github.com/nucypher/ATxM/actions/workflows/pytest.yml/badge.svg)](https://github.com/nucypher/ATxM/actions/workflows/pytest.yml)\n\nAn async EVM transaction retry machine.\nProgrammatically queue, broadcast, and retrying (speedup) transactions.\nTransactions are queued and broadcasted in a first-in-first-out (FIFO) order.\n\nThe machine is designed to be used in a long-running process, like a server.\n\n[![Diagram](./diagram.png)](./diagram.png)\n\n### Installation\n\n```bash\npip install atxm\n```\n\n### Usage\n\n```python\nfrom eth_account.local import LocalAccount\nfrom web3 import Web3, HTTPProvider\nfrom atxm import AutomaticTxMachine\nfrom twisted.internet import reactor\n\n\naccount = LocalAccount.from_keyfile('path/to/keyfile', 'password')\nw3 = Web3(HTTPProvider(\"http://localhost:8545\"))\n\ntransaction = {\n    'chainId': 80001,\n    'to': '0x1234567890123456789012345678901234567890',\n    'nonce': 0,\n    'value': 0,\n    'gas': 21000,\n    'maxFeePerGas': '1',\n    'maxPriorityFeePerGas': '1',\n}\n\nmachine = AutomaticTxMachine(w3=w3)\nfuture_tx = machine.queue_transaction(\n    signer=account,\n    params=transaction,\n    on_broadcast_failure=...,\n    on_fault=...,\n    on_finalized=...,\n    on_insufficient_funds=...,\n)\n\nreactor.run()\n```\n\n### Features\n\n\n##### Futures\n\nThe tracker returns a `FutureTx` instance when a transaction is queued.\nThe FutureTx instance can be used to track the transaction's lifecycle and\nto retrieve the transaction's receipt when it is finalized.\n\n##### Retry Strategies\n\nThe tracker supports a generic configurable interface for retry strategies (`AsynxTxStrategy`).\nThese strategies are used to determine when to retry a transaction and how to do so.\nThey can be configured to use any kind of custom context, like gas oracles.\n\n##### Lifecycle Hooks \n\nHooks are fired in a dedicated thread for lifecycle events.\n\n- `on_broadcast` _(Optional)_: When a transaction is broadcasted.\n- `on_broadcast_failure`: When a transaction fails to broadcast.\n- `on_finalized`: When a transaction is finalized (successful or reverted).\n- `on_fault`: When a transaction error occurred.\n- `on_insufficient_funds`: When the account associated with the transaction does not have enough funds for the transaction.\n\n\n##### Crash-Tolerance\n\nInternal state is written to a file to help recover from crashes\nand restarts. Internally caches LocalAccount instances in-memory which in\ncombination with disk i/o is used to recover from async task restarts.\n\n\n##### Throttle \n\nThere are three rates, work (fast scan), idle (slow scan) and sleep (zero activity).\nThis reduces the use of resources when there are no transactions to track.\nWhen a transaction is queued, the machine wakes up and goes to work.\nWhen all work is complete it eases into idle mode and eventually goes to sleep.\n\n##### Event Loop Support\n\nCurrently, the machine is designed to work with the Twisted reactor.\nHowever, it can be adapted to work with any event loop.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnucypher%2Fatxm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnucypher%2Fatxm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnucypher%2Fatxm/lists"}