0
0
Blockchain / Solidityprogramming~10 mins

Batch operations in Blockchain / Solidity - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a batch of transactions using the correct method.

Blockchain / Solidity
const batch = new web3.[1]();
Drag options to blanks, or click blank then click option'
ABatchOperations
BBatchRequest
CBatchTransactions
DTransactionBatch
Attempts:
3 left
💡 Hint
Common Mistakes
Using a non-existent class like TransactionBatch.
Confusing batch operations with single transactions.
2fill in blank
medium

Complete the code to add a transaction call to the batch.

Blockchain / Solidity
batch.[1](contract.methods.transfer(toAddress, amount), callback);
Drag options to blanks, or click blank then click option'
Aadd
Bsend
Cqueue
Dpush
Attempts:
3 left
💡 Hint
Common Mistakes
Using send which executes immediately instead of adding to batch.
Using push which is not a method of batch.
3fill in blank
hard

Fix the error in the code to execute the batch of transactions.

Blockchain / Solidity
batch.[1]();
Drag options to blanks, or click blank then click option'
Arun
Bprocess
Csend
Dexecute
Attempts:
3 left
💡 Hint
Common Mistakes
Using send which is for single transactions.
Using run or process which do not exist.
4fill in blank
hard

Fill both blanks to create a batch and add a call to get the balance.

Blockchain / Solidity
const batch = new web3.[1]();
batch.[2](contract.methods.balanceOf(userAddress), callback);
Drag options to blanks, or click blank then click option'
ABatchRequest
Bsend
Cadd
Dexecute
Attempts:
3 left
💡 Hint
Common Mistakes
Using send instead of add to add calls.
Confusing batch creation with execution.
5fill in blank
hard

Fill all three blanks to create a batch, add two calls, and execute the batch.

Blockchain / Solidity
const batch = new web3.[1]();
batch.[2](contract.methods.approve(spender, amount), callback);
batch.[3](contract.methods.allowance(owner, spender), callback);
batch.execute();
Drag options to blanks, or click blank then click option'
ABatchRequest
Badd
Csend
Dexecute
Attempts:
3 left
💡 Hint
Common Mistakes
Using send instead of add to add calls.
Trying to execute the batch before adding calls.