Skip to content

Spec

Documentation for tests/byzantium/eip196_ec_add_mul/spec.py@7b8124a7.

Defines EIP-196 specification constants and functions.

Spec dataclass

Parameters from the EIP-196 specification (https://eips.ethereum.org/EIPS/eip-196) with some modifications for readability.

Source code in tests/byzantium/eip196_ec_add_mul/spec.py
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
@dataclass(frozen=True)
class Spec:
    """
    Parameters from the EIP-196 specification (https://eips.ethereum.org/EIPS/eip-196)
    with some modifications for readability.
    """

    # Addresses
    ECADD = Address(0x06)
    ECMUL = Address(0x07)

    # The prime modulus of the BN254 prime field Fp
    P = 0x30644E72E131A029B85045B68181585D97816A916871CA8D3C208C16D87CFD47

    # G1 generator point
    G1 = PointG1(1, 2)

    # The point at infinity in G1
    INF_G1 = PointG1()

    # G1 generator point doubled: [2]G1
    G1x2 = PointG1(
        0x030644E72E131A029B85045B68181585D97816A916871CA8D3C208C16D87CFD3,
        0x15ED738C0E0A7C92E7845F96B2AE9C0A68A6A449E3538FC7FF3EBF7A5A18A2C4,
    )

    # Example point P
    P1 = PointG1(
        0x17C139DF0EFEE0F766BC0204762B774362E4DED88953A39CE849A8A7FA163FA9,
        0x01E0559BACB160664764A357AF8A9FE70BAA9258E0B959273FFC5718C6D4CC7C,
    )

    # Example point Q
    Q1 = PointG1(
        0x039730EA8DFF1254C0FEE9C0EA777D29A9C710B7E616683F194F18C43B43B869,
        0x073A5FFCC6FC7A28C30723D6E58CE577356982D65B833A5A5C15BF9024B43D98,
    )

    # Example point R = P + Q
    R1 = PointG1(
        0x15BF2BB17880144B5D1CD2B1F46EFF9D617BFFD1CA57C37FB5A49BD84E53CF66,
        0x049C797F9CE0D17083DEB32B5E36F2EA2A212EE036598DD7624C168993D1355F,
    )