serai/docs/protocol/Constants.md
Luke Parker 6a981dae6e
Make Validator Set Network a first-class property
There already should only be one validator set operating per network. This
formalizes that. Then, validator sets used to be able to operate over multiple
networks. That is no longer possible.

This formalization increases validator set flexibility while also allowing the
ability to formalize the definiton of tokens (which is necessary to define a
gas asset).
2023-03-25 01:30:53 -04:00

45 lines
1.7 KiB
Markdown

# Constants
### Types
These are the list of types used to represent various properties within the
protocol.
| Alias | Type |
|-----------------|----------------------------------------------|
| SeraiAddress | sr25519::Public (unchecked [u8; 32] wrapper) |
| Amount | u64 |
| NetworkId | u16 |
| Coin | u32 |
| Network | Vec<Coin> |
| Session | u32 |
| Validator Set | (Session, NetworkId) |
| Key | BoundedVec\<u8, 96> |
| ExternalAddress | BoundedVec\<u8, 128> |
| Data | BoundedVec\<u8, 512> |
### Networks
Every network connected to Serai operates over a specific curve. The processor
generates a distinct set of keys per network. Beyond the key-generation itself
being isolated, the generated keys are further bound to their respective
networks via an additive offset created by hashing the network's name (among
other properties). The network's key is used for all coins on that network.
| Network | Curve | ID |
|----------|-----------|----|
| Bitcoin | Secp256k1 | 0 |
| Ethereum | Secp256k1 | 1 |
| Monero | Ed25519 | 2 |
### Coins
Coins exist over a network and have a distinct integer ID.
| Coin | Network | ID |
|----------|----------|----|
| Serai | Serai | 0 |
| Bitcoin | Bitcoin | 1 |
| Ether | Ethereum | 2 |
| DAI | Ethereum | 3 |
| Monero | Monero | 4 |