private/send_block_proposal
Posts the caller’s signed maker side of a block trade as a block proposal, for a taker to accept with private/accept_block_proposal. The side is signed as the maker side of private/execute_block_trade. The exchange keeps the signature, and no other user can see it. With recipient_wallet, only that wallet can see and accept the proposal. With listed true, the proposal is on the public list that public/get_block_proposals returns, and anyone can accept it. With neither, anyone who has the proposal_id can read and accept the proposal, so share the id only with the intended counterparty. A listed proposal cannot have a recipient_wallet. The proposal can be accepted while the signed side can execute: until 60 seconds before its signature_expiry_sec, or 59 minutes after its nonce time, whichever is first. The response gives that time as expires_at_sec. So the signed signature_expiry_sec sets how long the proposal stays open. A proposal must stay open for at least 60 seconds, or the call fails with invalid_params (-32602). The side must pass the checks that private/verify_block_trade makes for a maker side, except that its nonce time can be up to 59 minutes old. Its total cost must be inside the currency’s RFQ price band. A proposal trades with no broker fee. A wallet can have a limited number of open proposals. Returns the proposal with its proposal_id. Its maker and its recipient also receive it on the .block_proposals channel. Fails with block_trade_outside_price_band (11123) if the total cost is outside the band, with block_trades_not_available_for_currency (11124) if the currency has no band, with insufficient_funds (11000) if the side does not have enough margin, with block_trade_same_owner (11115) if recipient_wallet is the caller’s wallet, with non_unique_nonce (11017) if an open proposal already uses the nonce, and with rate_limit_exceeded (-32000) if the wallet has too many open proposals. Requires the block_trade off-chain scope. A session key that signs the side needs block_trade and an RFQ trade scope for every instrument in the legs.
curl --request POST \
--url https://api.derive.xyz/v3/private/send_block_proposal \
--header 'Content-Type: application/json' \
--header 'X-DeriveSignature: <api-key>' \
--header 'X-DeriveTimestamp: <api-key>' \
--header 'X-DeriveWallet: <api-key>' \
--data '
{
"legs": [
{
"amount": "<string>",
"instrument_name": "<string>",
"price": "<string>"
}
],
"max_fee": "<string>",
"nonce": "<string>",
"signature": "<string>",
"signature_expiry_sec": 123,
"signer": "<string>",
"subaccount_id": 123,
"listed": false,
"recipient_wallet": "<string>"
}
'import requests
url = "https://api.derive.xyz/v3/private/send_block_proposal"
payload = {
"legs": [
{
"amount": "<string>",
"instrument_name": "<string>",
"price": "<string>"
}
],
"max_fee": "<string>",
"nonce": "<string>",
"signature": "<string>",
"signature_expiry_sec": 123,
"signer": "<string>",
"subaccount_id": 123,
"listed": False,
"recipient_wallet": "<string>"
}
headers = {
"X-DeriveWallet": "<api-key>",
"X-DeriveTimestamp": "<api-key>",
"X-DeriveSignature": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-DeriveWallet': '<api-key>',
'X-DeriveTimestamp': '<api-key>',
'X-DeriveSignature': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
legs: [{amount: '<string>', instrument_name: '<string>', price: '<string>'}],
max_fee: '<string>',
nonce: '<string>',
signature: '<string>',
signature_expiry_sec: 123,
signer: '<string>',
subaccount_id: 123,
listed: false,
recipient_wallet: '<string>'
})
};
fetch('https://api.derive.xyz/v3/private/send_block_proposal', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.derive.xyz/v3/private/send_block_proposal",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'legs' => [
[
'amount' => '<string>',
'instrument_name' => '<string>',
'price' => '<string>'
]
],
'max_fee' => '<string>',
'nonce' => '<string>',
'signature' => '<string>',
'signature_expiry_sec' => 123,
'signer' => '<string>',
'subaccount_id' => 123,
'listed' => false,
'recipient_wallet' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-DeriveSignature: <api-key>",
"X-DeriveTimestamp: <api-key>",
"X-DeriveWallet: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.derive.xyz/v3/private/send_block_proposal"
payload := strings.NewReader("{\n \"legs\": [\n {\n \"amount\": \"<string>\",\n \"instrument_name\": \"<string>\",\n \"price\": \"<string>\"\n }\n ],\n \"max_fee\": \"<string>\",\n \"nonce\": \"<string>\",\n \"signature\": \"<string>\",\n \"signature_expiry_sec\": 123,\n \"signer\": \"<string>\",\n \"subaccount_id\": 123,\n \"listed\": false,\n \"recipient_wallet\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-DeriveWallet", "<api-key>")
req.Header.Add("X-DeriveTimestamp", "<api-key>")
req.Header.Add("X-DeriveSignature", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.derive.xyz/v3/private/send_block_proposal")
.header("X-DeriveWallet", "<api-key>")
.header("X-DeriveTimestamp", "<api-key>")
.header("X-DeriveSignature", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"legs\": [\n {\n \"amount\": \"<string>\",\n \"instrument_name\": \"<string>\",\n \"price\": \"<string>\"\n }\n ],\n \"max_fee\": \"<string>\",\n \"nonce\": \"<string>\",\n \"signature\": \"<string>\",\n \"signature_expiry_sec\": 123,\n \"signer\": \"<string>\",\n \"subaccount_id\": 123,\n \"listed\": false,\n \"recipient_wallet\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.derive.xyz/v3/private/send_block_proposal")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-DeriveWallet"] = '<api-key>'
request["X-DeriveTimestamp"] = '<api-key>'
request["X-DeriveSignature"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"legs\": [\n {\n \"amount\": \"<string>\",\n \"instrument_name\": \"<string>\",\n \"price\": \"<string>\"\n }\n ],\n \"max_fee\": \"<string>\",\n \"nonce\": \"<string>\",\n \"signature\": \"<string>\",\n \"signature_expiry_sec\": 123,\n \"signer\": \"<string>\",\n \"subaccount_id\": 123,\n \"listed\": false,\n \"recipient_wallet\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"block_trade_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"creation_timestamp": 123,
"currency": "<string>",
"direction": "buy",
"expires_at_sec": 123,
"last_update_timestamp": 123,
"legs": [
{
"amount": "<string>",
"direction": "buy",
"instrument_name": "<string>",
"price": "<string>"
}
],
"listed": true,
"maker_wallet": "<string>",
"proposal_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"risk_universe_id": 1,
"status": "open",
"recipient_wallet": "<string>"
}{
"error": {
"code": 123,
"message": "<string>",
"data": "<string>"
}
}Authorizations
Body
The caller's maker side of a block trade, signed as for private/execute_block_trade, and who can accept it.
Response
Success
A block proposal as its maker and its recipient see it.
curl --request POST \
--url https://api.derive.xyz/v3/private/send_block_proposal \
--header 'Content-Type: application/json' \
--header 'X-DeriveSignature: <api-key>' \
--header 'X-DeriveTimestamp: <api-key>' \
--header 'X-DeriveWallet: <api-key>' \
--data '
{
"legs": [
{
"amount": "<string>",
"instrument_name": "<string>",
"price": "<string>"
}
],
"max_fee": "<string>",
"nonce": "<string>",
"signature": "<string>",
"signature_expiry_sec": 123,
"signer": "<string>",
"subaccount_id": 123,
"listed": false,
"recipient_wallet": "<string>"
}
'import requests
url = "https://api.derive.xyz/v3/private/send_block_proposal"
payload = {
"legs": [
{
"amount": "<string>",
"instrument_name": "<string>",
"price": "<string>"
}
],
"max_fee": "<string>",
"nonce": "<string>",
"signature": "<string>",
"signature_expiry_sec": 123,
"signer": "<string>",
"subaccount_id": 123,
"listed": False,
"recipient_wallet": "<string>"
}
headers = {
"X-DeriveWallet": "<api-key>",
"X-DeriveTimestamp": "<api-key>",
"X-DeriveSignature": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-DeriveWallet': '<api-key>',
'X-DeriveTimestamp': '<api-key>',
'X-DeriveSignature': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
legs: [{amount: '<string>', instrument_name: '<string>', price: '<string>'}],
max_fee: '<string>',
nonce: '<string>',
signature: '<string>',
signature_expiry_sec: 123,
signer: '<string>',
subaccount_id: 123,
listed: false,
recipient_wallet: '<string>'
})
};
fetch('https://api.derive.xyz/v3/private/send_block_proposal', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.derive.xyz/v3/private/send_block_proposal",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'legs' => [
[
'amount' => '<string>',
'instrument_name' => '<string>',
'price' => '<string>'
]
],
'max_fee' => '<string>',
'nonce' => '<string>',
'signature' => '<string>',
'signature_expiry_sec' => 123,
'signer' => '<string>',
'subaccount_id' => 123,
'listed' => false,
'recipient_wallet' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-DeriveSignature: <api-key>",
"X-DeriveTimestamp: <api-key>",
"X-DeriveWallet: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.derive.xyz/v3/private/send_block_proposal"
payload := strings.NewReader("{\n \"legs\": [\n {\n \"amount\": \"<string>\",\n \"instrument_name\": \"<string>\",\n \"price\": \"<string>\"\n }\n ],\n \"max_fee\": \"<string>\",\n \"nonce\": \"<string>\",\n \"signature\": \"<string>\",\n \"signature_expiry_sec\": 123,\n \"signer\": \"<string>\",\n \"subaccount_id\": 123,\n \"listed\": false,\n \"recipient_wallet\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-DeriveWallet", "<api-key>")
req.Header.Add("X-DeriveTimestamp", "<api-key>")
req.Header.Add("X-DeriveSignature", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.derive.xyz/v3/private/send_block_proposal")
.header("X-DeriveWallet", "<api-key>")
.header("X-DeriveTimestamp", "<api-key>")
.header("X-DeriveSignature", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"legs\": [\n {\n \"amount\": \"<string>\",\n \"instrument_name\": \"<string>\",\n \"price\": \"<string>\"\n }\n ],\n \"max_fee\": \"<string>\",\n \"nonce\": \"<string>\",\n \"signature\": \"<string>\",\n \"signature_expiry_sec\": 123,\n \"signer\": \"<string>\",\n \"subaccount_id\": 123,\n \"listed\": false,\n \"recipient_wallet\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.derive.xyz/v3/private/send_block_proposal")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-DeriveWallet"] = '<api-key>'
request["X-DeriveTimestamp"] = '<api-key>'
request["X-DeriveSignature"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"legs\": [\n {\n \"amount\": \"<string>\",\n \"instrument_name\": \"<string>\",\n \"price\": \"<string>\"\n }\n ],\n \"max_fee\": \"<string>\",\n \"nonce\": \"<string>\",\n \"signature\": \"<string>\",\n \"signature_expiry_sec\": 123,\n \"signer\": \"<string>\",\n \"subaccount_id\": 123,\n \"listed\": false,\n \"recipient_wallet\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"block_trade_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"creation_timestamp": 123,
"currency": "<string>",
"direction": "buy",
"expires_at_sec": 123,
"last_update_timestamp": 123,
"legs": [
{
"amount": "<string>",
"direction": "buy",
"instrument_name": "<string>",
"price": "<string>"
}
],
"listed": true,
"maker_wallet": "<string>",
"proposal_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"risk_universe_id": 1,
"status": "open",
"recipient_wallet": "<string>"
}{
"error": {
"code": 123,
"message": "<string>",
"data": "<string>"
}
}