# Making transactions

1. **Initiating Smart Contract**:

   ```javascript
   const apiKey = process.env.API_KEY;
   const chainEx = new ChainEx(apiKey);
   const smartAccount = await chainEx.initialize(provider, configParams); 
   const contractAddress = "<contract_address>";
   const abi = ERC721_ABI;
   const erc721Contract = new ethers.Contract(contractAddress, abi);
   ```

   Identify the address and ABI of your ERC-721 contract for SDK-enabled interactions.
2. **Constructing a Transaction**:

   ```javascript
   const transaction = {
       target: contractAddress,
       data: erc721Contract.interface.encodeFunctionData("safeMint", [param1, param2]) `
   };
   ```

   Create a transaction blueprint for invoking the `safeMint` function on your ERC-721 contract via ChainEx.
3. **Transaction Execution**:

   ```javascript
   const operationHash = await chainEx.executeTransaction(transaction);
   console.log("Operation Hash:", operationHash);
   ```

   Execute the transaction with ChainEx and receive the operation hash.


---

# 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://chainex.gitbook.io/whitepaper/sdk-integration-docs/making-transactions.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.
