DApps and web3 Flashcards
Is the front end of a DApp restricted to any technology/framework?
No. You can use anything you want, like HTML, CSS, JS, Java, Python, the list goes on.
What does the front end use in order to connect to the backend (Smart Contracts)?
Web3 API libraries.
What do you need in order to interact with a contract from a DApp?
The contract’s ABI and bytecode.
What is the ABI used for?
ABI is a description of the public interface of a contract, which is used by DApps for invoking the contract.
What is the bytecode used for?
The EVM on each node requires bytecode in order to execute the contract code.
Why would you use BigNumber library?
Because Javascript does not handle big numbers correctly.
Why is it necessary to always check if the web3 provider is set in the beginning of your web DApp code?
Because Metamask injects it and overwrites the any other web3 with its own.
Why would you use version web3 js 1.x instead of 0.2x.x?
Mainly because its async calls use promises instead of callbacks, which is preferred in the javascript world.
How to list accounts in web3 1.x?
web3.eth.getAccounts
What is the difference between .call and .send?
.send sends a transaction and costs moeny while .call queries the state of the contract.
Is sending one ether like this “.send({ value: 1 })” okay?
No, you send 1 wei. Transactions always work with wei.
So in order to send 1 ether I have to mutiply the value by 10^18?
You can use the util method web3.utils.toWei(1, ‘ether’)
What do I have to specify when calling “.send()”?
You must specify “from” which is the sender address. Everything else is optional.
The only function of web3.eth.sendTransaction() is to send ethers to a specific address, is that correct?
No, you can also invoke contract methods.