Skip to main content

Quick Start

This guide will help you quickly set up and start using Shield for submitting private Bitcoin transactions.

Prerequisites


Before using Shield, you should have:

  • Basic understanding of Bitcoin transactions
  • The ability to create and sign raw Bitcoin transactions
  • A tool or library capable of making HTTP requests (curl, request, axios, etc.)

Submit a transaction


1. Get Shield Fee Information

First, query Shield to get the current payment address and fee rates:

curl -XGET 'https://shield.rebarlabs.io/v1/info'

You'll receive a response like:

{
"height": 886512,
"payment": {
"p2wpkh": "bc1q..."
},
"fees": [
{
"estimated_hashrate": 0.12,
"feerate": 18.0
},
{
"estimated_hashrate": 0.27,
"feerate": 24.0
}
]
}

2. Create a Transaction with Shield Fee

When creating your Bitcoin transaction, add an output that pays the Shield service:

  1. Choose a fee tier from the response above based on your confirmation needs. The estimated_hashrate represents an estimate of the cumulative % hashrate of the network's hashrate available at a given fee, and the corresponding fee rate (in sats/vbyte)
  2. Create an additional transaction output for Rebar.
  3. Calculate the total fee (including the new transaction output): Transaction Size (vbytes) × Fee Rate (sats/vbyte)
  4. Modify the output to your transaction to pay this amount to the Shield payment address

3. Submit the Transaction

Submit your signed transaction to Shield:

curl -XPOST 'https://shield.rebarlabs.io/v1/rpc' \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": "1",
"method": "sendrawtransaction",
"params": ["YOUR_SIGNED_TRANSACTION_HEX"]
}'

On success, you'll receive the transaction ID:

{
"result": "txid_hex_string",
"error": null,
"id": "1"
}

Code Examples


JavaScript (Node.js with axios)

const axios = require('axios');

async function submitTransaction(txHex) {
try {
// Get fee information
const infoResponse = await axios.get('https://shield.rebarlabs.io/v1/info');
console.log('Payment address:', infoResponse.data.payment.p2wpkh);
console.log('Fee options:', infoResponse.data.fee_tiers);

// Submit transaction
const response = await axios.post('https://shield.rebarlabs.io/v1/rpc', {
jsonrpc: '1.0',
id: 'shield',
method: 'sendrawtransaction',
params: [txHex]
});

console.log('Transaction submitted:', response.data.result);
return response.data.result;
} catch (error) {
console.error('Error:', error.response?.data || error.message);
throw error;
}
}

// Usage
// submitTransaction('YOUR_SIGNED_TRANSACTION_HEX');

Next Steps

  • Read the Developer Guide for more detailed instructions
  • Check the API Reference for comprehensive API documentation
  • See the FAQ for answers to common questions