{"id":41417505,"url":"https://github.com/lambdaclass/rex","last_synced_at":"2026-01-23T13:58:05.646Z","repository":{"id":279659748,"uuid":"939301043","full_name":"lambdaclass/rex","owner":"lambdaclass","description":"Useful tools for developing on Ethereum powered by Ethrex","archived":false,"fork":false,"pushed_at":"2026-01-15T19:30:57.000Z","size":1367,"stargazers_count":18,"open_issues_count":96,"forks_count":4,"subscribers_count":9,"default_branch":"main","last_synced_at":"2026-01-15T19:42:08.212Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lambdaclass.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":".github/CODEOWNERS","security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-02-26T10:21:53.000Z","updated_at":"2026-01-15T19:31:02.000Z","dependencies_parsed_at":"2025-06-24T22:26:40.498Z","dependency_job_id":"09993f57-a1cd-4dfa-9241-b2408a6f2a97","html_url":"https://github.com/lambdaclass/rex","commit_stats":null,"previous_names":["lambdaclass/ethertools","lambdaclass/rex"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/lambdaclass/rex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambdaclass%2Frex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambdaclass%2Frex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambdaclass%2Frex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambdaclass%2Frex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lambdaclass","download_url":"https://codeload.github.com/lambdaclass/rex/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambdaclass%2Frex/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28693427,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T11:01:27.039Z","status":"ssl_error","status_checked_at":"2026-01-23T11:00:26.909Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2026-01-23T13:58:05.582Z","updated_at":"2026-01-23T13:58:05.637Z","avatar_url":"https://github.com/lambdaclass.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rex - Developing on Ethereum powered by Ethrex\n\nRex is a set of utilities for Ethereum development powered by [Ethrex](https://github.com/lambdaclass/ethrex).\n\nWith **Rex** you can\n- Launch your own devnet using Ethrex\n- Interact with a running L1 network\n- Interact with a running Ethrex L2 network\n- Execute useful functions for Ethereum development.\n\n**Rex** can be used both as a **CLI tool** and via its **Rust SDK**, allowing seamless integration with any Rust script.\n\nOur **CLI** is built on top of the **SDK**, ensuring a consistent and powerful developer experience.\n\nRex is currently a replacement for foundry's `cast` and `alloy`.\n\n## `rex` CLI\n\nThe `rex` CLI is a command line tool that provides a set of utilities for Ethereum development.\n\n### Installing the CLI\n\nSo far, **Rex** does not have a published release on [crates.io](https://crates.io).  \nTo install it, you need to clone the repository and run the following command to install the CLI as the binary `rex`:\n\n```Shell\nmake cli\n```\n\nOr install without cloning:\n\n```shell\ncargo install --git https://github.com/lambdaclass/rex --locked\n```\n\n### Using the CLI\n\nAfter installing the CLI with `make cli`, run `rex` to display the help message and see the available commands.\n\n```Shell\n➜  ~ rex\nUsage: rex \u003cCOMMAND\u003e\n\nCommands:\n  address           Get either the account's address from private key, the zero address, or a random address [aliases: addr, a]\n  autocomplete      Generate shell completion scripts.\n  balance           Get the account's balance info. [aliases: bal, b]\n  block-number      Get the current block_number. [aliases: bl]\n  call              Make a call to a contract\n  chain-id          Get the network's chain id.\n  code              Returns code at a given address\n  create-address    Compute contract address given the deployer address and nonce.\n  create2-address   Compute contract address for CREATE2 deployments.\n  deploy            Deploy a contract\n  hash              Get either the keccak for a given input, the zero hash, the empty string, or a random hash [aliases: h, keccak]\n  l2                L2 specific commands.\n  nonce             Get the account's nonce. [aliases: n]\n  receipt           Get the transaction's receipt. [aliases: r]\n  send              Send a transaction\n  sign              Sign a message with a private key\n  signer\n  transaction       Get the transaction's info. [aliases: tx, t]\n  transfer          Transfer funds to another wallet.\n  verify-signature  Verify if the signature of a message was made by an account\n  encode-calldata   Encodes calldata\n  decode-calldata   Decodes calldata\n  authorize         Authorize a delegated account\n  help              Print this message or the help of the given subcommand(s)\n\nOptions:\n  -h, --help     Print help\n  -V, --version  Print version\n```\n\n#### Helpful operations\n\n![ops](./assets/operations_demo.gif)\n\n#### Interacting with an Ethereum node\n\n\u003e [!NOTE]\n\u003e Before running the following commands, make sure you have an Ethereum node running or override the default RPC URL with the `--rpc-url` flag to point to a public node.\n\n![eth](./assets/chain_demo.gif)\n\n#### Interacting with an ethrex L2 node\n\nTODO\n\nYou can find the CLI documentation [here](cli/README.md).\n\n## `rex` SDK\n\nThe `rex` SDK provides a set of utilities for Ethereum and ethrex L2 development. With it, you can write Rust scripts to interact with Ethereum and ethrex L2 networks as well as deploy and interact with smart contracts, transferring funds between accounts, and more. \n\n### Getting Started with the SDK\n\n#### Adding the SDK to your project\n\nFor the moment, `rex-sdk` is not yet published on crates.io. You can add the SDK to your project by adding the following to your `Cargo.toml` file:\n\n```toml\n[dependencies]\nrex-sdk = { git = \"https://github.com/lambdaclass/rex\", package = \"rex-sdk\", branch = \"main\" }\nethrex-common = { git = \"https://github.com/lambdaclass/ethrex\", package = \"ethrex-common\", branch = \"main\" }\n```\n\n\u003e [!TIP]\n\u003e Maybe consider adding tokio as dependency since we are using a lot of async/await functions. If this example is meant to be done in the main function the #[tokio::main] annotation is needed.\n\n\u003c!-- Uncomment the following after crates.io publishing --\u003e\n\u003c!-- Add the following to your `Cargo.toml` file:\n\n```toml\n[dependencies]\nrex-sdk = \"0.1.0\"\nethrex-common = { git = \"https://github.com/lambdaclass/ethrex\", package = \"ethrex-common\", branch = \"main\" }\n```\n\nOr, via the command line:\n\n```Shell\ncargo add rex-sdk\n``` --\u003e\n\n#### First Steps\n\nIn the following example we will show simple interactions with an Ethereum node similar to the CLI example but using the SDK (as a matter of fact, the CLI uses the SDK as backend).\n\nAs pre-requisites for running this example you need to have an Ethereum node running locally or have access to a public node. And you need to have an account with some funds (these must be the values of `account` and `from_private_key` in the following example).\n\n*Importing the dependencies*\n\n```Rust\nuse ethrex_common::{Address, U256};\nuse rex_sdk::{\n    client::{EthClient, Overrides},\n    transfer, wait_for_transaction_receipt,\n};\nuse std::str::FromStr;\n```\n\nThe following should be either part of a function or the main function.\n\n*Connecting to the node*\n\n```Rust\nlet rpc_url = \"http://localhost:8545\";\n\nlet eth_client = EthClient::new(rpc_url);\n```\n\n*Doing simple interactions (balance and nonce of an account and chain-id)*\n\n```Rust\nlet account_balance = eth_client.get_balance(account).await.unwrap();\n\nlet account_nonce = eth_client.get_nonce(account).await.unwrap();\n\nlet chain_id = eth_client.get_chain_id().await.unwrap();\n\nprintln!(\"Account balance: {account_balance}\");\nprintln!(\"Account nonce: {account_nonce}\");\nprintln!(\"Chain id: {chain_id}\");\n```\n\n*Transferring funds*\n\n```Rust\nlet amount = U256::from_dec_str(\"1000000000000000000\").unwrap(); // 1 ETH in wei\nlet from = account;\nlet to = Address::from_str(\"0x4852f44fd706e34cb906b399b729798665f64a83\").unwrap();\n\nlet tx_hash = transfer(\n    amount,\n    from,\n    to,\n    from_private_key,\n    \u0026eth_client,\n    Overrides {\n        value: Some(amount),\n        ..Default::default()\n    },\n)\n.await\n.unwrap();\n\n// Wait for the transaction to be finalized\nwait_for_transaction_receipt(tx_hash, \u0026eth_client, 100)\n    .await\n    .unwrap();\n```\n\n*Getting transfer tx hash details and receipt*\n\n```Rust\nlet tx_receipt = eth_client.get_transaction_receipt(tx_hash).await.unwrap();\n\nprintln!(\"transfer tx receipt: {tx_receipt:?}\");\n\nlet tx_details = eth_client.get_transaction_by_hash(tx_hash).await.unwrap();\n\nprintln!(\"transfer tx details: {tx_details:?}\");\n```\n\n#### Full Example\n\n```Rust\nuse ethrex_common::{Address, U256};\nuse rex_sdk::{\n    client::{EthClient, Overrides},\n    transfer, wait_for_transaction_receipt,\n};\nuse std::str::FromStr;\n\n#[tokio::main]\nasync fn main() {\n    let rpc_url = \"http://localhost:8545\";\n\n    let eth_client = EthClient::new(\u0026rpc_url);\n\n    let account_balance = eth_client.get_balance(account).await.unwrap();\n\n    let account_nonce = eth_client.get_nonce(account).await.unwrap();\n\n    let chain_id = eth_client.get_chain_id().await.unwrap();\n\n    println!(\"Account balance: {account_balance}\");\n    println!(\"Account nonce: {account_nonce}\");\n    println!(\"Chain id: {chain_id}\");\n\n    let amount = U256::from(1000000000000000000); // 1 ETH in wei\n    let from = account;\n    let to = Address::from_str(\"0x4852f44fd706e34cb906b399b729798665f64a83\").unwrap();\n\n    let tx_hash = transfer(\n        amount,\n        from,\n        to,\n        from_private_key,\n        \u0026eth_client,\n        Overrides {\n            value: Some(amount),\n            ..Default::default()\n        },\n    )\n    .await\n    .unwrap();\n\n    // Wait for the transaction to be finalized\n    wait_for_transaction_receipt(tx_hash, \u0026eth_client, 100)\n        .await\n        .unwrap();\n\n    let tx_receipt = eth_client.get_transaction_receipt(tx_hash).await.unwrap();\n\n    println!(\"transfer tx receipt: {tx_receipt:?}\");\n\n    let tx_details = eth_client.get_transaction_by_hash(tx_hash).await.unwrap();\n\n    println!(\"transfer tx details: {tx_details:?}\");\n}\n```\n\n#### Running the examples\n\n\u003e [!WARNING]\n\u003e Before running the examples, make sure you have an Ethereum node running or override the default RPC URL with the `--rpc-url` flag to point to a public node.\n\u003e The account associated to the private key must have some funds in the network you are connecting to.\n\n```Shell\ncd sdk\ncargo run --release --example simple_usage -- --private-key \u003cPRIVATE_KEY\u003e --rpc-url \u003cRPC_URL\u003e\ncargo run --release --example keystore -- --private-key \u003cPRIVATE_KEY\u003e --rpc-url \u003cRPC_URL\u003e\n```\n\n\u003e [!NOTE]\n\u003e You can find the code for these examples in `sdk/examples/`.\n\nYou can find the SDK documentation [here](sdk/README.md).\n\n\n# Security\n\nWe take security seriously. If you discover a vulnerability in this project, please report it responsibly. \n\n- You can report vulnerabilities directly via the **[GitHub \"Report a Vulnerability\" feature](../../security/advisories/new)**.\n- Alternatively, send an email to **[security@lambdaclass.com](mailto:security@lambdaclass.com)**.\n\nFor more details, please refer to our [Security Policy](./.github/SECURITY.md).\n\n \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flambdaclass%2Frex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flambdaclass%2Frex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flambdaclass%2Frex/lists"}