Smart Contract Escrow DApp — Buyer View

Once emitted, I run loadContractDetail() again to refresh this contract's information on the page.Confirming Deliveryvar newConfirmDeliverEvent;$("#deliverButton").click(function() { $("#loaderdeliver").show(); Purchase.confirmReceived({gas: 1000000, gasPrice: web3.toWei(2, 'gwei')}, function(error, result){ if(!error){ console.log(JSON.stringify(result)); newConfirmDeliverEvent = Purchase.ItemReceived(); newConfirmDeliverEvent.watch(function(error, result){ if (!error) { $("#loaderdeliver").hide(); loadContractDetail(currentContractAddress); } else { $("#loaderdeliver").hide(); console.log(error); } }); } else{ console.error(error); } });});Lines 254 to 277 processes what happens when the user presses [Deliver].I run Purchase.confirmReceived() on the smart contract and watch and wait for the contract to emit newConfirmDeliverEvent.watch(function(error, result)) when it is done executing.Once emitted, I run loadContractDetail() again to refresh this contract's information on the page.Finishing OffI wrote several articles about Escrow Services Smart Contracts throughout 2018 because I believed that there ought to be more well illustrated use cases for Smart Contracts on the Blockchain platforms..The world of cryptocurrencies and blockchain needs more well documented business cases with executable examples and less whitepapers and ICOs.Here’s a summary of everything I have written so far:Smart Contract Explained by Demonstration: This is a step-by-step demonstration of how a Smart Contract works by having you pretending to be a seller and a buyer.Escrow Service as a Smart Contract Series: The Business Logic walks you through the thoughts that could have gone through the folks who wrote the original contract..The Execution lets you run the Solidity Smart Contract to execute the contracts directly using the Remix IDE.Creating Smart Contracts with Smart Contract extends the Safe Remote Purchase contract by letting the user spawn new purchase smart contracts.Finally, this article and Smart Contract Escrow Dapp — Seller View explains the HTML and JavaScript codes that gives you a user interface so that the layman can use it like a regular web app.. More details

Leave a Reply