區塊鏈交易排序的公平性探討




完美公平交易排序的不可行性

探討康多塞悖論如何揭示區塊鏈共識中完美公平的限制。

在分布式系統的研究中,尤其是在拜占庭共識和狀態機複製(SMR)方面,數十年來主要集中於兩個目標:一致性和活躍性。一致性意味著所有節點對相同的交易序列達成共識,而活躍性則確保系統能夠持續新增交易。然而,這些特性並不能阻止壞分子在接收交易後改變其排序。

在公共區塊鏈中,傳統共識保證的這一缺口已成為一個嚴重問題。驗證者、區塊建設者或排序者可以利用其在區塊排序中的特權角色獲取經濟利益,這種行為被稱為最大可提取價值(MEV)。這種操控包括有利的前置交易、後置交易和夾擊交易。因為交易執行的順序決定了在去中心化金融(DeFi)應用中的有效性或盈利性,交易排序的完整性對於維持公平和信任至關重要。

為了解決這一關鍵的安全缺口,交易順序公平性被提出作為第三個基本共識屬性。公平排序協議確保交易的最終順序取決於外部的客觀因素,例如到達時間(或接收順序),並且對對手的重新排序具有抵抗力。通過限制區塊提議者重新排序交易的權力,這些協議使區塊鏈更接近於透明、可預測和抵抗MEV的狀態。

康多塞悖論與理想公平的不可行性

最直觀且最強的公平觀念是接收順序公平性(ROF)。ROF非正式定義為「先接收,先輸出」,這意味著如果足夠多的交易(tx)在大多數節點之前到達另一個交易(tx′),則系統必須在執行時將tx排在tx′之前。

然而,除非假設所有節點能夠瞬時通訊(即在一個瞬時同步的外部網絡中運行),否則實現這種普遍接受的「排序公平」在根本上是不可能的。這一不可行性結果源於社會選擇理論的一個驚人聯繫,特別是康多塞悖論。

康多塞悖論說明,即使每個單獨的節點保持交易的傳遞內部排序,系統中的集體偏好也可能導致所謂的非傳遞循環。例如,可能出現大多數節點在交易A之前接收交易B,而大多數節點在交易B之前接收交易C,然後大多數節點又在交易C之前接收交易A。因此,這三個大多數偏好形成了一個循環(A→B→C→A)。這意味著,對於交易A、B和C,沒有單一一致的排序能同時滿足所有大多數偏好。

這一悖論展示了在異步網絡中完美實現接收順序公平的目標是不可行的,甚至在共享公共時鐘的同步網絡中,如果外部網絡延遲過長也同樣如此。這一不可行性要求採用較弱的公平性定義,例如批量順序公平性。

Hedera Hashgraph與中位時間戳的缺陷

Hedera使用Hashgraph共識算法,試圖近似強接收順序公平性(ROF)。它通過將每個交易的最終時間戳計算為所有節點對該交易的本地時間戳的中位數來實現。

然而,這本質上容易受到操控。單個對手節點可以故意扭曲其本地時間戳,反轉兩個交易的最終排序,即使所有誠實參與者都是按正確順序接收它們。

考慮一個簡單的例子,五個共識節點(A、B、C、D和E)中,節點E惡意行為。兩個交易,tx₁和tx₂,廣播到網絡。所有誠實節點在tx₂之前接收tx₁,因此預期的最終順序應該是tx₁ → tx₂。

在這個例子中,對手將tx₁分配一個較晚的時間戳(3),而tx₂則分配一個較早的時間戳(2)以扭曲中位數。

當協議計算中位數時:

* 對於tx₁,時間戳(1、1、4、4、3)得出的中位數為3。
* 對於tx₂,時間戳(2、2、5、5、2)得出的中位數為2。

因為tx₁的最終時間戳(3)大於tx₂(2),協議輸出tx₂ → tx₁,從而反轉了所有誠實節點觀察到的真實順序。

這個簡單的例子展示了一個關鍵缺陷:中位數函數雖然看似中立,但卻是造成不公平的真正原因,因為即使是單個不誠實的參與者也可以利用它來偏向最終交易排序。

因此,Hashgraph所宣稱的「公平時間戳」實際上是一種相當薄弱的公平觀念。Hashgraph共識未能保證接收順序公平性,而是依賴於一組授權的驗證者,而不是基於加密保證。

