Cause: You’re trying to use an account that hasn’t been deployed yet. On Starknet, accounts are smart contracts that must be deployed before use.Solution:
# 1. Check if account is createdsncast account list# 2. Fund the computed address with STRK/ETH# 3. Deploy the accountsncast account deploy \ --name your_account \ --url <YOUR_SEPOLIA_RPC_URL>
Transaction reverted: Insufficient funds for transaction
Cause: Before deploying an account contract, the computed address must be funded. Starknet computes the address deterministically, so you can fund it before deployment.Solution:
# 1. Create account (doesn't deploy yet)sncast account create --name my_account --type oz# Output shows: Address: 0x123...# 2. Fund that address BEFORE deploying# 3. Then deploysncast account deploy --name my_account
Cause: You’re trying to declare a contract class that already exists on the network.Solution:
# Use the existing class_hash insteadsncast deploy --class-hash <EXISTING_HASH> --arguments '...'# Or if you modified the contract, rebuild to get a new hashscarb clean && scarb build
Error: After deployment, the owner is set to an unexpected address (the UDC address).Cause: When deploying via the Universal Deployer Contract (UDC), get_caller_address() in the constructor returns the UDC address, not your account.Wrong pattern:
#[constructor]fn constructor(ref self: ContractState, endpoint: ContractAddress) { // BUG: This sets UDC as owner! self.ownable.initializer(get_caller_address());}
Cause: Attempting to store a value larger than ~2^251 in a felt252.Solution:
// Use u256 for large numberslet big_value: u256 = 1000000000000000000000000_u256;// When encoding for crosschain:// u256 is serialized as two felt252 (low, high)
Cause: Incorrect ByteArray encoding in calldata.ByteArray structure:
[ pending_word_len, // Number of bytes in pending_word data_len, // Number of 31-byte chunks data[0..data_len], // Full 31-byte chunks pending_word // Remaining bytes (< 31)]
Solution:
For short strings (< 31 bytes), use simplified encoding with --arguments:
# "MyToken" as a ByteArray using --argumentssncast invoke ... --arguments '"MyToken"'
When using --arguments, sncast handles ByteArray encoding automatically. You can pass strings directly in quotes.
Cause: Scarb/Cairo version doesn’t match project requirements.Solution:
# Check current versionscarb --version# Install correct version (check Scarb.toml for required version)asdf install scarb 2.14.0asdf local scarb 2.14.0