specs/docs/draft/12-sticker-pack.md

102 lines
6.6 KiB
Markdown
Raw Normal View History

---
permalink: /spec/12
2020-05-08 07:31:50 +00:00
parent: Draft specs
title: 12/IPFS gateway for Sticker Pack
---
# 12/IPFS gateway for Sticker Pack
2020-05-08 07:31:50 +00:00
> Version: 0.1.0
>
> Status: Draft
>
> Authors: Gheorghe Pinzaru <gheorghe@status.im>
>
## Table of Contents
1. [Abstract](#abstract)
2. [Specification](#specification)
3. [Copyright](#copyright)
## Abstract
Remove personal pronouns (#132) Resolves #115 * Rewrote 'you' and 'your' personal pronouns Additionally I've made related sentences more concise. NOTE I've ignored usages of you and your in comments and in links and section titles * Rewrote 'we' personal pronouns Again not changing usages in comments * Removed 'passive' and/or ambiguous language * Added README information about language mode * Added prepend to word list * Update README.md Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> * Update docs/draft/3-whisper-usage.md Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> * Update docs/draft/3-whisper-usage.md Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> * Added missing 'a's * Moved style related README info into STYLE-GUIDELINE.md * Added reference to Google Technical Writing * Tweaks to maintain consistency of changes across related specs * Addressed spelling and added link to the Discord server * Update docs/draft/12-sticker-pack.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/draft/13-3rd-party.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/draft/13-3rd-party.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/draft/13-3rd-party.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/stable/11-waku-mailserver.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Addressed feedback Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> Co-authored-by: Kim De Mey <kim.demey@gmail.com>
2020-06-03 22:02:45 +00:00
This specification describes how Status uses the IPFS gateway to store stickers.
The specification explores image format, how a user uploads stickers and how an end user can see them inside the Status app.
## Definition
| Term | Description |
|------------------|----------------------------------------------------------------------------------------|
| **Stickers** | A set of images which can be used to express emotions |
| **Sticker Pack** | ERC721 token which includes the set of stickers |
2020-05-08 07:31:50 +00:00
| **IPFS** | P2P network used to store and share data, in this case, the images for the stickerpack |
## Specification
### Image format
Accepted image file types are `PNG`, `JPG/JPEG` and `GIF`, with a maximum allowed size of 300kb.
The minimum sticker image resolution is 512x512, and its background SHOULD be transparent.
### Distribution
Remove personal pronouns (#132) Resolves #115 * Rewrote 'you' and 'your' personal pronouns Additionally I've made related sentences more concise. NOTE I've ignored usages of you and your in comments and in links and section titles * Rewrote 'we' personal pronouns Again not changing usages in comments * Removed 'passive' and/or ambiguous language * Added README information about language mode * Added prepend to word list * Update README.md Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> * Update docs/draft/3-whisper-usage.md Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> * Update docs/draft/3-whisper-usage.md Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> * Added missing 'a's * Moved style related README info into STYLE-GUIDELINE.md * Added reference to Google Technical Writing * Tweaks to maintain consistency of changes across related specs * Addressed spelling and added link to the Discord server * Update docs/draft/12-sticker-pack.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/draft/13-3rd-party.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/draft/13-3rd-party.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/draft/13-3rd-party.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/stable/11-waku-mailserver.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Addressed feedback Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> Co-authored-by: Kim De Mey <kim.demey@gmail.com>
2020-06-03 22:02:45 +00:00
The node implements sticker packs as [ERC721 token](https://eips.ethereum.org/EIPS/eip-721) and contain a set of stickers. The node stores these stickers
inside the sticker pack as a set of hyperlinks pointing to IPFS storage. These hyperlinks are publicly available and can be accessed by any user inside the status chat.
Stickers can be sent in chat only by accounts that own the sticker pack.
### IPFS gateway
At the moment of writing, the current main Status app uses the [Infura](https://infura.io/) gateway. However, clients could choose a different gateway or to run own IPFS node.
2020-05-08 07:31:50 +00:00
Infura gateway is an HTTPS gateway, which based on an HTTP GET request with the multihash block will return the stored content at that block address.
Remove personal pronouns (#132) Resolves #115 * Rewrote 'you' and 'your' personal pronouns Additionally I've made related sentences more concise. NOTE I've ignored usages of you and your in comments and in links and section titles * Rewrote 'we' personal pronouns Again not changing usages in comments * Removed 'passive' and/or ambiguous language * Added README information about language mode * Added prepend to word list * Update README.md Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> * Update docs/draft/3-whisper-usage.md Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> * Update docs/draft/3-whisper-usage.md Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> * Added missing 'a's * Moved style related README info into STYLE-GUIDELINE.md * Added reference to Google Technical Writing * Tweaks to maintain consistency of changes across related specs * Addressed spelling and added link to the Discord server * Update docs/draft/12-sticker-pack.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/draft/13-3rd-party.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/draft/13-3rd-party.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/draft/13-3rd-party.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/stable/11-waku-mailserver.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Addressed feedback Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> Co-authored-by: Kim De Mey <kim.demey@gmail.com>
2020-06-03 22:02:45 +00:00
The node requires the use of a gateway to enable easy access to the resources over HTTP.
The node stores each image of a sticker inside IPFS using a unique address that is
2020-05-08 07:31:50 +00:00
derived from the hash of the file. This ensures that a file can't be overridden, and an end-user of the IPFS will receive the same file at a given address.
2020-05-08 07:31:50 +00:00
### Security
The IPFS gateway acts as an end-user of the IPFS and allows users of the gateway to access IPFS without connection to the P2P network.
Usage of a gateway introduces potential risk for the users of that gateway provider. In case of a compromise in the security of the provider, meta information such as IP address, User-Agent and other of its users can be leaked.
Remove personal pronouns (#132) Resolves #115 * Rewrote 'you' and 'your' personal pronouns Additionally I've made related sentences more concise. NOTE I've ignored usages of you and your in comments and in links and section titles * Rewrote 'we' personal pronouns Again not changing usages in comments * Removed 'passive' and/or ambiguous language * Added README information about language mode * Added prepend to word list * Update README.md Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> * Update docs/draft/3-whisper-usage.md Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> * Update docs/draft/3-whisper-usage.md Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> * Added missing 'a's * Moved style related README info into STYLE-GUIDELINE.md * Added reference to Google Technical Writing * Tweaks to maintain consistency of changes across related specs * Addressed spelling and added link to the Discord server * Update docs/draft/12-sticker-pack.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/draft/13-3rd-party.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/draft/13-3rd-party.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/draft/13-3rd-party.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/stable/11-waku-mailserver.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Addressed feedback Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> Co-authored-by: Kim De Mey <kim.demey@gmail.com>
2020-06-03 22:02:45 +00:00
If the provider servers are unavailable the node loses access through the gateway to the IPFS network.
2020-05-08 07:31:50 +00:00
### Status sticker usage
Remove personal pronouns (#132) Resolves #115 * Rewrote 'you' and 'your' personal pronouns Additionally I've made related sentences more concise. NOTE I've ignored usages of you and your in comments and in links and section titles * Rewrote 'we' personal pronouns Again not changing usages in comments * Removed 'passive' and/or ambiguous language * Added README information about language mode * Added prepend to word list * Update README.md Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> * Update docs/draft/3-whisper-usage.md Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> * Update docs/draft/3-whisper-usage.md Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> * Added missing 'a's * Moved style related README info into STYLE-GUIDELINE.md * Added reference to Google Technical Writing * Tweaks to maintain consistency of changes across related specs * Addressed spelling and added link to the Discord server * Update docs/draft/12-sticker-pack.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/draft/13-3rd-party.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/draft/13-3rd-party.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/draft/13-3rd-party.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/stable/11-waku-mailserver.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Addressed feedback Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> Co-authored-by: Kim De Mey <kim.demey@gmail.com>
2020-06-03 22:02:45 +00:00
When the app shows a sticker, the Status app makes an HTTP GET request to IPFS gateway using the hyperlink.
2020-05-08 07:31:50 +00:00
To send a sticker in chat, a user of Status should buy or install a sticker pack.
To be available for installation a Sticker Pack should be submitted to Sticker market by an author.
#### Submit a sticker
To submit a sticker pack, the author should upload all assets to IPFS. Then generate a payload including name, author, thumbnail, preview and a list of stickers in the [EDN format](https://github.com/edn-format/edn). Following this structure:
```
{meta {:name "Sticker pack name"
:author "Author Name"
2020-05-13 13:59:08 +00:00
:thumbnail "e30101701220602163b4f56c747333f43775fdcbe4e62d6a3e147b22aaf6097ce0143a6b2373"
:preview "e30101701220ef54a5354b78ef82e542bd468f58804de71c8ec268da7968a1422909357f2456"
:stickers [{:hash "e301017012207737b75367b8068e5bdd027d7b71a25138c83e155d1f0c9bc5c48ff158724495"}
{:hash "e301017012201a9cdea03f27cda1aede7315f79579e160c7b2b6a2eb51a66e47a96f47fe5284"}]}}
2020-05-08 07:31:50 +00:00
```
Remove personal pronouns (#132) Resolves #115 * Rewrote 'you' and 'your' personal pronouns Additionally I've made related sentences more concise. NOTE I've ignored usages of you and your in comments and in links and section titles * Rewrote 'we' personal pronouns Again not changing usages in comments * Removed 'passive' and/or ambiguous language * Added README information about language mode * Added prepend to word list * Update README.md Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> * Update docs/draft/3-whisper-usage.md Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> * Update docs/draft/3-whisper-usage.md Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> * Added missing 'a's * Moved style related README info into STYLE-GUIDELINE.md * Added reference to Google Technical Writing * Tweaks to maintain consistency of changes across related specs * Addressed spelling and added link to the Discord server * Update docs/draft/12-sticker-pack.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/draft/13-3rd-party.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/draft/13-3rd-party.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/draft/13-3rd-party.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/stable/11-waku-mailserver.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Addressed feedback Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> Co-authored-by: Kim De Mey <kim.demey@gmail.com>
2020-06-03 22:02:45 +00:00
All asset fields, are contenthash fields as per [EIP 1577](https://eips.ethereum.org/EIPS/eip-1577).
The node also uploads this payload to IPFS, and the node uses the IPFS address in the content field of the Sticker Market contract. See [Sticker Market spec](https://github.com/status-im/sticker-market/blob/651e88e5f38c690e57ecaad47f46b9641b8b1e27/docs/specification.md) for a detailed description of the contract.
2020-05-08 07:31:50 +00:00
#### Install a sticker pack
Remove personal pronouns (#132) Resolves #115 * Rewrote 'you' and 'your' personal pronouns Additionally I've made related sentences more concise. NOTE I've ignored usages of you and your in comments and in links and section titles * Rewrote 'we' personal pronouns Again not changing usages in comments * Removed 'passive' and/or ambiguous language * Added README information about language mode * Added prepend to word list * Update README.md Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> * Update docs/draft/3-whisper-usage.md Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> * Update docs/draft/3-whisper-usage.md Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> * Added missing 'a's * Moved style related README info into STYLE-GUIDELINE.md * Added reference to Google Technical Writing * Tweaks to maintain consistency of changes across related specs * Addressed spelling and added link to the Discord server * Update docs/draft/12-sticker-pack.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/draft/13-3rd-party.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/draft/13-3rd-party.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/draft/13-3rd-party.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/stable/11-waku-mailserver.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Addressed feedback Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> Co-authored-by: Kim De Mey <kim.demey@gmail.com>
2020-06-03 22:02:45 +00:00
To install a sticker pack, the node fetches all sticker packs available in Sticker Market. The node needs the following steps to fetch all sticker packs:
#### 1. Get total number of sticker packs
Call `packCount()` on the sticker market contract, will return number of sticker pack registered as `uint256`.
#### 2. Get sticker pack by id
Remove personal pronouns (#132) Resolves #115 * Rewrote 'you' and 'your' personal pronouns Additionally I've made related sentences more concise. NOTE I've ignored usages of you and your in comments and in links and section titles * Rewrote 'we' personal pronouns Again not changing usages in comments * Removed 'passive' and/or ambiguous language * Added README information about language mode * Added prepend to word list * Update README.md Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> * Update docs/draft/3-whisper-usage.md Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> * Update docs/draft/3-whisper-usage.md Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> * Added missing 'a's * Moved style related README info into STYLE-GUIDELINE.md * Added reference to Google Technical Writing * Tweaks to maintain consistency of changes across related specs * Addressed spelling and added link to the Discord server * Update docs/draft/12-sticker-pack.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/draft/13-3rd-party.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/draft/13-3rd-party.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/draft/13-3rd-party.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/stable/11-waku-mailserver.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Addressed feedback Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> Co-authored-by: Kim De Mey <kim.demey@gmail.com>
2020-06-03 22:02:45 +00:00
ID's are represented as `uint256` and are incremental from `0` to total number of sticker packs in the contract, received in the previous step. To get a sticker pack call `getPackData(sticker-pack-id)`, the return type is `["bytes4[]" "address" "bool" "uint256" "uint256" "bytes"]` which represents the following fields: `[category owner mintable timestamp price contenthash]`. Price is the SNT value in wei set by sticker pack owner. The contenthash is the IPFS address described in the [submit description](#submit-a-sticker) above. Other fields specification could be found in [Sticker Market spec](https://github.com/status-im/sticker-market/blob/651e88e5f38c690e57ecaad47f46b9641b8b1e27/docs/specification.md)
2020-05-08 07:31:50 +00:00
##### 3. Get owned sticker packs
Remove personal pronouns (#132) Resolves #115 * Rewrote 'you' and 'your' personal pronouns Additionally I've made related sentences more concise. NOTE I've ignored usages of you and your in comments and in links and section titles * Rewrote 'we' personal pronouns Again not changing usages in comments * Removed 'passive' and/or ambiguous language * Added README information about language mode * Added prepend to word list * Update README.md Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> * Update docs/draft/3-whisper-usage.md Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> * Update docs/draft/3-whisper-usage.md Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> * Added missing 'a's * Moved style related README info into STYLE-GUIDELINE.md * Added reference to Google Technical Writing * Tweaks to maintain consistency of changes across related specs * Addressed spelling and added link to the Discord server * Update docs/draft/12-sticker-pack.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/draft/13-3rd-party.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/draft/13-3rd-party.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/draft/13-3rd-party.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/stable/11-waku-mailserver.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Addressed feedback Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> Co-authored-by: Kim De Mey <kim.demey@gmail.com>
2020-06-03 22:02:45 +00:00
The current Status app fetches owned sticker packs during the open of any sticker view (a screen which shows a sticker pack, or the list of sticker packs).
To get owned packs, get all owned tokens for the current account address, by calling `balanceOf(address)` where address is the address for the current account. This method returns a `uint256` representing the count of available tokens. Using `tokenOfOwnerByIndex(address,uint256)` method, with the address of the user and ID in form of a `uint256` which is an incremented int from 0 to the total number of tokens, gives the token id. To get the sticker pack id from a token call`tokenPackId(uint256)` where `uint256` is the token id. This method will return an `uint256` which is the id of the owned sticker pack.
##### 4. Buy a sticker pack
Remove personal pronouns (#132) Resolves #115 * Rewrote 'you' and 'your' personal pronouns Additionally I've made related sentences more concise. NOTE I've ignored usages of you and your in comments and in links and section titles * Rewrote 'we' personal pronouns Again not changing usages in comments * Removed 'passive' and/or ambiguous language * Added README information about language mode * Added prepend to word list * Update README.md Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> * Update docs/draft/3-whisper-usage.md Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> * Update docs/draft/3-whisper-usage.md Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> * Added missing 'a's * Moved style related README info into STYLE-GUIDELINE.md * Added reference to Google Technical Writing * Tweaks to maintain consistency of changes across related specs * Addressed spelling and added link to the Discord server * Update docs/draft/12-sticker-pack.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/draft/13-3rd-party.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/draft/13-3rd-party.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/draft/13-3rd-party.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Update docs/stable/11-waku-mailserver.md Co-authored-by: Kim De Mey <kim.demey@gmail.com> * Addressed feedback Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> Co-authored-by: Kim De Mey <kim.demey@gmail.com>
2020-06-03 22:02:45 +00:00
To buy a sticker pack call `approveAndCall(address,uint256,bytes)` where `address` is the address of buyer,`uint256` is the price and third parameters `bytes` is the callback called if approved. In the callback, call `buyToken(uint256,address,uint256)`, first parameter is sticker pack id, second buyers address, and the last is the price.
## Copyright
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).