{"id":21156926,"url":"https://github.com/apache/incubator-resilientdb-ResContract","last_synced_at":"2025-07-09T12:32:55.389Z","repository":{"id":246309359,"uuid":"820709402","full_name":"ResilientEcosystem/ResContract","owner":"ResilientEcosystem","description":null,"archived":false,"fork":false,"pushed_at":"2024-11-15T04:01:20.000Z","size":2326,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-11-15T05:17:24.793Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ResilientEcosystem.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-06-27T03:01:28.000Z","updated_at":"2024-11-15T04:01:24.000Z","dependencies_parsed_at":"2024-06-27T05:14:54.000Z","dependency_job_id":"6740aaaf-8d36-480d-b5f5-3422c19a0cec","html_url":"https://github.com/ResilientEcosystem/ResContract","commit_stats":null,"previous_names":["resilientecosystem/rescontract"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ResilientEcosystem%2FResContract","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ResilientEcosystem%2FResContract/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ResilientEcosystem%2FResContract/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ResilientEcosystem%2FResContract/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ResilientEcosystem","download_url":"https://codeload.github.com/ResilientEcosystem/ResContract/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225544174,"owners_count":17486064,"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-20T11:55:04.903Z","updated_at":"2025-07-09T12:32:50.084Z","avatar_url":"https://github.com/ResilientEcosystem.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# ResContract CLI 🚀\n\nThe **ResContract CLI** is a command-line tool for creating, deploying, and managing smart contracts within the ResilientDB ecosystem. It provides a streamlined interface for developers and students to interact with smart contracts efficiently.\n\n## Table of Contents\n\n- [Features ✨](#features-)\n- [Prerequisites](#prerequisites)\n- [Installation 🛠️](#installation-️)\n- [Usage](#usage)\n  - [Commands](#commands)\n    - [create Command](#create-command)\n    - [compile Command](#compile-command)\n    - [deploy Command](#deploy-command)\n    - [execute Command](#execute-command)\n- [Configuration ⚙️](#configuration-️)\n  - [Setting the ResDB_Home Variable](#setting-the-resdb_home-variable)\n    - [Option 1: Set `ResDB_Home` Environment Variable](#option-1-set-resdb_home-environment-variable)\n    - [Option 2: Use a `config.yaml` File](#option-2-use-a-configyaml-file)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Features ✨\n\n- **Create Smart Contracts**: Generate new smart contract templates.\n- **Compile Contracts**: Compile Solidity contracts to JSON.\n- **Deploy Smart Contracts**: Deploy contracts to the blockchain.\n- **Execute Functions**: Interact with and manage deployed contracts.\n\n## Prerequisites\n\nBefore installing and using the ResContract CLI, ensure you have the following prerequisites installed on your system:\n\n- **Node.js (version \u003e= 14)**: [Download and install Node.js](https://nodejs.org/en/download/)\n- **npm**: Comes with Node.js. Ensure it's up-to-date.\n- **Solidity Compiler (`solc`)**: Required to compile smart contracts.\n\n### Installing `solc`\n\n#### Linux (Ubuntu/Debian)\n\n```bash\nsudo add-apt-repository ppa:ethereum/ethereum\nsudo apt-get update\nsudo apt-get install -y solc\n```\n\n#### macOS\n```bash\nbrew update\nbrew upgrade\nbrew tap ethereum/ethereum\nbrew install solidity\n```\n\n## Installation 🛠️\n\nInstall the ResContract CLI globally using npm:\n\n```bash\nnpm install -g rescontract-cli\n```` \n\n## Configuration ⚙️\n\n### Setting the ResDB_Home Variable\n\nBefore using the ResContract CLI, you  **must**  set the  `ResDB_Home`  environment variable or provide the path to your ResilientDB installation in a  `config.yaml`  file. The CLI will  **not**  prompt you for this path and will exit with an error if it's not set.\n\n#### Option 1: Set  `ResDB_Home`  Environment Variable\n\nSet the  `ResDB_Home`  environment variable to point to the directory where ResilientDB is installed.\n\n**Linux/macOS:**\n```bash\nexport ResDB_Home=/path/to/resilientdb\n```\n\nAdd the above line to your  `.bashrc`  or  `.zshrc`  file to make it persistent.\n\n#### Option 2: Use a  `config.yaml`  File\n\nUpdate the `config.yaml`  file in the same directory where you run the  `rescontract`  command or in your home directory.\n\n**Example  `config.yaml`:**\n```yaml\nResDB_Home: /path/to/resilientdb\n```\n\nEnsure the  `ResDB_Home`  path is correct.\n\n\u003e **Note:**  The CLI checks for  `config.yaml`  in the current directory first, then in your home directory.\n\n## Usage\n\nAfter installation, you can use the  `rescontract`  command in your terminal.\n\n```bash\nrescontract \u003ccommand\u003e [options]\n```\n\n### Commands\n\n#### create Command\n\nInitializes a new account using ResilientDB's smart contract tools.\n\n**Usage:**\n```bash\nrescontract create --config \u003cpath_to_config\u003e\n```\n-   `--config, -c`: Path to the configuration file.\n\n**Example:**\n\n```bash\nrescontract create --config ~/resilientdb/config/service.config\n```\n\n#### compile Command\n\nCompiles a Solidity smart contract into a JSON file using  `solc`.\n\n**Usage:**\n```bash\nrescontract compile --sol \u003cinputFile.sol\u003e --output \u003coutputFile.json\u003e\n```\n\n-   `--sol, -s`: Path to the Solidity smart contract file.\n-   `--output, -o`: Name of the resulting JSON file.\n\n**Example:**\n\n```bash\nrescontract compile --sol contracts/MyToken.sol --output build/MyToken.json\n```\n\n#### deploy Command\n\nDeploys the smart contract to the blockchain.\n\n**Usage:**\n\n```bash\nrescontract deploy --config \u003cservice.config\u003e --contract \u003ccontract.json\u003e \\\n--name \u003ctokenName\u003e --arguments \"\u003cparameters\u003e\" --owner \u003caddress\u003e\n```\n\n-   `--config, -c`: Client configuration path.\n-   `--contract, -p`: Path to the contract JSON file.\n-   `--name, -n`: Name of the contract.\n-   `--arguments, -a`: Parameters to create the contract object (enclosed in quotes).\n-   `--owner, -m`: Contract owner's address.\n\n**Example:**\n\n```bash\nrescontract deploy --config ~/resilientdb/config/service.config \\\n--contract build/MyToken.json --name MyToken \\\n--arguments \"1000000\" --owner 0xYourAddress\n```\n\n#### execute Command\n\nExecutes a smart contract function.\n\n**Usage:**\n\n```bash\nrescontract execute --config \u003cservice.config\u003e --sender \u003csenderAddress\u003e \\\n--contract \u003ccontractAddress\u003e --function-name \u003cfunctionName\u003e --arguments \"\u003cparameters\u003e\"\n```\n\n-   `--config, -c`: Path to the client configuration file.\n-   `--sender, -m`: Address of the sender executing the function.\n-   `--contract, -s`: Address of the deployed contract.\n-   `--function-name, -f`: Name of the function to execute (include parameter types).\n-   `--arguments, -a`: Arguments to pass to the function (enclosed in quotes).\n\n**Example:**\n```bash\nrescontract execute --config ~/resilientdb/config/service.config \\\n--sender 0xYourAddress --contract 0xContractAddress \\\n--function-name \"transfer(address,uint256)\" \\\n--arguments \"0xRecipientAddress,100\"\n```\n\n## License\n\nThis project is licensed under the MIT License - see the  [LICENSE](LICENSE)  file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapache%2Fincubator-resilientdb-ResContract","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapache%2Fincubator-resilientdb-ResContract","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapache%2Fincubator-resilientdb-ResContract/lists"}