Skip to main content

Productivity Tips from Professionals

· 2 min read

MIT surveyed nearly 20,000 professionals from around the world - 50% from North America, 21% from Europe, 19% from Asia, and the rest from Australia, South America, and Africa. Takeaways are ...

1. Sort tasks by importance and act with a clear goal.

  • Before writing anything of any length, prepare an outline in a logical order to help you stay on track.
  • Revise your daily calendar the night before to emphasize your priorities. Next to each agenda on your schedule, write down your goals.
  • Send a detailed agenda to all participants before any meeting.
  • When embarking on a large project, sketch out preliminary conclusions as soon as possible.
  • Before reading any lengthy material, determine your specific purpose for it.

2. Dealing with information & task overload.

  • Skip most messages by looking at the subject and sender.
  • Make daily processes, like getting dressed or eating breakfast, a routine so you don't spend time thinking about them.
  • Check your device's screen every hour, rather than every few minutes.
  • Break large projects into sections and reward yourself when you complete each section.
  • Delegate tasks that don't interfere with your top priorities, when feasible.
  • Set aside time in your daily schedule to deal with emergencies and unexpected events.

3. Your colleagues need short meetings, responsive communication, and clear direction.

  • Respond immediately to messages from those who are important to you.
  • To capture the audience's attention, speak from some notes rather than reading a prepared text.
  • Limit any meeting to 90 minutes or less, but preferably less. At the end of each session, delineate the next steps and responsibilities for those steps.
  • To improve your team's performance, establish procedures to prevent future mistakes instead of playing the blame game.
  • Establish clear goals and success metrics for any team effort.

What Makes Some People More Productive Than Others?

· 2 min read

MIT surveyed nearly 20,000 professionals from around the world, with 50% from North America, 21% from Europe, 19% from Asia, and the remainder from Australia, South America, and Africa. They identified methods that make people's productivity stand out.

1. Plan your work based on the importance of tasks, and act with clear goals.

  • Revise your daily schedule the night before, highlighting your priorities. Write down your goals next to each item on the calendar.
  • Send a detailed agenda to all participants before any meeting.
  • When starting a large project, outline preliminary conclusions as soon as possible.
  • Before reading any lengthy material, clarify your specific purpose for it.
  • Before writing anything of length, create a logically ordered outline to help you proceed step by step.

2. Develop effective techniques to manage information overload and tasks.

  • Turn daily routines, like getting dressed or having breakfast, into habits so you don't spend time thinking about them.
  • Allocate time in your daily schedule to handle urgent and unexpected events.
  • Check your device's screen once an hour instead of every few minutes.
  • Skip most messages by looking at the subject and sender.
  • Break large projects into smaller parts and reward yourself after completing each part.
  • Delegate tasks that do not affect your primary objectives whenever possible.

3. Understand colleagues' needs for brief meetings, responsive communication, and clear direction.

  • Limit any meeting to 90 minutes or less, preferably shorter. At the end of each meeting, outline the next steps and assign responsibilities for those steps.
  • Respond immediately to messages from people who are important to you.
  • To engage the audience, speak based on notes rather than reading a prepared text.
  • Establish clear goals and success metrics for any team's work.
  • To enhance your team's performance, create processes to prevent future mistakes rather than playing the blame game.

Designing Online Judge or Leetcode

· 3 min read

Requirements

An online judge is primarily a place where you can execute code remotely for educational or recruitment purposes. In this design, we focus on designing an OJ for interview preparation like Leetcode, with the following requirements:

  • It should have core OJ functionalities like fetching a problem, submitting the solution, compiling if needed, and executing it.
  • It should be highly available with an async design, since running code may take time.
  • It should be horizontal scalable or, saying, easy to scale-out.
  • It should be robust and secure to execute untrusted source code.

Architecture

The architecture below is featured on queueing for async execution and sandboxing for secure execution. And each component is separately deployable and scalable.

designing online judge system

Components

Presentation Layer

The user agent is usually a web or mobile app like coderoma.com. It displays the problem description and provides the user with a code editor to write and submit code.

When the user submits the code, the client will get a token since it is an async call. Then the client polls the server for the submission status.

API

Please see Public API Choices for the protocols we can choose from. And let’s design the interface itself here and GraphQL for example:

type Query {
problems(id: String): [Problem]
languageSetup(id: String!, languageId: LanguageId!): LanguageSetup
submission(token: String!) Submission
}

