Soda Labs
Soda Labs Docs

Is nullified

Check whether an anonymous token value has already been nullified.

When utilizing Anonymous tokens, users have the ability to inquire about the status of a particular token value to determine if it has been nullified. This process allows users to ensure the token's validity and confirm whether it is still active or has been invalidated. By checking if a token is nullified, users can maintain secure and effective use of token-based systems, enhancing security protocols by actively monitoring token status. This proactive approach ensures that any compromised or unused tokens are promptly identified and addressed.

Checking if a token is nullified is done through a gRPC function:

rpc IsNullified(IsNullifiedRequest) returns (IsNullifiedResponse);

message IsNullifiedRequest{
    bytes y_value = 1;
}

message IsNullifiedResponse {
    bool response = 1;
    bytes mpc_signature = 2;
    int32 result_code = 3;
}

The following Python code demonstrates how to perform an isNullified RPC call:

  • client: A gRPC client.
  • y_value: Token value to check nullification.
def check_nullified(client, y_value):
    y_bytes = y_value.to_bytes(16, byteorder='big')

    # Call the gRPC service to get the encrypted balance of this handle
    request = pb.IsNullifiedRequest(
		y_value=y_bytes,
	)
    response = client.IsNullified(request)

    if response.result_code != 0:
        raise ValueError(f"Invalid result code: {response.result_code}")
    return response.response