Links

Sell Content

Learn how to monetize your Smart Vault content in a peer-to-peer manner without any intermediary or fees.

How to sell

Step 1: Upload commercial content

Add the commercial content, you wish to sell later, to your node's storage. We will be selling a "rare" image from the It Crowd series.

Add the image to your node

curl -X POST \
http://localhost:9091/storage/add \
-H 'multipart/form-data; boundary="===============1648430772=="' \
-F owner=YOUR_NODE_1_ACCT \
-F password=YOUR_NODE_1_ACCT_PWD \
-F file=@it_crowd.jpg
{
"acl":"0xEB9D37F30F406e2642E211C19Ed6F7A5FC6d8Ec4",
"meta":"QmNnUze4f1QfnSQJFFco2hdPWZb2iXUjcB2onAzxLQQj5f"
}

Step 2: Create your eShop

Create your online Shop:
curl --location --request POST 'http://127.0.0.1:9091/shop/create' \
--header 'Content-Type: application/json' \
--data-raw '{
"from": "YOUR_NODE_1_ACCT",
"password": "YOUR_NODE_1_ACCT_PWD"
}'
> {"shop":"0x5BE0Ca57069d25dA6bc65c2a5043E0aa447BCD46"}
Check the Shop Balance using Sirius Blockchain Explorer: https://explorer.sirius.lightstreams.io/addr/0x5BE0Ca57069d25dA6bc65c2a5043E0aa447BCD46

Step 3: Add content for sale

Sell the access to your file, let's say for 5 PHT, at your newly created online, decentralized eShop:
curl --location --request POST 'http://127.0.0.1:9091/shop/sell' \
--header 'Content-Type: application/json' \
--data-raw '{
"shop": "0x5BE0Ca57069d25dA6bc65c2a5043E0aa447BCD46",
"from": "YOUR_NODE_1",
"password": "YOUR_NODE_1_ACCT_PWD",
"acl": "0xEB9D37F30F406e2642E211C19Ed6F7A5FC6d8Ec4",
"price_wei": "5000000000000000000"
}'
From this moment, anyone can get read access to your commercial content by simply purchasing the permission to access it.
You can announce in social media that:
  • the Read ACL Permission 0xEB9D37F30F406e2642E211C19Ed6F7A5FC6d8Ec4
  • to your file QmNnUze4f1QfnSQJFFco2hdPWZb2iXUjcB2onAzxLQQj5f
  • is available to be purchased for 1 PHT
  • at your online digital shop 0xffeF98e9de5524Eaf82A8DE88B031160f694a90A

How to buy

All the steps below will be executed on a separate Node with ID 2.

Attempt to steal it

If a malicious buyer would try to by-pass the purchasing process and download the file directly, he would run into an error:
// generates token
curl --location --request POST 'http://localhost:9092/user/signin' \
--header 'Content-Type: application/json' \
--data-raw '{
"account": "THIEF_NODE_2_ACC",
"password": "THIEF_NODE_2_ACC_PWD"
}'
> { "token": "eyJibG9DB9...hUh4yICLseCD5ejRs" }
// attempts to stream the file he did NOT purchase
curl --request GET 'http://localhost:9092/storage/stream?meta=[meta]&token=[token]'
// expected error output
{"error":{
"message": "no READ access. Account '[THIEF_NODE_2_ACC]' is unable to access Smart Vault protected file '[hash]' with public meta '[meta]'.",
"code":"TOKEN_DENIED"
}

Step 1: Buy the content

Buying the access to the file (an ACL READ permission):
curl --location --request POST 'http://127.0.0.1:9092/shop/buy' \
--header 'Content-Type: application/json' \
--data-raw '{
"shop": "0x5BE0Ca57069d25dA6bc65c2a5043E0aa447BCD46",
"from": "BUYER_NODE_2_ACC",
"password": "BUYER_NODE_2_ACC_PWD",
"acl": "0xEB9D37F30F406e2642E211C19Ed6F7A5FC6d8Ec4"
}'
> {"success":"true"}

Step 2: Stream the purchased content

To read documents using the HTTP API, you first need to generate a token:
curl --location --request POST 'http://localhost:9092/user/signin' \
--header 'Content-Type: application/json' \
--data-raw '{
"account": "BUYER_NODE_2_ACC",
"password": "BUYER_NODE_2_ACC_PWD"
}'
> { "token": "eyJibG9ja2NoYWluIjoiRVRIIiwiZX..." }
Use the generated token to stream the content:
curl --request GET 'http://localhost:9092/storage/stream?meta=[meta]&token=[token]' > purchased_it-crowd.jpg

Open the purchased content:

open purchased_it-crowd.jpg

Shop sale earnings

As result from the previous purchase the eShop balance has increased by 5 PHT: