# Bar to Abar

Below you can see an example of how to perform `bar to abar` operation.

```typescript
// An instance of the Anonymous wallet, where `bar to abar` would be sent to
const myAnonWallet = {
  axfrPublicKey: "-Gdf_hulMdWPeC2dG3RG-Hjo8yLTdWnPfB5csEGkbmg=",
  axfrSecretKey:
    "z4atlAssg_PcVa05__EXB5VbT23JF4mSdAuCUa2-fQn4Z2P-G6UzNY94LbcbdEb4eOhbItPZac8AHlywQaRbaA==",
  decKey: "1Js-MFSVJipTNL-y09zkSBakd15WLK-SfAUTTfsUInE=",
  encKey: "bim4EWU_PnClrNiVpKen4DZ0v-RwsVLSUtZy7PXCOCc=",
};

const barToAbar = async () => {
  // First, we create an instance of a Findora Wallet using given password
  // and wallet private key. This object will be our "sender" wallet
  const password = "1234qwe!weUR^";
  const pkey = "YOUR_WALLET_PRIVATE_KEY";
  const walletInfo = await Keypair.restoreFromPrivateKey(pkey, password);

  // At the moment, triple masking only support sending one specific UTXO to the `bar to abar` operation.
  // In the future there would be added support of sending any amount
  // So, `sid` in the next line is the numeric number of the UTXO which would be sent to the operation
  const sid = 30;

  // Next is a key method, which returns 3 things:
  // - an instance of the transactionBuilder, which would be used to submit the generated tx to the network
  // - an object with the information about the unique hash (a commitment)
  // - an array of numbers representing the UTXO sids, which were used for the `bar to abar` operation
  const {
    transactionBuilder,
    barToAbarData,
    sids: usedSids,
  } = await TripleMasking.barToAbar(walletInfo, [sid], myAnonWallet.axfrPublicKey);

  // Then we retrieve transaction data (to be broadcasted)
  const submitData = transactionBuilder.transaction();

  // Finally, we submit the transaction to the network to finalize the `bar to abar` operation
  // and, as a result we receive a transaction hash
  const result = await Network.submitTransaction(submitData);
  const { response: resultHandle } = result;

  const { axfrPublicKey: formattedAxfrPublicKey } =
    barToAbarData.anonKeysFormatted;

  // The only way to get access to the funds from the `abar` is to ensure that commitment(s) is saved
  // after the operation is completed and transaction is broadcasted.
  // `givenCommitments` MUST be saved in order to get access to the funds later.
  const givenCommitments = barToAbarData.commitments;

  // Here we simply wait for 17s until next block is produced by the network
  await sleep(17000);
};
```


---

# 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.findora.org/key-concepts/triple-masking/bar-to-abar.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.
