COREREACTIONSLIB¶
Overview¶
COREREACTIONSLIB provides centralized reaction functions for the Dysnomia ecosystem. It orchestrates entropy-based state transformations across multiple SHIOs, initializing the core reaction chain during deployment.
- Inherits: DYSNOMIA V2
- License: Sharia
- Solidity: ^0.8.21
What This Means For Players¶
Plain English Summary: COREREACTIONSLIB is the physics engine of the Dysnomia world - it handles all the cryptographic "reactions" that happen when you interact with the game. When you chat, claim territory, or trade, reactions occur that update the game state in unpredictable but deterministic ways.
Real-World Analogy: Think of it like the physics calculations in a video game. When you throw a ball, the game calculates where it lands. In Dysnomia, when you perform actions, COREREACTIONSLIB calculates the resulting state changes using cryptographic math.
How It Affects Your Gameplay: - Entropy tracking - Your actions contribute to system randomness - Chat reactions - Every chat message triggers cryptographic reactions - State evolution - Reactions update values like BRIGHTNESS, HUE, and WHITE that influence the game - Color metaphor - BLACK, WHITE, BRIGHTNESS, HUE represent different entropy states
State Variables¶
| Variable | Type | Visibility | Description |
|---|---|---|---|
| Type | string | public constant | "ReactionsLib" |
| Void | VOID | public | Reference to session manager |
| Cho | CHOINTERFACE | public | Reference to CHO login contract |
| BLACK | uint64 | public | Initial entropy value |
| HYUN | uint64 | public | Reaction output |
| SHUTTER | uint64 | public | Reaction output |
| BRIGHTNESS | uint64 | public | Accumulated brightness |
| HUE | uint64 | public | Accumulated hue |
| WHITE | uint64 | public | Final reaction output |
Read Functions¶
Entropy¶
- Access:public
- Parameters:
- On (Bao): Operation context containing the SHIO to extract entropy from
- Returns:
- uint64: Computed entropy value from the SHIO's Rod and Cone Chin values
- Description: Computes a deterministic entropy value from the Bao's SHIO pair.
- Logic Flow:
1. Call _mintToCap()
2. Return modExp64(On.Shio.Rho().Cone.View().Chin, On.Shio.Rho().Rod.View().Chin, MotzkinPrime)
- Computation Details:
- Entropy = ConesChin^RodsChin mod 953467954114363
- Side Effects: Mints tokens
- In Plain English: Extract the unique randomness embedded in your cryptographic keys. The Chin values from Rod and Cone are combined via modular exponentiation to produce a personal entropy. This makes your game actions unpredictable yet verifiable.
Initialize¶
- Access:public
- Parameters:
- On (Bao): Operation context to initialize
- Returns:
- uint64: Omicron output value
- uint64: Omega output value
- Description: Initializes reaction chain by connecting to Bang and Le system states.
- Logic Flow:
1. React via Rod: (Omicron, Omega) = ReactShioRod(On.Shio, Void.Nu().Psi().Rho().Bang.Omicron)
2. React via Lai: (Omicron, Omega) = ReactLai(Omega)
3. React via Rod again: (Omicron, Omega) = ReactShioRod(On.Shio, Void.Nu().Psi().Rho().Le.Omicron)
4. Return final (Omicron, Omega)
- Computation Details:
- Uses YANG's Bang.Omicron and Le.Omicron as initialization seeds
- Side Effects: Triggers multiple SHIO reactions; mints tokens
- In Plain English: Bootstrap the reaction sequence for your Bao by connecting it to the system's core states (Bang and Le). This establishes the starting point for all future game interactions by mixing your SHIO with the global state.
Write Functions¶
RegisterChoForTalk¶
- Access:onlyOwners
- Parameters:
- ChoAddress (address): Address of the CHO contract to register
- Description: Stores the CHO contract reference for talk-based reactions.
- Logic Flow:
1. Set Cho = CHOINTERFACE(ChoAddress)
- Side Effects: Updates Cho state variable
- In Plain English: Connect the login/authentication system to the reaction library. Once registered, CHO can process user reactions for chat operations. Admin-only because it changes how the system handles talk reactions.
React¶
- Access:public
- Parameters:
- On (Bao): Operation context with SHIO for reactions
- Omicron (uint64): First input value
- Omega (uint64): Second input value
- Returns:
- uint64: New Omicron after two reactions
- uint64: New Omega after two reactions
- Description: Generic double-reaction on the Bao's SHIO Rod.
- Logic Flow:
1. First reaction: (Omega, Omicron) = ReactShioRod(On.Shio, Omicron)
2. Second reaction: (Omega, Omicron) = ReactShioRod(On.Shio, Omega)
3. Return (Omicron, Omega)
- Computation Details:
- Note: outputs are swapped after each ReactShioRod call
- Side Effects: Triggers Rod reactions; mints tokens
- In Plain English: Trigger a game state change that mixes your identity with system entropy. Runs two sequential reactions on the Rod, evolving the state. Every chat, trade, and territory claim uses this pattern.
ReactToBang / ReactToLai / ReactToLe¶
function ReactToBang(Bao memory On, uint64 Omicron, uint64 Omega) public returns (uint64, uint64)
function ReactToLai(Bao memory On, uint64 Omicron, uint64 Omega) public returns (uint64, uint64)
function ReactToLe(Bao memory On, uint64 Omicron, uint64 Omega) public returns (uint64, uint64)
public
- Parameters:
- On (Bao): Operation context
- Omicron, Omega (uint64): Input values to mix with system state
- Returns: Updated (Omicron, Omega) tuple
- Description: React with XOR against YANG's three core states.
- Logic Flow (ReactToBang example):
1. XOR with Bang: React(On, Omicron ^ Bang.Omicron, Omega ^ Bang.Omega)
- Computation Details:
- ReactToBang: XORs with Void.Nu().Psi().Rho().Bang.{Omicron,Omega}
- ReactToLai: XORs with Void.Nu().Psi().Rho().Lai.{Omicron,Omega}
- ReactToLe: XORs with Void.Nu().Psi().Rho().Le.{Omicron,Omega}
- Side Effects: Triggers React; mints tokens
- In Plain English: Mix your reaction with one of the system's three core states (Bang, Lai, or Le). These system states from YANG are cryptographically linked, and reacting against them connects your actions to the global game state via XOR mixing.
ReactToNew¶
- Access:public
- Parameters:
- On (Bao): Operation context
- Saat (uint64[3]): User's Saat array [Pole, Soul, Aura]
- Returns: Updated (Omicron, Omega) tuple
- Description: React using the user's Saat values, then with Le state.
- Logic Flow:
1. React: (Omicron, Omega) = React(On, On.Omicron ^ Saat[2], On.Omega ^ Saat[1])
2. React via Rod: (Omicron, Omega) = ReactShioRod(On.Shio, Omega ^ Le.Omega)
- Computation Details:
- XORs with Aura (Saat[2]) and Soul (Saat[1])
- Then mixes with Le.Omega
- Side Effects: Multiple reactions; mints tokens
- In Plain English: Process a reaction using a user's unique Saat identifier. Mixes the Aura and Soul values into the reaction, then connects to the Le system state. Links the reaction permanently to a specific player's identity.
OperatorReact¶
- Access:public
- Parameters:
- On (Bao): Operation context
- Omega (uint64): Additional entropy to mix
- Returns: Updated (Omicron, Omega) tuple
- Description: React using the system operator's Aura.
- Logic Flow:
1. Return React(On, On.Omicron ^ Void.Nu().Aura(), On.Omega ^ Omega)
- Computation Details:
- XORs Omicron with Nu.Aura() (current system Aura)
- XORs Omega with provided entropy
- Side Effects: Triggers React; mints tokens
- In Plain English: Run a reaction mixing the system operator's Aura value. Ties the reaction to administrative/system-level permissions. The Aura changes over time, so this links the reaction to the current system state.
ReactToTalk¶
- Access:public
- Parameters:
- Alpha (User): User struct containing Soul, Bao, Username, and Entropy
- Returns: Updated (Omicron, Omega) tuple
- Description: Processes reactions for chat/talk operations through CHO.
- Logic Flow:
1. Mint tokens: _mintToCap()
2. React via CHO: Alpha.On.Omega = Cho.ReactUser(Alpha.Soul, Lai.Omicron)
3. React via Lai: (Alpha.On.Omicron, Alpha.On.Omega) = ReactLai(Alpha.Soul)
4. React via CHO again: Alpha.On.Omicron = Cho.ReactUser(Alpha.Soul, Alpha.On.Omega)
5. Return (Alpha.On.Omicron, Alpha.On.Omega)
- Side Effects: Calls CHO.ReactUser; triggers ReactLai; mints tokens
- In Plain English: Process a reaction triggered by a chat message. Uses CHO to react the user's Soul with system states. Every time you talk in the game, this function updates the system state based on your Soul and the Lai reaction chain.
Named Reactions¶
function ReactBang(uint64 Eta) public returns (uint64, uint64)
function ReactLai(uint64 Gamma) public returns (uint64, uint64)
function ReactLe(uint64 Delta) public returns (uint64, uint64)
function ReactEris(uint64 Iota) public returns (uint64, uint64)
function ReactFomalhaute(uint64 Mu) public returns (uint64, uint64)
function ReactFornax(uint64 Rho) public returns (uint64, uint64)
public
- Parameters: Single uint64 input value to react
- Returns: (uint64, uint64) reaction outputs
- Description: React on specific system SHIOs via their Cone channel.
- Logic Flow (each function):
- ReactBang(Eta): ReactShioCone(Void.Nu().Psi().Rho().Bang.Shio, Eta)
- ReactLai(Gamma): ReactShioCone(Void.Nu().Psi().Rho().Lai.Shio, Gamma)
- ReactLe(Delta): ReactShioCone(Void.Nu().Psi().Rho().Le.Shio, Delta)
- ReactEris(Iota): ReactShioCone(GetRodByIdx(Lai.Xi).Shio, Iota) (Lai's installation)
- ReactFomalhaute(Mu): ReactShioCone(GetRodByIdx(ZHOU.Xi()).Shio, Mu) (ZHOU's installation)
- ReactFornax(Rho): ReactShioCone(Void.Nu().Psi().Mu().Tau().Upsilon().Eta().Psi(), Rho) (YI's SHIO)
- Side Effects: Triggers Cone reactions on system SHIOs; mints tokens
- In Plain English: Run reactions against named system components. Bang/Lai/Le are YANG's core states. Eris/Fomalhaute/Fornax are named installations. Each represents a different part of the cryptographic infrastructure, and reacting against them updates global state.
ReactShioRod / ReactShioCone¶
function ReactShioRod(SHIO Beta, uint64 Theta) public returns (uint64, uint64)
function ReactShioCone(SHIO Beta, uint64 Theta) public returns (uint64, uint64)
public
- Parameters:
- Beta (SHIO): The SHIO pair to react on
- Theta (uint64): Input value for reaction
- Returns: (uint64, uint64) reaction outputs from SHA.React
- Description: Core reaction functions that call React on Rod or Cone.
- Logic Flow (ReactShioRod):
1. Call _mintToCap()
2. Return Beta.Rod().React(Theta, Beta.Cone().View().Channel)
- Logic Flow (ReactShioCone):
1. Call _mintToCap()
2. Return Beta.Cone().React(Theta, Beta.Rod().View().Channel)
- Computation Details:
- ReactShioRod: Uses Rod as primary, Cone's Channel as secondary
- ReactShioCone: Uses Cone as primary, Rod's Channel as secondary
- Side Effects: Triggers SHA.React; mints tokens
- In Plain English: The fundamental reaction functions - building blocks for all other reactions. ReactShioRod processes through the Rod channel of a SHIO pair using the Cone's Channel as the secondary value. ReactShioCone does the opposite. All higher-level reactions ultimately call these.
Contract Interactions¶
Depends On¶
- DYSNOMIA V2 - Base functionality
- VOID - Session management
- CHO - User authentication
- YANG - Multi-state access
Registered In¶
- VOID library registry as "corereactions"
Constructor Initialization¶
The constructor performs an extensive initialization sequence:
constructor(VoidAddress) {
// Register as library
Void.AddLibrary("corereactions", address(this));
// Create own user session
(Saat, On) = Void.Enter("ReactionsLib", "ReactionsLib");
// Initialize reaction chain
BLACK = Entropy(On);
(BRIGHTNESS, HUE) = Initialize(On);
(BRIGHTNESS, HUE) = React(On, BRIGHTNESS, HUE);
(HYUN, SHUTTER) = ReactToBang(On, BRIGHTNESS, HUE);
(BRIGHTNESS, HUE) = ReactToNew(On, Saat);
(BRIGHTNESS, HUE) = ReactToLai(On, BRIGHTNESS, HUE);
(BRIGHTNESS, HUE) = OperatorReact(On, BLACK);
(BRIGHTNESS, HUE) = ReactToLe(On, BLACK, HYUN);
(BRIGHTNESS, HUE) = ReactBang(BRIGHTNESS);
(BRIGHTNESS, HUE) = ReactEris(HUE);
(BRIGHTNESS, HUE) = ReactLai(BRIGHTNESS);
(BRIGHTNESS, HUE) = ReactFomalhaute(HUE);
(BRIGHTNESS, HUE) = ReactLe(BRIGHTNESS);
(BRIGHTNESS, HUE) = ReactFornax(HUE);
(BRIGHTNESS, WHITE) = ReactShioCone(On.Shio, BLACK);
// Verify initialization
assert(BLACK > 1551);
assert(BRIGHTNESS > 1551);
assert(HUE > 1551);
assert(WHITE > 1551);
}
Special Mechanisms¶
System SHIOs¶
The library reacts against several system-level SHIOs: - Bang: YANG's first reaction state - Lai: YANG's created installation - Le: YANG's second reaction state - Eris: Installation at Lai.Xi - Fomalhaute: Installation at ZHOU.Xi - Fornax: YI's primary SHIO (Psi)
XOR Accumulation Pattern¶
All React functions use XOR to combine values:
Entropy Computation¶
function Entropy(Bao memory On) public returns (uint64) {
return Xiao.modExp64(
On.Shio.Rho().Cone.View().Chin,
On.Shio.Rho().Rod.View().Chin,
MotzkinPrime
);
}
Minimum Value Assertions¶
Constructor verifies all values exceed 1551, ensuring proper initialization.
Usage Pattern¶
// Get entropy for a Bao
uint64 entropy = reactionsLib.Entropy(myBao);
// React through the chain
(uint64 o, uint64 w) = reactionsLib.ReactShioRod(shio, inputValue);
// React against system states
(o, w) = reactionsLib.ReactToBang(myBao, brightness, hue);
Contract Verification¶
| Property | Value |
|---|---|
| Keccak256 Hash | 0x79a0678e9a7b48a328d337b1519c3eac978a9c2f76c242ee94f9ae8a20bc92cf |
| Source URL | https://raw.githubusercontent.com/busytoby/atropa_pulsechain/main/solidity/dysnomia/lib/reactions_core.sol |
| Hash Generated | 2026-02-08T00:29:08Z |