Skip to content

Latest commit

 

History

History
17 lines (14 loc) · 1.34 KB

README.md

File metadata and controls

17 lines (14 loc) · 1.34 KB

This example demonstrates how to declare a contract on Starknet. It uses a simple Hello Starknet contract, but it can be any smart contract.

Steps:

  1. Rename the ".env.template" file located at the root of the "examples" folder to ".env"
  2. Uncomment, and assign your Sepolia testnet endpoint to the RPC_PROVIDER_URL variable in the ".env" file
  3. Uncomment, and assign your account address to the ACCOUNT_ADDRESS variable in the ".env" file (make sure to have a few ETH in it)
  4. Uncomment, and assign your starknet public key to the PUBLIC_KEY variable in the ".env" file
  5. Uncomment, and assign your private key to the PRIVATE_KEY variable in the ".env" file
  6. Make sure you are in the "simpleDeclare" directory
  7. Ensure you have the contract files (contract.casm.json and contract.sierra.json) in the directory (override them with new ones)
  8. Execute go run main.go

NOTE: you need to replace the contract files for another ones. If not, this example WILL RETURN AN ERROR. This is expected, since the contract.sierra.json contract was already declared, and there can be only one contract class in starknet( ref: https://docs.starknet.io/architecture-and-concepts/smart-contracts/contract-classes/#contract_classes_2).

After successful declaration, the transaction hash, status, and the class hash will be returned at the end of the execution.