Sign Transaction API

Introduction

The signTransaction method allows securely signing an Ethereum transaction within an authenticated session.

To sign a message a user / an account would need to have to have been register and authenticated by going through Register using API flow.

Once you have registered the user, you can choose one of the below 2 flows

Session-Based Authentication

Request Spec

Follow the Authenticating with API flow to obtain the session and then do the following HTTP request

Headers:

  • X-Encrypted-Session: Session information for maintaining state or continuity.

  • X-Encrypted-Key: Encrypted key for secure processing of the request.

  • X-Encrypted-User: User details encrypted using encryption key

Parameters:

  • params: The transaction parameters as a TypedTransaction object.

    • from - The sender address

    • nonce - The transaction nonce

    • maxPriorityFeePerGas - Max tip paid to miner

    • maxFeePerGas - Max total fee willing to pay

    • to - Recipient address

    • gas - Gas limit

    • value - Amount of ETH to send

    • chainId - Network ID

    • type - EIP-2718 transaction type

Returns:

An RLP encoded transaction signature that can be executed as a raw transaction

Request Example

POST / HTTP/1.1
Host: tiramisu.0xpass.io
Content-Type: application/json
X-Encrypted-Session: eJjdnfdknf...
X-Encrypted-Key: jp6t2GVOvzltN+4VGc21ZKPIbLjEvitE34cFYDvVNrcmF2ukcKMTO8R/F0wbonGZM0NZBg2X94FvirH6Hi2U1zFlXN5srkOdvQL3lVNZ86gbfEtJFPOEAeZkxtTOKOsH4ZXPtUbFOjT2Niblo8njOKibOoAMRKIhtsNTTvRXjHRxnNqVs3QcSe7XbO1DbH/pdRgq+YZN13znlSRsupu4G/h/KBEZr98wXFo8PeDV9F8ZV56F90GqQ3wKzFUBwC9rJihGz0omH+eJA0jB/K7BYt30fhWDnqaLNP2eb1mbIjBCmv6sXqu2jtghr3ejl0YwjP9lCO+aVD7bophfb/IyKg==
X-Encrypted-User: JZVjZw33OGoQDEMcbOdckx4TzspQEKP5j+iAGqf6b6gPleziY/Noyd4uW6KMSujq0HKP2Rb69p9Wi8ic5O8LZl9oTmmWk4op0CUKejqcV5DsNDp83PYzUg==
{
    "jsonrpc": "2.0",
    "method": "eth_signTransaction",
    "params": [
        {
            "from": "0x764904Df4B0e3eBabBEE902e356D9cA701e1fC70",
            "nonce": "0",
            "maxPriorityFeePerGas": "0x9184E72A", 
            "maxFeePerGas": "0x9184E72A",
            "to": "0xb89FF4E9AD6B33F69153fa710F9849f51712eEc4",
            "gas": "0x7530", 
            "value": "0x2386F26FC10000", 
            "chainId": "0x13881",
            "type": "0x02"
        }
    ],
    "id": 1
}

Response Example

{
    "jsonrpc": "2.0",
    "result": "0x02f8748301388180849184e72a849184e72a82753094b89ff4e9ad6b33f69153fa710f9849f51712eec4872386f26fc1000080c080a0997d192e9037357eb47ce92f62bc3eb40946952322588527cb2a8bcfee364ee2a038ca2627eb05d833fa0dd7b96ba2a3bdf09907ad95c1a7f2fc3e5d4af7779582",
    "id": "1"
}

Direct Passkey Authentication

Request Spec

In order to use this approach, you must sign your User Input json using Passkey to obtain a signature.

Headers

  • X-Encrypted-Key: Encrypted key for secure processing of the request.

  • X-Encrypted-Webauthn-Signature: Webauthn signature encrypted using encryption key

  • X-Encrypted-User: User details encrypted using encryption key

Parameters:

  • params: The transaction parameters as a TypedTransaction object.

    • from - The sender address

    • nonce - The transaction nonce

    • maxPriorityFeePerGas - Max tip paid to miner

    • maxFeePerGas - Max total fee willing to pay

    • to - Recipient address

    • gas - Gas limit

    • value - Amount of ETH to send

    • chainId - Network ID

    • type - EIP-2718 transaction type

Returns:

An RLP encoded transaction signature that can be executed as a raw transaction

Request Example

POST / HTTP/1.1
Host: tiramisu.0xpass.io
Content-Type: application/json
X-Encrypted-Webauthn-Signature: eJjdnfdknf...
X-Encrypted-Key: jp6t2GVOvzltN+4VGc21ZKPIbLjEvitE34cFYDvVNrcmF2ukcKMTO8R/F0wbonGZM0NZBg2X94FvirH6Hi2U1zFlXN5srkOdvQL3lVNZ86gbfEtJFPOEAeZkxtTOKOsH4ZXPtUbFOjT2Niblo8njOKibOoAMRKIhtsNTTvRXjHRxnNqVs3QcSe7XbO1DbH/pdRgq+YZN13znlSRsupu4G/h/KBEZr98wXFo8PeDV9F8ZV56F90GqQ3wKzFUBwC9rJihGz0omH+eJA0jB/K7BYt30fhWDnqaLNP2eb1mbIjBCmv6sXqu2jtghr3ejl0YwjP9lCO+aVD7bophfb/IyKg==
X-Encrypted-User: JZVjZw33OGoQDEMcbOdckx4TzspQEKP5j+iAGqf6b6gPleziY/Noyd4uW6KMSujq0HKP2Rb69p9Wi8ic5O8LZl9oTmmWk4op0CUKejqcV5DsNDp83PYzUg==
{
    "jsonrpc": "2.0",
    "method": "eth_signTransaction",
    "params": [
        {
            "from": "0x764904Df4B0e3eBabBEE902e356D9cA701e1fC70",
            "nonce": "0",
            "maxPriorityFeePerGas": "0x9184E72A", 
            "maxFeePerGas": "0x9184E72A",
            "to": "0xb89FF4E9AD6B33F69153fa710F9849f51712eEc4",
            "gas": "0x7530", 
            "value": "0x2386F26FC10000", 
            "chainId": "0x13881",
            "type": "0x02"
        }
    ],
    "id": 1
}

Response Example

{
    "jsonrpc": "2.0",
    "result": "0x02f8748301388180849184e72a849184e72a82753094b89ff4e9ad6b33f69153fa710f9849f51712eec4872386f26fc1000080c080a0997d192e9037357eb47ce92f62bc3eb40946952322588527cb2a8bcfee364ee2a038ca2627eb05d833fa0dd7b96ba2a3bdf09907ad95c1a7f2fc3e5d4af7779582",
    "id": "1"
}

Last updated