> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mpcvault.com/llms.txt
> Use this file to discover all available pages before exploring further.

# EVM

> Transfer assets, call or deploy contracts, and sign messages on EVM networks with the MPCVault API.

## Networks

Use a [built-in EVM network](https://docs.mpcvault.com/api-reference/supported-networks#evm-chain-ids) or [add a custom network](#use-a-custom-evm-network). EVM wallets use `networkType: "NETWORK_TYPE_EVM"`.

## Signing request types

| Payload | Use |
| - | - |
| [`evmSendNative`](https://docs.mpcvault.com/api-reference/rest/create-signing-request) | Transfer the network's native coin. |
| [`evmSendErc20`](https://docs.mpcvault.com/api-reference/rest/create-signing-request) | Transfer ERC-20 tokens. |
| [`evmSendCustom`](https://docs.mpcvault.com/api-reference/rest/create-signing-request) | Call or deploy contracts, including approvals, swaps and NFT operations. |
| [`evmMessage`](https://docs.mpcvault.com/api-reference/rest/create-signing-request) | Sign EIP-191 personal messages or EIP-712 typed data. |

To sign transactions you build yourself or messages you format yourself, use [raw signing](https://docs.mpcvault.com/api-reference/overview.md#raw-signing).

## Wallet

[Create a wallet](https://docs.mpcvault.com/api-reference/rest/create-wallet.md) with `networkType: "NETWORK_TYPE_EVM"`. The same address works across EVM networks. Fund it on the selected network with its native coin for transaction fees and any assets being sent.

## Transfer assets

This example sends `1 USDC` on Ethereum Mainnet (`chainId: "1"`). Fund the wallet with at least `1 USDC` and enough ETH for transaction fees.

[CreateSigningRequest](https://docs.mpcvault.com/api-reference/rest/create-signing-request.md)

```bash theme={null}
curl -X POST https://api.mpcvault.com/v1/createSigningRequest \
  -H "Content-Type: application/json" \
  -H "x-mtoken: <API_TOKEN>" \
  -d '{
    "vaultUuid": "<VAULT_UUID>",
    "callbackClientSignerPublicKey": "<CLIENT_SIGNER_OPENSSH_PUBLIC_KEY>",
    "evmSendErc20": {
      "chainId": "1",
      "from": "<YOUR_EVM_ADDRESS>",
      "to": "<RECIPIENT_EVM_ADDRESS>",
      "tokenContractAddress": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
      "amount": "1000000"
    }
  }'
```

`amount: "1000000"` sends `1 USDC` (six decimals). The example uses [Circle's Ethereum Mainnet USDC contract](https://developers.circle.com/stablecoins/usdc-contract-addresses#mainnet). For another [built-in EVM network](#networks), use its chain ID, USDC contract and native fee coin.

### Send the native coin

To send `0.001 ETH` instead, replace `evmSendErc20` with this payload:

```json theme={null}
{
  "evmSendNative": {
    "chainId": "1",
    "from": "<YOUR_EVM_ADDRESS>",
    "to": "<RECIPIENT_EVM_ADDRESS>",
    "value": "1000000000000000"
  }
}
```

`value` is an integer string in wei. ETH covers both the transfer amount and its transaction fee.

## Call or deploy a contract

Use `evmSendCustom` for token approvals, swaps, NFT transfers, and other contract interactions. `input` carries the ABI-encoded calldata or deployment bytecode as **base64 bytes** in REST JSON.

**Call a contract**

```bash theme={null}
curl -X POST https://api.mpcvault.com/v1/createSigningRequest \
  -H "Content-Type: application/json" \
  -H "x-mtoken: <API_TOKEN>" \
  -d '{
    "vaultUuid": "<VAULT_UUID>",
    "callbackClientSignerPublicKey": "<CLIENT_SIGNER_OPENSSH_PUBLIC_KEY>",
    "evmSendCustom": {
      "chainId": "1",
      "from": "<YOUR_EVM_ADDRESS>",
      "to": "<CONTRACT_ADDRESS>",
      "value": "0",
      "input": "<BASE64_ABI_ENCODED_CALLDATA>"
    }
  }'
```

`value: "0"` calls the contract without sending ETH. To attach ETH, set its amount in wei.

**Deploy a contract**

```bash theme={null}
curl -X POST https://api.mpcvault.com/v1/createSigningRequest \
  -H "Content-Type: application/json" \
  -H "x-mtoken: <API_TOKEN>" \
  -d '{
    "vaultUuid": "<VAULT_UUID>",
    "callbackClientSignerPublicKey": "<CLIENT_SIGNER_OPENSSH_PUBLIC_KEY>",
    "evmSendCustom": {
      "chainId": "1",
      "from": "<YOUR_EVM_ADDRESS>",
      "to": "",
      "value": "0",
      "input": "<BASE64_DEPLOYMENT_BYTECODE>"
    }
  }'
```

An empty `to` creates a contract. `input` includes the compiled creation bytecode and ABI-encoded constructor arguments.

Convert hex calldata or deployment bytecode to base64, omitting its `0x` prefix:

```bash theme={null}
printf '%s' '<HEX_BYTES_WITHOUT_0x>' | xxd -r -p | openssl base64 -A
```

## Sign and track

[Sign the request](https://docs.mpcvault.com/api-reference/overview.md#sign-the-request). For [custom EVM networks](#broadcast-and-confirm), broadcast the returned signed transaction before querying its receipt.

The UUID identifies the signing request; the returned `txHash` identifies the EVM transaction. Query [`eth_getTransactionReceipt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_gettransactionreceipt) on the same network:

```bash theme={null}
curl -X POST '<EVM_RPC_URL>' \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "eth_getTransactionReceipt",
    "params": ["<TRANSACTION_HASH>"]
  }'
```

Use `txHash` as `<TRANSACTION_HASH>`. Receipt `result.status: "0x1"` indicates successful execution; `"0x0"` indicates failure. `result: null` means the provider has no receipt; poll with an interval and timeout. For the USDC example, also verify the USDC contract's `Transfer` event matches the sender, recipient and amount. Apply the selected network's confirmation policy before settlement.

After a timeout, [check the existing request](https://docs.mpcvault.com/api-reference/overview.md#track-the-result) and on-chain result before creating another request.

## Use a custom EVM network

[Add the network](https://docs.mpcvault.com/guides/24-how-to-use-custom-evm-networks/index.md#add-a-custom-network) in the vault's Dashboard settings, including its chain ID, RPC URL, and Legacy or EIP-1559 transaction type. Use that vault's EVM wallet and fund it on the custom network.

### Create and sign a transaction

For a custom network, supply the chain ID, gas settings, and nonce explicitly. Obtain the gas estimate and pending nonce from that network's RPC; API values below are decimal strings.

```bash theme={null}
curl -X POST https://api.mpcvault.com/v1/createSigningRequest \
  -H "Content-Type: application/json" \
  -H "x-mtoken: <API_TOKEN>" \
  -d '{
    "vaultUuid": "<VAULT_UUID>",
    "callbackClientSignerPublicKey": "<CLIENT_SIGNER_OPENSSH_PUBLIC_KEY>",
    "evmSendCustom": {
      "chainId": "<CUSTOM_CHAIN_ID>",
      "from": "<YOUR_EVM_ADDRESS>",
      "to": "<CONTRACT_ADDRESS>",
      "value": "0",
      "input": "<BASE64_ABI_ENCODED_CALLDATA>",
      "nonce": "<DECIMAL_NONCE>",
      "gasFee": {
        "maxFee": "<WEI_PER_GAS>",
        "gasLimit": "<GAS_LIMIT>"
      }
    }
  }'
```

`maxFee` is the gas price on Legacy networks and the fee cap on EIP-1559 networks. For EIP-1559, `gasFee.maxPriorityFee` sets the tip in wei per gas. `gasLimit` is in gas units. MPCVault transaction simulation and calldata decoding are unavailable for custom networks.

### Broadcast and confirm

[Sign the request](https://docs.mpcvault.com/api-reference/overview.md#sign-the-request) and save `signedTransaction` and `txHash`. **On custom EVM networks, your application broadcasts the transaction.** The returned `signedTransaction` is serialized transaction hex with a `0x` prefix; pass it directly to the network's RPC:

```bash theme={null}
curl -X POST '<CUSTOM_EVM_RPC_URL>' \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "eth_sendRawTransaction",
    "params": ["<SIGNED_TRANSACTION_HEX>"]
  }'
```

Use `txHash` with the [receipt query above](#confirm-a-transaction) on the custom network's RPC. Setting `broadcastTx` does not enable MPCVault broadcasting for custom networks.

### Sign messages on the custom network

Use either [message example](#sign-a-message) with the custom `chainId`. `vaultUuid` identifies the vault where that custom network was added. Message signing uses the same EIP-191 or EIP-712 format and returns the same signature fields. For EIP-712, set the typed-data domain's `chainId` to the custom network as well.

## Sign a message

Use `evmMessage` with `TYPE_PERSONAL_SIGN` for EIP-191 messages or `TYPE_SIGN_TYPED_DATA` for EIP-712 structured data. Both use base64-encoded `content` in REST JSON.

**Personal sign**

This signs the UTF-8 text `MPCVault integration example`. MPCVault applies the Ethereum signed-message prefix.

```bash theme={null}
curl -X POST https://api.mpcvault.com/v1/createSigningRequest \
  -H "Content-Type: application/json" \
  -H "x-mtoken: <API_TOKEN>" \
  -d '{
    "vaultUuid": "<VAULT_UUID>",
    "callbackClientSignerPublicKey": "<CLIENT_SIGNER_OPENSSH_PUBLIC_KEY>",
    "evmMessage": {
      "chainId": "1",
      "from": "<YOUR_EVM_ADDRESS>",
      "type": "TYPE_PERSONAL_SIGN",
      "content": "TVBDVmF1bHQgaW50ZWdyYXRpb24gZXhhbXBsZQ=="
    }
  }'
```

**Typed data (EIP-712)**

Save this example as `typed-data.json`:

```json theme={null}
{
  "types": {
    "EIP712Domain": [
      { "name": "name", "type": "string" },
      { "name": "version", "type": "string" },
      { "name": "chainId", "type": "uint256" }
    ],
    "IntegrationMessage": [
      { "name": "purpose", "type": "string" }
    ]
  },
  "primaryType": "IntegrationMessage",
  "domain": {
    "name": "MPCVault Integration Example",
    "version": "1",
    "chainId": 1
  },
  "message": {
    "purpose": "MPCVault integration example"
  }
}
```

Encode the entire JSON file, then use the output as `content`:

```bash theme={null}
openssl base64 -A -in typed-data.json
```

```bash theme={null}
curl -X POST https://api.mpcvault.com/v1/createSigningRequest \
  -H "Content-Type: application/json" \
  -H "x-mtoken: <API_TOKEN>" \
  -d '{
    "vaultUuid": "<VAULT_UUID>",
    "callbackClientSignerPublicKey": "<CLIENT_SIGNER_OPENSSH_PUBLIC_KEY>",
    "evmMessage": {
      "chainId": "1",
      "from": "<YOUR_EVM_ADDRESS>",
      "type": "TYPE_SIGN_TYPED_DATA",
      "content": "<BASE64_TYPED_DATA_JSON>"
    }
  }'
```

[Sign the message request](https://docs.mpcvault.com/api-reference/overview.md#sign-the-request) using `signingRequest.uuid`, then read the shared [signature format](https://docs.mpcvault.com/api-reference/overview.md#signature-format). For `evmMessage`, the API client signer returns `V: "0"` or `"1"`; App signing returns `"27"` or `"28"`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.