BTA Certified Blockchain Developer - Ethereum Questions and Answers
CBDE BTA Certified Blockchain Developer - Ethereum Questions and Answers
Questions 4
Using selfdestruct(beneficiary) with the beneficiary being a contract without a payable fallback function:
Options:
A.
will throw an exception, because the fallback function is non-payable and thus cannot receive ether.
B.
it ' s impossible to secure a contract against receiving ether, because selfdestruct will always send ether to the address in the argument. This is a design decision of the Ethereum platform.
C.
selfdestruct doesn ' t send anything to a contract, it just re-assigns the owner of the contract to a new person. Sending ether must be done outside of selfdestruct.
a function that is marked as internal cannot be called by other contracts, unless the function is used by a derived contract. Private Functions cannot be called by any other outside contract and public variables are generating automatically a getter function.
B.
a function that is marked as external can never be called internally. Private functions can also be called by derived contracts using inheritance. Private variables are accessible also in derived contracts.
When solidity is compiled then also Metadata is generated:
Options:
A.
the Metadata contains the ABI Array, which defines the Interface to interact with the Smart Contract. Metadata can also contain the address of the smart contract when it gets deployed.
B.
metadata contains the address, and the size of the smart contract. The ABI Array is generated externally upon deploying the smart contract.
C.
the ABI array and the Metadata are not generated when solidity is compiled to bytecode, its generated by a migration software which deploys the smart contract on the blockchain.
When considering smart contracts and the blockchain it ' s good:
Options:
A.
to move all existing logic to the blockchain, so everything runs on the same system. This way it might be more complex, but easier to maintain.
B.
to move only those parts to the blockchain that really need the blockchain. This way smart contracts can be easier to read, easier to test and are not so complex.
C.
to move those parts to the blockchain that deal with Ether transfers. All other parts can remain in traditional database systems. This way only the value-transfer is on the blockchain.
it’s good to use a push and a pull method to ensure that participants can get their money no matter the contract state. In addition to and pushing it should contain a withdraw method.
Why is it important to follow the same Interfaces?
Options:
A.
Websites that try to interface with the Token would have to know the exact ABI. It is upfront clear how the interaction has to be with the standard Interfaces.
B.
The Ethereum Foundation can easily validate the Tokens and approve any audits by following the standard interface.
is determined by the Ethereum Committee every fortnight to reflect the average amount of transaction and it cannot be influenced by the network itself.
B.
increases when the time between mined blocks is below 10 seconds, while it decreases when the time is above 20 seconds.
C.
increases when the time between mined blocks is below 20 seconds, while it decreases when the time is above 60 seconds.
The difference between address.send() and address.transfer() is:
Options:
A.
.send returns a Boolean and .transfer throws an exception on error. Both just forward the gasstipend of 2300 gas and are considered safe against re-entrancy.
B.
.send throws an exception and .transfer returns a Boolean on error. Both just forward the gasstipend of 2300 gas and considered safe against re-entrancy
C.
.send returns a Boolean and .transfer throws an exception on error. .send is considered dangerous, because it sends all gas along, while .transfer only sends the gas stipend of 2300 gas along
D.
.send and .transfer are both considered low-level functions which are dangerous, because they send all gas along. It ' s better to use address.call.value()() to control the gas-amount.
can help to engage the community in testing your smart contracts and therefore help to find bugs early.
B.
might be a burden as it is an administrative overhead mainly.
C.
is completely useless. Who wants to test beta-ware software? It’s better to start with the bug-bounty program after the contract is released on the main-net.
Address.call() is used for calling other contracts using the scope of the called contract in terms of storage variables. Address.delegatecall() is used for libraries, which uses the storage variables of the contract who called. Libraries are a great way to re-use already existing code and delegatecall can make sure that no storage is used from the library, instead it looks like the code is directly copied into the calling contract.
B.
Address.delegatecall() is used for calling other contracts using the scope of the called contract in terms of storage variables. Address.call() is used for libraries, which uses the storage variables of the contract who called. Libraries are a great way to re-use already existing code and call() can make sure that no storage is used from the library, instead it looks like the code is directly copied into the calling contract.
the amount of gas your contract deployment and transactions, against your contract, will need. This way you can essentially lower the gas costs over traditional web3.js dApps.
B.
different Networks to deploy your contracts to. This way you can easily deploy to a local blockchain, the main-net or the Ropsten/Rinkeby Test-Net with only one parameter.
C.
you can manage your secret API keys to the Ethereum Network. This way you can get access to several different Ethereum nodes at the same time without the need to switch your keyfiles.
can be destroyed using the selfdestruct keyword. This way all remaining ether will be sent to the receiver address, regardless if they have a fallback function or not.
B.
are bound to a private key which is necessary to sign transactions outgoing from that account.
C.
are logical opcodes running on the ethereum blockchain very similar to smart contracts.