# Set Proxy Account via XCM
## Step 1: Encode the call
Get the encoded call via polkadot.js apps:
```rust
const ALICE = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
const addProxy = api.tx.proxy.addProxy(ALICE, "Any", 0);
const asDerivative = api.tx.utility.asDerivative(0, addProxy);
console.log("As derivative: ", asDerivative.toHex());
```
Note to replace account id `ALICE` and proxy type `Any`. And double check the first param of `asDerivative` (the derive index).
This will result a hex of the encoded call, something like:
```rust
0xb0045a0100005b01d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d0000000000
```
Remember to remove the leading module and call id, `b004` in this case, and use the rest:
```rust
0x5a0100005b01d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d0000000000
```
## Step 2: Make sure the proxied account exist
For homa-lite, the proxied account is derived from Karura sovereign account. Transfer some fund to it to make it alive.
## Step 3: Send the XCM message
Use `ormlXcm.sendAsSovereign` as follows. Structure of this message:
```rust
WithdrawAsset {
..,
effects: vec![
// buy execution fee
BuyExecution {
..,
xcm: vec![Xcm::Transact { .. }]
},
// refund fees
DepositAsset { .. }
]
}
```
- The withdraw `amount` amount is to pay execution fees.
- `debt` field in `BuyExecution` is the weight for `Xcm::Transact`. In rococo, it's `296,569,000` for adding a proxy via derived account.
- `network` in `DepositAsset` might need to change, depending on which relay chain the message will be sent to.