type Mutation {
createSubmission(
problemId: String!
code: String!
languageId: LanguageId!
): CreatedSubmission!
}

enum LanguageId {
JAVA
JS
ELIXIR
# ...
}


type Problem {
id: String!
title: String!
description: String!
supportedLanguages: [Float!]!
}

type LanguageSetup {
languageId: LanguageId!
template: String!
solutions: [String!]!
}

type Status {
id: Float!
description: String!
}

type Submission {
compileOutput: String
memory: Float
message: String
status: Status
stderr: String
stdout: String
time: String
token: String
}

type CreatedSubmission {
token: String!
}

The API layer records the submission in the database, publishes it into the queue, and returns a token for the client's future reference.

Code Execution Engine

Code execution engine (CEE) polls the queue for the code, uses a sandbox to compile and run the code and parses the metadata from the compilation and execution.

The sandbox could be LXC containers, Docker, virtual machines, etc. We can choose Docker for its ease of deployment.

Coderoma.com

I am recently learning Elixir and creating an online judge coderoma.com for my daily practice. It now supports Elixir and JavaScript. And I am adding more languages (like Java) and problems to it.

We may host future events to improve your coding skills. Join us at https://t.me/coderoma for the English community or use your WeChat to scan the following QR onetptp and reply 刷题 for the Chinese community.

onetptp

Why PWA?

· 2 min read

PWA means Progressive Web Apps. Back in 2014, the W3C published a draft of Service Worker, and then in 2015, Chrome supported it in the production environment. If we take the emergence of Service Worker, one of PWA's core technologies, as the start point of PWA, PWA's birth year is 2015. Before focusing on what a PWA is, let's first understand why we need it.

  1. User experience. Back to 2015, frontend developers spend a lot of time optimizing the web by speeding up the rendering of the initial page, making the animation smoother, etc. However, the native app still wins regarding the user experience.

  2. User retention. Native apps can be pinned onto the mobile phone's home screen and bring the users back into the app by notifications, while the web apps cannot.

  3. Leveraging device APIs. Android and iOS provide abundant device APIs that native apps can easily use with the user's permission. However, back then, the browser does not fully support them.

Google's tutorial of Why Build Progressive Web Apps summarizes the problem as "Broad Reach, Low Engagement".

UV and user duration comparison between web sites and native apps

To tackle the disadvantages of web apps in the mobile age, PWA comes into being.

What is PWA?

· 3 min read

When Google came up with the PWA, it didn't have a precise definition. It is not a specific technology, but a combination of techniques to improve the user experience. Those technologies are Web App Manifest, Service Worker, Web Push, etc.

The main features of PWA are as follows.

  • Reliability - instant loading, even in unstable or disconnected network environments.
  • User experience - rapid response, with smooth transition animations and feedback on user actions
  • Stickiness - like the Native App, can be added to the home screen and receive offline notifications.

PWA itself emphasizes Progressive (Progressive) in two perspectives.

  1. PWA is still evolving;
  2. PWA is downward-compatible and non-intrusive. It costs developers little to use the new features - developers can add it to the existing site progressively.

Google's "Progressive Web App Checklist" defines those minimum requirements for PWA.

  • served over HTTPS.
  • Pages should be responsive on desktop, tablet, and mobile devices
  • All URLs have content to show in case of disconnection, not the default browser page
  • requires Web App Manifest to be added to the desktop
  • Faster page loading and shorter delay, even on 3G networks
  • It displays correctly in all major browsers
  • Smooth animation with immediate feedback
  • Each page has its own URL

Features of PWA

A PWA combines the benefits of both the Web App and Native App and gives us the following features.

  • Progressive - for all browsers, as it is developed with progressive enhancements in mind
  • Connectivity agnostic - Ability to leverage Service Worker for offline or low network connectivity.
  • Native experiences - on the App Shell model, they should have Native App interactions.
  • Continued updates -- always up-to-date, no version or update issues.
  • Security - Served over HTTPS
  • Indexable - manifest files and Service Workers can be recognized and indexed by the search engine.
  • Stickiness - By pushing offline notifications, etc., you can get users back to your app.
  • Installable - users can easily add web apps to the home or desktop without going to an app store.
  • Linkable - share contents through links without downloading and installing them.

