# Create/Restore Wallet

:warning:The wallet create/restore method must be preceded by the previous initialization.

## Create Wallet

### Creating Wallet

If you don't have a wallet, you can create a new one with the parameters 'wallet name' and 'wallet password'

{% hint style="info" %}

* Wallet password can only be a "6-digit string of integers".
* A user can only create one wallet.
  {% endhint %}

```swift
let walletId: Int = try await fncyWallet.makeWallet(
walletNm: "wallet name", 
pinNumber : "wallet password" // A 6-digit string of integers
)
```

## Setting Wallet Restore Questions/Answers

If a user loses the password to the wallet, the assets in that wallet are lost forever.

However, if a user has registered a **wallet restore question/answer**, users can recover their wallet using that answer as a **recovery key.**

### Requesting List of Wallet Restore Questions

The recovery key for restoring your wallet is a pair of selected questions and answers.

First, select a restore question by requesting for a list of questions to choose from.

```swift
let array: [FncyQuestion] = try await fncyWallet.getQuestionList(
pageNo: 1,
pageSize: 20
)
```

#### See Also&#x20;

[getQuestionList](https://docs.fncy.world/fncy-2.0.2-eng/for-developers/wallet/sdk/methods#func-getquesetionlist)

[FncyQuestion](https://docs.fncy.world/fncy-2.0.2-eng/for-developers/wallet/sdk/domain#fncyquestion)

### Registering Wallet Restore Questions/Answers

You can register a wallet **restore question/answer** using the **number of the question (questionSeq)**, the c**ontent of the answer**, and the **wallet's password.**

```swift
let isSuccess: Bool = try await fncyWallet.postRegisterRestorationKey(
wid: wid, //If makeWallet() succeeds, wid is returned in the result.
questionSeq: questionSeq, //user-selected seq from the list of questions returned by getQuesetionList()
answer = "Backup Question's Answers",
pinNumber: "Wallet Password"
)
```

#### See Also&#x20;

[postRegisterRestorationKey](https://docs.fncy.world/fncy-2.0.2-eng/for-developers/wallet/sdk/methods#func-postregisterrestorationkey)

[FncyQuestion](https://docs.fncy.world/fncy-2.0.2-eng/for-developers/wallet/sdk/domain#fncyquestion)

## Restoring Wallet

If a user forgets their wallet password, they can change their wallet password and recover their wallet if they have a registered **wallet recovery question/answer pair.**

### Calling User's Registered Questions

If you have a registered **wallet restore question/answer** **pair**, you can request a registered wallet restore questions.

```swift
let result: FncyQuestion = try await fncyWallet.getResetQuestion()
```

#### See Also

[getResetQuestion](https://docs.fncy.world/fncy-2.0.2-eng/for-developers/wallet/sdk/methods#func-getresetquestion)

[FncyQuestion](https://docs.fncy.world/fncy-2.0.2-eng/for-developers/wallet/sdk/domain#fncyquestion)

### Entering Question's Answers and New Password

You can change the wallet password and recover the wallet by using the restore **wallet answer** and the **new wallet password.**

```swift
let isSuccess: Bool = try await fncyWallet.postResetQuestion(
answer: "Backup Question's Answers",
newPinNumber: "New Wallet Password"
)
```

#### See Also

[postResetQuestion](https://docs.fncy.world/fncy-2.0.2-eng/for-developers/wallet/sdk/methods#func-postresetquestion)&#x20;

## Change Wallet Password

You can change your wallet password using the current wallet password and the new wallet password.

### Changing Wallet Password&#x20;

```swift
let isSuccess: Bool = try await fncyWallet.resetWalletPin(
oldPinNumber: "Current Wallet Password", 
newPinNumber: "New Wallet Password"
)
```

#### See Also

[resetWalletPin](https://docs.fncy.world/fncy-2.0.2-eng/for-developers/wallet/sdk/methods#func-resetwalletpin)
