<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Block Buster on Medium]]></title>
        <description><![CDATA[Stories by Block Buster on Medium]]></description>
        <link>https://medium.com/@chain_science?source=rss-1eee5b8bd333------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*SMuycZXZLaK-UXccarvJAQ.png</url>
            <title>Stories by Block Buster on Medium</title>
            <link>https://medium.com/@chain_science?source=rss-1eee5b8bd333------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 07:31:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chain_science/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Smart Contracts in the Real World: Handling One-off Services]]></title>
            <link>https://medium.com/@chain_science/smart-contracts-in-the-real-world-handling-one-off-services-284cced2bb5e?source=rss-1eee5b8bd333------2</link>
            <guid isPermaLink="false">https://medium.com/p/284cced2bb5e</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[future-of-work]]></category>
            <dc:creator><![CDATA[Block Buster]]></dc:creator>
            <pubDate>Sat, 16 Dec 2023 10:08:09 GMT</pubDate>
            <atom:updated>2023-12-17T08:25:19.195Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J_Pkxrc_K8yIhwMC2-Hhcg.png" /></figure><h3>Abstract</h3><p>In this article, we explore the advantages of utilizing smart contracts for real-world services. We delve into the process of resolving disputes and examine a sample Solidity smart contract for a hypothetical one-off service. Additionally, we address the practicality and accessibility of smart contracts for individuals who are not computer programmers.</p><h3>Services Best Suited for Migration to Smart Contracts</h3><p>Although smart contracts have gained popularity in sectors like FinTech, Gaming, digital property management, and healthcare, traditional service agreements frequently rely on paper contracts.</p><p>Below are examples of services that could seamlessly transition from paper-based systems to blockchain technology. This shift would enhance security, reduce risk, and elevate the overall user experience:</p><ul><li>Construction and Repair Services</li><li>Engineering Projects</li><li>Information Technology Solutions</li><li>Creative and Graphic Design Services</li><li>Automotive Repair and Maintenance</li><li>And any other services requiring time-bound completion and post-completion quality assurance.</li></ul><h3>So, What is a Service Contract?</h3><p>The core elements of any service contract are the <strong>definition of done</strong>, <strong>cost</strong>, and <strong>deadline</strong>. The customer anticipates a certain outcome from the contractor’s efforts within an agreed timeframe and is prepared to compensate for the delivered work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GwC12Ej7nWYgXtCQJDGRjw.jpeg" /></figure><h3>Prepayment, Post-payment or Escrow</h3><p>The primary concern for customers is the risk of losing money on work that is either poorly executed or not completed, while contractors worry about not being paid for their well-done work. Ideally, customers would prefer to pay entirely after the work is done (post-payment), and contractors would favor full payment in advance (prepayment). To mitigate these concerns, a compromise involving a pre/post-payment ratio can be established, offering some security to both parties. However, this arrangement still carries inherent risks, especially for high-value contracts such as in construction, where failure could potentially lead to bankruptcy for either party.</p><p>This is where the concept of an escrow account becomes valuable. In this setup, the customer and contractor use a third-party bank account to securely hold the funds until the work is satisfactorily completed. This method is commonly used in real estate transactions and typically involves a bank as the intermediary and an expert organization to assess the quality of work. The escrow system thus provides a balanced solution, safeguarding the interests of both the customer and the contractor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z4KiMyYSXd9yhz63WOLQhg.png" /><figcaption>Customer and contractor are opening the escrow bank account</figcaption></figure><h3>Smart Contract Approach</h3><p>While bank escrows offer security, they also entail interacting with banks, incurring time and service fees, and often complicating the process. Moreover, they are not universally applicable — for instance, opening an escrow account for a garden design project might not be feasible.</p><p>Smart contracts, however, can adeptly address these limitations! They offer an easy, highly reliable way to secure funds, eliminating the need for human intervention. Here’s an illustrative workflow for a one-off service using a smart contract:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bx4huiRdNEL9xWtxAwvDzA.png" /><figcaption>The smooth workflow of handling one-off service with the smart contract</figcaption></figure><h3>Dispute Resolving</h3><p>Indeed, disputes can arise where the contractor completes the task, but the customer remains dissatisfied with the quality.</p><p>With traditional paper contracts, resolving such disputes often means resorting to legal action, which can be time-consuming, expensive, and stressful. Typically, it involves selecting an independent expert during the trial to provide evidence on whether the work meets the agreed standards.</p><p>In contrast, smart contracts require the customer and contractor to consider independent expertise in advance. The appointed inspector could be an individual, an organization, or even a group. If a group is chosen, it’s advisable to have an odd number of members to prevent a tie in decision-making. This proactive approach streamlines dispute resolution, saving time and resources for all parties involved.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gGyQVvlVajkynqf6QsNKow.png" /><figcaption>Dispute resolving with the smart contract involving inspector</figcaption></figure><h3>Automatic Calculation of Penalty Fees for Delay</h3><p>An additional advantageous feature is the management of work completion post-deadline. Typically, contracts impose a penalty fee for each day of delay, and in cases of significant delay, the customer may be entitled to a full refund.</p><p>Contrary to traditional paper contracts, smart contracts can automate this process. They can precisely calculate and apply penalty fees for delays and even process full refunds when necessary, all without manual intervention.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t5d4oWoiPQZj-JqISqpK9w.png" /><figcaption>Completing the work after the deadline leads to a partial refund</figcaption></figure><h3>Example Solidity One-Off Service Smart Contract</h3><p>This GitHub repository showcases a smart contract that encapsulates the behaviors and functionalities described above:<br><a href="https://github.com/blockbuster/OneOffService">https://github.com/blockbuster/OneOffService</a></p><p>The contract is designed to utilize a configurable ERC-20 contract address for payment tokens. Given the preference for stability, contractors often opt for a stablecoin like USDT, rather than a highly volatile token.</p><p>Therefore, the state of the contract is defined by the following variables:</p><pre>contract OneOffService {<br>    // Service cost is in stable coin like USDT<br>    IERC20 public coin;<br><br>    // Counterparties of the contract<br>    address public customer;<br>    address public contractor;<br>    address public inspector;<br><br>    // Full cost of the service<br>    uint256 public serviceCost;<br><br>    // Number of days since the contract start<br>    uint public deadlineDays;<br><br>    // Penalty for each day of delay after the deadline<br>    uint256 public penaltyFee;<br><br>    // Date when customer deposited money<br>    uint256 public startDate;<br><br>    // Date when contractor completed the work<br>    uint256 public completeDate;<br><br>    // Deadline date<br>    uint256 public deadlineDate;<br><br>    // Signing status<br>    bool public isCustomerSigned = false;<br>    bool public isContractorSigned = false;<br><br>    // Status of the service<br>    enum Status {Pending, Started, Completed, Approved, Disputed, Rejected}<br><br>    Status public status;</pre><p>The variables are defined in the constructor upon contract deployment:</p><pre>constructor(<br>   address _coinContract,<br>   address _contractor,<br>   address _inspector,<br>   uint256 _serviceCost,<br>   uint _deadlineDays,<br>   uint256 _penaltyFee<br>) {<br>   coin = IERC20(_coinContract);<br>   customer = msg.sender;<br>   contractor = _contractor;<br>   inspector = _inspector;<br>   serviceCost = _serviceCost;<br>   deadlineDays = _deadlineDays;<br>   penaltyFee = _penaltyFee;<br>   status = Status.Pending;<br>}</pre><p>The contract has publicly available views for all the state variables for quick checking the contract state:</p><pre>function getCounterparties() public view returns (address, address, address){<br>    return (customer, contractor, inspector);<br>}<br><br>function getServiceCost() public view returns (uint256){<br>    return serviceCost;<br>}<br><br>function getDeadlineDays() public view returns (uint){<br>    return deadlineDays;<br>}</pre><p>and state changing functions which require a signature. Based on the signature provided, the contract identifies the actor — be it the customer, contractor, or inspector — whose addresses are predefined in the constructor.</p><p>For example, here is the <strong>sign()</strong> function which customer and contractor must call before starting the contract:</p><pre>function sign() external {<br>    require(msg.sender == customer || msg.sender == contractor, &quot;Only customer or contractor can sign&quot;);<br>    if (msg.sender == customer) {<br>        isCustomerSigned = true;<br>    } else {<br>        isContractorSigned = true;<br>    }<br>}</pre><p>Function <strong>start()</strong> gets the service cost from the customer’s wallet and deposits it on contract’s address:</p><pre>function start() external {<br>    require(msg.sender == customer, &quot;Only customer can start the contract&quot;);<br>    require(isCustomerSigned &amp;&amp; isContractorSigned, &quot;Contract is not fully signed&quot;);<br><br>    require(coin.balanceOf(msg.sender) &gt;= serviceCost, &quot;Insufficient balance&quot;);<br>    bool success = coin.transferFrom(msg.sender, address(this), serviceCost);<br>    require(success, &quot;Deposit transfer failed&quot;);<br><br>    startDate = block.timestamp;<br>    deadlineDate = startDate + deadlineDays * SECONDS_IN_DAY;<br><br>    status = Status.Started;<br>}</pre><p>The other functions of the contract which lead the contract to the end are:</p><pre>function completeWork()<br>function approveWork()<br>function disputeWork()<br>function resolveDispute(bool approve)<br>function refund()</pre><p>see more details in the <a href="https://github.com/blockbuster/OneOffService/blob/main/contracts/OneOffService.sol">contract code</a> and repo <a href="https://github.com/blockbuster/OneOffService/blob/main/README.md">README</a>.</p><h3>How Can Non-Programmer Read the Smart Contract?</h3><p>Certainly, comprehending Solidity code in a smart contract is not straightforward, and it’s unreasonable to expect contractors to sign something they don’t understand. Moreover, even if parties are willing to adopt a high-tech solution, interacting with a smart contract presents its own challenges. Executing a function call in the contract still requires some coding knowledge, which can be a significant barrier for many users.</p><h3>Solution: Standard, Audit and User-Friendly App</h3><p>One of Ethereum’s strengths lies in the standardization of commonly used contracts, such as ERC-20 for functional tokens, ERC-721 for NFTs, and ERC-884 for fractional ownership. Contracts adhering to these standards are typically regarded as secure, audited, and widely adopted.</p><p>A one-off service contract could become another such standard from which all service contracts are derived. Specific contracts could then be efficiently generated using templates available through mobile apps or websites, simplifying the process significantly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1A9YulpWIhiFJ6rX8cQY8w.png" /><figcaption>Example mobile app: customer creates a contract and sends it to the other parties for review.</figcaption></figure><h3>How to Outline the Service Scope?</h3><p>In a traditional paper contract, supplementary documents often detail the scope of work. For smart contracts, a Proof-of-Existence mechanism, like the one described at <a href="https://originstamp.com/blog/proof-of-existence-on-blockchain/">OriginStamp</a>, can be used to notarize the requirements document.</p><p>This approach allows for the document to be stored in any location. Each party — the customer, contractor, and inspector — retains a copy of the document. The smart contract, in this case, would only store the digital signature of the document, ensuring its integrity and authenticity while maintaining accessibility for all involved parties.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QAMZI6EI-bO38XU_mg8rlw.png" /><figcaption>The approach of norarizing the requirements in the smart contract</figcaption></figure><h3>Conclusion</h3><p>The regulatory sector is known for its conservative approach and slow pace of change. However, it is inevitable that it will gradually shift towards embracing technological advancements. This article aims to diminish the uncertainty surrounding the adoption of smart contracts over traditional paper ones for real-world services, paving the way for a more technologically integrated future in regulatory practices.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=284cced2bb5e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>