Crates.io | sgraph |
lib.rs | sgraph |
version | 0.1.2 |
source | src |
created_at | 2023-03-02 18:35:24.208456 |
updated_at | 2023-03-02 19:48:31.506644 |
description | Created with Anchor |
homepage | https://sgraph.io |
repository | https://github.com/sgraph-protocol/sgraph |
max_upload_size | |
id | 799090 |
size | 1,633,795 |
Welcome to sgraph monorepo
A permissionless social graph that enables any relation or event to become a shared record on the web.
Sgraph allows to:
While various different graph technologies and protocols exist, there isn't a single technology which could combine them together into a single universal public registry that is:
Imagine that Alice follows Bob on Platform X and Bob flagged Charlie on Platform Y. Instead of storing those relations locally on, sgraph allows to share these relations on-chain so Platform X, Platform Y, and any others apps and users can benefit from that information.
sgraph is operating on Solana blockchain. Core contract manages all writes to the graph.
In order to consume as little space as possible while making writes essentially free, sgraph uses technology called SPL Account Compression. Instead of actual data (relations), only hashes are stored on-chain. Naturally, in order to read data, it must be indexed somewhere off-chain. To do this, one must run indexer
- a dedicated binary that maintains a local copy of all the relations.
We aim to make indexer
easy to deploy and maintain, so that it's benefits (such as incredible read performace) outweigh the initial investment in setting it up. Hosted version of indexer
will also be available.
Diagram explaining different sgraph entities (click to view)
|-- programs
| |-- graph => Core contract
| `-- usersig => Manual signature provider (checkout out it's README.md)
| `-- cli => Utilities to create relations using usersig
|-- sdk
| `-- js => Typescript SDK
| `-- _examples => Examples of interaction with the graph
|-- indexer => Worker that caches relations locally
# start localnet
solana-test-validator
# deploy contracts on localnet
# install anchor at https://www.anchor-lang.com/docs/installation
anchor build && anchor deploy
npx ts-node ~/sgraph/sdk/js/cli/initTree.ts <tree-keypair> <authority-keypair>
# run examples
set -x ANCHOR_WALLET "~/.config/solana/id.json" # set to path to your wallet
npx ts-node sdk/js/_examples/full.ts
Addresses:
Crates/Docs | Mainnet/Devnet/Testnet | Provider addr | |
---|---|---|---|
graph | graph8zS8zjLVJHdiSvP7S9PP7hNJpnHdbnJLR81FMg | N/A | |
usersig | s1gsZrDJAXNYSCRhQZk5X3mYyBjAmaVBTYnNhCzj8t2 | 8MgDy6gEztWYsS2PKhBkYPCVDb6VQJ4XkTChtwayXvyB |
Public indexer instances:
env | url |
---|---|
mainnet | https://api.sgraph.io |
devnet | https://dev.api.sgraph.io |
Running locally is recommended for production use
Read how you can run your instance of in ./indexer/README.md
Coming soon: Events
TODO:
Integration tests
More SDK helpers
More providers!
Open issue, start a discussion or don't hesitate to ping us at hello at sgraph.io
.
Security-related issues should only be reported to email listed above.
Apache 2.0. See LICENSE