5D Library › Cross-Border Payment Routing, Chargeback Defense Games and Treasury Ruin Bounds · 中文

Chapter 7. Song Maritime Customs Levies, and the Secret Codes and Transfers of the Shanxi Remittance Banks

Why read these sources here

The three problems of cross-border collection each have a counterpart among old Chinese institutions: settlement and withholding on overseas trade at the port, guarding long-distance remittances against forgery, and moving funds among branches in different places. This chapter checks the sources and asks which correspondences can be computed and which are only skin-deep. Two points come out of the check: the Song maritime trade office’s “chou jie” levy was a tax, and what it took was never returned, unlike a rolling reserve, which is released; and the phrase “zhuo ying ji xu” (drawing on surplus to relieve shortfall) is found in the Qing statutes on granary reserves (昆冈 et al. 1991), not coined by the remittance banks; only later was it used to describe transfers among their branches.

Maritime levies: one part in ten taken first

Source text

History of Song, “Treatise on Food and Money, VIII”, maritime trade

大抵海船至,十先征其一,价直酌蕃货轻重而差给之,岁约获五十余万斤、条、株、颗。

旧法抽解有定数,而取之不苛,输税宽其期,而使之待价,怀远之意实寓焉。

(脱脱 et al. 1977)

“As a rule, when a sea-going ship arrives, one part in ten is taken first, and the price for the rest is set by the weight of the foreign goods … The old rule was that the levy had a fixed amount and was not harshly taken; the time for paying the tax was lenient, letting merchants wait for a price, and the intent of welcoming those from afar lay in this.” The ship’s goods were levied in kind at one tenth on arrival, and the rest bought at prices set by the goods’ weight. In form the levy resembles a rolling reserve: a fixed share is taken first from every inflow. But they differ at root: the levy was a tax and was not returned, while a reserve only delays payment and must be released when the holding period ends. The computations of Chapter 5 turn on exactly this delay: a reserve below the net margin rate is only money held up. “The time for paying the tax was lenient, letting merchants wait for a price” shows attention to cash flow even then: merchants could pay after their goods were sold.

Remittance codes: strength comes from changing them

The Shanxi remittance banks moved silver between branches by draft, and guarded the drafts against forgery with secret codes (fixed tables of characters standing for the month, the day and the amount), changing the tables from time to time (卫聚贤 2008). Below, the strength of a simplified table is computed: 12 characters for the month, 30 for the day, 10 for the digits, and four digits of amount.

Calculation

# Chapter 7. p13: Secret codes and pooled silver. (1) A draft carries a
# code: one symbol for the month (12), one for the day (30) and one per
# digit of the amount (10 symbols, 4 digits). A forger who has seen no
# genuine draft guesses all six symbols; one who has seen n genuine drafts
# may have learned the symbols he needs. Against that, a keyed hash
# (HMAC) truncated to 32 bits is guessed with 2^-32 whatever he has seen.
# (2) k branches each face independent cash calls with sd 1 (in units of
# a branch's typical call); each alone needs 2.326 sd for 99% cover, a
# pooled treasury needs 2.326 * sqrt(k).
import random
from math import sqrt

def learned(rng, n, trials=4000):
    """Share of target drafts whose six symbols all appeared in n drafts."""
    hit = 0
    for _ in range(trials):
        seen_m, seen_d, seen_x = set(), set(), set()
        for _ in range(n):
            seen_m.add(rng.randrange(12))
            seen_d.add(rng.randrange(30))
            seen_x.update(rng.randrange(10) for _ in range(4))
        m, d = rng.randrange(12), rng.randrange(30)
        xs = {rng.randrange(10) for _ in range(4)}
        hit += m in seen_m and d in seen_d and xs <= seen_x
    return hit / trials

if __name__ == "__main__":
    rng = random.Random(85)
    print("   forger guessing blind: 1 in {:,}".format(12 * 30 * 10 ** 4))
    for n in (10, 50, 200):
        print("   after {:3d} genuine drafts, all symbols known: {:.3f}"
              .format(n, learned(rng, n)))
    print("   HMAC truncated to 32 bits: 1 in {:,}".format(2 ** 32))
    print("   branches  separate reserves  pooled  saving")
    for k in (1, 4, 9, 16):
        sep, pool = 2.326 * k, 2.326 * sqrt(k)
        print("   {:8d}  {:17.2f}  {:6.2f}  {:6.0%}".format(
            k, sep, pool, 1 - pool / sep))
#    forger guessing blind: 1 in 3,600,000
#    after  10 genuine drafts, all symbols known: 0.155
#    after  50 genuine drafts, all symbols known: 0.806
#    after 200 genuine drafts, all symbols known: 0.998
#    HMAC truncated to 32 bits: 1 in 4,294,967,296
#    branches  separate reserves  pooled  saving
#           1               2.33    2.33      0%
#           4               9.30    4.65     50%
#           9              20.93    6.98     67%
#          16              37.22    9.30     75%

A forger who has never seen a genuine draft guesses all six characters with a chance of 1 in 3,600,000. But the table is fixed: after seeing 10 genuine drafts, the probability that he already knows every character needed to forge a random draft is 0.155; after 50, 0.806; after 200, 0.998. The security of the code lies not in the table but in changing it regularly and keeping each draft in few hands. A modern keyed hash (truncated to 32 bits) is different: however many genuine documents the attacker has seen, his chance of guessing remains 1 in 4,294,967,296, provided the key itself does not leak. The evidence log of Chapter 4 works this way.

Drawing on surplus to relieve shortfall: the square-root law of pooling

Pooling the cash of several branches needs less reserve than each branch holding its own. If kk branches face independent cash calls, each must hold 2.326 standard deviations for 99% cover on its own, while together they need only 2.326k2.326\sqrt{k}. In the computation above, 4 branches save 50% of the reserve, 9 save 67%, 16 save 75%. The saving relies on the branches’ calls being independent: the return season of Chapter 5 tends to hit every branch at once, and then pooling helps much less.

Hypothesis · not established

The author’s interpretation (not yet tested): in firms collecting on many sites in many currencies, having headquarters manage all sites’ cash together (rather than each site holding its own reserve) cuts the total reserve by at least three tenths for the same confidence of staying in cash. What would show it wrong: in quarterly cash records, managing cash together reduces the total reserve needed for the same confidence by less than three tenths.

Summary

The maritime levy and the rolling reserve look alike but are not: one is a tax, the other a delay; “the time for paying the tax was lenient” shows that merchants’ cash flow was already considered. The security of the remittance codes came from changing and guarding them, not from the tables themselves; a modern keyed hash is far stronger on this point. “Drawing on surplus to relieve shortfall” corresponds to the square-root law of cash pooling, which holds only when the calls on each place are independent.

References

卫聚贤. 2008. 山西票号史. 山西财经大学晋商研究经典文库. 经济管理出版社.
昆冈 et al. 1991. 钦定大清会典事例. 中华书局.
脱脱 et al. 1977. 宋史. 中华书局.

Fan, Y. (2026). Cross-Border Payment Routing, Chargeback Defense Games and Treasury Ruin Bounds: Multi-Acquirer Success Optimization, Dispute Evidence Scoring and Cramér-Lundberg Cash Reserves [跨境支付智能路由、拒付抗辩博弈与资金池破产边界] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090225 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).