So far you have been able to create a Portal client and create their MPC wallets. Now, lets sign a transaction and send someone some MON tokens over Monad Testnet.

Steps

  1. In order to send your first transaction, you’ll first need to fund your wallet. You can get some test MON tokens by using the Client API Fund Wallet endpoint.
curl --request POST \
  --url https://api.portalhq.io/api/v3/clients/me/fund \
  --header 'Authorization: Bearer [clientApiKey|clientSessionToken]' \
  --header 'Content-Type: application/json' \
  --data '{
	"chainId": "eip155:10143",
	"token": "NATIVE",
	"amount": "0.01"
}'
  1. Next, we’ll need to format a transaction object.
Here is the example transaction:
const transaction = {
  "value": "0x01",
  "from": "YOUR_ETH_ADDRESS",
  "to": "RECIPIENT_ADDRESS",
  "data": ""
};
  1. Now that we some testnet ETH, let’s send a transaction! We will send our test funds to a Portal test wallet using a single API request to https://mpc-client.portalhq.io/v1/sign .
    1. You can learn more about Ethereum transactions here, but for this example you only need to know about a few fields:
      1. method: this defines which Ethereum RPC signer method we want to use.
      2. params : these are the parameters of your transaction.
        • value : this is the amount of MON measured in wei and hex encoded.
        • from: this is the address of the sender - your wallet in this case.
        • to: this is the address you’re sending to - our test wallet in this case.
        • data: this is used for interacting with smart contracts - we can ignore it.
In the example below we are using the eth_sendTransaction Ethereum RPC method to instruct the Portal API to both sign and submit a transaction to the blockchain.
curl -X POST 'https://mpc-client.portalhq.io/v1/sign' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <clientApiKey>' \
  -d '{
    "share": $share,
    "method": "eth_sendTransaction",
    "params": "{\"value\": \"0x01\",\"from\": \"YOUR_ETH_ADDRESS\",\"to\": \"RECIPIENT_ADDRESS\",\"data\": \"\"}",
    "rpcUrl": "YOUR_RPC_URL",
    "chainId": "eip155:10143"
  }'
If your wallet is not funded, you will receive a RPC error on this step.
Congrats! 🎉 You have successfully created a wallet and signed a transaction!