> For the complete documentation index, see [llms.txt](https://docs.arcan.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.arcan.finance/examples/token.md).

# Confidential transfer

This example is a minimal ERC-7984 style token. It seals balances and transfers. It does not publish the amount.

```solidity
import { FHE, euint64, externalEuint64 } from "@arcan/solidity/lib/FHE.sol";
import { ArcanConfig } from "@arcan/solidity/config/ArcanConfig.sol";

contract ConfidentialToken is ArcanConfig {
    mapping(address => euint64) internal balances;

    function confidentialTransfer(
        address to,
        externalEuint64 encryptedAmount,
        bytes calldata inputProof
    ) external {
        euint64 amount = FHE.fromExternal(encryptedAmount, inputProof);
        euint64 senderNext = FHE.sub(balances[msg.sender], amount);
        euint64 recipientNext = FHE.add(balances[to], amount);

        ebool ok = FHE.le(amount, balances[msg.sender]);
        balances[msg.sender] = FHE.select(ok, senderNext, balances[msg.sender]);
        balances[to] = FHE.select(ok, recipientNext, balances[to]);

        FHE.allowThis(balances[msg.sender]);
        FHE.allowThis(balances[to]);
        FHE.allow(balances[msg.sender], msg.sender);
        FHE.allow(balances[to], to);
    }

    function confidentialBalanceOf(address account) external view returns (euint64) {
        return balances[account];
    }
}
```

`FHE.le` and `FHE.select` keep a failed transfer from moving value and from revealing why. The sender's balance and the amount stay ciphertext either way.

## App call

```ts
const input = arcan.createEncryptedInput(tokenAddress, signer.address);
input.add64(amount);
const { handles, inputProof } = await input.encrypt();
await token.confidentialTransfer(recipient, handles[0], inputProof);
```

The recipient decrypts with [user decrypt](/sdk/decrypt.md). Anyone else reading the chain sees the handle and, in a wallet, `****`.

More on the standard is in [Confidential token standard](/apps/token.md). The SDK walkthrough is [Transfer](/sdk/transfer.md).


---

# 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 following URL with the `ask` and `goal` query parameters:

```
GET https://docs.arcan.finance/examples/token.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `build a script that syncs our docs to a CMS` lets GitBook tailor the answer to that use case.

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.
