> For the complete documentation index, see [llms.txt](https://docs-legacy.dfns.co/d/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-legacy.dfns.co/d/api-docs/keys/generate-signature/cardano.md).

# Cardano

Cardano supports the following signature `kinds`:

* `Transaction`, unsigned transaction.

## Transaction

Signs an unsigned transaction.

| Field            | Description                                          | Type - Optional |
| ---------------- | ---------------------------------------------------- | --------------- |
| `blockchainKind` | `Cardano`                                            | String          |
| `kind`           | `Transaction`                                        | String          |
| `transaction`    | The unsigned hex encoded transaction as shown below. | String          |

```json
{
  "kind": "Transaction",
  "transaction": "0x84a3008182582082544414292ededfa716ae42af007ecff823c58796cb9ba60330699fb4d55d7901018282581d60112f2721059581f2a8f9986638359b83c567a61d5486ed0e16c818621a000cf4ae82581d60112f2721059581f2a8f9986638359b83c567a61d5486ed0e16c818621b0000000253db20cd021a00028785a0f5f6"
}
```

### Typescript Example with MeshJS SDK <a href="#typescript-example" id="typescript-example"></a>

First install the MeshJS SDK. You can find the full documentation here: <https://docs.meshjs.dev/>

You also need a service that tracks the account's UTXO, for example Blockfrost. [The Dfns TypeScript SDK](https://github.com/dfns/dfns-sdk-ts) has an example demonstrating how to write a custom Blockfrost initiator plugin for MeshJS.

Here a code sample to generate a signature via [the Dfns TypeScript SDK](https://github.com/dfns/dfns-sdk-ts):

```typescript
import { BlockfrostProvider, Transaction } from '@meshsdk/core'

const walletId = 'wa-6lbfv-9esgj-xxxxxxxxxxxxxxxx'
const wallet = await dfnsClient.wallets.getWallet({ walletId })

const provider = new BlockfrostProvider(process.env.BLOCKFROST_PROJECT_ID!)
const initiator = new CustomInitiator(wallet.address, provider)

const transaction = await new Transaction({ initiator })
  .sendLovelace('addr_test1vq5eele9enryyqkg4wrjyp7x4gpshvkr6rylkwtyau56g3qgrcks9', '1000000')
  .build()

const res = await dfnsClient.wallets.generateSignature({
  walletId,
  body: {
    kind: 'Transaction',
    transaction: `0x${transaction}`,
  },
})
```

## CIP-8

Signs an arbitrary message using [CIP-8](https://cips.cardano.org/cip/CIP-0008). Note: signing address depends on the targeted blockchain. Therefore it's tied to a specific `network` rather than the blockchain kind.

| Field     | Description                      | Type - Optional |
| --------- | -------------------------------- | --------------- |
| `network` | A supported Cardano network.     | String          |
| `kind`    | `Cip8`                           | String          |
| `context` | `Signature1`                     | String          |
| `payload` | The generic message hex encoded. | String          |

```json
{
  "network": "Cardano",
  "kind": "Cip8",
  "context": "Signature1",
  "payload": "0x49206c6f76652044666e73"
}
```


---

# 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://docs-legacy.dfns.co/d/api-docs/keys/generate-signature/cardano.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.
