# Kernel Account API

The Kernel Account API powers [Patch wallets](https://app.patchwallet.com) and controls the [EIP-4337 account abstraction](https://eips.ethereum.org/EIPS/eip-4337) smart contract wallets called, Kernel Accounts.

Kernel Accounts are a simple smart contract wallet with the same address on all EVM chains and connected to a user's email, social account, phone, or an app provider. The Kernel Account API can be used to submit a transaction or sign a message through a target wallet.

### Submit a Transaction

To send a transaction through a Kernel Account, see the Kernel Tx endpoint in Postman.

```javascript
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "Bearer {{access_token}}");

var raw = JSON.stringify({
  "userId": "test:elonmusk",
  "chain": "matic",
  "to": [
    "0x74427681c620DE258Aa53a382d6a4C865738A06C"
  ],
  "value": [
    "10000000000000"
  ],
  "data": [
    "0x"
  ],
  "delegatecall": 0, // Optional parameter. Set to 1 for a delegatecall().
  "auth": ""
});

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

fetch("https://paymagicapi.com/v1/kernel/tx", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

### Sign a Message

Sign any arbitrary message using an EIP-1271 signature from your Patch wallet. Commonly used to sign into an application, submit a trade, or list an NFT on a marketplace.&#x20;

```javascript
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://paymagicapi.com/v1/kernel/sign',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer {{access_token}}'
  },
  body: JSON.stringify({
    "userId": "test:elonmusk",
    "hash": "0xec3608877ecbf8084c29896b7eab2a368b2b3c8d003288584d145613dfa4706c"
  })

};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
```


---

# 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.patchwallet.com/api/kernel-account-api.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.
