# Scrolls Bitcoin API is here! Scrolls will sign transactions spending from addresses generated by this API. The flow is as follows: 1. Generate a Scrolls address (or a few). 2. Send BTC and/or Charms to the address(es). They are now locked. 3. To unlock, sign the spending transaction with Scrolls. Only transactions carrying correct spells will be signed. ## `GET /config` Returns the current configuration of the Scrolls Bitcoin API as JSON. '''json { "fee_address": { "main": "bc1qxxxjm06n50uugxewxe5r5w5tskqwq4gkwrm0al", "testnet4": "tb1qrk6da5g0592sx6lmgpchaf5qy2lgn8am7cuf3a" }, "fee_per_input": 64, "fee_basis_points": 10, "fixed_cost": 895 } ''' Scrolls will only sign transactions if they have a fee output paid to `fee_address`. The fee is calculated as follows: `fee = fixed_cost + fee_per_input * number_of_inputs + fee_basis_points / 10000 * total_input_sats` ## `GET /{network}/address/{nonce}` Returns the address derived for `nonce` (64-bit unsigned integer) on `network` ("main" or "testnet4"). The nonce is used to derive the address deterministically: the same nonce always results in the same address on the same network. The returned address is a JSON string value (in double quotes). ## `POST /{network}/sign` ```json { "sign_inputs": [ { "index": 0, "nonce": 1234567890 }, { "index": 1, "nonce": 1234567890" } ], "prev_txs": ["020000000001025a...529219c900000000", "0200000001b1d12d...b0645dc000000000"], "tx_to_sign": "0200000001b1d12d...b0645dc000000000" } ``` Signs `tx_to_sign` and returns the signed transaction as a hex-encoded string for `network` ("main" or "testnet4"). The `sign_inputs` array contains the indices of the inputs to sign. The `prev_txs` array contains hex encoded transactions creating the outputs that `tx_to_sign` spends. The returned signed transaction is a JSON string value (in double quotes).