> For the complete documentation index, see [llms.txt](https://docs.trac.network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.trac.network/documentation/developers/mainnet/dapp-developer-guide/quickstart.md).

# Quickstart

## Local Dev

Goal: connect `trac-peer` to an already-running MSB network, create/join a subnet, and execute one demo contract operation.

### Prereqs

* Node.js + npm
* MSB network parameters:
  * `MSB_BOOTSTRAP`: 32-byte hex (64 hex chars)
  * `MSB_CHANNEL`: string
* An MSB “admin/funded” node that can transfer TNK to new addresses (so new peers can pay MSB fees).

### 1) Install

From the `trac-peer` repo folder:

```sh
npm install
```

### 2) Start the first peer (creates a new subnet)

This starts an in-process MSB *client node* (joins your MSB network) + the subnet peer node.

```sh
npm run peer:run -- \
  --msb-bootstrap=<MSB_BOOTSTRAP_HEX32> \
  --msb-channel=<MSB_CHANNEL> \
  --msb-store-name=peer-msb-1 \
  --peer-store-name=peer1 \
  --subnet-channel=tuxedex-v1
```

On first run, the peer will generate a **subnet bootstrap** and persist it to:

* `stores/peer1/subnet-bootstrap.hex`

Share that hex with joiners.

### 3) Fund the peer on MSB

In the peer logs you’ll see:

* `Peer MSB address: trac1...`

On your MSB funded/admin node, transfer TNK to that address (any amount that covers fees for a few txs).

Why: MSB rejects txs from addresses that don’t exist in MSB state or can’t pay fees.

### 4) Deploy the subnet (one-time per subnet)

In the peer terminal:

```txt
/deploy_subnet
```

This broadcasts an MSB operation that registers the subnet bootstrap + subnet channel.

### 5) Execute a demo contract operation

The default demo app is “Tuxemon”. It supports a single tx type:

* `catch`

In the peer terminal:

```txt
/tx --command "catch"
```

Then query your local subnet state:

```txt
/get --key app/tuxedex/<your-wallet-publicKey-hex> --confirmed false
```

You can print your pubkey via:

```txt
/stats
```

### 6) Start a second peer (join the existing subnet)

Use the subnet bootstrap from `stores/peer1/subnet-bootstrap.hex`.

```sh
npm run peer:run -- \
  --msb-bootstrap=<MSB_BOOTSTRAP_HEX32> \
  --msb-channel=<MSB_CHANNEL> \
  --msb-store-name=peer-msb-2 \
  --peer-store-name=peer2 \
  --subnet-channel=tuxedex-v1 \
  --subnet-bootstrap=<SUBNET_BOOTSTRAP_HEX32>
```

Fund `peer2`’s printed `Peer MSB address` the same way.

### Notes

* If you put flags on a new line without `\`, `zsh` will treat them as a new shell command.
* `confirmed=false` reads the local (unconfirmed) subnet view. `confirmed=true` reads the subnet’s signed view. These are subnet-specific, not “MSB finality”.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.trac.network/documentation/developers/mainnet/dapp-developer-guide/quickstart.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
