Page MenuHomePhabricator

[new lokad] Add spec for onchain trollbox for tokens
ClosedPublic

Authored by bytesofman on Wed, Oct 30, 13:50.

Details

Reviewers
tobias_ruck
Group Reviewers
Restricted Project
Commits
rABC7a59b64e4ccc: [new lokad] Add spec for onchain trollbox for tokens
Summary

See trollbox.md for rationale. Would be a good way for token creators to communicate with their users and vice versa.

Test Plan

proofread

Diff Detail

Repository
rABC Bitcoin ABC
Branch
new-lokad
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 30937
Build 61377: Build Diff
Build 61376: arc lint + arc unit

Event Timeline

tobias_ruck added a subscriber: tobias_ruck.
tobias_ruck added inline comments.
doc/standards/trollbox.md
21 ↗(On Diff #50560)

Any reason not to use eMPP? Also I'd some add the following:

  1. A version byte (like a token type in SLP)
  2. A message type (either as string (like PARTIAL in Agora), or a single byte)

So simply change this to be:
OP_RETURN OP_RESERVED "<LOKAD ID:[u8;4]><version:u8><message type:u8><token ID:[u8;32]><utf8 message:[u8]>"

  • version is 0 for the first version
  • message type is 0 for just sending a message in chat
  • message is the leftover of that pushdata in utf8
This revision now requires changes to proceed.Wed, Oct 30, 16:19

EMPP for trollbox spec, add version byte, add msg type byte, update example

bytesofman added inline comments.
doc/standards/trollbox.md
21 ↗(On Diff #50560)

no reason, just didn't occur to me

EMPP is probably better. More extensible, fewer bytes.

We might also want to use Shammah's CashWeb, which is much more generic and powerful, but also creates much less data on-chain:

Code: https://github.com/givelotus/cashweb

Whitepaper: https://www.stampchat.io/whitepaper.pdf

OTOH, starting with a super simple version of this first and then switching to something more elaborate later IMO could make more sense.

doc/standards/trollbox.md
21–26 ↗(On Diff #50564)
36 ↗(On Diff #50564)

You might wanna spec a message type for these rules already, depending on how you want to identify token creators.

Trollbox devs can then query the display rules from the chain.

This revision now requires changes to proceed.Thu, Oct 31, 07:56

improve spec description in line with suggested comments, provide spec for Cashtab planned implementation

Fabien added inline comments.
doc/standards/trollbox.md
14

This is volatile data, you can't rely on this

bytesofman added inline comments.
doc/standards/trollbox.md
14

Can't rely on it for important stuff, no. But, similar to tx history in herald or cashtab -- imo it's good to sort by timeFirstSeen when available (lets you do things like show unconfirmed txs "in order").

Usual approach is to

if tx is unconfirmed:

  • use timeFirstSeen if available
  • use Date.now() if not

if tx is confirmed

  • use timeFirstSeen if available
  • use block timestamp if not

For the purposes of a trollbox I think it's good enough.

bytesofman added inline comments.
doc/standards/trollbox.md
14

my thinking is that the trollbox component will have a websocket subscription to a plugin that indexes these msgs by tokenid

there's a good chance that "old" msgs could lose timeFirstSeen, since who knows what chronik node is connected; these could have strange sorting.

but messages coming into the websocket are very likely to have timeFirstSeen, meaning live chat will be well sorted.

Otherwise seems good to go, the timeFirstSeen seems fine.

doc/standards/trollbox.md
26

Oh brainfart btw we have to pick one endianness here, otherwise we can’t find the token.

I recommend little-endian, to be in line with ALP and the rest of Bitcoin. Big-endian would be what SLP does.

This revision now requires changes to proceed.Fri, Nov 1, 17:42
doc/standards/trollbox.md
26

does that mean we can only index trollbox txs for ALP, and SLP needs some other spec?

specy little-endian for tokenId push

This revision is now accepted and ready to land.Sat, Nov 2, 05:05
doc/standards/trollbox.md
26

No, it can be for both, we just have to pick one of the two encodings and stick with it