SCdev
Overview
SCdev is an interactive terminal-based tool that enables developers to compile, deploy, and interact with smart contracts on the R5 network. In addition, SCdev provides account management functions using encrypted wallet key files (compatible with those generated by the CLI wallet). With SCdev, you can quickly navigate your filesystem, manage configurations, compile contracts written in Solidity or Vyper, and deploy them safely using your secure wallet.
Basic Features
Terminal Navigation: Use familiar Unix-like commands (
cd
,ls
,mkdir
,rm
,cp
,mv
, andclear
) to navigate your filesystem and manage files or directories directly from the SCdev terminal.RPC URL Management: Configure the RPC endpoint via the global configuration file (
scdev.ini
), and change it on the fly using therpcurl
command.Smart Contract Compilation: Compile smart contracts written in Solidity or Vyper. SCdev supports various EVM versions (with Berlin as the default) and optimization settings. The compiled bytecode and ABI are saved in the same folder as the contract source.
Smart Contract Deployment: Deploy your compiled smart contracts using an encrypted wallet. SCdev prompts for the wallet password to decrypt the wallet file before sending the deployment transaction. It verifies that the wallet has sufficient R5 balance to cover gas fees.
ABI Inspection and Function Interaction: Load and read ABI files with the
readabi
command, which lists all available contract functions along with their input parameters. Then use thecf
command to call contract functions, handling GET (read-only) and POST (state-changing) methods appropriately.Account (Wallet) Management: Manage your deployment account securely with the
acc
command. You can display the current wallet information, create a new wallet (optionally with a custom alias), or import an existing wallet using a private key.Configuration Flexibility: SCdev uses a global configuration file (
scdev.ini
) for default settings. Additionally, a local configuration file (scdev.config
) in the current directory can override global defaults on a per-project basis.
Getting Started
You can find the SCdev binary/executable inside your node's /bin
folder, and can execute it from that same folder, or deploy it somewhere else of your preference.
When SCdev starts, it will:
Load global defaults from
scdev.ini
. If the file doesn’t exist, a new one is created with default settings.Look for a local
scdev.config
file in the current working directory to override any default settings.Display the terminal title, version information, and a prompt (
SCdev #
).Accept and process commands as detailed below.
Available Commands
Command
Usage
Description
cd <path>
cd path/to/directory
Change the current working directory.
ls
ls
List files and directories in the current directory.
mkdir
mkdir dirname
Create a new directory.
rm
rm [-rf] path
Remove a file or directory (use -rf
for recursive deletion).
cp
cp <source> <destination>
Copy a file from source to destination.
mv
mv <source> <destination>
Move or rename a file.
clear
clear
Clear the terminal screen.
rpcurl
rpcurl [new_url]
Display the current RPC URL, or update it if a new URL is provided.
compile
compile <contract_filepath>
Compile a smart contract (supports .sol
for Solidity and .vy
/.vyper
for Vyper).
deploy
deploy <contract_source_filepath>
Deploy a compiled contract (requires corresponding .bin
and abi.json
files).
readabi
readabi <path_to_abi.json>
Load an ABI JSON file and list available functions along with their parameters.
cf
cf <contract_address> <function_name> [parameters...]
Call a function on a deployed smart contract. Uses GET calls for view/pure functions and POST for others.
acc
acc [new] [import] [alias]
Display the current wallet information, create a new wallet (optionally with a custom alias), or import an existing wallet using a private key.
help
help
Display a list of available commands and their descriptions.
exit
exit
Exit the SCdev terminal.
Global Configuration File (scdev.ini
)
scdev.ini
)The scdev.ini
file serves as the global configuration file for SCdev. It defines the default settings that will be used if no local configuration (scdev.config
) is present. When you install or run SCdev for the first time, if scdev.ini
is missing, the tool automatically creates one with the default values.
Schematic of scdev.ini
scdev.ini
Here’s an example of what the global configuration file might look like:
How It Is Used
Fallback Defaults: SCdev always checks for a local
scdev.config
file first. If none is found, or if certain values are missing locally, SCdev falls back to the values specified inscdev.ini
.Global Settings: These settings are applied as defaults across all projects, ensuring consistency in how contracts are compiled and deployed unless specifically overridden locally.
Automatic Creation: If the file does not exist when SCdev is started, the tool automatically creates
scdev.ini
with these default settings. This helps ensure that there is always a baseline configuration to work from.
Local Configuration File (scdev.config
)
scdev.config
)The scdev.config
file is an optional local configuration file that you can place in the current working directory where you run SCdev. When present, its settings override those defined in the global configuration file (scdev.ini
). This allows you to customize settings on a per-project basis without modifying the global defaults.
Schematic of scdev.config
scdev.config
Below is a schematic example of a typical scdev.config
file:
How It Is Used
Override Defaults: When you start SCdev, the tool first loads the global configuration from
scdev.ini
. Then, it checks whether ascdev.config
file exists in the current directory. If it does, SCdev merges these settings with the global ones—values fromscdev.config
will override any corresponding global setting.Per-Project Customization: This file is particularly useful if you work on multiple projects that require different settings (e.g., different RPC URLs or wallet files). You can have a unique
scdev.config
in each project directory to tailor SCdev’s behavior for that project.Defaults: If no local configuration file is found, SCdev uses the values from
scdev.ini
as the default.
Detailed Workflow
Navigation and RPC Management
Navigation: Use standard commands such as cd
, ls
, mkdir
, rm
, cp
, and mv
to browse and manage your project directories.
RPC URL: The rpcurl
command shows the currently set RPC URL (as defined in the global or local configuration). To change it during a session, simply type:
If called without arguments, it displays the current URL.
Smart Contract Compilation
Compilation: To compile a contract, navigate to the directory containing your smart contract source file and run:
SCdev will detect whether the contract is Solidity or Vyper based on the file extension, apply the compilation settings (compiler, EVM version, optimization, etc.) from the configuration, and output a .bin
file (bytecode) and an abi.json
file in the same directory.
Smart Contract Deployment
Deployment: Ensure your contract is compiled before deploying. Run:
SCdev verifies that the corresponding compiled files exist. It then prompts for the wallet password, decrypts the deployer's wallet (as specified in your configuration), and checks that the account has sufficient R5 balance. Upon successful deployment, SCdev outputs the contract address and logs the deployment details in a file named with the contract name and timestamp.
ABI Inspection and Contract Interaction
Read ABI: To inspect a contract’s ABI and see the list of callable functions, use:
The output will list each function with its parameters and state mutability, allowing you to see which functions require transactions (POST) versus simple calls (GET).
Call Function:
Use the cf
command to interact with a contract. For example:
For GET functions, the result is displayed immediately. For POST functions, you will be prompted for your wallet password to sign and send the transaction.
Wallet (Account) Management
Account Management:
Use the acc
command to manage your deployment wallet:
Display current wallet:
Create a new wallet:
If no alias is provided, the default wallet file
r5.key
is used.Import an existing wallet:
The wallet file is encrypted using a user-defined password. When a new wallet is created or imported, SCdev updates the configuration so that the deployer wallet path is set to the new wallet file.
Additional Considerations
Configuration Files: The global configuration is stored in scdev.ini
, and any local overrides can be provided via a scdev.config
file in the current directory. This two-tier system allows you to have default settings while tailoring projects individually.
Versioning: On startup, SCdev displays the current version (read from a file named version
in the root). If this file is missing or empty, it will notify you that the version could not be determined.
Extensibility: The terminal includes a help command (help
) that lists all available commands. As SCdev evolves, you can add further functionality (e.g., automated contract verification, integration with additional compilers, etc.) while keeping the command interface simple.
Error Handling: All commands include basic error handling and user prompts to ensure that mistakes (like trying to deploy a contract that isn’t compiled) are caught and reported.
Last updated