> For the complete documentation index, see [llms.txt](https://developers.aixchain.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.aixchain.com/http-api/api-list/smart-contracts/deploycontract.md).

# DeployContract

Deploys a contract. Returns TransactionExtention, which contains an unsigned transaction.

**BODY PARAMS**\
`{`&#x20;

**`abi`**` ``string`

**`bytecode`**` ``string`

**`function_selector`**` ``string`

**`parameter`**` ``string`

**`fee_limit`**` ``int32`

**`origin_energy_limit`**` ``int32`

**`owner_address`**` ``string`

**`name`**` ``string`

**`call_value`**` ``int32`

**`consume_user_resource_percent`**` ``int32`

**`permission_id`**` ``int32 (Optional)`

**`visible`**` ``boolean (Optional)`

`}`&#x20;

**Note:**  &#x20;

* **abi** : Smart Contract's Application Binary Interface
* **bytecode:** The compiled contract's identifier, used to interact with the Virtual Machine.
* **fee\_limit** is maximum TRX consumption, measured in Aiix (1 TRX = 1,000 Aiix).
* **parameter** encoding needs to be in accordance with the ABI rules, the rules are more complicated, users can use the ethers library to encode,For details, please refer to the document-Guide-Smart Contract-Best Practice-Parameter Encoding and Decoding.
* **origin\_energy\_limit** : The max energy which will be consumed by the owner in the process of execution or creation of the contract, is an integer which should be greater than 0.
* **owner address** that triggers the contract, converted to a hex string
* **name** is contract name
* **call\_value** is amount of TRX transferred with this transaction, measured in Aiix (1 TRX = 1,000 Aiix).
* **consume\_user\_resource\_percent :** The same as User Pay Ratio. The percentage of resources specified for users who use this contract. This field accepts integers between \[0, 100]. If it is 0, it means the user does not consume resources until the developer resources are exhausted. However, it is strongly recommended to set the value between 1 and 99 (inclusive). This is prevent the contract developer from potential malicious infinite loop time out attacks.
* **permission\_id,** whether the address is in base58 format.
* **visible:** whether the address is in base58check format.

**Example:**

curl --request POST\
\--url <http://172.104.51.182:16667/wallet/deploycontract>\
\--header 'Accept: application/json'\
\--header 'Content-Type: application/json'\
\--data ' { "abi": "\[{"constant":false,"inputs":\[{"name":"key","type":"uint256"},{"name":"value","type":"uint256"}],"name":"set","outputs":\[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":\[{"name":"key","type":"uint256"}],"name":"get","outputs":\[{"name":"value","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}]", "bytecode": "608060405234801561001057600080fd5b5060de8061001f6000396000f30060806040526004361060485763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631ab06ee58114604d5780639507d39a146067575b600080fd5b348015605857600080fd5b506065600435602435608e565b005b348015607257600080fd5b50607c60043560a0565b60408051918252519081900360200190f35b60009182526020829052604090912055565b600090815260208190526040902054905600a165627a7a72305820fdfe832221d60dd582b4526afa20518b98c2e1cb0054653053a844cf265b25040029", "owner\_address": "AFzFXoQCgUeoApjejKM9B46NgFGHXvUyKz", "name": "delpoyContracthungtest", "origin\_energy\_limit":1000000000, "consume\_user\_resource\_percent": 10, "visible":true }

**Input:**&#x20;

`{`

&#x20;`"abi": "[{"constant":false,"inputs":[{"name":"key","type":"uint256"},{"name":"value","type":"uint256"}],"name":"set","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"key","type":"uint256"}],"name":"get","outputs":[{"name":"value","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}]", "bytecode": "608060405234801561001057600080fd5b5060de8061001f6000396000f30060806040526004361060485763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631ab06ee58114604d5780639507d39a146067575b600080fd5b348015605857600080fd5b506065600435602435608e565b005b348015607257600080fd5b50607c60043560a0565b60408051918252519081900360200190f35b60009182526020829052604090912055565b600090815260208190526040902054905600a165627a7a72305820fdfe832221d60dd582b4526afa20518b98c2e1cb0054653053a844cf265b25040029", "owner_address": "AFzFXoQCgUeoApjejKM9B46NgFGHXvUyKz", "name": "delpoyContracthungtest", "origin_energy_limit":1000000000, "consume_user_resource_percent": 10, "visible":true`&#x20;

`}`

**Response:**&#x20;

`{`&#x20;

`"visible": true, "txID": "6fe61a44390f1c3157aea50b99b9281fcf74469a36d95e66cd513388546a85fe", "contract_address": "411e1980e0a7acd3af82c24e6962bed85116d727c5", "raw_data": { "contract": [ { "parameter": { "value": { "owner_address": "AFzFXoQCgUeoApjejKM9B46NgFGHXvUyKz", "new_contract": { "bytecode": "608060405234801561001057600080fd5b5060de8061001f6000396000f30060806040526004361060485763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631ab06ee58114604d5780639507d39a146067575b600080fd5b348015605857600080fd5b506065600435602435608e565b005b348015607257600080fd5b50607c60043560a0565b60408051918252519081900360200190f35b60009182526020829052604090912055565b600090815260208190526040902054905600a165627a7a72305820fdfe832221d60dd582b4526afa20518b98c2e1cb0054653053a844cf265b25040029", "consume_user_resource_percent": 10, "name": "delpoyContracthungtest", "origin_address": "AFzFXoQCgUeoApjejKM9B46NgFGHXvUyKz", "abi": { "entrys": [ { "inputs": [ { "name": "key", "type": "uint256" }, { "name": "value", "type": "uint256" } ], "name": "set", "stateMutability": "Nonpayable", "type": "Function" }, { "outputs": [ { "name": "value", "type": "uint256" } ], "constant": true, "inputs": [ { "name": "key", "type": "uint256" } ], "name": "get", "stateMutability": "View", "type": "Function" } ] }, "origin_energy_limit": 1000000000 } }, "type_url": "type.googleapis.com/protocol.CreateSmartContract" }, "type": "CreateSmartContract" } ], "ref_block_bytes": "774b", "ref_block_hash": "267e9e3b5f5f2ed3", "expiration": 1639986108000, "timestamp": 1639986048426 }, "raw_data_hex": "0a02774b2208267e9e3b5f5f2ed340e0aca8b6dd2f5ae903081e12e4030a30747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e437265617465536d617274436f6e747261637412af030a15414203485a535a4072c9fbfaaddfe2a010ad0bcdb01295030a15414203485a535a4072c9fbfaaddfe2a010ad0bcdb01a5c0a2b1a03736574220e12036b65791a0775696e743235362210120576616c75651a0775696e74323536300240030a2d10011a03676574220e12036b65791a0775696e743235362a10120576616c75651a0775696e743235363002400222fd01608060405234801561001057600080fd5b5060de8061001f6000396000f30060806040526004361060485763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631ab06ee58114604d5780639507d39a146067575b600080fd5b348015605857600080fd5b506065600435602435608e565b005b348015607257600080fd5b50607c60043560a0565b60408051918252519081900360200190f35b60009182526020829052604090912055565b600090815260208190526040902054905600a165627a7a72305820fdfe832221d60dd582b4526afa20518b98c2e1cb0054653053a844cf265b25040029300a3a1664656c706f79436f6e747261637468756e6774657374408094ebdc0370aadba4b6dd2f"`&#x20;

`}`

\==> Continue you call **gettransactionsign** API then call **broadcasttransaction** API

We will the final result: The transaction created success on AIXChain network.

`{`&#x20;

`"result": true, "txid": "6fe61a44390f1c3157aea50b99b9281fcf74469a36d95e66cd513388546a85fe"`

&#x20;`}`

&#x20;&#x20;


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://developers.aixchain.com/http-api/api-list/smart-contracts/deploycontract.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
