For Terra smart contracts, there is a distinction between uploading contract code and instantiating a contract. This separation allows multiple contracts to share the same uploaded code if there are only minor variations in their logic which can be configured at contract creation. This configuration is passed in an InitMsg and provides the initial state of the contract.
To create or instantiate a smart contract, you must first know the code_id of an uploaded code. You will reference this code_id in a MsgInstantiateContract alongside the InitMsg to create the contract. Upon successful creation, your contract will be located at an address that you specify.
Smart contracts respond to JSON messages called HandleMsg which can exist as different types. The smart contract writer must provide end-users of the smart contract with the expected format of all the varieties of HandleMsg the contract is supposed to understand, in the form of a JSON schema. This schema is analogous to Ethereum contracts' ABI.
A contract can define a query handler, which understands requests for data specified in a JSON message called a QueryMsg. Unlike the message handler, the query handler cannot modify the contract's or blockchain's state. Queries are read-only operations. Therefore, querying data from a contract does not use a message and transaction, but works directly through the LCDClient API.