Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit 70c5ed3

Browse files
Merge pull request #86 from ava-labs/launch-readme
Launch readme
2 parents 0bed78c + c6c3120 commit 70c5ed3

File tree

2 files changed

+115
-71
lines changed

2 files changed

+115
-71
lines changed

README.md

Lines changed: 115 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,124 @@
1-
# SpacesVM
1+
# Spaces Virtual Machine (SpacesVM)
22

3-
Avalanche is a network composed of multiple blockchains. Each blockchain is an instance
4-
of a [Virtual Machine (VM)](https://docs.avax.network/learn/platform-overview#virtual-machines),
3+
_Authenticated, Hierarchical Key-Value Store w/EIP-712 Compatibility,
4+
Programmatic Expiry, Async Pruning, and Fee-Based Metering_
5+
6+
## Avalanche Subnets and Custom VMs
7+
Avalanche is a network composed of multiple sub-networks (called subnets) that each contain
8+
any number of blockchains. Each blockchain is an instance of a
9+
[Virtual Machine (VM)](https://docs.avax.network/learn/platform-overview#virtual-machines),
510
much like an object in an object-oriented language is an instance of a class. That is,
6-
the VM defines the behavior of the blockchain where it is instantiated. The use of
7-
[Coreth (EVM)](https://github.com/ava-labs/coreth) on the [Avalanche C-Chain](https://docs.avax.network/learn/platform-overview)
8-
is a canonical use case of a virtual machine (EVM) and its instantiation (C-Chain) on the Primary Subnet (Avalanche Mainnet). One
9-
could deploy their own instance of the EVM as their own blockchain (to take
10-
this to its logical conclusion.
11+
the VM defines the behavior of the blockchain where it is instantiated. For example,
12+
[Coreth (EVM)](https://github.com/ava-labs/coreth) is a VM that is instantiated by the
13+
[Avalanche C-Chain](https://docs.avax.network/learn/platform-overview). Likewise, one
14+
could deploy another instance of the EVM as their own blockchain (to take
15+
this to its logical conclusion).
1116

17+
## Introduction
1218
Just as Coreth powers the C-Chain, SpacesVM can be used to power its own
13-
blockchain. However, instead of providing a place to execute smart contracts on
14-
decentralized applications, SpacesVM enables anyone to store arbitrary data for
15-
fast retrieval, like a Key-Value Database where a single party controls an
16-
entire hierarchy of keys, you can claim your own hierarchy. (TODO).
17-
18-
You could build...
19-
* Name Service
20-
* Link Service
21-
* dApp Metadata Backend
22-
* Twitter Feed-like
23-
* NFT Storage (value hashing)
24-
25-
## How it Works
26-
### Action Types
27-
#### Claim
28-
29-
##### Community support
19+
blockchain in an Avalanche Subnet. Instead of providing a place to execute Solidity
20+
smart contracts, however, SpacesVM enables authenticated, hierarchical storage of arbitrary
21+
keys/values using any [EIP-712](https://eips.ethereum.org/EIPS/eip-712) compatible wallet.
3022

31-
#### Set/Delete
23+
### Authenticated
24+
All modifications of storage require the signature of the owner
25+
of a "space"
3226

33-
##### Arbitrary Size File Support (using CLI)
27+
### Hierarchical
28+
Owners can modify any key in their "space" (ex: `owner/*`), however, no one
29+
else can
3430

35-
#### Resolve
31+
### Arbitrary Key/Value Storage
32+
As long as a key is `^[a-z0-9]{1,256}$`, it can be used as an identifier in
33+
SpacesVM. The max length of values is defined in genesis but typically ranges
34+
between 64-200KB. Any number of values can be linked together to store files in
35+
the > 100s of MBs range (as long as you have the `SPC` to pay for it).
3636

37-
#### Transfer
37+
### EIP-712 Compatible
38+
![wallet-signing](./imgs/wallet-signing.png)
3839

39-
#### Move
40+
The canonical digest of a SpacesVM transaction is EIP-712 compliant, so any
41+
Web3 wallet that can sign typed data can be used to interact with SpacesVM.
4042

41-
### Wallet Support: `eth_typedSignedData`
42-
TODO: Insert image of signing using MM
43+
## [Demo: https://tryspaces.xyz](https://tryspaces.xyz)
44+
What better way to understand how the the SpacesVM works than to see it in action?
45+
Well anon, you are in luck!
4346

44-
### Reserved Spaces
45-
address space is reserved
47+
You can try out the SpacesVM at [https://tryspaces.xyz)](https://tryspaces.xyz). All you need
48+
is a EIP-712 Compatible Web3 Wallet (like MetaMask) and some `SPC` (all 973k of
49+
you that interacted with the C-Chain more than 2 times got 10k `SPC` to get you
50+
started).
4651

47-
### Content Addressing
48-
SpacesVM verifies that values associated with keys that are length 66 (0x + hex-encoded keccak256 hash) are valid hashes.
52+
This demo is running as an Avalanche Subnet on Fuji. It is **ALPHA LEVEL CODE** and may be
53+
restarted/have a few bugs in it. It exists for demonstration purposes **ONLY**
54+
but could be extended to run as a production-level Subnet on Avalanche Mainnet.
4955

50-
### Fee Mechanisms
51-
Claim Desirability + Decay Rate
52-
FeeUnits vs Load Units vs Expiry Units (per action)
56+
## How it Works
57+
### Claim
58+
Interacting with the SpacesVM starts with a `ClaimTx`. This reserves your own
59+
"space" and associates your address with it (so that only you can make changes
60+
to it and/or the keys in it).
61+
62+
#### Reserved Spaces
63+
Spaces of length 66 (`0x + hex-encoded EVM-style address`) are reserved for
64+
address holders. Only the person who can produce a valid signature for a given
65+
address can claim these types of spaces.
66+
67+
### Set/Delete
68+
Once you have a space, you can then use `SetTx` and `DeleteTx` actions to
69+
add/modify/delete keys in it. The more storage your space uses, the faster it
70+
will expire.
71+
72+
#### Content-Addressable Keys
73+
To support common blockchain use cases (like NFT storage), the SpacesVM
74+
supports the storage of arbitrary size files using content-addressable keys.
75+
You can try this out using `spaces-cli set-file <space> <filename>`.
76+
77+
### Lifeline
78+
When your space uses a lot of storage and/or you've had it for a while, you may
79+
need to extend its life using a `LifelineTx`. If you don't, your space will
80+
eventually become inaccessible and all data stored within it will be deleted by
81+
the SpacesVM.
82+
83+
#### Community Space Support
84+
It is not required that you own a space to submit a `LifelineTx` that extends
85+
its life. This enables the community to support useful spaces with their `SPC`.
86+
87+
### Resolve
88+
When you want to view data stored in SpacesVM, you call `Resolve` on the value
89+
path: `<space>/<key>`. If you stored a file at a particular path, use this
90+
command to retrieve it: `spaces-cli resolve-file <path> <destination
91+
filepath>`.
92+
93+
### Transfer
94+
If you want to share some of your `SPC` with your friends, you can use
95+
a `TransferTx` to send to any EVM-style address.
96+
97+
### Move
98+
If you want to share a space with a friend, you can use a `MoveTx` to transfer
99+
it to any EVM-style address.
53100

54101
### Space Rewards
55-
Lottery allocation X% of fee
102+
50% of the fees spent on each transaction are sent to a random space owner (as
103+
long as the randomly selected recipient is not the creator of the transaction).
104+
105+
One could the SpacesVM to instead send rewards to a beneficiary chosen by
106+
whoever produces a block.
56107

57-
One could easily modify this repository to instead send rewards to
58-
beneficiaries chosen by whoever produces a block.
108+
### Fees
109+
All interactions with the SpacesVM require the payment of fees (denominated in
110+
`SPC`). The VM Genesis includes support for allocating one-off `SPC` to
111+
different EVM-style addresses and to allocating `SPC` to an airdrop list.
59112

60-
### Genesis Allocation -> public beta only
61-
Airdrop `10,000 SPC` for anyone who has interacted with C-Chain more than
62-
twice.
113+
Nearly all fee-related params can be tuned by the SpacesVM deployer.
63114

64115
## Usage
65116
_If you are interested in running the VM, not using it. Jump to [Running the
66117
VM](#running-the-vm)._
67118

68-
Public Beta...
69-
70-
### tryspaces.xyz
71-
What better way to understand how this works than to see it in action?
72-
73-
TODO: insert try spaces image + link
74-
75-
Hooked up to public beta
119+
### [tryspaces.xyz](https://tryspaces.xyz)
120+
The easiest way to try out SpacesVM is to visit the demo website
121+
[trysapces.xyz](https://tryspaces.xyz).
76122

77123
### spaces-cli
78124
#### Install
@@ -120,9 +166,9 @@ Use "spaces-cli [command] --help" for more information about a command.
120166

121167
##### Uploading Files
122168
```
123-
spaces-cli set-file patrick ~/Downloads/computer.gif -> patrick/6fe5a52f52b34fb1e07ba90bad47811c645176d0d49ef0c7a7b4b22013f676c8
124-
spaces-cli resolve-file patrick/6fe5a52f52b34fb1e07ba90bad47811c645176d0d49ef0c7a7b4b22013f676c8 computer_copy.gif
125-
spaces-cli delete-file patrick/6fe5a52f52b34fb1e07ba90bad47811c645176d0d49ef0c7a7b4b22013f676c8
169+
spaces-cli set-file spaceslover ~/Downloads/computer.gif -> patrick/6fe5a52f52b34fb1e07ba90bad47811c645176d0d49ef0c7a7b4b22013f676c8
170+
spaces-cli resolve-file spaceslover/6fe5a52f52b34fb1e07ba90bad47811c645176d0d49ef0c7a7b4b22013f676c8 computer_copy.gif
171+
spaces-cli delete-file spaceslover/6fe5a52f52b34fb1e07ba90bad47811c645176d0d49ef0c7a7b4b22013f676c8
126172
```
127173

128174
### [Golang SDK](https://github.com/ava-labs/spacesvm/blob/master/client/client.go)
@@ -460,29 +506,18 @@ _Can use this to get the current fee rate._
460506
```
461507

462508
## Running the VM
463-
To build the VM, run `./scripts/build.sh`.
509+
To build the VM (and `spaces-cli`), run `./scripts/build.sh`.
464510

465511
### Joining the public beta
466-
Put spacesvm binary in plugins dir
467-
Add subnet-id to whitelisted-subnets
468-
469-
TODO: set bootstrap nodes
470-
471-
Here is an example config file:
472-
--network-id=fuji
473-
474-
Make sure to add these commands when running the node:
475-
--config-file
476-
477-
If you'd like to become a validator, reach out to @\_patrickogrady on Twitter
512+
If you'd like to become a validator on the demo, reach out to @\_patrickogrady on Twitter
478513
after you've joined the network and synced to tip. Please send a screenshot
479514
indicating you've done this successfully.
480515

481516
### Running a local network
482-
[`scripts/run.sh`](scripts/run.sh) automatically installs [avalanchego](https://github.com/ava-labs/avalanchego) to set up a local network
517+
[`scripts/run.sh`](scripts/run.sh) automatically installs [avalanchego](https://github.com/ava-labs/avalanchego), sets up a local network,
483518
and creates a `spacesvm` genesis file. To build and run E2E tests, you need to set the variable `E2E` before it: `E2E=true ./scripts/run.sh 1.7.4`
484519

485-
See [`tests/e2e`](tests/e2e) and [`tests/runner`](tests/runner) to see how it's set up and how its client requests are made:
520+
_See [`tests/e2e`](tests/e2e) and [`tests/runner`](tests/runner) to see how it's set up and how its client requests are made._
486521

487522
```bash
488523
# to startup a local cluster (good for development)
@@ -540,3 +575,12 @@ COMMENT
540575
# to terminate the cluster
541576
kill 12811
542577
```
578+
579+
### Deploying Your Own Network
580+
Anyone can deploy their own instance of the SpacesVM as a subnet on Avalanche.
581+
All you need to do is compile it, create a genesis, and send a few txs to the
582+
P-Chain.
583+
584+
You can do this by following [the tutorial
585+
online](https://docs.avax.network/build/tutorials/platform/subnets/create-a-subnet/)
586+
or by using the [subnet-cli](https://github.com/ava-labs/subnet-cli).

imgs/wallet_signing.png

527 KB
Loading

0 commit comments

Comments
 (0)