# Deploy Contract

The "Deploy Contract" feature in the KrypC wallet-dev Service API enables users to seamlessly deploy smart contracts on the blockchain, facilitating the creation and execution of decentralised applications.

This Deploys contract using this method.&#x20;

## API Specification

## Deploy Contract

<mark style="color:green;">`POST`</mark> `https://api.krypcore.com/api/v0/devWallet/deployContract`

To deploy Contract API under the given instance.&#x20;

#### Headers

| Name                                            | Type   | Description            |
| ----------------------------------------------- | ------ | ---------------------- |
| DappId<mark style="color:red;">\*</mark>        | String | DappId                 |
| Authorization<mark style="color:red;">\*</mark> | String | User Auth key obtained |
| ChainId                                         | String | ChainId                |
| SubscriptionId                                  | String | SubscriptionId         |

#### Request Body

| Name                                         | Type   | Description |
| -------------------------------------------- | ------ | ----------- |
| service<mark style="color:red;">\*</mark>    | String | service     |
| privateKey<mark style="color:red;">\*</mark> | String | private key |
| byteCode<mark style="color:red;">\*</mark>   | String | bytecode    |
| abi<mark style="color:red;">\*</mark>        | String | abi         |
| params<mark style="color:red;">\*</mark>     | String | params      |
| chainId<mark style="color:red;">\*</mark>    | String | chainId     |

{% tabs %}
{% tab title="200: OK SUCCESS" %}

```javascript

{
    "Data": {
        "contractAddress": "0xAa79a01409D842aD3F6ec0xxxxxxxxxxxxxxx",
        "txHash": "0x1cd443b4573eddcd5e518d1ab31916xxxxxxxxxxxxxxxxxxxxx"
    },
    "Message": "Signed and executed txn successfully",
    "Status": "SUCCESS"
}

```

{% endtab %}

{% tab title="401: Unauthorized Failure in authentication" %}

```
{
    "message": "Invalid API key in request"
}
```

{% endtab %}

{% tab title="500: Internal Server Error Key values are not given" %}

```json
{
    "message": "Internal Server Error"
}
```

{% endtab %}
{% endtabs %}

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

Here, "abi" will be in json format which we need to convert to base64.

{% tabs %}
{% tab title="curl" %}

```bash

curl --location 'https://api.krypcore.com/api/v0/devWallet/deployContract' \
--header 'DappId: **********' \
--header 'Authorization: **********' \
--header 'SubscriptionId: ********' \
--header 'ChainId: ********' \
--header 'Content-Type: application/json' \
--data '{
    "service": "easy-nft",
    "privateKey": "**********",
    "byteCode":" ",
    "abi":" ",
    "params":[],
    "chainId":80001
}'
```

{% endtab %}

{% tab title="Node.js (Axios)" %}

```javascript

var myHeaders = new Headers();
myHeaders.append("DappId", "**********");
myHeaders.append("Authorization", "**********");
myHeaders.append("SubscriptionId", "********");
myHeaders.append("ChainId", "********");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "service": "easy-nft",
  "privateKey": "**********",
  "byteCode": " ",
  "abi": " ",
  "params": [],
  "chainId": 80001
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://api.krypcore.com/api/v0/devWallet/deployContract", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

{% endtab %}

{% tab title="Python " %}

```python

import requests
import json

url = "https://api.krypcore.com/api/v0/devWallet/deployContract"

payload = json.dumps({
  "service": "easy-nft",
  "privateKey": "**********",
  "byteCode": " ",
  "abi": " ",
  "params": [],
  "chainId": 80001
})
headers = {
  'DappId': '**********',
  'Authorization': '**********',
  'SubscriptionId': '********',
  'ChainId': '********',
  '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 := "https://api.krypcore.com/api/v0/devWallet/deployContract"
  method := "POST"

  payload := strings.NewReader(`{
    "service": "easy-nft",
    "privateKey": "**********",
    "byteCode":" ",
    "abi":" ",
    "params":[],
    "chainId":80001
}`)

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

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("DappId", "**********")
  req.Header.Add("Authorization", "**********")
  req.Header.Add("SubscriptionId", "********")
  req.Header.Add("ChainId", "********")
  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 %}


---

# 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://docs.krypcore.com/dev-docs/api-reference/core-service-apis/wallet-manager/developer-wallet/deploy-contract.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.
