stxn-cli
v1.2.0
Published
CLI for interacting with Lestnet blockchain
Maintainers
Readme
STXN CLI
A command-line interface for interacting with the Lestnet blockchain. STXN CLI provides a simple way to manage wallets, check balances, deploy smart contracts, and more on the Lestnet testnet.
Installation
Install globally from npm:
npm install -g stxn-cliFeatures
- 🔍 Check address balances
- 🔑 Create new wallets
- 🌐 Get network information
- 💸 Send transactions
- 📝 Deploy smart contracts
- 💻 Dry-run deployment with gas estimation
Usage
Check Balance
Get the balance of any Lestnet address:
stxn balance <address>Example:
stxn balance 0xB5a71834a2DC0cc2a7a8893407D6EA04ABAB6BD4Create Wallet
Generate a new random wallet with address, private key, and mnemonic:
stxn create-walletKeep your private key and mnemonic secure!
Network Information
Get information about the Lestnet network:
stxn networkSend Transactions
Send LETH to another address:
stxn send <to> <amount> <privateKey> [options]Options:
-g, --gas-limit <limit>: Custom gas limit
Example:
# Send 1 LETH
stxn send 0xRecipientAddress 1 0xYourPrivateKey
# Send with custom gas limit
stxn send 0xRecipientAddress 0.5 0xYourPrivateKey --gas-limit 21000Deploy Smart Contracts
Deploy a Solidity smart contract to Lestnet:
stxn deploy <contract-file> -c <constructor-args> -p <private-key>Options:
-c, --constructor-args <args>: Constructor arguments (comma-separated)-p, --private-key <key>: Private key for deployment-g, --gas-limit <limit>: Custom gas limit-d, --dry-run: Compile without deploying (good for testing)
Example:
# Deploy with constructor argument 42
stxn deploy SimpleStorage.sol -c 42 -p 0x123...
# Dry run to check compilation and estimate gas
stxn deploy SimpleStorage.sol -c 42 -p 0x123... --dry-runContract Example
Here's a simple storage contract example (SimpleStorage.sol):
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract SimpleStorage {
uint256 private value;
constructor(uint256 _value) {
value = _value;
}
function getValue() public view returns (uint256) {
return value;
}
function setValue(uint256 _value) public {
value = _value;
}
}Getting Testnet Funds
To get testnet LETH for your wallet:
- Visit Lestnet website
- Click on "Get Testnet Funds"
- Enter your wallet address
- Receive free testnet LETH
Links
License
MIT