實現實際保證

然而,為了繞過康多塞所展示的理論不可能性,實用的公平排序方案必須以某種方式放寬公平性的定義。

Aequitas協議引入了區塊順序公平性(BOF)或批量順序公平性的標準。BOF規定,如果足夠多的節點在另一個交易tx′之前接收交易tx,則tx必須在tx′之前或同時交付,這意味著沒有誠實節點可以在tx之後的區塊中交付tx′。這將規則從「必須交付之前」(ROF的要求)放寬為「必須不遲於交付」。

考慮三個共識節點(A、B和C)和三個交易:tx₁、tx₂和tx₃。當至少三個節點(多數)首先觀察到一個交易時,該交易被視為「較早接收」。

如果我們應用多數投票來確定全局順序:

* tx₁ → tx₂(A和C一致同意)
* tx₂ → tx₃(A和B一致同意)
* tx₃ → tx₁(B和C一致同意)

這些偏好形成了一個循環:tx₁ → tx₂ → tx₃ → tx₁。在這種情況下,沒有單一的順序可以同時滿足每個人的觀點,這意味著嚴格的ROF是無法實現的。

BOF通過將所有衝突的交易分組到同一批次或區塊中來解決這一問題,而不是強迫一個在另一個之前。協議簡單地輸出:

區塊B₁ = {tx₁、tx₂、tx₃}

這意味著,從協議的角度來看,這三個交易被視為同時發生。在區塊內,使用確定性的平局打破者(例如哈希值)來決定它們的執行順序。通過這樣做,BOF確保了每對交易的公平性,並保持最終交易日誌對每個人一致。每個交易的處理不會晚於其之前的交易。

這一小而重要的調整使協議能夠處理交易排序衝突的情況,通過將這些衝突的交易分組到同一區塊或批次中。重要的是,這不會導致部分排序,因為每個節點仍必須對一個單一的線性交易序列達成共識。每個區塊內的交易仍然按照固定的順序進行執行。在沒有發生此類衝突的情況下,協議仍然達到更強的ROF屬性。

雖然Aequitas成功實現了BOF,但它面臨著重大限制,特別是其通信複雜性非常高,並且只能保證弱活躍性。弱活躍性意味著交易的交付僅在其所屬的整個康多塞循環完成後才有保證。如果循環「鏈接在一起」,這可能需要任意長的時間。

Themis協議被引入以強制執行相同的強BOF屬性,但改善了通信複雜性。Themis通過三種技術實現這一點:批量解開、延遲排序和更強的內部批次保證。

在其標準形式中,Themis要求每個參與者與網絡中的大多數其他節點交換消息。所需的通信量隨著網絡參與者數量的平方增長。然而,在其優化版本SNARK-Themis中,節點使用簡潔的加密證明來驗證公平性,而不需要直接與每個其他參與者通信。這減少了通信負擔,使其僅隨著線性增長,這使得Themis即使在大型網絡中也能有效擴展。

假設五個節點(A–E)參與共識接收三個交易:tx₁、tx₂和tx₃。由於網絡延遲,它們的本地順序不同。

正如在Aequitas中一樣,這些偏好形成了一個康多塞循環。但Themis不需要等待整個循環解決,而是使用一種稱為批量解開的方法。它識別所有屬於循環的交易,並將它們分組成一個集合,稱為強連通組件(SCC)。在這種情況下,所有三個交易都屬於同一SCC,Themis將其輸出為一個進行中的批次,標記為批次B₁ = {tx₁、tx₂、tx₃}。

通過這樣做,Themis允許網絡在Batch B₁的內部順序仍在確定的同時,繼續處理新交易。這確保系統保持活躍,避免停滯。

總結:

完美公平的交易排序概念看似簡單。誰的交易最先到達網絡,誰就應該最先被處理。然而,正如康多塞悖論所示,這一理想在真實的分布式系統中無法實現。不同的節點以不同的順序看到交易,當這些觀點衝突時,沒有協議能夠在不妥協的情況下建立一個單一的「正確」序列。

Hedera的Hashgraph試圖用中位時間戳來近似這一理想,但該方法更依賴於信任而非證明。單個不誠實的參與者可以扭曲中位數並翻轉交易順序,揭示「公平時間戳」並不真正公平。

