---
# System prepended metadata

title: Light account integration (Work in progress)

---

---
title: Light account integration (Work in progress)

---


### Light accounts integration guide

Integrating SPK Network light accounts into an existing hive DAPP.



### References

- https://union.us-02.infra.3speak.tv/api/v2/graphql - Union indexer graphql explorer
- https://us-01.infra.3speak.tv/v1/graphql - Offchain only graphql explorer endpoint.
- https://github.com/spknetwork/spk-beta-site - Exampe of logging in with a hive account and generating an offchain account
- https://github.com/spknetwork/union-indexer-node - Unified HIVE & Offchain indexer
- https://github.com/spknetwork/spk-indexer-node - Offchain indexer
- [Architecture diagram](https://ipfs.3speak.tv/ipfs/QmU7vmGgHdU296roBHKCcd4zqaTu4XiPr6FYK1RTfUCWN5)
- [Code examples](https://ipfs.3speak.tv/ipfs/QmbHZwuQPYUVZTqav2Q7v7kx1E4S2tHJEodcNuatdV1Vfw)
 
### Considerations

Most important, DApps need to consider what desired functionality is required of a backend/indexing solution like what SPK network has built. These are either universal features or more app specfic features. During the initial phases we might not have (or know) all the desired functionality dapps require. Providing the SPK Network team with a list of desired functionality as it will aid our development process and improve developer experience. 


### 1. Installing and using graphql

We strongly recommend using apollo client for graphql queries for both react contexts and non contexts. In react based webapps apollos provides out of the box hooks to interact with a graphql API of choice.


Installation Guide: https://www.apollographql.com/docs/react/get-started/


### 2. Installing and using Ceramic + SPK Network indexer

To modify offchain content you will need to install ceramic's http library and a small library that is specifically designed to interact with offchain social objects.

Ceramic deps: 
`
npm install @ceramicnetwork/http-client @ceramicstudio/idx key-did-provider-ed25519 key-did-resolver dids
`

SPK network deps:

`
npm install @spknetwork/graph-client @hiveio/dhive
`


Example code available [here](https://ipfs.3speak.tv/ipfs/QmbHZwuQPYUVZTqav2Q7v7kx1E4S2tHJEodcNuatdV1Vfw)


### 2.b Login methods

The predominant need for Ceramic comes from the desire to post decentralized content from using other blockchain identities such as Ethereum, Binance smart chain, etc. Thus the predominant support is geared around metamask integration. However, Ceramic accounts can also be generated from a hive account using hive keychain.


Sign in with HIVE: https://github.com/spknetwork/spk-beta-site/blob/main/src/contexts/AccountContext.js

Example code available [here](https://ipfs.3speak.tv/ipfs/QmbHZwuQPYUVZTqav2Q7v7kx1E4S2tHJEodcNuatdV1Vfw)

### 3. Posting content



```
await ClientInstance.client.createDocument({
    title: title,
    body: markdownString,
    debug_metadata: {
    	auth_id: authInfo.authId
    }
})
```


This will create a post at <user DID>/<short random permlink> 
    
    

Example code available [here](https://ipfs.3speak.tv/ipfs/QmbHZwuQPYUVZTqav2Q7v7kx1E4S2tHJEodcNuatdV1Vfw)