Bitcoin API Documentation
Use this API to simulate Bitcoin transactions on Fauxchain.
Authentication
All API requests must include your API key in the request headers. Your API key identifies your account and provides access to the Bitcoin simulation features.
X-API-KEY: your_api_key_here
Simulate a Bitcoin Transaction
This endpoint allows you to create a simulated Bitcoin transaction between wallets on the Fauxchain network. The transaction will be processed and verified according to Bitcoin network rules, but no real cryptocurrency is used.
Body Parameters
Parameter | Type | Required | Description |
---|---|---|---|
receiver_address | string | Required | The Bitcoin address that will receive the transaction |
amount | float | Required | Amount of Bitcoin to send (minimum 0.00000001 BTC) |
Transaction Hash Usage
Every successful transaction returns a unique tx_hash. This hash serves as a permanent identifier for the transaction and can be used to build an explorer link for your users to view transaction details.
https://fauxchain.io/explorer/bitcoin/tx/YOUR_TX_HASH
Replace YOUR_TX_HASH with the actual hash returned in the API response. Example:
https://fauxchain.io/explorer/bitcoin/tx/5a8ec879e0dd34a58b51cf09e42ad8d11869ac523dfb890ca5e0a5354d548858
Example Request
{
"receiver_address": "1BoatSLRHtKNngkdXEeobR76b53LETtpyT",
"amount": 0.003
}
Example Success Response
{
"success": true,
"tx_hash": "5a8ec879e0dd...",
"sender_address": "1YourAddress...",
"receiver_address": "1BoatSLRHtKNngkdXEeobR76b53LETtpyT",
"amount": 0.003,
"fee": "0.00000600",
"size": 312
}
Response Field Description
Field | Type | Description |
---|---|---|
tx_hash | string | Unique transaction identifier. Used to link to the explorer. |
sender_address | string | Your configured Bitcoin API address |
receiver_address | string | Destination address |
amount | float | Amount transferred |
fee | float | Auto-calculated 0.2% fee |
size | integer | Simulated size of the transaction in bytes |
Example Error Responses
The following errors may be returned if the request fails validation or is unauthorized:
{
"error": "Bitcoin API address is not set. Please configure it in your dashboard."
}
{
"error": "Insufficient balance. Minimum of $0.05 is required to simulate a transaction."
}
Response Codes
-
200 OKTransaction simulated successfully. JSON response includes all transaction details.
-
401 UnauthorizedMissing or invalid API key.
-
403 ForbiddenInsufficient balance.
-
422 Unprocessable EntityValidation errors (e.g., missing receiver address, invalid amount, API address not set).
-
500 Internal Server ErrorUnexpected backend error.
Code Examples
import requests
url = "https://fauxchain.io/api/simulate/bitcoin"
headers = {
"X-API-KEY": "YOUR_API_KEY",
"Content-Type": "application/json"
}
data = {
"receiver_address": "RECEIVER_ADDRESS",
"amount": BITCOIN_AMOUNT
}
response = requests.post(url, json=data, headers=headers)
print(response.json())
$response = Http::withHeaders([
'X-API-KEY' => 'YOUR_API_KEY'
])->post('https://fauxchain.io/api/simulate/bitcoin', [
'receiver_address' => 'RECEIVER_ADDRESS',
'amount' => BITCOIN_AMOUNT
]);
echo $response->body();
var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-KEY", "YOUR_API_KEY");
var content = new StringContent("{ \"receiver_address\": \"RECEIVER_ADDRESS\", \"amount\": BITCOIN_AMOUNT }", Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://fauxchain.io/api/simulate/bitcoin", content);
var responseString = await response.Content.ReadAsStringAsync();
fetch('https://fauxchain.io/api/simulate/bitcoin', {
method: 'POST',
headers: {
'X-API-KEY': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
receiver_address: 'RECEIVER_ADDRESS',
amount: BITCOIN_AMOUNT
})
}).then(response => response.json())
.then(data => console.log(data));
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse("https://fauxchain.io/api/simulate/bitcoin")
request = Net::HTTP::Post.new(uri)
request["X-API-KEY"] = "YOUR_API_KEY"
request.content_type = "application/json"
request.body = JSON.dump({
"receiver_address" => "RECEIVER_ADDRESS",
"amount" => BITCOIN_AMOUNT
})
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
puts response.body
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://fauxchain.io/api/simulate/bitcoin"))
.header("X-API-KEY", "YOUR_API_KEY")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString("{\"receiver_address\":\"RECEIVER_ADDRESS\",\"amount\":BITCOIN_AMOUNT}"))
.build();
HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
type RequestBody struct {
ReceiverAddress string `json:"receiver_address"`
Amount float64 `json:"amount"`
}
func main() {
body := RequestBody{
ReceiverAddress: "RECEIVER_ADDRESS",
Amount: BITCOIN_AMOUNT,
}
jsonBody, _ := json.Marshal(body)
req, _ := http.NewRequest("POST", "https://fauxchain.io/api/simulate/bitcoin", bytes.NewBuffer(jsonBody))
req.Header.Set("X-API-KEY", "YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)
}