# 지갑 주소 검증하기

암호화폐의 지갑 주소는 **지갑 주소**와 **Tag** 혹은 **Memo**, 그리고 이 둘을 구분하기 위한 **구분자** 등을 조합하여 다양한 형식으로 만들어 집니다. 주의해야 할 점은, 이렇게 다양한 형태로 존재하는 지갑 주소를  IVMS101 프로토콜 상에서는 하나의 문자열(string)로 다룬다는 점입니다.

따라서 이론적으로 암호화폐 지갑 주소는 다음과 같은 4가지의 형태가 존재할 수 있습니다.

<table data-header-hidden data-full-width="true"><thead><tr><th width="59"></th><th width="315"></th><th width="296"></th><th></th></tr></thead><tbody><tr><td><br></td><td>설명</td><td>예시 자산</td><td>주소 포맷</td></tr><tr><td>1</td><td>주소 단순 문자열로 이루어진 경우</td><td>BTC , ETH…</td><td>address</td></tr><tr><td>2</td><td>주소 문자열에 Tag나 Memo가 추가되는 경우</td><td>EOS,  XRP…</td><td>address:memo or tag</td></tr><tr><td>3</td><td>주소에 ‘:’ 이 포함되어 있는경우</td><td>BCH, Kaspa…</td><td>currency:address</td></tr><tr><td>4</td><td>주소에 ‘:’이 포함되어 있고 Tag나 Memo가 추가되는 경우</td><td>현재는 없으나 미래에 존재할 수 있다고 가정</td><td>currency:address:memo or tag</td></tr></tbody></table>

이때, 송신하는 측(Originator VASP)에서는 는 메모나 태그가 있는 지갑 주소를 ‘:’으로 연결해서 하나로 만들어 보내기로 약속되어 있습니다. 그렇기 때문에 수신하는 측(Beneficiary VASP)에서 예외 케이스 없이 잘 처리하기 위해서는, 다양한 지갑 주소의 경우를 고려하여 주소를 검증하는 흐름을 아래와 같이 잘 설계해야 합니다.

### 주소 먼저 검증

<figure><img src="https://lh7-us.googleusercontent.com/G8aq5k0kSTitA2bj8Nb5YWm1IvXcDzFicNPV4aJb6tJqc5e7NITR4RWjBSuPwr0hzCc376OnN7hH92r5yIWyA8K3XP0AhzWV3tjLWhgiPYyxZAFSc-gDclqNlrvaEzTqe6ImU6PAZng3dQs_oZ-U8Vs" alt=""><figcaption></figcaption></figure>

1. 받은 그대로의 문자열로 주소가 존재하는지를 검증합니다.&#x20;
2. 검증에 실패했다면, 주소에 ‘:’이 있는지를 확인하고, 있다면 맨 우측 ‘:’을 기준으로 문자열을 분할합니다.&#x20;
3. 분할한 첫 번째 문자열로 주소가 존재하는지를 다시 검증합니다.

{% hint style="warning" %}

#### 주의사항

* 문자열 분할 시, ‘:’의 개수와 무관하게 반드시 맨 우측의 것을 기준으로 해야 합니다.
* ‘:’의 존재 여부와 관계없이 전체 스트링 주소 검증은 우선적으로 진행합니다.
  {% endhint %}

### ‘:’의 유무를 먼저 검증

만약 이미 ‘:’의 유무를 먼저 검증하는 흐름으로 설계가 되어 있다면 아래와 같은 방법으로 보완하는 로직을 추가할 수 있습니다.

<figure><img src="https://lh7-us.googleusercontent.com/YuQwy9dPgdF1KiEJg-70F-YWIMZPhLT0_5m2lEXBIJc_sI2R9UWTXanD_T6p2Q3behQVsLJ618hYRv827AGGmgVRi-RWNKUToIgQeW2T8Dc97WAiW7hMbTtDpnCFXs5nJDwtsmhQW2IaJKly3fhXN4Y" alt=""><figcaption></figcaption></figure>

1. ‘:’이 없으면 바로 주소를 검증합니다.&#x20;
2. ‘:’이 있으면 맨 우측 ‘:’을 기준으로 문자를 분할하여 첫 번째 문자열로 주소를 검증합니다.&#x20;
3. 실패했다면 받은 그대로의 문자열로(‘:’을 포함하는) 주소 존재 여부를 검증합니다.&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://codevasp.gitbook.io/code-api-docs-ko/api-reference/ivms101/verify-wallet.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
