Skip to main content

Try it Live

Run Address examples in the interactive playground
This page is a placeholder. All examples on this page are currently AI-generated and are not correct. This documentation will be completed in the future with accurate, tested examples.
View the complete executable example at playground/src/examples/primitives/address/equals.ts.

bool primitives_address_equals(const PrimitivesAddress *a, const PrimitivesAddress *b)

Compare two address instances for equality.Parameters:
  • a: const PrimitivesAddress * - First address
  • b: const PrimitivesAddress * - Second address
Returns: bool - true if addresses are equalExample:
Defined in: src/primitives.h

Comparison Semantics

Value equality: Compares byte contents, not object identity. Case insensitive: Addresses created from different case formats are equal:
Format independent: Different construction methods producing same address are equal:

Use Cases

Validation

Check if address matches expected value:

Filtering

Filter transactions by address:

Deduplication

Remove duplicate addresses:

Lookups

Check membership in address list:

Performance Considerations

Direct comparison: equals() converts to hex and uses string comparison internally. For repeated comparisons, convert to hex once and use string comparison:

Alternative Comparisons

String comparison:
Bigint comparison:
Byte comparison:
Recommendation: Use equals() for clarity. It handles the comparison efficiently.

Relation to Other Comparisons

See Also