email: cuidefang1@gmail.com
What is a smart contract? How are they deployed? You should be able to describe how a smart contract is deployed and the necessary steps.
Smart contract is a type of program that run on the blockchain(a kind of network of computers), which means the execution of the program happens in the blockchain, and the result of execution is proved and saved by the computer nodes in the blockchain. Every smart contracts has a unique ID in the blockchain system. To deploy a smart contract, you should do the following steps:
Write your smart contract with a high level programming language which human can understand easily, currently the most popular one is solidity.
Compile(just like translate) the high level language code to the machine code that can be understood by the machine in the blockchain network.
Send a transaction to the address(0) in the blockchain networks with the compile code above to tell the network you want to deploy this smart contract. After that, the smart contract is deployed.
What is gas? Why is gas optimization such a big focus when building smart contracts?
Gas is the fuel you need in the execution process of your smart contract. Since the resource of executing smart contract is very limited and precious, the price of gas is very high. In order to save the gas fee you pay, it is very important for you to optimize the gas use when you build your smart contract.
What is a hash? Why do people use hashing to hide information?
Hash is a tool that can map a sentence, a picture, or any form of information to a fixed length sequence of 0 and 1. The hash of data is just like the fingerprint of a human being, you can see this analogy by the following two properties of Hash:
It is very difficult for you to guess the original data from the new sequence, no matter how smart you are. Actually, there is no better way for you to make this guess than try tons of possibilities result. Just like fingerprint. If you only have a fingerprint, you have no idea who it belongs to unless you map this fingerprint with everybody one by one.
It is almost impossible for your to find two different data with same Hash, which also like the fingerprint. Given you and your fingerprint, it is very hard for you to find someone who has same fingerprint as you.
People want to use hash to hide information because hash can make information safe and secured, which means no one can see it or change it:
The hash can prevent the information from corruption. Once any part of the information is changed, you find the sequence after hash is changed.
The hash can prevent the information from stealing. No one can guess the original information from the sequence after hash.
How would you prove to a colorblind person that two different colored objects are actually of different colors?
First, ask the the colorblind person to choose a specific object from the two, then let him exchange these two objects at somewhere you don’t know for any times he wants, finally you point out which one is the chosen object at first. Repeat the above process as much as possible.
If you can always point out the right object, then the colorblind person have to accept the two objects are of different colors, otherwise you just make the right guess at every time, and this kind of probability is too small to be possible.
Hello World(for question 1)

The Ballot(for question 2,3,4)
you can see in the picture 1 that the contract is deployed successfully, picture 2 that the start time is 1651305240, picture 3 that after some time at 1651305674(434 seconds after deployed), and the vote function failed.



