Stacks transfer transactions

How do Stacks token transfers work?

I see that Stacks token transfers refer to an underlying transaction on the Bitcoin blockchain:

However, token transfers aren’t included in the list of possible Blockstack transactions in the wire format docs:

Is a description of how the transfer is made available in a document somewhere?

Huh. For some reason the docs builder didn’t pick up the TOKEN_TRANSFER wire format. It’s documented here:

CC @moxiegirl


Is there documentation for the GENESIS_INIT and UNLOCK operations as well? Like the ones I’m seeing here?

I’m trying to understand the relationship between bitcoin addresses and STACKS addresses completely. I still have a few questions.

Does every STACKS address correspond to a bitcoin address?

What does the genesis block look like on the bitcoin blockchain?

I’m guessing GENESIS_INIT has an OP_RETURN value that includes the hash of a bitcoin address and an amount of STACKS tokens it is supposed to receive, and UNLOCK publishes the hashed values in cleartext. And I’m guessing the genesis block relates to an underlying bitcoin transaction that had a LOT of outputs, one for each genesis owner.

Is that about right?

GENESIS_INIT and UNLOCK are internal operations that do not correspond to any transactions. The GENESIS_INIT operation is processed once when the genesis block went live, and UNLOCK is processed every 4032 blocks to unlock purchased tokens over an agreed-upon interval.

Every STACKs address corresponds to a Bitcoin address – a STACKs address is the c32check encoding of the same 20-byte hash encoded by a base58check address (same data, different alphabet).

The genesis block is not stored on-chain, but is stored as a database table within the Blockstack node itself – it’s simply the initial allocation of all tokens so far, plus the unlock schedule.

GENESIS_INIT and UNLOCK are not encoded on-chain – the system automatically processes them per the above. However, TOKEN_TRANSFER, NAME_PREORDER, NAMESPACE_PREORDER, and NAME_RENEWAL can all spend tokens, and these are on-chain.