像Aequitas和Themis這樣的協議推進了討論,承認了可以和不能實現的目標。它們不再追求不可能的理想,而是以某種方式重新定義公平性,同時在真實的網絡條件下保留順序的完整性。所產生的不是對公平的拒絕,而是其演變。這一演變清晰地劃分了感知的公平與可證明的公平。它表明,在去中心化系統中,真正的交易排序完整性不能依賴於聲譽、驗證者信任或授權控制,而必須來自於嵌入協議中的加密驗證。

以上文章由特價GPT API KEY所翻譯及撰寫。而圖片則由FLUX根據內容自動生成。

🎨 Nano Banana Pro 圖像生成器|打幾句說話就出圖

想畫人像、產品圖、插畫?SSFuture 圖像生成器支援 Flux Gemini Nano Banana Pro 改圖 / 合成, 打廣東話都得,仲可以沿用上一張圖繼續微調。

🆓 Flux 模型即玩,不用登入
🤖 登入後解鎖 Gemini 改圖
📷 支援上載參考圖再生成
⚡ 每天免費額度任你玩
✨ 即刻玩 AI 畫圖
Wide-angle vertical group selfie shot, the man from @imgl in his usual outfit (same clothes as @imgl), natural everyday grooming, candid natural expression, holding the phone vertically for a selfie.
Key Characters: Only the core Avengers join in frame: Iron Man, Captain America, and Black Widow in official costumes.
Background & Environment: Mid-shoot on a movie set with practical debris plus some green screen sections; visible cinema cameras, lighting rigs, crew, clapperboard, candid BTS vibe.
Technical Specs: Ultra photorealistic, 8K, highly detailed, no text/logos/watermark, Vertical Portrait Mode, Aspect Ratio 9:16 --ar 9:16 {
"intro": "Create an ultra realistic 8K UHD DSLR photo based on the attached image as a reference of facial features, maintaining 100% likeness.",

"subject": {
"identity": "A beautiful real human woman portrayed as Cleopatra, seated majestically on her royal Egyptian throne, maintaining 100% likeness to the reference.",
"pose": "Confident, elegant, and seductive seated posture with her back straight and shoulders relaxed. One hand rests authoritatively on the throne’s armrest while firmly holding a ceremonial cobra staff, and the other hand rests sensually on her thigh. Her legs are positioned to subtly reveal the high slit of her gown, radiating queenly dominance, power, and allure.",
"hair": "Long, thick, voluminous hair flowing past her shoulders, colored deep dark brown with a rich natural sheen. The hair is worn loose and sleek with soft natural movement, cascading elegantly down her back and framing her face in a regal manner.",
"makeup": "Bold royal Egyptian glam with highly colorful eye makeup. Her eyes feature layered pigments of turquoise, sapphire blue, emerald green, and molten gold, enhanced with dramatic black ink-style Egyptian eyeliner extending boldly beyond the outer corners in graphic, calligraphic strokes. Metallic accents and micro-shimmer highlight the inner corners. Skin remains warm, glowing, and luminous with sculpted bronze contours, peachy blush, and radiant highlights. Brows are full, strong, and queenly. Lips are soft nude-peach with a glossy, luminous finish to balance the intense eye look.",
"attire": "An ultra-luxurious, sexy Cleopatra couture gown in pure luminous white. The gown is body-hugging through the bodice and hips, featuring a plunging deep neckline adorned with gold filigree, crystal embellishments, and sacred Egyptian symbols. A dramatic thigh-high slit reveals her leg elegantly. Additional elements include gold-thread embroidery, sculpted drapery, and gemstone accents along the waist and slit. A long, ultra-sheer, lightweight cape made of fine translucent silk chiffon flows from her shoulders, delicately dusted with gold shimmer and subtle hieroglyphic motifs, adding movement and divine softness to her powerful presence.",
"crown": "An extraordinarily grand and opulent Cleopatra headpiece—the ultimate royal Egyptian crown. Crafted from radiant gold, it features a dominant central cobra (uraeus) with emerald and lapis lazuli gemstone eyes, flanked by winged sun disks, lotus engravings, and layered ceremonial plates. The crown rises elegantly with intricate detailing, inlaid gemstones, and divine symmetry, making it unmistakably royal, powerful, and legendary.",
"accessories": "Lavish layers of royal accessories including an oversized beaded broad collar necklace in gold, turquoise, lapis lazuli, and carnelian; stacked gold arm cuffs engraved with hieroglyphs; gemstone-studded bangles; multiple ornate rings; a delicate gold waist chain draped over her hips; and detailed anklets with symbolic charms that enhance her divine queen status.",
"footwear": "Traditional Egyptian royal flat sandals crafted from gold-plated leather with delicate beaded straps, turquoise and lapis inlays, open-toe design, and sacred cobra and lotus motifs."
},

"throne": {
"design": "A massive, ultra-bonggang ancient Egyptian royal throne made of carved gold, obsidian, and polished stone.",
"details": "The throne is richly decorated with winged sun disks, twin cobras, lion-head armrests, lotus and papyrus carvings, and engraved hieroglyphs symbolizing power, eternity, and divine rule. The backrest rises high above her head like a ceremonial monument, inlaid with turquoise, lapis lazuli, and gold leaf patterns. Cushioned with deep ivory and gold-embroidered textiles, the throne radiates absolute authority and unmatched royal luxury."
},

"props": {
"primary": "A ceremonial golden staff topped with a sculpted cobra head, its eyes set with glowing emerald gemstones, symbolizing wisdom, protection, and supreme power.",
"secondary": "Golden jars, papyrus scrolls, gemstone offerings, decorative incense holders emitting thin smoke trails, sacred ceremonial artifacts, and royal insignias placed symmetrically around the throne platform."
},

"background": {
"setting": "A grand Egyptian throne room at night, glowing with warm torchlight and golden illumination.",
"details": "Towering sandstone walls fully carved with hieroglyphics and royal chronicles, monumental lotus and papyrus columns trimmed in gold, statues of Egyptian gods and goddesses standing guard, large braziers casting flickering firelight, patterned gold-and-turquoise stone flooring, and sheer linen curtains gently flowing in the warm desert breeze. Macro-to-micro details are visible throughout, with no blur effect—everything is crisp, sharp, and hyper-detailed."
},

"camera": {
"shot": "Half-body to three-quarter editorial portrait showcasing her throne, flowing white gown with cape, colorful inked eye makeup, crown, and cobra staff.",
"angle": "Eye-level royal perspective emphasizing her dominance, beauty, and divine authority.",
"lens": "85mm portrait lens with ultra-sharp clarity and deep texture definition.",
"lighting": "Cinematic warm golden torchlight combined with subtle shadow sculpting, enhancing gold textures, gemstones, fabric folds, and facial features; no blur effects.",
"quality": "Ultra-sharp, high-contrast, glossy editorial realism with 8K-level detail."
}
} Create a photorealistic and highly detailed image featuring the attached image walking confidently down a modern city street, accompanied by Jason Statham, Dwayne “The Rock” Johnson, and Jason Momoa acting as bodyguards.
John Wick (Keanu Reeves) is walking just beside or slightly behind the subject, holding an umbrella over him to shield from light rain.
The subject should be the central figure, wearing stylish casual clothing — like a fitted jacket, dark jeans, and sunglasses — exuding calm authority and cool charisma.
Statham, The Rock, and Momoa are dressed in black tactical-style suits, maintaining alert, protective stances, scanning the surroundings like professional bodyguards. John Wick wears his signature black suit and tie, looking composed as he holds the umbrella.
The setting is a downtown urban street with wet pavement reflecting city lights, parked luxury cars, and paparazzi in the background snapping photos.
The photo should look like a real paparazzi shot — slightly off-angle, mid-step motion blur, with realistic lighting and reflections.
Lighting: natural daylight with overcast skies, reflections from wet concrete, realistic shadows, subtle raindrops on the umbrella and clothing.
Camera realism: crisp detail on facial features and clothing textures, shallow depth of field emphasizing the group, with lens flare or light bloom for authenticity.
Mood & tone: grounded, cinematic, and stylish — feels like a moment from a celebrity entourage photo or action-movie press capture, taken with an iPhone by paparazzi.
Style: ultra-realistic, documentary-style street photography with modern cinematic sharpness.