sign_for - XRPL

This method provides one signature for a multi-signed transaction. This method is admin-only on public servers.

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

Parameters

ParameterTypeRequiredDescription
accountstringYesAddress to sign for
tx_jsonobjectYesTransaction to sign
secretstringNoSigner's secret
seedstringNoSigner's seed
seed_hexstringNoSeed in hex
passphrasestringNoPassphrase
key_typestringNoKey algorithm

Request Example

curl

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_for",
    "params": [{
        "account": "rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH",
        "tx_json": {
            "TransactionType": "Payment",
            "Account": "rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH",
            "Destination": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
            "Amount": "1000000",
            "Fee": "30"
        },
        "secret": "s..."
    }],
    "id": "getblock.io"
}'

sign_for.js

javascriptconst axios = require('axios');

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

const payload = {
    jsonrpc: '2.0',
    method: 'sign_for',
    params: [{
        account: 'rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH',
        tx_json: {
            TransactionType: 'Payment',
            Account: 'rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH',
            Destination: 'ra5nK24KXen9AHvsdFTKHSANinZseWnPcX',
            Amount: '1000000',
            Fee: '30'
        },
        secret: 's...'
    }],
    id: 'getblock.io'
};

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

sign_for.py

pythonimport requests

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

payload = {
    "jsonrpc": "2.0",
    "method": "sign_for",
    "params": [{
        "account": "rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH",
        "tx_json": {
            "TransactionType": "Payment",
            "Account": "rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH",
            "Destination": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
            "Amount": "1000000",
            "Fee": "30"
        },
        "secret": "s..."
    }],
    "id": "getblock.io"
}

response = requests.post(url, headers=headers, json=payload)
print(response.json())

sign_for.rs

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_for",
        "params": [{
            "account": "rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH",
            "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": {
        "error": "notSupported",
        "error_code": 75,
        "error_message": "Signing is not supported by this server.",
        "request": {
            "account": "rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH",
            "command": "sign_for",
            "secret": "<masked>",
            "tx_json": {
                "Account": "rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH",
                "TransactionType": "Payment"
            }
        },
        "status": "error"
    }
}

Response Parameters

FieldTypeDescription
tx_blobstringTransaction with signature
tx_jsonobjectTransaction JSON

Use Cases

  • Multi-signature wallets
  • Shared custody
  • Organizational accounts

local_multisign_xrpl.js

javascriptconst xrpl = require('xrpl');

async function multiSign() {
    const wallet1 = xrpl.Wallet.fromSeed('s...');
    const wallet2 = xrpl.Wallet.fromSeed('s...');
    
    const tx = {
        TransactionType: 'Payment',
        Account: 'rMultiSigAccount...',
        Destination: 'ra5nK24KXen9AHvsdFTKHSANinZseWnPcX',
        Amount: '1000000',
        Fee: '30',
        Sequence: 1,
        SigningPubKey: ''
    };
    
    // Each signer signs
    const sig1 = xrpl.multisign(tx, wallet1);
    const sig2 = xrpl.multisign(tx, wallet2);
    
    // Combine signatures
    const combined = xrpl.combine([sig1, sig2]);
    console.log('Combined:', combined);
}

multiSign();

local_multisign_xrpl_py.py

pythonfrom xrpl.wallet import Wallet
from xrpl.transaction import multisign

wallet1 = Wallet.from_seed("s...")
wallet2 = Wallet.from_seed("s...")

# See xrpl-py documentation for full multi-sign workflow