Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

Latest commit

 

History

History
124 lines (97 loc) · 3.27 KB

api.md

File metadata and controls

124 lines (97 loc) · 3.27 KB

mph_connections

Audit hubs liquidity to determan if a transfer is likely to succeed.

Each entry is signed by the hub to prove it controls the keypair.

Optionally the entries can be limited to a set of provided clients and assets.

Arguments: {
    "handles": ["handle"],
    "assets": ["asset"]
}

Response: [{
    "asset": "asset",
    "handle": "handle",
    "client_url": "url" or null,
    "c2h_deposit_script": "hex",
    "h2c_deposit_script": "hex",
    "pubkey": "hub pubkey hex",
    "signature": "hub signature hex"
}]

mph_terms

Get current terms of the hub.

Arguments: {
    "assets": [asset]
}

Response: {
    "asset": {
        "setup_ttl": blocks,  # client deposit must be confirmed within
        "deposit_limit": satoshis,  # max server will invest in channel
        "deposit_ratio": float,  # deposit ratio compared to client
        "timeout_limit": blocks,  # max timeout server will set
        "sync_fee": satoshisa  # fee per sync
    }
}

mph_request

Exchange spend secrets and pubkeys for channel.

Channel culled if deposit not made fast enough.

Arguments: {
    "asset": asset,
    "pubkey": "hex",
    "signature": "hex",
    "spend_secret_hash": "hex"  # hub to client channel
    "url": "url" or None  # client is itself a payment hub
}

Response: {
    "handle": "hex",
    "spend_secret_hash": "hex",  # client to hub channel
    "pubkey": "hex",
    "signature": "hex",
    "channel_terms": {
        "setup_ttl": blocks,  # client deposit must be confirmed within
        "deposit_limit": satoshis,  # max server will invest in channel
        "deposit_ratio": float,  # deposit ratio compared to client
        "timeout_limit": blocks,  # max timeout server will set
        "sync_fee": satoshisa  # fee per sync
    }
}

mph_deposit

Exchange depsoit scripts. Hub waits with funding deposit until client deposit is confirmed.

Hub will fund deposit according to the deposit ratio given in the terms.

Channel culled if client deposit not made fast enough.

Arguments: {
    "handle": "hex",
    "pubkey": "hex",
    "signature": "hex",
    "deposit_script": "hex",  # client to hub
    "next_revoke_secret_hash": "hex"  # hub to client channel
}

Response: {
    "pubkey": "hex",
    "signature": "hex",
    "deposit_script": "hex",  # hub to client
    "next_revoke_secret_hash": "hex"  # client to hub channel
}

mph_sync

Arguments: {
    "handle": "hex",
    "pubkey": "hex",
    "signature": "hex",
    "sends": [{
        "payee_handle": "hex", 
        "amount": satoshis, 
        "token": "hex"
    }],
    "commit": {"rawtx": "hex", "script": "hex"},
    "revokes": ["secrets"],
    "next_revoke_secret_hash": "hex"  # hub to client channel
}

Response: {
    "pubkey": "hex",
    "signature": "hex",
    "receive": [{
        "payer_handle": "hex", 
        "amount": satoshis, 
        "token": "hex"
    }],
    "commit": {"rawtx": "hex", "script": "hex"},
    "revokes": ["hex"],
    "next_revoke_secret_hash": "hex"  # client to hub channel
}