For the complete documentation index, see llms.txt. This page is also available as Markdown.

sign - XRPL

Example code for the sign JSON RPC method. Complete guide to using sign JSON-RPC in the GetBlock Web3 documentation.

This method takes a transaction in JSON format and a secret value, and returns a signed binary representation of the transaction. This method is admin-only on public servers.

Parameters

Parameter
Type
Required
Description

tx_json

object

Yes

Transaction to sign

secret

string

No

Account secret

seed

string

No

Account seed

seed_hex

string

No

Seed in hex

passphrase

string

No

Passphrase

key_type

string

No

Key algorithm

offline

boolean

No

Offline mode

build_path

boolean

No

Build payment paths

fee_mult_max

number

No

Fee multiplier

fee_div_max

number

No

Fee divisor

Request Example

curl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS_TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "sign",
    "params": [{
        "tx_json": {
            "TransactionType": "Payment",
            "Account": "rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH",
            "Destination": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
            "Amount": "1000000"
        },
        "secret": "s..."
    }],
    "id": "getblock.io"
}'
const axios = require('axios');

const url = 'https://shared.eu-central-1.getblock.io/<ACCESS_TOKEN>/';
const headers = {
    'Content-Type': 'application/json'
};

// Note: sign method typically not available on public RPCs
// Use local signing instead
const payload = {
    jsonrpc: '2.0',
    method: 'sign',
    params: [{
        tx_json: {
            TransactionType: 'Payment',
            Account: 'rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH',
            Destination: 'ra5nK24KXen9AHvsdFTKHSANinZseWnPcX',
            Amount: '1000000'
        },
        secret: 's...'
    }],
    id: 'getblock.io'
};

axios.post(url, payload, { headers })
    .then(response => console.log(response.data))
    .catch(error => console.error(error));

Response Example

Response Parameters

Field
Type
Description

tx_blob

string

Signed transaction hex

tx_json

object

Transaction JSON

hash

string

Transaction hash

Use Cases

  • Transaction signing (admin only)

  • Development environments

  • Private nodes

Last updated

Was this helpful?