Make sure you have the right version of the tools you need:
- cairo v1.1.0 (check out the tag)
- cairo-lang v0.11.2
Set up the env
export STARKNET_NETWORK=alpha-goerli
export STARKNET_WALLET=starkware.starknet.wallets.open_zeppelin.OpenZeppelinAccount
you also need an CLI account - you can check ~/.starknet_accounts/starknet_open_zeppelin_accounts.json
if you have some or do starknet new_account --account experiments
to get an address, then fund it with some goerli ETH and then starknet deploy_account --account experiments
compile the contract using the built cairo binaries
cairo/target/release/starknet-copmile contract.cairo > contract.json
now declare the contract
starknet declare --contract contract.json --account experiments --max_fee 10000000000000000
that will give you a contract class hash which you'll need in the deploy step; monitor for the TX to pass (at least "pending" I think)
to deploy, the easiest way from CLI is to use the UDC - the deploy is done by invoking a contract that's basically a wrapper around a deploy syscall
starknet invoke --address 0x041a78e741e5af2fec34b695679bc6891742439f7afb8484ecd7766661ad02bf --abi ./UDC_abi.json --function deployContract --inputs CLASS_HASH_FROM_DECLARE_TX SALT UNIQUE_FLAG CTOR_DATA_LEN CTOR_DATA --account experiments
monitor this TX on Starkscan; to get the address of the deployed contract, check the ContractDeploy
event that this TX emits, specifically the address
field
it's also possible to declare and deploy via ArgentX - in some Developer tools submenu, there's an option to do that