# Create Wallet

This creates a wallet using this method.

## API Specification

## Create Wallet

<mark style="color:green;">`POST`</mark> `http://localhost:8889/wallet/createWallet`



Creates a new wallet under the given instance.&#x20;

#### Request Body

| Name                                        | Type   | Description                |
| ------------------------------------------- | ------ | -------------------------- |
| name<mark style="color:red;">\*</mark>      | String | Name of the wallet         |
| algorithm<mark style="color:red;">\*</mark> | String | Algorithm Name to be used  |

{% tabs %}
{% tab title="200: OK SUCCESS" %}
```javascript
{
  "Status": "SUCCESS",
  "Message": "wallet created successfully",
  "Data": {
    "WalletId": "20775f3e-8be1-4e4c-8c80-xxxxxxxxxxx",
    "Address": "0x688c17c7FF9Def682b04699C31Dxxxxxxxxxxxxx"
  }
}
```
{% endtab %}

{% tab title="417: Expectation Failed similar wallet name exist" %}
```javascript
{
    "Status": "FAILURE",
    "Message": "key exist with specified name",
    "Data": null
}
```
{% endtab %}
{% endtabs %}

#### Request Body

| Name                                        | Type   | Description  |
| ------------------------------------------- | ------ | ------------ |
| name<mark style="color:red;">\*</mark>      | String | VW89xy17qNjQ |
| algorithm<mark style="color:red;">\*</mark> | String | G1aoelP8VxPG |

Take a look at how you might call this method using our official libraries, or via `curl`:

{% tabs %}
{% tab title="curl" %}
```bash
curl -X POST http://localhost:8889/wallet/createWallet \
-H "Content-Type: application/json" \
-d '{
    "name": "wallet2",
    "algorithm": "secp256k1"
}'
```
{% endtab %}

{% tab title="Node.js (Fetch)" %}
```javascript
var axios = require('axios');
var data = JSON.stringify({
  "name": "sep",
  "algorithm": "secp256k1"
});

var config = {
  method: 'post',
  url: 'http://localhost:8889/wallet/createWallet',
  headers: { 
    'Content-Type': 'application/json'
  },
  data : data
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});

```
{% endtab %}

{% tab title="Python " %}
```python
import requests
import json

url = "http://localhost:8889/wallet/createWallet"

payload = json.dumps({
  "name": "sep",
  "algorithm": "secp256k1"
})
headers = {
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

```
{% endtab %}

{% tab title="Golang" %}
```go
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "http://localhost:8889/wallet/createWallet"
  method := "POST"

  payload := strings.NewReader(`{
    "name": "sep",
    "algorithm": "secp256k1"
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
```
{% endtab %}
{% endtabs %}