More specifically, what is the advantage of PWA over the native app? Openness and index-ability. Users can hardly install a native app instantly and search across native apps seamlessly.

The table below shows the comparison between t raditional Web App, Native App, and PWA for each feature.

InstallableLinkableUser experienceUser stickiness
Traditional Web
Native App😐✅️
PWA

Rewriting Facebook.com

· 3 min read

Facebook has evolved from its initial PHP server-side rendered website over the past 16 years. The external environment for web development has changed dramatically, and the cost of developing new features on the old architecture is increasing. To achieve an "app-like experience" and outstanding performance, they rewrote the entire main website using React and Relay, based on two principles — "as little as possible, as early as possible" and "enhancing developer experience to serve user experience."

Applying these two principles to four main elements (CSS, JavaScript, data, navigation) yields the following insights:

  1. Improve CSS
    1. Atomic CSS: Using atomic class CSS generated at build time reduced the homepage's CSS by 80% — because the number of entries in this CSS approaches log N — the total amount of styles grows with unique styles rather than the number of styles and features written in the code. We at Uber use Styletron for this purpose.
    2. CSS-in-JavaScript: Using methods like stylex.create({}) to generate styles for components, colocating them with the components to enhance removability and make styles easier to maintain.
    3. Consistently use rem for better scaling experience, automatically converting px to rem at build time.
    4. Implement dark mode using CSS variables.
    5. Use inline SVG in HTML as icons to solve the flash issue of delayed icon rendering.
  2. Split JavaScript to optimize performance
    1. Incrementally load code, breaking down 500 KB of total code into 50 KB Tier 1, 150 KB Tier 2, and 300 KB Tier 3, corresponding to skeleton content, initial screen content, and non-UI content, loading them as needed.
    2. Load experimental code only when necessary.
    3. Load corresponding code based on data, such as loading image components for image data and video components for video data.
    4. Budget the size of JavaScript and strictly monitor changes in code size.
  3. Load data as early as possible
    1. Preloading: Using Relay to immediately know the data needed for the initial screen, streaming this data while downloading the code.
    2. Reduce round trips using streaming.
    3. Delay loading data that is not currently needed.
  4. Define route mapping to accelerate navigation
    1. Obtain route definitions as early as possible.
    2. Pre-fetch resources early, starting when hovering or focusing. After navigation changes, if loading is not complete, retain the current page using React Suspense transitions until loading is finished before switching. This keeps the experience consistent with standard browser behavior.
    3. Download code and data in parallel. Typically, code is downloaded first followed by data, which is serial; Facebook allows data and code to download simultaneously in one round trip.

How not to die?

· 5 min read

Eating in the right way can significantly influence your health. Heard various advice from different sources, you may have difficulties to tell which one is the most helpful. The book "How Not to Die" provided eight practical suggestions backed up by scientific researches to help you establish a healthy diet.

Adopting a plant-based diet

The plant-based diet has been proven to have a much positive result on health than other foods we have in the US society. A China-Cornell-Oxford research project studied the menu of Chinese people in the 1980s. They found the Guizhou Province has the lowest mortality rate of coronary disease among men under 65, where people consumed the least animal-based food.

Additionally, plant-based diets can facilitate the patient's recovery. Lifestyle-medical pioneers Nathan Pritikin and Dean Ornish put patients with advanced heart disease on plant-based diets, and then they witnessed significant improvements in alleviating their symptoms. For example, the harmful plaque in patients' arteries dissolved faster than usual.

Having more fruits, especially berries

Four servings of fruit, including one type of berries, per day, is essential in a healthy diet. A single extra serving of fruit each day has proven to result in a 24-percent decline in the possibility of having Chronic Obstructive Pulmonary Disease. Notably, berries are particularly crucial due to their positive influence on liver function, cancer-resistance, and immune system. In 2014, a study taken among 14 patients revealed that their polyp load declined remarkably after nine months of having black raspberries.

Vegetables are indispensable

Vegetables play a vital role in preventing diseases. Known as "queen of greens", kale can reduce people's cholesterol levels. In a three-month study taken in 2008, high-cholesterol-level patients were asked to take three to four shots of kale juice every day. The proportion of beneficial cholesterol increased significantly, which was equal to the effect of running for 300 miles. Also, cruciferous vegetables help boost liver and lung functions.

