Skip to main content

Group

Overview

Elliptic curve group element class for operations on group elements in the Aleo network. Provides methods for creating, converting, and manipulating group elements with support for various arithmetic operations and format conversions.

Methods

fromString

Creates a group object from a string representation of a group element

fromString(group)Group
ParamTypeDescription
groupstringString representation of a group element
returnGroupGroup object

toString

Returns the string representation of the group element

toString() ► string
ParamType
returnstring

fromBytesLe

Create a group element from a Uint8Array of left endian bytes

fromBytesLe(bytes)Group
ParamTypeDescription
bytesUint8ArrayByte array representation
returnGroupGroup object

toBytesLe

Encode the group element as a Uint8Array of left endian bytes

toBytesLe()Uint8Array
ParamType
returnUint8Array

fromBitsLe

Reconstruct a group element from a boolean array representation

fromBitsLe(bits)Group
ParamTypeDescription
bitsArray.<any>Boolean array representation
returnGroupGroup object

toBitsLe

Get the left endian boolean array representation of the group element

toBitsLe()Array.<any>
ParamType
returnArray.<any>

toFields

Get the field array representation of the group

toFields()Array.<any>
ParamType
returnArray.<any>

toXCoordinate

Get the x-coordinate of the group element

toXCoordinate()Field
ParamType
returnField

toPlaintext

Create a plaintext element from a group element

toPlaintext()Plaintext
ParamType
returnPlaintext

clone

Clone the group element

clone()Group
ParamType
returnGroup

random

Generate a random group element

random()Group
ParamType
returnGroup

add

Add two group elements

add(other)Group
ParamTypeDescription
otherGroupGroup element to add
returnGroupSum of the group elements

subtract

Subtract two group elements (equivalently: add the inverse of an element)

subtract(other)Group
ParamTypeDescription
otherGroupGroup element to subtract
returnGroupDifference of the group elements

scalarMultiply

Multiply a group element by a scalar element

scalarMultiply(scalar)Group
ParamTypeDescription
scalarScalarScalar element to multiply by
returnGroupResult of scalar multiplication

double

Double the group element

double()Group
ParamType
returnGroup

inverse

Get the inverse of the group element. This is the reflection of the point about the axis of symmetry i.e. (x,y) -> (x, -y)

inverse()Group
ParamType
returnGroup

equals

Check if one group element equals another

equals(other) ► boolean
ParamTypeDescription
otherGroupGroup element to compare
returnbooleanWhether the group elements are equal

zero

Get the group identity element under the group operation (i.e. the point at infinity)

zero()Group
ParamType
returnGroup

generator

Get the generator of the group

generator()Group
ParamType
returnGroup