Skip to content

Added curl equivalents, updated bitcoin installation info #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 1 addition & 52 deletions getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,58 +5,7 @@ description: You can try the Bitcoin Spaces protocol on testnet4 🎉
# Installation

### Install Bitcoin Core

{% hint style="info" %}
Bitcoin Core version 28+ is required for testnet4 and it's not yet released at the time of this writing. Check the [website](https://bitcoin.org/en/bitcoin-core/) to see if it's released otherwise follow instructions below to compile from source.
{% endhint %}

The following instructions is for compiling Bitcoin core from source to access `testnet4`

{% tabs %}
{% tab title="MacOS" %}
Setup environment xcode & brew

```sh
xcode-select --install

brew install automake libtool boost pkg-config libevent llvm
```

Compile Bitcoin core

```sh
git clone https://github.com/bitcoin/bitcoin.git && cd bitcoin
./autogen.sh
CC=$(brew --prefix llvm)/bin/clang CXX=$(brew --prefix llvm)/bin/clang++ ./configure --with-gui=no
make
make install # optional
```

If you need further help, check the main [guide](https://github.com/bitcoin/bitcoin/blob/master/doc/build-osx.md)
{% endtab %}

{% tab title="Linux" %}
#### Ubuntu/debian

Install dependencies

```sh
sudo apt-get install build-essential libtool autotools-dev automake pkg-config bsdmainutils python3 libevent-dev libboost-dev libsqlite3-dev
```

Compile

```sh
git clone https://github.com/bitcoin/bitcoin.git && cd bitcoin
./autogen.sh
./configure
make # use "-j N" for N parallel jobs
make install # optional
```

If you need further help or use a different distro, check the main [guide](https://github.com/bitcoin/bitcoin/blob/master/doc/build-unix.md)
{% endtab %}
{% endtabs %}
Bitcoin Core of version 28+ is required. It can be installed from the official [download page](https://bitcoincore.org/en/download/).

### Install Spaces Daemon

Expand Down
2 changes: 1 addition & 1 deletion space-daemon/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ The Spaces daemon listens on the following ports by default:

All these arguments can be specified as environment variables with `SPACED_` prefix and `UPPER_SNAKE_CASE`

<table><thead><tr><th width="270">Option</th><th>Description</th><th>Default</th></tr></thead><tbody><tr><td>--<code>chain</code></td><td>Network to use</td><td>None (Required)</td></tr><tr><td>--<code>bitcoin-rpc-url</code></td><td>Bitcoin RPC URL</td><td>Bitcoin core default URL based on the specified <code>chain</code>e.g. <a href="http://127.0.0.1:8332"><code>http://127.0.0.1:8332</code></a> for mainnet</td></tr><tr><td>--<code>bitcoin-rpc-cookie</code></td><td>Bitcoin RPC cookie file path</td><td>None</td></tr><tr><td>--<code>bitcoin-rpc-user</code></td><td>Bitcoin RPC user</td><td>None</td></tr><tr><td>--<code>bitcoin-rpc-password</code></td><td>Bitcoin RPC password</td><td>None</td></tr><tr><td>--<code>block_index</code></td><td>Enable block indexing</td><td><code>false</code></td></tr><tr><td>--<code>data_dir</code></td><td>Custom data directory to store spaced state</td><td>None</td></tr><tr><td>--<code>jobs</code></td><td>Number of concurrent workers during sync</td><td><code>8</code></td></tr><tr><td>--<code>rpc_bind</code></td><td>Bind address for JSON-RPC connections</td><td><code>127.0.0.1, ::1</code></td></tr><tr><td>--<code>rpc_port</code></td><td>Port for JSON-RPC connections</td><td>None</td></tr><tr><td>--<code>config</code></td><td>Path to a configuration file</td><td>None</td></tr></tbody></table>
<table><thead><tr><th width="270">Option</th><th>Description</th><th>Default</th></tr></thead><tbody><tr><td><code>--bitcoin-rpc-cookie</code></td><td>Bitcoin RPC cookie file path</td><td>None</td></tr><tr><td><code>--bitcoin-rpc-password</code></td><td>Bitcoin RPC password</td><td>None</td></tr><tr><td><code>--bitcoin-rpc-url</code></td><td>Bitcoin RPC URL</td><td>Bitcoin core default URL based on the specified <code>--chain</code> e.g.<a href="http://127.0.0.1:8332"><code>http://127.0.0.1:8332</code></a> for mainnet</td></tr><tr><td><code>--bitcoin-rpc-user</code></td><td>Bitcoin RPC user</td><td>None</td></tr><tr><td><code>--block_index</code></td><td>Enable block indexing</td><td><code>false</code></td></tr><tr><td><code>--chain</code></td><td>Network to use</td><td>None (Required)</td></tr><tr><td><code>--config</code></td><td>Path to a configuration file</td><td>None</td></tr><tr><td><code>--data_dir</code></td><td>Custom data directory to store spaced state</td><td>None</td></tr><tr><td><code>--jobs</code></td><td>Number of concurrent workers during sync</td><td><code>8</code></td></tr><tr><td><code>--rpc_bind</code></td><td>Bind address for JSON-RPC connections</td><td><code>127.0.0.1, ::1</code></td></tr><tr><td><code>--rpc_port</code></td><td>Port for JSON-RPC connections</td><td>None</td></tr></tbody></table>

152 changes: 130 additions & 22 deletions space-daemon/server-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,23 @@ The daemon implements [JSON RPC](https://www.jsonrpc.org/specification), so you

**Params** None

**Response**
{% tabs %}
{% tab title="CLI" %}
```
space-cli --chain testnet4 getserverinfo
```
{% endtab %}

{% tab title="cURL" %}
```bash
curl -X POST http://127.0.0.1:7224 \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"getserverinfo","params":[],"id":1}'
```
{% endtab %}
{% endtabs %}

**Example Response**

```json
"chain": "testnet4",
Expand All @@ -37,6 +53,22 @@ The daemon implements [JSON RPC](https://www.jsonrpc.org/specification), so you

<table><thead><tr><th width="223">Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code>space</code></td><td>string</td><td>Canonical space name e.g. @bitcoin</td></tr></tbody></table>

{% tabs %}
{% tab title="CLI" %}
```
space-cli --chain testnet4 getspace @bitcoin
```
{% endtab %}

{% tab title="cURL" %}
```bash
curl -X POST http://127.0.0.1:7224 \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"getspace","params":["@bitcoin"],"id":1}'
```
{% endtab %}
{% endtabs %}

**Example Response**

{% tabs %}
Expand Down Expand Up @@ -102,7 +134,23 @@ The daemon implements [JSON RPC](https://www.jsonrpc.org/specification), so you
| ------- | ------ | ---------------------------------- |
| `space` | string | Canonical space name e.g. @bitcoin |

**Example Response**\
{% tabs %}
{% tab title="CLI" %}
```
only available via JSON-RPC
```
{% endtab %}

{% tab title="cURL" %}
```bash
curl -X POST http://127.0.0.1:7224 \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"getspaceowner","params":["@bitcoin"],"id":1}'
```
{% endtab %}
{% endtabs %}

**Example Response**
Responds with an outpoint with `txid:vout` format.

```json
Expand All @@ -118,21 +166,38 @@ b2819258b2416314a36e8f66840ebb5682e2600a07c28a04b4e27fe0b51b46fc:1
<table><thead><tr><th width="137">Name</th><th width="87">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>outpoint</code></td><td>string</td><td><p>An Outpoint which is a specific output within a transaction using <code>txid:vout</code> format e.g.</p><pre class="language-json"><code class="lang-json">b2819258b2416314a36e8f66840ebb5682e2600a07c28a04b4e27fe0b51b46fc:1
</code></pre></td></tr></tbody></table>

{% tabs %}
{% tab title="CLI" %}
```
space-cli --chain testnet4 getspaceout "b2819258b2416314a36e8f66840ebb5682e2600a07c28a04b4e27fe0b51b46fc:1"
```
{% endtab %}

{% tab title="cURL" %}
```bash
curl -X POST http://127.0.0.1:7224 \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"getspaceout","params":["b2819258b2416314a36e8f66840ebb5682e2600a07c28a04b4e27fe0b51b46fc:1"],"id":1}'
```
{% endtab %}
{% endtabs %}

**Example Response**

{% tabs %}
{% tab title="Space UTXO" %}
<pre class="language-json"><code class="lang-json"><strong>{
</strong><strong> "value": 662,
</strong> "script_pubkey": "5120882cd5b0ef333be2efd7efd9bea0953f894677f1d5a638c8a3d13734e99d22e6",
```json
{
"value": 662,
"script_pubkey": "5120882cd5b0ef333be2efd7efd9bea0953f894677f1d5a638c8a3d13734e99d22e6",
"name": "@bitcoin",
"covenant": {
"type": "transfer",
"expire_height": 93050,
"data": null
}
}
</code></pre>
```
{% endtab %}

{% tab title="Other UTXOs" %}
Expand All @@ -155,7 +220,23 @@ b2819258b2416314a36e8f66840ebb5682e2600a07c28a04b4e27fe0b51b46fc:1
| -------- | ------ | ------------------------ |
| `target` | number | The target rollout block |

**Example Response**\
{% tabs %}
{% tab title="CLI" %}
```
space-cli --chain testnet4 estimatebid 14400
```
{% endtab %}

{% tab title="cURL" %}
```bash
curl -X POST http://127.0.0.1:7224 \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"estimatebid","params":[144],"id":1}'
```
{% endtab %}
{% endtabs %}

**Example Response**
Responds with an amount in Satoshis

```json
Expand All @@ -170,25 +251,35 @@ Responds with an amount in Satoshis

<table><thead><tr><th width="208">Name</th><th width="172">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>target</code></td><td>number</td><td>The target interval e.g. specify 0 for the coming rollout, 1 for the day after and so on.</td></tr></tbody></table>

**Example Response**\
{% tabs %}
{% tab title="CLI" %}
```
space-cli --chain testnet4 getrollout 0
```
{% endtab %}

{% tab title="cURL" %}
```bash
curl -X POST http://127.0.0.1:7224 \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"getrollout","params":[0],"id":1}'
```
{% endtab %}
{% endtabs %}

**Example Response**
An array of spaces expected to be in auctions within the given `target`

```json
[
{
"outpoint": "1ea73982abb36cf2c62deced717fbe944c3af89abe768aa454642879b29e5adc:1",
"value": 662,
"script_pubkey": "51202a7267b047254ad41e87458b902c286434e3764ffd2f2fdb46a9c8fafa6135e3",
"name": "@btc",
"covenant": {
"type": "bid",
"burn_increment": 1000,
"signature": "........",
"total_burned": 1000,
"claim_height": null
}
}
]
[
"@bitcoin",
1000
],
[
"@mytestspace",
1000
],
```

## Get Block Data
Expand All @@ -201,6 +292,22 @@ An array of spaces expected to be in auctions within the given `target`
| ------------ | ------ | ---------------------------- |
| `block_hash` | string | The block hash as hex string |

{% tabs %}
{% tab title="CLI" %}
```
space-cli --chain testnet4 getblockdata 0000000012982b6d5f621229286b880e909984df669c2afabb102ce311b13f28
```
{% endtab %}

{% tab title="cURL" %}
```bash
curl -X POST http://127.0.0.1:7224 \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"getblockdata","params":["0000000012982b6d5f621229286b880e909984df669c2afabb102ce311b13f28"],"id":1}'
```
{% endtab %}
{% endtabs %}

**Example Response**

```json
Expand Down Expand Up @@ -388,3 +495,4 @@ An array of spaces expected to be in auctions within the given `target`

[^1]: Checkout this outpoint here\
[https://mempool.space/testnet4/tx/1ea73982abb36cf2c62deced717fbe944c3af89abe768aa454642879b29e5adc#vout=](https://mempool.space/testnet4/tx/1ea73982abb36cf2c62deced717fbe944c3af89abe768aa454642879b29e5adc#vout=1)