Thus it is advised that two of the five daily servings should be leafy veggies (e.g., kale, arugula, and chard). Another two could be carrots, beets, or mushrooms. And finally, one serving of cruciferous vegetables like broccoli, cabbage, or cauliflower.

Recommending beans and whole grains for every meal

It is recommended by the American Institute for Cancer Research that beans or legumes should be included in every meal since they contain an animal-free protein as well as fibers. Navy and pinto beans can also be a good alternative to decrease bad cholesterol for people who don't like soy much. They can also function in slowing down sugar absorption and relaxing stomach. Similar to beans, people should also take whole grains three times daily. In 2015, research found that people who involve whole grains in diets live longer.

Taking more nuts and seeds for better nutrition

The Global Burden of Disease Study conducted between 1990 and 2010 found that eating too few seeds and nuts were the third-leading dietary cause for death and disability all over the world. Even a single serving of brazil nuts is equivalent to statins medicine in lowering cholesterol levels. Nuts and seeds facilitate the detoxification of excess iron. They can also build up bone density. Among all the seeds, chia, hemp, pumpkin, sesame, and sunflower seeds are recommended. It is an excellent alternative to sauces and dressings of your daily meals.

Placing herbs and spices in food

Not only can herbs and spices add flavor to a dish, but they are also essential in preventing diseases, especially cancer. Among all the food groups, they have the highest levels of antioxidants. In a study taken in 2010, Alzheimer participants who took saffron received better cognitive function outcomes than those who had a placebo. Additionally, spices like cloves and cinnamon can reduce depression because of an enzyme inhibited in them.

It is worth mentioning that turmeric is proven to be the best in preventing cancers among all the herbs and spices. Due to the fact that turmeric disappears rapidly, having it with black pepper can slow down the process and help absorption. Curry powder is a decent choice since it usually contains both pepper and turmeric. However, turmeric isn't for everybody. People with gallstones and kidney stones should restrict their intake.

Making water your first choice of beverages

Theoretically, a human should drink five 12-ounce beverages every day, and pure water is always the best choice. It is claimed by many articles that drinking eight glasses of water per day is a must, yet there is barely scientific evidence on that. Our daily intake of water comes from not only beverages but also fruits and vegetables.

In addition to water, coffee and tea can also be a good alternative since they are all good for health to some extent. For instance, research conducted by Tufts University revealed that tea functioned significantly in dropping blood pressure.

Four Steps to Rational Decision-Making

· 3 min read

Ordinary people have few opportunities to make decisions in life and work, and it is also difficult to practice and improve their decision-making skills. Most people's decisions rely on intuition, while rational decisions depend on processes. The book "Decisive" proposes a four-step process for rational decision-making — to increase the probability of making the best decision, we need to 1. broaden options, 2. test assumptions with facts, 3. step outside ourselves to see ourselves, and 4. prepare for wrong decisions.

1. Broaden Options

People mistakenly think that making a choice is as simple as answering multiple-choice questions on an exam, selecting one from three or five options. However, the world is vast, and options are not limited to just a few. For example, an advertising design company may develop multiple design proposals simultaneously and combine useful elements into the final design outcome after each round of feedback. This not only increases work efficiency but also saves time costs in decision-making. Additionally, one can refer to the base rates of others' choices in similar situations. Sam Walton, the founder of Walmart, closely monitored competitors throughout his career to adjust decisions in a timely manner. As decision-makers, we should find the best solutions by creating more options and referencing others' choices.

2. Test Assumptions with Facts

If practice is the only criterion for testing truth, then conducting experiments before making final decisions can relatively accurately estimate whether an idea will work. Many companies have evolved from hiring employees solely through interviews to requiring them to go through short trial periods, precisely to avoid the limitations of interviews and increase decision accuracy. A friend of mine tried staying overnight in a house before buying it and discovered that he could hear the train's horn, thus avoiding a significant mistake at a low cost.

3. Step Outside Ourselves to See Ourselves

When decision-makers become too immersed in their own viewpoints, they often overlook external perspectives. Therefore, to assess the potential outcomes of a decision, one should investigate the objective circumstances underlying the decision. Consider evaluating options from a broader temporal and spatial perspective, such as Andy Grove pretending to be the new CEO entering through the front door and cutting the memory chip business; Kai-Fu Lee hypothesizing that tomorrow's headlines will report on his two choices — one being emotional but unjust, the other just but unfeeling, and then choosing to be just as a leader; Jeff Bezos imagining himself at 80 looking back, using the "regret minimization framework."

