BitcoinMethods

combinepsbt

The combinepsbt method allows you to combine multiple partially signed Bitcoin transactions into a single transaction. This is particularly useful in multi-signature wallet setups where transaction...

combinepsbt

Overview

The 'combinepsbt' method allows you to combine multiple partially signed Bitcoin transactions into a single transaction. This is particularly useful in multi-signature wallet setups where transactions require signatures from multiple parties before they can be broadcasted to the network.

Request

shell

wget --no-check-certificate --quiet \
  --method POST \
  --timeout=0 \
  --header 'Content-Type: application/json' \
  --header 'accept: application/json' \
  --header 'X-CoinAPI-Key: 4303fb63-adec-42dc-b571-74bc2f2a5167' \
  --body-data '{"jsonrpc":"2.0","id":1,"method":"combinepsbt","params": [ ]}' \
   'https://bitcoin-mainnet.node.coinapi.io'

csharp

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://bitcoin-mainnet.node.coinapi.io");
request.Headers.Add("x-coinapi-key", "73034021-THIS-IS-SAMPLE-KEY");
request.Headers.Add("accept", "application/json");
var content = new StringContent("{\"jsonrpc\":\"2.0\",\"method\":\"combinepsbt\",\"params\": [],\"id\":1}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());

php

<?php
$client = new Client();
$headers = [
  'x-coinapi-key' => '73034021-THIS-IS-SAMPLE-KEY',
  'Content-Type' => 'application/json',
  'accept' => 'application/json'
];
$body = '{
  "jsonrpc": "2.0",
  "method": "combinepsbt",
  "params": [],
  "id": 1
}';
$request = new Request('POST', 'https://bitcoin-mainnet.node.coinapi.io', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
?>

python

import requests
import json

url = "https://bitcoin-mainnet.node.coinapi.io"

payload = json.dumps({
  "jsonrpc": "2.0",
  "method": "combinepsbt",
  "params": [],
  "id": 1
})
headers = {
  'x-coinapi-key': '73034021-THIS-IS-SAMPLE-KEY',
  'Content-Type': 'application/json',
  'accept': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

javascript

var settings = {
  "url": "https://bitcoin-mainnet.node.coinapi.io",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "x-coinapi-key": "4303fb63-adec-42dc-b571-74bc2f2a5167",
    "Content-Type": "application/json",
    "accept": "application/json"
  },
  "data": JSON.stringify({
    "jsonrpc": "2.0",
    "method": "combinepsbt",
    "params": [],
    "id": 1
  }),
};

$.ajax(settings).done(function (response) {
console.log(response);
});

go

package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://bitcoin-mainnet.node.coinapi.io"
  method := "POST"

  payload := strings.NewReader(`{"jsonrpc":"2.0","method":"combinepsbt","params": [],"id":1}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("x-coinapi-key", "73034021-THIS-IS-SAMPLE-KEY")
  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("accept", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}

ruby

require "uri"
require "json"
require "net/http"

url = URI("https://bitcoin-mainnet.node.coinapi.io")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-coinapi-key"] = "73034021-THIS-IS-SAMPLE-KEY"
request["Content-Type"] = "application/json"
request["accept"] = "application/json"
request.body = JSON.dump({
  "jsonrpc": "2.0",
  "method": "combinepsbt",
  "params": [],
  "id": 1
})

response = https.request(request)
puts response.read_body

Request Parameters

  • method: (string) The name of the method being invoked, in this case, "combinepsbt".
  • params: (json array, required) The base64 strings of partially signed transactions. Each element in the array is a base64 encoded string representing a partially signed transaction.
  • psbt: (string) A base64 string of a partially signed Bitcoin transaction (PSBT).

Response

{
  "result": null,
  "error": {
    "code": -1,
    "message": "combinepsbt [\"psbt\",...]\n\nCombine multiple partially signed Bitcoin transactions into one transaction.\nImplements the Combiner role.\n\nArguments:\n1. txs            (json array, required) The base64 strings of partially signed transactions\n     [\n       \"psbt\",    (string) A base64 string of a PSBT\n       ...\n     ]\n\nResult:\n\"str\"    (string) The base64-encoded partially signed transaction\n\nExamples:\n> bitcoin-cli combinepsbt '[\"mybase64_1\", \"mybase64_2\", \"mybase64_3\"]'\n"
  },
  "id": 1
}
Service StatusGitHub SDK