5D Library › Zero-Touch Multi-Site Fault Tolerance, Payment Anti-Fraud State Machines and Passive Cashflow Queuing · 中文
Chapter 7. Matched Tallies, Banknote Seals and Liu Yan’s Canal
Why read these sources here
The book’s three questions – how a voucher resists forgery and double redemption, how the total of vouchers in circulation is capped, and how the flow of goods grows when time in transit shrinks – all have precedents in Tang and Song public finance: the flying cash of the Tang, the jiaozi of the Northern Song, and Liu Yan’s reorganisation of grain transport under the Tang. This chapter did not obtain editions of the primary texts that could be checked character by character, so it quotes no classical text; it quotes only the wording of the relevant English Wikipedia articles (checked word for word) and lists the scholarship they rely on. Whatever those articles do not record, this chapter does not assert.
Tang flying cash: matching the tallies
Source text
English Wikipedia, “Flying cash” (relying on Yang 1952)
the merchants would entrust their money to the representative offices of their local governments
When the tallies were matched at a local office, they could withdraw their money.
in the year 804, merchants were using flying cash
According to the article, Tang merchants entrusted their money to the representative offices of their local governments and received a voucher; when the voucher was matched with the half kept by the authorities at a local office, the money could be withdrawn. The article also records that merchants were using flying cash by 804 at the latest, and that the court, after banning it at first, accepted it officially in 812.
This is the problem of Chapter 1: a voucher must prove that “this money was really deposited, and is withdrawn only once”. The security of matched tallies comes from the two halves having to agree: a forger cannot see the authorities’ half and can only guess.
Calculation
# Chapter 7. [p14] Tallies, seals, caps and canals, recomputed.
# (1) Flying cash: a merchant's tally half is redeemed only when it
# matches the office's half. If a match checks k independent marks of
# b possible forms each, a blind forger matches with chance b^-k.
# (2) Jiaozi were stamped with several seals. If a forger copies any one
# seal convincingly with chance q, all n seals pass with chance q^n.
# (3) The official issue was capped at 1,255,340 strings of cash and
# notes were exchanged after a two-year term: if exchanges were spread
# evenly, the issue office turned over cap / 2 a year.
# (4) Little's law for a supply line: stock in transit = throughput x
# transit time. Throughput T and the transit times are parameters; a
# shorter passage carries the same flow with less grain on the road.
if __name__ == "__main__":
print(" (1) blind forgery of a tally: b^-k")
print(" k b=4 b=10 b=60")
for k in (1, 2, 3, 4, 6):
print(" {} {:10.2e} {:10.2e} {:10.2e}".format(
k, 4.0 ** -k, 10.0 ** -k, 60.0 ** -k))
print(" (2) all n seals pass: q^n")
print(" n q=0.5 q=0.3 q=0.1")
for n in (1, 2, 3, 5):
print(" {} {:9.4f} {:8.4f} {:8.4f}".format(
n, 0.5 ** n, 0.3 ** n, 0.1 ** n))
cap = 1255340
print(" (3) cap {:,d}; even exchange over 2 years: {:,d} a year"
.format(cap, cap // 2))
print(" (4) grain in transit for throughput T = 100 units a day")
for days in (60, 40, 30):
print(" transit {:2d} days -> {:,d} units on the road".format(
days, 100 * days))
print("\nReading: matching four marks of ten forms leaves a blind")
print("forger one chance in ten thousand - the full reference")
print("number of Chapter 1, not its last digits. Several seals")
print("multiply a forger's difficulty as several independent")
print("checks do. A cap and a term bound what is outstanding, as a")
print("limit on provisional orders and a key's lifetime do.")
# (1) blind forgery of a tally: b^-k
# k b=4 b=10 b=60
# 1 2.50e-01 1.00e-01 1.67e-02
# 2 6.25e-02 1.00e-02 2.78e-04
# 3 1.56e-02 1.00e-03 4.63e-06
# 4 3.91e-03 1.00e-04 7.72e-08
# 6 2.44e-04 1.00e-06 2.14e-11
# (2) all n seals pass: q^n
# n q=0.5 q=0.3 q=0.1
# 1 0.5000 0.3000 0.1000
# 2 0.2500 0.0900 0.0100
# 3 0.1250 0.0270 0.0010
# 5 0.0312 0.0024 0.0000
# (3) cap 1,255,340; even exchange over 2 years: 627,670 a year
# (4) grain in transit for throughput T = 100 units a day
# transit 60 days -> 6,000 units on the road
# transit 40 days -> 4,000 units on the road
# transit 30 days -> 3,000 units on the road
#
# Reading: matching four marks of ten forms leaves a blind
# forger one chance in ten thousand - the full reference
# number of Chapter 1, not its last digits. Several seals
# multiply a forger's difficulty as several independent
# checks do. A cap and a term bound what is outstanding, as a
# limit on provisional orders and a key's lifetime do.If matching checks independent marks with possible forms each, a blind forger matches with probability : with 4 marks of 10 forms, only 1.00e-04, one in ten thousand. That is the conclusion of Chapter 1 again: what must be checked is the full reference number, not its last few digits.
Northern Song jiaozi: multiple seals and an issue cap
Source text
English Wikipedia, “Jiaozi (currency)”
To combat counterfeiting, jiaozi were stamped with multiple banknote seals.
According to the article, jiaozi were first issued privately by merchants in Sichuan; in 1023 the court set up a Jiaozi Office and took issue into official hands; the article records an official issue capped at 1,255,340 strings of cash, with notes exchanged for new ones after a two-year term.
Jiaozi resisted forgery by multiple seals: if a forger copies any one seal convincingly with probability , all seals pass with probability ; at two seals cut the pass rate from 0.3000 to 0.0900 and three to 0.0270. This is the same reasoning as identifying rings by two independent signals, device and payment account, in Chapter 2: independent checks multiply. The issue cap and the two-year term correspond to the designs of Chapter 3: a limit on the total of provisionally released orders outstanding, and a lifetime for idempotency keys. If exchanges were spread evenly over two years, 627,670 strings would be exchanged each year.
Liu Yan: clearing the Bian River
Source text
English Wikipedia, “Liu Yan” (Tang official, 715 or 716 – 780)
the food supplies for the Chang’an regions became plentiful
According to the article, Liu Yan took charge of the salt and iron administration in 758, later travelled the former transport route himself and began a project to clear the Bian River of silt, after which the food supplies of the Chang’an region became plentiful. The article records no figures for tonnage or travel time, and this chapter infers none.
The program’s fourth part uses only Little’s law to show the principle: stock in transit = throughput x time in transit (Little 1961). Shipping 100 units a day with 60 days in transit leaves 6,000 units on the road; with transit cut to 30 days, the same flow needs only 3,000 in transit. The queues of Chapter 4 and the cash reserve of Chapter 6 obey the same law: shortening time in transit (processing time, settlement delay) reduces the stock and the cash that must be advanced.
Hypothesis · not established
The author’s interpretation (not yet tested): the matched tallies of flying cash and the multiple seals and issue cap of jiaozi correspond respectively to full verification, multi-factor checking and control of the total outstanding in modern digital vouchers; these mechanisms were used more than a thousand years ago to solve the same problems. What would show this interpretation unsound: if research on the primary sources showed that the depreciation or failure of flying cash and jiaozi was due mainly not to failures of anti-forgery or of the cap but to other causes (fiscal over-issue, say), the analogy would hold only in form.
Summary
Matching the tallies of flying cash is a check of the whole voucher: 4 marks of 10 forms leave a blind forger one chance in ten thousand. The multiple seals of jiaozi multiply independent checks, and the issue cap and two-year term bound the vouchers outstanding. After Liu Yan cleared the Bian River the food supply of Chang’an became plentiful; Little’s law shows that shortening time in transit reduces the goods on the road. Everything quoted in this chapter is the wording of English Wikipedia articles; no classical text is quoted.
References
Fan, Y. (2026). Zero-Touch Multi-Site Fault Tolerance, Payment Anti-Fraud State Machines and Passive Cashflow Queuing: Receipt-Hash Deduplication, Self-Referral Blocking, Host-Header Routing and Availability Bounds [零人工多站点容错架构、支付防欺诈状态机与被动现金流排队论] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090201 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).