4. Prepare for Wrong Decisions

When considering the outcomes of decisions, you should contemplate both the best and worst-case scenarios to understand your position. If the situation approaches the worst outcome, you can respond in a timely manner. Additionally, you can establish signals that make you aware of your actions, thereby weakening the inertia of behavior and correcting decisions promptly. Notably, to increase the speed of decision-making, Bezos believes that decisions are inherently unequal and should never be treated equally — reversible decisions should use lightweight decision-making processes.

How to Design the Architecture of a Blockchain Server?

· 7 min read

Requirement Analysis

  • A distributed blockchain accounting and smart contract system
  • Nodes have minimal trust in each other but need to be incentivized to cooperate
    • Transactions are irreversible
    • Do not rely on trusted third parties
    • Protect privacy, disclose minimal information
    • Do not rely on centralized authority to prove that money cannot be spent twice
  • Assuming performance is not an issue, we will not consider how to optimize performance

Architecture Design

Specific Modules and Their Interactions

Base Layer (P2P Network, Cryptographic Algorithms, Storage)

P2P Network

There are two ways to implement distributed systems:

  • Centralized lead/follower distributed systems, such as Hadoop and Zookeeper, which have a simpler structure but high requirements for the lead
  • Decentralized peer-to-peer (P2P) network distributed systems, such as those organized by Chord, CAN, Pastry, and Tapestry algorithms, which have a more complex structure but are more egalitarian

Given the premise that nodes have minimal trust in each other, we choose the P2P form. How do we specifically organize the P2P network? A typical decentralized node and network maintain connections as follows:

  1. Based on the IP protocol, nodes come online occupying a certain address hostname/port, broadcasting their address using an initialized node list, and trying to flood their information across the network using these initial hops.
  2. The initial nodes receiving the broadcast save this neighbor and help with flooding; non-adjacent nodes, upon receiving it, use NAT to traverse walls and add neighbors.
  3. Nodes engage in anti-entropy by randomly sending heartbeat messages containing the latest information similar to vector clocks, ensuring they can continuously update each other with their latest information.

We can use existing libraries, such as libp2p, to implement the network module. For the choice of network protocols, see Crack the System Design Interview: Communication.

Cryptographic Algorithms

In a distributed system with minimal trust, how can a transfer be proven to be initiated by oneself without leaking secret information? Asymmetric encryption: a pair of public and private keys corresponds to "ownership." Bitcoin chooses the secp256k1 parameters of the ECDSA elliptic curve cryptographic algorithm, and for compatibility, other chains also generally choose the same algorithm.

Why not directly use the public key as the address for the transfer? Privacy concerns; the transaction process should disclose as little information as possible. Using the hash of the public key as the "address" can prevent the recipient from leaking the public key. Furthermore, people should avoid reusing the same address.

Regarding account ledgers, there are two implementation methods: UTXO vs. Account/Balance

  • UTXO (unspent transaction output), such as Bitcoin, resembles double-entry bookkeeping with credits and debits. Each transaction has inputs and outputs, but every input is linked to the previous output except for the coinbase. Although there is no concept of an account, taking all unspent outputs corresponding to an address gives the balance of that address.
    • Advantages
      • Precision: The structure similar to double-entry bookkeeping allows for very accurate recording of all asset flows.
      • Privacy protection and resistance to quantum attacks: If users frequently change addresses.
      • Stateless: Leaves room for improving concurrency.
      • Avoids replay attacks: Because replaying will not find the corresponding UTXO for the input.
    • Disadvantages
      • Records all transactions, complex, consumes storage space.
      • Traversing UTXOs takes time.
  • Account/Balance, such as Ethereum, has three main maps: account map, transaction map, transaction receipts map. Specifically, to reduce space and prevent tampering, it uses a Merkle Patricia Trie (MPT).
    • Advantages
      • Space-efficient: Unlike UTXO, a transaction connects multiple UTXOs.
      • Simplicity: Complexity is offloaded to the script.
    • Disadvantages
      • Requires using nonce to solve replay issues since there is no dependency between transactions.

It is worth mentioning that the "block + chain" data structure is essentially an append-only Merkle tree, also known as a hash tree.

Storage

