I found several articles explaining how smart contracts used and stored in blockchain but where does the smart contract actually resides in a blockchain (block or transaction or separate structure in the blockchain)? Is it possible to get trasactions related to a smart contract from the blockchain.
1 Answer
Smart contract code (EVM bytecode, in the case of Ethereum) is "uploaded" to the blockchain in the deployment transaction of a smart contract. The contract gets its own address, similar to Ethereum personal address.
You can easily inspect transactions in and out of a smart contract by monitoring its address. This can be done using a blockchain explorer like EtherScan.
Below is a transaction list for Coinfirm AMLT token. You see a list of token contract's transfer()
function calls.
https://etherscan.io/address/0xca0e7269600d353f70b14ad118a49575455c0f2f
(It was deployed at address 0xca0e7269600d353f70b14ad118a49575455c0f2f)