Comment on page

Signing a transaction

Want to implement your own style, but with all the functionality Portal offers? Use these functions to implement your own custom web3 UI for your users.
This example shows how the Portal Provider interacts with the MPC wallet and the blockchain.
The params have a hardcoded address for the transaction of sending 1 wei from our MPC wallet. The Provider then receives a signed transaction from our mobile MPC library and submits that to chain using the configured RPC url.
Here is a quick example of how you can make requests using Portal's web3 provider:
Ensure you have set the gateway URL correctly with Infura or Alchemy when you initialize the portal class.
// Imports...
class MainActivity : AppCompatActivity() {
lateinit var portal: Portal
lateinit var sendButton: Button
override fun onCreate(savedInstanceState: Bundle?) {
sendButton = findViewById(
sendButton.setOnClickListener { sendOneWei() }
private fun sendOneWei() {
CoroutineScope(Dispatchers.IO).launch {
try {
// Create the transaction params.
val params = listOf(TransactionParams(
// Attempt to send the transaction.
val transactionHash = portal.provider.request(
// ✅ Transaction sent successfully!
} catch (err: Error) {
// ❌ Handle errors sending the transaction.
And now you are signing transactions with Portal! 🙌 🚀 Next, we'll explore how to simulate a transaction so that you can create smoother experiences for your users.