Since UTXO or MPT structures serve as indexes, and to simplify operations for each node in a distributed environment, data persistence typically favors in-process databases that can run directly with the node's program, such as LevelDB or RocksDB.

Because these indexes are not universal, you cannot query them like an SQL database, which raises the barrier for data analysis. Optimizations require a dedicated indexing service, such as Etherscan.

Protocol Layer

Now that we have a functional base layer, we need a more general protocol layer for logical operations above this layer. Depending on the blockchain's usage requirements, specific logical processing modules can be plugged in and out like a microkernel architecture.

For instance, the most common accounting: upon receiving some transactions at the latest block height, organize them to establish the data structure as mentioned in the previous layer.

Writing a native module for each business logic and updating all nodes' code is not very realistic. Can we decouple this layer using virtualization? The answer is a virtual machine capable of executing smart contract code. In a non-trusting environment, we cannot allow clients to execute code for free, so the most unique feature of this virtual machine may be billing.

The difference between contract-based tokens, such as ERC20, and native tokens leads to complications when dealing with different tokens, resulting in the emergence of Wrapped Ether tokens.

Consensus Layer

After the protocol layer computes the execution results, how do we reach consensus with other nodes? There are several common mechanisms to incentivize cooperation:

  • Proof of Work (POW): Mining tokens through hash collisions, which is energy-intensive and not environmentally friendly.
  • Proof of Stake (POS): Mining tokens using staked tokens.
  • Delegated Proof-of-Stake (DPOS): Electing representatives to mine tokens using staked tokens.

Based on the incentive mechanism, the longest chain among nodes is followed; if two groups dislike each other, a fork occurs.

Additionally, there are consensus protocols that help everyone reach agreement (i.e., everyone either does something together or does nothing together):

  • 2PC: Everyone relies on a coordinator: the coordinator asks everyone: should we proceed? If anyone replies no, the coordinator tells everyone "no"; otherwise, everyone proceeds. This dependency can lead to issues if the coordinator fails in the middle of the second phase, leaving some nodes unsure of what to do with the block, requiring manual intervention to restart the coordinator.
  • 3PC: To solve the above problem, an additional phase is added to ensure everyone knows whether to proceed before doing so; if an error occurs, a new coordinator is selected.
  • Paxos: The above 2PC and 3PC both rely on a coordinator; how can we eliminate this coordinator? By using "the majority (at least f+1 in 2f + 1)" to replace it, as long as the majority agrees in two steps, consensus can be achieved.
  • PBFT (deterministic 3-step protocol): The fault tolerance of the above methods is still not high enough, leading to the development of PBFT. This algorithm ensures that the majority (2/3) of nodes either all agree or all disagree, implemented through three rounds of voting, with at least a majority (2/3) agreeing in each round before committing the block in the final round.

In practical applications, relational databases mostly use 2PC or 3PC; variants of Paxos include implementations in Zookeeper, Google Chubby distributed locks, and Spanner; in blockchain, Bitcoin and Ethereum use POW, while the new Ethereum uses POS, and IoTeX and EOS use DPOS.

API Layer

See Public API choices

Credit Card Processing System

· 2 min read

Credit Card Payment Processing

5 Parties

  1. Cardholder: an authorized user of the card. e.g., anyone who has a credit card.
  2. Issuer: an institution that issues credit cards to its users. e.g., Chase, BOA, discover, etc.
  3. Merchant: an entity that provides products or services, and accepts payments via credit cards. e.g., Uber, Doordash, etc.
  4. Acquirer: who provides card services to merchants. e.g., BOA Merchant Services, Chase Paymentech.
  5. Electronic payments networks: a clear-house for acquirers and issuers. e.g., VisaNet, MasterCard, Discover, American Express, etc.

Are Square and Stripe acquirers? No, they are payment aggregators.

2 Workflows

  1. Authorization: The cardholder provides the card / card info to the merchant, who processes it and sends (card number, amount, merchant ID) to the acquirer. The acquirer contacts the issuer via the electronic payments networks. The issuer checks against the credit line and fraud-prevention system, and then authorize or decline the transaction.

  2. Clearing / Settlement

    1. batching: At the end of the business day, the merchant asks the acquirer with a batch of payment information for clearing.
    2. clearing and settlement: the acquirer coordinates the clearing with the issuer via the electronic payments networks, and the issuer settles the funds and bookkeeps the transaction for the cardholder.