sign - XRPL

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.

This method is not available on public RPC endpoints. Use local signing with xrpl.js or xrpl-py instead.

Parameters

ParameterTypeRequiredDescription
tx_jsonobjectYesTransaction to sign
secretstringNoAccount secret
seedstringNoAccount seed
seed_hexstringNoSeed in hex
passphrasestringNoPassphrase
key_typestringNoKey algorithm
offlinebooleanNoOffline mode
build_pathbooleanNoBuild payment paths
fee_mult_maxnumberNoFee multiplier
fee_div_maxnumberNoFee divisor

Request Example

bashcurl --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"
}'
javascriptconst 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));
pythonimport requests

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

# Note: sign method typically not available on public RPCs
payload = {
    "jsonrpc": "2.0",
    "method": "sign",
    "params": [{
        "tx_json": {
            "TransactionType": "Payment",
            "Account": "rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH",
            "Destination": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
            "Amount": "1000000"
        },
        "secret": "s..."
    }],
    "id": "getblock.io"
}

response = requests.post(url, headers=headers, json=payload)
print(response.json())
rustuse reqwest::Client;
use serde_json::json;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();
    
    let payload = json!({
        "jsonrpc": "2.0",
        "method": "sign",
        "params": [{
            "tx_json": {
                "TransactionType": "Payment",
                "Account": "rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH",
                "Destination": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
                "Amount": "1000000"
            },
            "secret": "s..."
        }],
        "id": "getblock.io"
    });

    let response = client
        .post("https://shared.eu-central-1.getblock.io/<ACCESS_TOKEN>/")
        .header("Content-Type", "application/json")
        .json(&payload)
        .send()
        .await?;

    let result: serde_json::Value = response.json().await?;
    println!("{:#?}", result);
    
    Ok(())
}

Response Example

json{
    "result": "null",
    "id": "getblock.io",
    "status_code": 405,
    "message": "Method not allowed"
}

Response Parameters

FieldTypeDescription
tx_blobstringSigned transaction hex
tx_jsonobjectTransaction JSON
hashstringTransaction hash

Use Cases

  • Transaction signing (admin only)
  • Development environments
  • Private nodes
javascriptconst xrpl = require('xrpl');

async function signAndSubmit() {
    const client = new xrpl.Client('wss://shared.eu-central-1.getblock.io/<ACCESS_TOKEN>');
    await client.connect();
    
    const wallet = xrpl.Wallet.fromSeed('s...');
    
    const payment = {
        TransactionType: 'Payment',
        Account: wallet.address,
        Destination: 'ra5nK24KXen9AHvsdFTKHSANinZseWnPcX',
        Amount: '1000000'
    };
    
    // Local signing
    const prepared = await client.autofill(payment);
    const signed = wallet.sign(prepared);
    
    console.log('Signed blob:', signed.tx_blob);
    
    // Submit
    const result = await client.submitAndWait(signed.tx_blob);
    console.log('Result:', result);
    
    await client.disconnect();
}

signAndSubmit();
pythonfrom xrpl.clients import JsonRpcClient
from xrpl.wallet import Wallet
from xrpl.models.transactions import Payment
from xrpl.transaction import sign, submit_and_wait

client = JsonRpcClient("https://shared.eu-central-1.getblock.io/<ACCESS_TOKEN>")
wallet = Wallet.from_seed("s...")

payment = Payment(
    account=wallet.address,
    destination="ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
    amount="1000000"
)

# Local signing
signed = sign(payment, wallet)
print("Signed:", signed)