Sign Ethereum transactions
So far you have been able to create a Portal client and create their MPC wallets. Now, lets sign a transaction and send someone 1 gwei of ETH (the smallest denomination of ETH) over the Sepolia testnet.
Steps
In order to send your first transaction, you’ll first need to fund your wallet. Head over to Alchemy’s Sepolia faucet to claim some Sepolia ETH.
Next, we’ll need to format a transaction object.
Here is the example transaction:
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
.You can learn more about Ethereum transactions here, but for this example you only need to know about a few fields:
method
: this defines which Ethereum RPC signer method we want to use.params
: these are the parameters of your transaction.value
: this is the amount of ETH 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.
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!
Last updated