Fount (a name meaning the source of something) is the top layer of The Stack that starts with Sessionless. It handles the resolution of MAGIC spells, and disburses digital items amongst participants. It's probably closest in spirit to a cooperative bank (in the US these are called credit unions) where the owners are any and all participants of anything that uses Fount.
The Fount server is essentially a publically available resolver, which, along with Addie can be used as a payment processor with two additional features. First it can handle "payments" of things that aren't money. Second it can attach meaningful things to the transactions--think of a receipt that is useful or collectible in some way.
In The Stack ecosystem, Fount is a Resolver. It can be used for monied transactions1, but for right now I'll focus on non-monied transactions here.
Because Fount generates useful things when spells resolve, some gating mechanism is necessary to prevent people from just spamming requests. This gate is a stored value system called mp. MP is granted to each user, and is expended with non-monied spells, and then recharges over time. If you've played Skyrim, it works just like the Magika bar.
So what are those useful things? With every spell, Fount is able to disburse money, (experience) points, or tokens2 called Nineum. Again I'll leave money for now.
The points are attached to the uuid being used in the spell, and persist throughout any digital context where that uuid is used. They can be used to create a level system in one context or another, or just as some overall store of points.
Nineum is a 128-bit interger, which encodes a set of properties that can be used to map to digital things like armor in a game like Skyrim, or cards in a game like Hearthstone, or collectible monsters in a game like Pokemon. It can also map to things like rewards, and badges, and achievements. And yes it can map to bad digital artwork if you really want.
Ok, so how does this work? Here's the flowchart of a spell from MAGIC:
flowchart LR
A[Caster]-->|Casts Spell| B{Target}
B-->|Passes Spell| C{Resolver}
C -->|Resolves| C
C -->|Effect| B
B -->|Adds To Effect| A
A -->|Modifies State| A
In the case of Open Source Force's bounty bot, the caster would be the person posting the bounty, the target would be the bot, and the resolver is Fount. So:
flowchart LR
A[BountyPoster]-->|Casts Spell| B{OSFBot}
B-->|Passes Spell| C{PlanetNine}
C -->|Resolves| C
C -->|Effect| B
B -->|Adds To Effect| A
A -->|Modifies State| A
When the spell resolves, the bot will be assigned Nineum by Fount, which it can then transfer to whomever it is that completes the bounty. It can also grant points at that time, and eventually, should someone supply it, money.
The bot, being the holder of the rewards for the bounty, can be used to aggregate rewards too. So if multiple people want to support the bounty they can spend mp to add to the rewards as well.
So there're some basic CRUD operations for user management.
The cool APIs are resolve
, transfer
, and grant
at the bottom.
PUT
/user/create
Creates a new user if pubKey does not exist, and returns existing uuid if it does.
name required data type description pubKey true string (hex) the publicKey of the user's keypair timestamp true string in a production system timestamps narrow window for replay attacks signature true string (signature) the signature from sessionless for the message
http code content-type response 200
application/json
USER
400
application/json
{"code":"400","message":"Bad Request"}
curl -X PUT -H "Content-Type: application/json" -d '{"pubKey": "key", "timestamp": "now", "signature": "sig"}' https://<placeholderURL>/user/create
GET
/user/:uuid?timestamp=&signature=
Returns a user by their uuid
name required data type description timestamp true string in a production system timestamps prevent replay attacks signature true string (signature) the signature from sessionless for the message
http code content-type response 200
application/json
USER
406
application/json
{"code":"406","message":"Not acceptable"}
curl -X GET -H "Content-Type: application/json" https://<placeholderURL>/<uuid>?timestamp=123&signature=signature
GET
/user/pubKey/:pubKey?timestamp=&signature=
Returns a user by pubKey
name required data type description timestamp true string in a production system timestamps prevent replay attacks signature true string (signature) the signature from sessionless for the message
http code content-type response 200
application/json
USER
406
application/json
{"code":"406","message":"Not acceptable"}
curl -X GET -H "Content-Type: application/json" https://<placeholderURL>/<uuid>?timestamp=123&signature=signature
POST
/resolve
Resolves a spell
name required data type description spell true object [SPELL]
http code content-type response 200
application/json
{success: <bool>, signatureMap: TBD}
400
application/json
{"code":"400","message":"Bad Request"}
curl -X POST -H "Content-Type: application/json" -d '[SPELL]' https://<placeholderURL>/user/<uuid>/associate
POST
/user/:uuid/transfer
Transfers Nineum to another Fount uuid
name required data type description timestamp true string in a production system timestamps prevent replay attacks uuid true string the transferer's uuid destinationUUID true string the transferee's uuid nineumUniqueIds true string[] the nineum to transfer as hex coded Int128s price false Int price of the transfer (can be null or 0 for free transfers) currency false string the currency for the transaction signature true string (signature) the signature from sessionless for the message
http code content-type response 200
application/json
USER
400
application/json
{"code":"400","message":"Bad Request"}
curl -X POST -H "Content-Type: application/json" -d '<will fill this in later>' https://<placeholderURL>/user/<uuid>/associate
POST
/user/:uuid/grant
Grants point to a Fount user
name required data type description timestamp true string in a production system timestamps prevent replay attacks uuid true string the granter's uuid destinationUUID true string receiver's uuid amount true Int the amount of points to grant description false string An optional description of the grant signature true string (signature) the signature from sessionless for the message
http code content-type response 200
application/json
USER
400
application/json
{"code":"400","message":"Bad Request"}
curl -X POST -H "Content-Type: application/json" -d '<will fill this in later>' https://<placeholderURL>/user/<uuid>/grant
createUser(saveKeys, getKeys)
- Creates a new fount user
getUserByUUID(uuid)
- gets a fount user by uuid
getUserByPublicKey(pubKey)
- get a fount user by public key
resolve(spell)
- resolves a spell (see [MAGIC][magic])
grant(uuid, destinationUUID, amount, description)
- grants some points to a destination
getNineum(uuid)
- gets a user's nineum
transferNineum(uuid, destinationUUID, nineumUniqueIds, price, currenct)
- transfers nineum from one user to another
Footnotes
-
"I am actively working on this for Julia, and the MAGIC demo." ↩
-
"Technically Nineum is a non-fungible token (well more accurately a half-fungible token3), but the crypto bros ruined that concept so thoroughly that I've had to scrub all reference to the idea from everything I write. But I'd like to remind the readers of this that mapping digital things to strings and numbers has had usefulness long before Ethereum ruined the concept. ↩
-
"When you read about fungibility, it’s usually presented as a binary--either something is fungible or it isn’t. But the real world is of course never so simple. There are a whole range of goods that are fungible in one respect and non-fungible in another. Take beer as an example. Beer manufacturers go to great lengths to ensure that each of their beers taste the same, that they would be fungible with each other. At the same time Beer manufacturers go to great lengths to ensure that their beer does not taste like any competitors’ making their beer non-fungible with other brands. Virtually everything we consume that’s branded falls into this category of fungible within/non-fungible without. For lack of a better term, let’s call these types of goods half-fungible." ↩