Tea Ceremony algorithm
Table of contents
Introduction
Tea Ceremony is an algorithm for secure generation of genesis.txt
and node private and public keys. It allows nodes to exchange public keys without needing to exchange private keys with each other. Thanks to the Tea Ceremony algorithm, the node private keys are stored only on the nodes they are generated for.
Stages of Tea Ceremony
The Tea Ceremony has three steps:
- Collection of public keys of all nodes in the chain.
- Signing the settings patch.
- Signing the block.
The Tea Ceremony client shows how many nodes have participated in each step.
Algorithm work scheme
Tea Ceremony algorithm works as follows:
-
Chain administrators initiate Tea Ceremony by addressing to the API using
curl
. Here is an example of initialization:curl -d '{"chain_number":666,"nodes":3,"settings":[{"p":["current","chain","blocktime"],"v":2},{"p":["current","chain","minsig"],"v":2},{"p":["current","chain","allowempty"],"v":0},{"p":["current","chain","patchsigs"],"v":2},{"p":["current","allocblock","block"],"v":666},{"p":["current","allocblock","group"],"v":10},{"p":["current","allocblock","last"],"v":0},{"p":["current","endless",["!bin","800140029A000001"],"SK"],"v":true},{"p":["current","endless",["!bin","800140029A000001"],"TST"],"v":true},{"p":["current","freegas"],"v":2000000},{"p":["current","something_left"],"v":["!bin","01020304"]},{"p":["current","gas","SK"],"v":1000},{"p":["current","nosk"],"v":1}]}' https://tea.thepower.io/api/new_ceremony -H "content-type: application/json"
where
- parameters in
''
arejson
-formatted; https://tea.thepower.io/api/new_ceremony
— API address for Tea Ceremony initialization.
- parameters in
-
The request returns a Ceremony token.
-
The users start the Tea Ceremony client on each node in a chain. All node providers in the chain must start the Tea Ceremony client on their nodes to initiate generation of
genesis txt
. Otherwise, the node public keys will not be added intogenesis.txt
and will not be trusted. -
The Tea Ceremony client generates the private keys for nodes.
-
The Tea Ceremony client waits for
genesis.txt
to sign it. -
The Tea Ceremony client sends the signed
genesis.txt
back to the node, where the client was started. -
The Tea Ceremony client creates the node configuration files.
-
The Tea Ceremony waits for
genesis.txt
signed by all the nodes in the chain, and saves it.