Prism RPC Methods

Prism RPC Methods
Photo by Arget / Unsplash

The prism plugin exposes four RPC methods for creating and managing prisms: createprism, listprisms, updateprism, and deleteprism

💡

Learn to start the plugin on your node here.

createprism

createprism label members[]

label is a string to label prisms and the corresponding offer

members is an array of member objects with the following form:

{
  name: string,
  destination: string,
  split: 0 <= int <= 1,000,
  type?: "bolt12" | "keysend"
}

name: identifier for the member

destination: bolt12 or node pubkey (for keysending). Bolt 12 is the default destination type.

split: relative payment split for that member. All splits get normalized to a percentage. Max split value is arbitrarily set to 1,000

type: "bolt12" or "keysend". Defaults to "bolt12"

3 member prism example

lightning-cli createprism \
label="band-prism" \
members="[{\"name\": \"lead-singer\", \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2q5mngwpnxstzzql8sxrnaaq8secwrcsw5wmdxtfqgj9kamaslpvgxk08g0tdmqzmav\", \"split\":5}, {\"name\": \"drummer\", \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2q5mngwpnxstzzql8sxrnaaq8secwrcsw5wmdxtfqgj9kamaslpvgxk08g0tdmqzmav\", \"split\":2}, {\"name\": \"guitarist\", \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2q5mngwpnxstzzql8sxrnaaq8secwrcsw5wmdxtfqgj9kamaslpvgxk08g0tdmqzmav\", \"split\":3}]"

Returns the BOLT 12 offer:

{
   "offer_id": "facedc24ee4587f42b75cec81863a63727acea9961d2bdd170d70b90bd28f7b7",
   "active": true,
   "single_use": false,
   "bolt12": "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2pf3xzmny94c8y6tnd5tzzql8sxrnaaq8secwrcsw5wmdxtfqgj9kamaslpvgxk08g0tdmqzmav",
   "used": false,
   "created": true
}

listprisms

listprisms

Returns an array of all prisms:

{
   "prisms": [
      {
         "label": "band-prism",
         "version": "v0.0.1",
         "members": [
            {
               "name": "lead-singer",
               "destination": "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2q5mngwpnxstzzql8sxrnaaq8secwrcsw5wmdxtfqgj9kamaslpvgxk08g0tdmqzmav",
               "split": 5,
               "outlay_msat": 0,
               "id": 1
            },
            {
               "name": "drummer",
               "destination": "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2q5mngwpnxstzzql8sxrnaaq8secwrcsw5wmdxtfqgj9kamaslpvgxk08g0tdmqzmav",
               "split": 2,
               "outlay_msat": 3000,
               "id": 2
            },
            {
               "name": "guitarist",
               "destination": "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2q5mngwpnxstzzql8sxrnaaq8secwrcsw5wmdxtfqgj9kamaslpvgxk08g0tdmqzmav",
               "split": 3,
               "outlay_msat": 2300,
               "id": 3
            }
         ],
         "offer": {
            "offer_id": "facedc24ee4587f42b75cec81863a63727acea9961d2bdd170d70b90bd28f7b7",
            "active": true,
            "single_use": false,
            "bolt12": "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2pf3xzmny94c8y6tnd5tzzql8sxrnaaq8secwrcsw5wmdxtfqgj9kamaslpvgxk08g0tdmqzmav",
            "used": false
         }
      }
   ]
}

deleteprism

deleteprism offer_id

⚠️

Deleting a prism disables the corresponding offer. You will NOT be able to enable to offer or create another offer with the same description. Prefer updateprism.

When prisms are created, they get stored in the node's datastore with the offer id as the key.

see datastore, listdatastore, and deldatastore from the CLN docs.

updateprism

updateprism offer_id members[]

Replaces the array of members in a preexisting prism with the members array that gets passed. The members array gets passed to this method in the same way as createprism.

gudnuf

gudnuf

developing = building + learning