Smart Contracts and Solidity Flashcards

1
Q

So what is a smart contract?

A

It is computer code written in multiple languages. Smart contracts live on the network. They enforce rules and preform actions, negotiated by participants in those contracts.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What languages can smart contracts be written in?

A

Solidity is the most commonly used

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is Metamask?

A

Metamask is a tool which helps you to easily interact with the Ethereum networks in your browser

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What node does Metamask use?

A

It uses infura.io

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does Metamask NOT support?

A

Mining and contract deployment.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Is execution of contracts free?

A

No, invoking contract methods is a transaction.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Is accessing a Smart Contract state free?

A

Yes, querying state is not a transaction.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Who executes the contracts?

A

Miners.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Why does it cost money to invoke a method on a Smart Contract?

A

Some methods, which do not modify the state of the contract and have no logic other than returning a value, are free. Apart from sending ether as a payment, invoking methods that make change the state cost money also because they require gas for execution.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Why is there gas, more precisely?

A

Since miners execute contract code on their machines, they must cover their costs from executing the code requested by a caller.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does the gas usage in a transaction depend on?

A

It depends on amount of storage, and type and number of instructions (opt codes). Each EVM opt code has a fixed amount of gas.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

And how is transaction fee calculated?

A

Gas used * gas price (specified by the caller)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

If an execution of a Smart Contract costs less than the specified gas, does the user get a refund?

A

Yes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What happens if the execution of a Smart Contract costs more than the specified gas?

A

The user doesn’t get a refund and also the execution halts as soon as all the gas is used up and no changes are made to the contract.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What do nodes run Smart Contracts code on?

A

EVM - Ethereum Virtual Machine. EVM follows the EVM specification, which is part of the Ethereum protocol. EVM is simply a process on the node.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does the EVM need in order to run a Smart Contract?

A

It needs the contract’s bytecode which is generated from compiling a higher-level language such as Solidity.

17
Q

What is Remix?

A

An online tool for developing, testing and deloying contracts. It’s great for quickly building and testing lightweight contracts but not for more complex ones.