What is the meaning of deploying a Smart Contract?

Viewed 26

I am working on an Ethereum solidity blockchain and I deploy smart contracts using truffle.js, I am a bit confused about how smart contracts work.

Is deploying a smart contract equivalent to instantiating it (I mean calling its constructor)?

Therefore each time I need to create a new instance of a smart contract, I actually need to deploy it?

The address resulting from the deployment is a pointer to an instance of a smart contract and not to the smart contract itself?

2 Answers

When you deploy a smart contract, you convert your Solidity code to binary code and copy that code to a network, it can be a local network, a testnet or a mainnet.

Every time you display your code create a new address.

You can deploy 10 copies of your code and generate 10 different independent addresses from the same code.

Everything happens on the Ethereum blockchain by sending a message from one account to another account. Each account is identified by an address. Smart contracts are precisely the accounts that store executable bytecode.

So in order to use your smart contract, you need to "upload" your compiled bytecode to the blockchain and store it at an address. This is deployment.

Thinking of class instances and such is probably not a useful way of thinking about this process. The Ethereum Virtual Machine (EVM) doesn't actually know about classes. That's a construct of the Solidity language that is used to simplify the creation of smart contract bytecode.

Related