This software "sunrise-data" is a program to publish and retrieve the BLOB data from off chain storage like IPFS, Arweave and so on.
sunrise-data uses IPFS protocol to upload metadata and shard to IPFS.
We can download official prebuilt binaries from https://dist.ipfs.tech#kubo and Extract 'kubo_v0.29.0_linux-amd64.tar.gz" after download.
wget https://dist.ipfs.tech/kubo/v0.29.0/kubo_v0.29.0_darwin-amd64.tar.gz
MacOS
mv ./kubo/ipfs /usr/local/bin/
Linux
$ cd kubo_v0.29.0_linux-amd64/kubo
$ sudo ./install.sh
To check ipfs has been installed.
$ ipfs version
ipfs version 0.29.0
$ ipfs init --profile=lowpower
$ ipfs daemon
$ ipfs id
$ ipfs bootstrap add /ip4/13.114.102.20/tcp/4001/p2p/12D3KooWSBJ1warTMHy7bdaViev6udyWU8XBnz9QCYS8TSX9qadt
You can visit http://localhost:8080/ipfs to check runing IPFS RPC.
This project need to store in directory stored "sunrise" codebase
$ ls
sunrise
sunrise-data
-
Prepare config.toml Copy config.default.toml to config.toml and replace your configurations.
Note: To connect to a local IPFS daemon, leave the
ipfs_api_url
field empty. For a remote IPFS daemon, specify the HTTP URL along with the rpc port number, e.g.http://1.2.3.4:5001
. -
Run daemon
$ make dev
- Install daemon
$ make install
$ sunrise-data
Request JSON:
{
"blob": "Base64 Encoded string",
"shard_count_half": number,
"protocol": "ipfs" or "arweave"
}
Response JSON:
{
metadata_uri: "metadata_uri"
}
Response:
{
shard_size: number,
shard_uris:[
"uri1",
"uri2",
...
],
shard_hashes:[
"base64 encoded shard for index1",
"base64 encoded shard for index2",
"base64 encoded shard for index3",
...
]
}
Response:
{
blob:"base64 encoded blob",
}
In case that error occurs on API service, Endpoint returns HTTP 400 code and error msg.
POST http://localhost:8000/api/publish
Request
{
"blob": "MTIzNDU2Nzg5MDEyMzQ1Njc4OTA=", // "12345678901234567890"
"shard_count_half": 10,
"protocol": "ipfs" // or "arweave"
}
Response
{
metadata_uri: "ipfs://QmPXFt19HTkGjoZcbavLEgYYsuPm2xJR7hkhQxtRgPURMU"
}
GET http://localhost:8000/api/shard-hashes?metadata_uri=ipfs://QmPdJ4GtFRvpkbsn47d1HbEioSYtSvgAYDkq5KsL5xUb1C&indices=1,2,3
{
"shard_size":7,
"shard_uris":[
"ipfs://QmYbgKse7s4S1qSrz139zsPECYSu9HbHuz9TBy7ZDEKi54",
"ipfs://QmWGhZL3maoUPbaYNauhq4BLL33xZdrf9Bi7xHUMFgtnV7",
"ipfs://QmapUiNguJpqfuWdxtUJ1GPp5264yCLN5aMJqgWJvxdaEu",
"ipfs://QmXLtGEkGVcRZukdaftW3M979SPWDaZidt6EpjkEk4SjCv",
"ipfs://QmQzrZhSG3hAfwfJinMjiwC66MnJV6LxaVtLNKCjWaRdmj",
"ipfs://Qmd2tYLCM7YecjoLA9ppJNPRgQnshVfdoiPwnux3WiyS2H"
],
"shard_hashes":[
"JvpetAD7cXIa6zMnWYOyOCfYD+g68xbHBVU5CEKz9OI=",
"DKLinTzcoegAW/1rEIfBswH0ZXu6+W0V01PZb83Xmzg=",
"A0+kyUqS08YRt34emU3OISrcCOWn3z7kCkBzftiKqog="
]
}
GET http://localhost:8000/api/get-blob?metadata_uri=ipfs://QmPdJ4GtFRvpkbsn47d1HbEioSYtSvgAYDkq5KsL5xUb1C
{
"blob": "MTIzNDU2Nzg5MDEyMzQ1Njc4OTA"
}
- Search transactions
- Verify shard double hashes in published data
- Submit MsgChallengeForFraud
- Submit MsgSubmitProof