G2

scalus.cardano.onchain.plutus.prelude.crypto.bls12_381.G2
object G2

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
G2.type

Members list

Value members

Concrete methods

The compressed generator of the G2 group of the BLS12-381 curve.

The compressed generator of the G2 group of the BLS12-381 curve.

Attributes

Note

This is a function, not a constant deliberately. Being a constant would make it always initialize in your Plutus script (which is not cheap) even if the BLS12-381 is not used in the evaluated code. Hence, to avoid multiple initializations, please create a local variable in the scope where you need it, like:

   val genG2 = G2.generator
inline def hashToGroup(bs: ByteString, dst: ByteString): G2Element

Hashes a scalus.uplc.builtin.ByteString to a point in the G2 group.

Hashes a scalus.uplc.builtin.ByteString to a point in the G2 group.

Value parameters

bs

The byte string to hash.

dst

The domain separation tag, which should be a short byte string (up to 255 bytes).

Attributes

Returns

A point in the G2 group.

inline def uncompress(bs: ByteString): G2Element

Uncompresses a point in the G2 group from its compressed form.

Uncompresses a point in the G2 group from its compressed form.

Attributes

BLS12 G2 zero element.

BLS12 G2 zero element.

This is the point at infinity in the BLS12-381 G2 group

Attributes

Note

This is a function, not a constant deliberately. Being a constant would make it always initialize in your Plutus script (which is not cheap) even if the BLS12-381 is not used in the evaluated code. Hence, to avoid multiple initializations, please create a local variable in the scope where you need it, like:

   val zeroG2 = G2.zero

Givens

Extensions

Extensions

extension (self: G2Element)
infix inline def +(rhs: G2Element): G2Element

Adds two points in the G2 group

Adds two points in the G2 group

Attributes

inline def compress: ByteString

Compresses the point in the G2 group to its compressed form.

Compresses the point in the G2 group to its compressed form.

Attributes

Returns

A scalus.uplc.builtin.ByteString representing the compressed point.

inline def equal(rhs: G2Element): Boolean

Checks if two points in the G2 group are equal

Checks if two points in the G2 group are equal

Attributes

inline def scale(scalar: BigInt): G2Element

Exponentiates a point in the G2 group with a scalar. This operation is equivalent to the repeated addition of the point with itself e times.

Exponentiates a point in the G2 group with a scalar. This operation is equivalent to the repeated addition of the point with itself e times.

Value parameters

scalar

The scalar to multiply the point by.

Attributes

Returns

A new point in the G2 group, which is the result of multiplying the original point by the scalar.

inline def unary_-: G2Element

Negates the point in the G2 group

Negates the point in the G2 group

Attributes