Table of Contents

Class AccountAddress

Namespace
Concordium.Sdk.Types
Assembly
Concordium.Sdk.dll

Represents an account address.

The address of an account is a 32-byte value which uniquely identifies the account.

public sealed record AccountAddress : IEquatable<AccountAddress>, IAddress, IAccountIdentifier
Inheritance
AccountAddress
Implements
Inherited Members

Fields

BytesLength

The serialized length of the account address.

public const uint BytesLength = 32

Field Value

uint

Methods

AsSpan()

Returns a read only span of underlying byte array.

public ReadOnlySpan<byte> AsSpan()

Returns

ReadOnlySpan<byte>

CreateAliasAddress(byte, byte, byte)

Gets a alias of this account address with the given input bytes.

The first 29 bytes of an address identifies a unique account with the remaining 3 bytes representing aliases of that account

public AccountAddress CreateAliasAddress(byte byte1, byte byte2, byte byte3)

Parameters

byte1 byte

Position 30

byte2 byte

Position 31

byte3 byte

Position 32

Returns

AccountAddress

Alias of the account address with the given bytes.

Equals(AccountAddress?)

Determines whether one AccountAddress is equal to a second AccountAddress.

public bool Equals(AccountAddress? other)

Parameters

other AccountAddress

Returns

bool

Remarks

This does not consider two distinct aliases to the same account as equal.

From(byte[])

Creates an instance from a length-32 byte array representing the address (without the version byte prepended).

public static AccountAddress From(byte[] addressAsBytes)

Parameters

addressAsBytes byte[]

The address as a length-32 byte array, i.e. without the version byte prepended.

Returns

AccountAddress

Exceptions

ArgumentException

The input is not a length-32 byte array.

From(string)

Initializes a new instance of the AccountAddress class.

public static AccountAddress From(string addressAsBase58String)

Parameters

addressAsBase58String string

The address represented as a length-50 base58 encoded string.

Returns

AccountAddress

Exceptions

ArgumentException

The input is not a length-50 base58 encoded string.

GetBaseAddress()

Returns base address which is the first 29 bytes of an address.

public AccountAddress GetBaseAddress()

Returns

AccountAddress

GetHashCode()

Get hash code for the AccountAddress.

public override int GetHashCode()

Returns

int

GetNthAlias(uint)

Gets the nth alias of this account address.

The first 29 bytes of an address identifies a unique account with the remaining 3 bytes representing aliases of that account. An alias can thus be thought of as an unsigned integer whose value is between 0 and 2^24-1. We refer to the address where the last three bytes corresponds to the value n in big endian format as the nth alias of the account.

public AccountAddress GetNthAlias(uint n)

Parameters

n uint

An unsigned integer representing the nth alias.

Returns

AccountAddress

A new account address which is the nth alias of the account.

Exceptions

ArgumentOutOfRangeException

n is larger than 2^24-1.

IsAliasOf(AccountAddress)

Check whether the account address is an alias of another.

Two addresses are aliases if they identify the same account. This is defined to be when the addresses agree on the first 29 bytes.

public bool IsAliasOf(AccountAddress other)

Parameters

other AccountAddress

the account address as base58 encoded string.

Returns

bool

IsValid(string?)

Checks if passed string is a base58 encoded address.

public static bool IsValid(string? addressAsBase58String)

Parameters

addressAsBase58String string

The account address as base58 encoded string.

Returns

bool

true if the input could be decoded as a base58 encoded address and false otherwise.

ToAccountIdentifierInput()

Converts the account address to a corresponding AccountIdentifierInput

This can be used as the input for class methods of RawClient.

public AccountIdentifierInput ToAccountIdentifierInput()

Returns

AccountIdentifierInput

ToBytes()

Copies the address to a byte array which has the version byte preprended.

public byte[] ToBytes()

Returns

byte[]

ToProto()

Converts the account address to its corresponding protocol buffer message instance.

This can be used as the input for class methods of RawClient.

public AccountAddress ToProto()

Returns

AccountAddress

ToString()

Get the address represented as a base58 encoded string.

public override string ToString()

Returns

string

TryDeserial(ReadOnlySpan<byte>, out (AccountAddress? AccountAddress, string? Error))

Create an account address from a byte array.

public static bool TryDeserial(ReadOnlySpan<byte> bytes, out (AccountAddress? AccountAddress, string? Error) output)

Parameters

bytes ReadOnlySpan<byte>

The serialized account address.

output (AccountAddress AccountAddress, string Error)

Where to write the result of the operation.

Returns

bool

TryParse(string, out AccountAddress?)

Try parse account address from a base 58 encoded string.

public static bool TryParse(string base58EncodedAddress, out AccountAddress? address)

Parameters

base58EncodedAddress string

Base 58 encoded string of address

address AccountAddress

If parsed returns Account Address.

Returns

bool

True if Account Address could be parsed.