From 4f7d1d4c3d8ae6a6b837e5f9b1558e6414f3da4c Mon Sep 17 00:00:00 2001 From: LowEntropyBody Date: Fri, 7 Aug 2020 14:15:00 +0800 Subject: [PATCH] change readme (#40) --- README.md | 235 ++----------------------------------------------- docs/API.md | 212 ++++++++++++++++++++++++++++++++++++++++++++ docs/docker.md | 5 ++ 3 files changed, 224 insertions(+), 228 deletions(-) create mode 100644 docs/API.md create mode 100644 docs/docker.md diff --git a/README.md b/README.md index 0b86c26..993eab9 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ # Crust Restful API -## Normal launch -### build +### Build ```shell yarn ``` -### start + +### Start The default startup will start with 56666 API port and connect to the local Crust chain: ```shell yarn start @@ -15,233 +15,12 @@ Change the setting like this, if you want to connect to other chain: yarn start 56666 ws://192.168.50.6:9944/ ``` -## Docker launch +## Docker +Please refer to [crust api docker](docs/docker.md) -### Build docker image -```shell -sudo ./build_docker.sh -``` -### Run docker -```shell -sudo docker run -it --name test-container -e ARGS="56666 ws://127.0.0.1:9944/" --network host crustio/crust-api:0.5.0 -``` -### Check logs -```shell -sudo docker logs -``` -## Usage - -### Get header information -Request: -```shell -curl GET 'http://localhost:56666/api/v1/block/header' -``` - -Response: -```json -{ - "number": 13871, - "hash": "0xeeadb2bd71c125c98ce0892d830931fb27c771ab0025c60735fca9419abae990" -} -``` - -### [MPoW] Get block hash by block number -Request: -```shell -curl GET 'http://localhost:56666/api/v1/block/hash?blockNumber=100' -``` - -Response: -```json -"0xeeadb2bd71c125c98ce0892d830931fb27c771ab0025c60735fca9419abae990" -``` - -### [MPoW] Register as TEE trusted node -Request: -```shell -curl POST 'http://localhost:56666/api/v1/tee/identity' \ ---header 'Content-Type: application/json' \ ---header 'password: 123456' \ ---data-raw '{ - "ias_sig": "blQCK9boBazDWj5e5TeS7PxFs1RJqlKhvkgiQvZwDa2nhVfBlGUdpBEC4QFui45R7pEFMMJcNbKIB2en/BoaNXMum7n9hYDc6wRdgveupLAJvw4KQzeIMKiUM5WfT4oTo3OZopM9Q/FiCAyoiwJ9bLOYH/HFVSFujbwJEhlhGE+3p+7hw7nB8IMvJsijwt8Y/vJiflsqJMlQSGo2CeERW37iKsK5G/mtB96ZYSkwiJEv33d0xVBEk5X3sp2FOloM6lg8Dx+205rrjS3+C1U2pFq/qrxKge1hTxQciRrBulSesJ1b8vdcpi1SYAJ8401nL/vWEa3aNCZ3Z8CiL3lhiw==", - "ias_cert": "-----BEGIN CERTIFICATE-----\nMIIEoTCCAwmgAwIBAgIJANEHdl0yo7CWMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNV\nBAYTAlVTMQswCQYDVQQIDAJDQTEUMBIGA1UEBwwLU2FudGEgQ2xhcmExGjAYBgNV\nBAoMEUludGVsIENvcnBvcmF0aW9uMTAwLgYDVQQDDCdJbnRlbCBTR1ggQXR0ZXN0\nYXRpb24gUmVwb3J0IFNpZ25pbmcgQ0EwHhcNMTYxMTIyMDkzNjU4WhcNMjYxMTIw\nMDkzNjU4WjB7MQswCQYDVQQGEwJVUzELMAkGA1UECAwCQ0ExFDASBgNVBAcMC1Nh\nbnRhIENsYXJhMRowGAYDVQQKDBFJbnRlbCBDb3Jwb3JhdGlvbjEtMCsGA1UEAwwk\nSW50ZWwgU0dYIEF0dGVzdGF0aW9uIFJlcG9ydCBTaWduaW5nMIIBIjANBgkqhkiG\n9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqXot4OZuphR8nudFrAFiaGxxkgma/Es/BA+t\nbeCTUR106AL1ENcWA4FX3K+E9BBL0/7X5rj5nIgX/R/1ubhkKWw9gfqPG3KeAtId\ncv/uTO1yXv50vqaPvE1CRChvzdS/ZEBqQ5oVvLTPZ3VEicQjlytKgN9cLnxbwtuv\nLUK7eyRPfJW/ksddOzP8VBBniolYnRCD2jrMRZ8nBM2ZWYwnXnwYeOAHV+W9tOhA\nImwRwKF/95yAsVwd21ryHMJBcGH70qLagZ7Ttyt++qO/6+KAXJuKwZqjRlEtSEz8\ngZQeFfVYgcwSfo96oSMAzVr7V0L6HSDLRnpb6xxmbPdqNol4tQIDAQABo4GkMIGh\nMB8GA1UdIwQYMBaAFHhDe3amfrzQr35CN+s1fDuHAVE8MA4GA1UdDwEB/wQEAwIG\nwDAMBgNVHRMBAf8EAjAAMGAGA1UdHwRZMFcwVaBToFGGT2h0dHA6Ly90cnVzdGVk\nc2VydmljZXMuaW50ZWwuY29tL2NvbnRlbnQvQ1JML1NHWC9BdHRlc3RhdGlvblJl\ncG9ydFNpZ25pbmdDQS5jcmwwDQYJKoZIhvcNAQELBQADggGBAGcIthtcK9IVRz4r\nRq+ZKE+7k50/OxUsmW8aavOzKb0iCx07YQ9rzi5nU73tME2yGRLzhSViFs/LpFa9\nlpQL6JL1aQwmDR74TxYGBAIi5f4I5TJoCCEqRHz91kpG6Uvyn2tLmnIdJbPE4vYv\nWLrtXXfFBSSPD4Afn7+3/XUggAlc7oCTizOfbbtOFlYA4g5KcYgS1J2ZAeMQqbUd\nZseZCcaZZZn65tdqee8UXZlDvx0+NdO0LR+5pFy+juM0wWbu59MvzcmTXbjsi7HY\n6zd53Yq5K244fwFHRQ8eOB0IWB+4PfM7FeAApZvlfqlKOlLcZL2uyVmzRkyR5yW7\n2uo9mehX44CiPJ2fse9Y6eQtcfEhMPkmHXI01sN+KwPbpA39+xOsStjhP9N1Y1a2\ntQAVo+yVgLgV2Hws73Fc0o3wC78qPEA+v2aRs/Be3ZFDgDyghc/1fgU+7C+P6kbq\nd4poyb6IW8KCJbxfMJvkordNOgOUUxndPHEi/tb/U7uLjLOgPA==\n-----END CERTIFICATE-----\n", - "sig": "a5d773d0474f572f8dfc2b4c59cdcb095f17869ed0323d760fe6be124b1f91d03775c914a4f8d6de38d52790aef2c2a1d9e0593949eabc30b1b65b7c2d6cd18b", - "account_id": "5FqazaU79hjpEMiWTWZx81VjsYFst15eBuSBKdQLgQibD7CX", - "isv_body": "{\"id\":\"123961886185477148090777879985426742743\",\"timestamp\":\"2020-06-24T05:01:29.013171\",\"version\":3,\"epidPseudonym\":\"4tcrS6EX9pIyhLyxtgpQJuMO1VdAkRDtha/N+u/rRkTsb11AhkuTHsY6UXRPLRJavxG3nsByBdTfyDuBDQTEjMYV6NBXjn3P4UyvG1Ae2+I4lE1n+oiKgLA8CR8pc2nSnSY1Wz1Pw/2l9Q5Er6hM6FdeECgMIVTZzjScYSma6rE=\",\"isvEnclaveQuoteStatus\":\"GROUP_OUT_OF_DATE\",\"platformInfoBlob\":\"1502006504000F00000F0F02040101070000000000000000000B00000B00000002000000000000142A6BA71C112E9E7C24891D0BC3FAF303549F78DDDF8EB1952908F78CC55C985D785A9DD1E3ED99C9E42FCFA81D81EDEF9612E1E2BD6862DE240564DDD5F6EFD5DF\",\"isvEnclaveQuoteBody\":\"AgABACoUAAAKAAkAAAAAAP7yPH5zo3mCPOcf8onPvAcAAAAAAAAAAAAAAAAAAAAACA7///8CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAAAAAHAAAAAAAAAOJWq0y16RNrwcERUIj8QMofQYJUXqdXaVeMINhDAozVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACD1xnnferKFHD2uvYqTXdDA8iZ22kCD5xw7h38CMfOngAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADza6mYgLFtxw0txDzMl/3RdCApfFl+bev52H3xjSbjl/b4IPC63+P57HJpPU/DUsGBj75XknR9iyK4pRc1Y/Q/\"}", - "backup": "{\"address\":\"5FqazaU79hjpEMiWTWZx81VjsYFst15eBuSBKdQLgQibD7CX\",\"encoded\":\"0x992da087a5adf2b7ad2d2d72a65aa1fe1a59f599d24badebc37a2ede36f1b6ec647ee18c0956a635ad7070d1fea2e3bf75dd99579d1b92cbca27f5763b56720200d6c5cb6d4084a25c288bd6d99f0f976caf7cd895ebc7fe7d5c9a6d27e7d9e80dcaba5cdda1e0acddd835621c70bc6075debcbe9a0f1b062bd124eee73c3b588bad251a459ef6287fcacf6e2131fa9f0a8403d900efa94672e07f6ae5\",\"encoding\":{\"content\":[\"pkcs8\",\"sr25519\"],\"type\":\"xsalsa20-poly1305\",\"version\":\"2\"},\"meta\":{\"name\":\"Yang1\",\"tags\":[],\"whenCreated\":1580628430860}}" -}' -``` - -Response: -```json -{ - "action": "identity", - "status": "success", -} -``` - -### [MPoW] Get TEE identity -Request: -```shell -curl GET 'http://localhost:56666/api/v1/tee/identity?address=5HBPJZkoLeUBdPombuYe3tcUkXcTAKyRhRgXJvHpCs9mzxfL' -``` - -Response: -```json - -{ - "ias_sig": "0x626c51434b39626f42617a44576a356535546553375078467331524a716c4b68766b676951765a774461326e685666426c475564704245433451467569343552377045464d4d4a634e624b494232656e2f426f614e584d756d376e39685944633677526467766575704c414a7677344b517a65494d4b69554d35576654346f546f334f5a6f704d39512f46694341796f69774a39624c4f59482f4846565346756a62774a45686c6847452b33702b376877376e4238494d764a73696a777438592f764a69666c73714a4d6c5153476f3243654552573337694b734b35472f6d744239365a59536b77694a457633336430785642456b355833737032464f6c6f4d366c673844782b32303572726a53332b433155327046712f7172784b676531685478516369527242756c5365734a3162387664637069315359414a383430316e4c2f7657456133614e435a335a3843694c336c6869773d3d", - "ias_cert": "0x2d2d2d2d2d424547494e2043455254494649434154452d2d2d2d2d0a4d4949456f54434341776d67417749424167494a414e4548646c30796f3743574d413047435371475349623344514542437755414d483478437a414a42674e560a42415954416c56544d517377435159445651514944414a44515445554d424947413155454277774c553246756447456751327868636d4578476a415942674e560a42416f4d45556c756447567349454e76636e4276636d4630615739754d5441774c675944565151444443644a626e526c6243425452316767515852305a584e300a5958527062323467556d567762334a3049464e705a323570626d6367513045774868634e4d5459784d5449794d446b7a4e6a55345768634e4d6a59784d5449770a4d446b7a4e6a5534576a42374d517377435159445651514745774a56557a454c4d416b474131554543417743513045784644415342674e564241634d43314e680a626e526849454e7359584a684d526f77474159445651514b4442464a626e526c6243424462334a7762334a6864476c76626a45744d437347413155454177776b0a535735305a57776755306459494546306447567a644746306157397549464a6c6347397964434254615764756157356e4d494942496a414e42676b71686b69470a397730424151454641414f43415138414d49494243674b434151454171586f74344f5a75706852386e75644672414669614778786b676d612f45732f42412b740a626543545552313036414c31454e635741344658334b2b453942424c302f375835726a356e4967582f522f317562686b4b5777396766715047334b65417449640a63762f75544f3179587635307671615076453143524368767a64532f5a45427151356f56764c54505a3356456963516a6c79744b674e39634c6e7862777475760a4c554b3765795250664a572f6b7364644f7a50385642426e696f6c596e524344326a724d525a386e424d325a5759776e586e7759654f4148562b5739744f68410a496d7752774b462f393579417356776432317279484d4a426347483730714c61675a37547479742b2b714f2f362b4b41584a754b775a716a526c457453457a380a675a51654666565967637753666f39366f534d417a56723756304c364853444c526e70623678786d625064714e6f6c3474514944415141426f34476b4d4947680a4d42384741315564497751594d426141464868446533616d66727a51723335434e2b733166447548415645384d41344741315564447745422f775145417749470a7744414d42674e5648524d4241663845416a41414d474147413155644877525a4d466377566142546f46474754326830644841364c793930636e567a6447566b0a63325679646d6c6a5a584d75615735305a577775593239744c324e76626e526c626e517651314a4d4c314e48574339426448526c6333526864476c76626c4a6c0a6347397964464e705a323570626d64445153356a636d77774451594a4b6f5a496876634e4151454c425141446767474241476349746874634b394956527a34720a52712b5a4b452b376b35302f4f7855736d57386161764f7a4b62306943783037595139727a69356e553733744d45327947524c7a6853566946732f4c704661390a6c70514c364a4c316151776d4452373454785947424149693566344935544a6f4343457152487a39316b7047365576796e32744c6d6e49644a625045347659760a574c72745858664642535350443441666e372b332f58556767416c63376f4354697a4f666262744f466c59413467354b63596753314a325a41654d51716255640a5a73655a4363615a5a5a6e363574647165653855585a6c447678302b4e644f304c522b357046792b6a754d307757627535394d767a636d5458626a73693748590a367a6435335971354b32343466774648525138654f42304957422b3450664d3746654141705a766c66716c4b4f6c4c635a4c327579566d7a526b7952357957370a32756f396d65685834344369504a32667365395936655174636645684d506b6d4858493031734e2b4b775062704133392b784f7353746a6850394e31593161320a745141566f2b7956674c67563248777337334663306f3377433738715045412b76326152732f4265335a46446744796768632f316667552b37432b50366b62710a6434706f7962364957384b434a6278664d4a766b6f72644e4f674f5555786e64504845692f74622f5537754c6a4c4f6750413d3d0a2d2d2d2d2d454e442043455254494649434154452d2d2d2d2d0a", - "account_id": "5FqazaU79hjpEMiWTWZx81VjsYFst15eBuSBKdQLgQibD7CX", - "isv_body": "0x7b226964223a22313233393631383836313835343737313438303930373737383739393835343236373432373433222c2274696d657374616d70223a22323032302d30362d32345430353a30313a32392e303133313731222c2276657273696f6e223a332c226570696450736575646f6e796d223a22347463725336455839704979684c7978746770514a754d4f315664416b52447468612f4e2b752f72526b547362313141686b755448735936555852504c524a61767847336e7342794264546679447542445154456a4d5956364e42586a6e33503455797647314165322b49346c45316e2b6f694b674c41384352387063326e536e535931577a3150772f326c395135457236684d364664654543674d4956545a7a6a536359536d613672453d222c22697376456e636c61766551756f7465537461747573223a2247524f55505f4f55545f4f465f44415445222c22706c6174666f726d496e666f426c6f62223a22313530323030363530343030304630303030304630463032303430313031303730303030303030303030303030303030303030423030303030423030303030303032303030303030303030303030313432413642413731433131324539453743323438393144304243334641463330333534394637384444444638454231393532393038463738434335354339383544373835413944443145334544393943394534324643464138314438314544454639363132453145324244363836324445323430353634444444354636454644354446222c22697376456e636c61766551756f7465426f6479223a224167414241436f554141414b41416b4141414141415037795048357a6f336d43504f6366386f6e507641634141414141414141414141414141414141414141414341372f2f2f384341414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414277414141414141414141484141414141414141414f4a577130793136524e727763455255496a38514d6f6651594a55587164586156654d494e6844416f7a56414141414141414141414141414141414141414141414141414141414141414141414141414141414141434431786e6e6665724b4648443275765971545864444138695a32326b434435787737683338434d664f6e674141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141447a61366d59674c46747877307478447a4d6c2f33526443417066466c2b62657635324833786a53626a6c2f623449504336332b503537484a7050552f44557347426a3735586b6e523969794b3470526331592f512f227d", - "pub_key": "0xf36ba99880b16dc70d2dc43ccc97fdd17420297c597e6debf9d87df18d26e397f6f820f0badfe3f9ec72693d4fc352c1818fbe5792747d8b22b8a5173563f43f", - "sig": "0xa5d773d0474f572f8dfc2b4c59cdcb095f17869ed0323d760fe6be124b1f91d03775c914a4f8d6de38d52790aef2c2a1d9e0593949eabc30b1b65b7c2d6cd18b" -} - -``` - -### [MPoW] Post TEE work report -Request: -```shell -curl POST 'http://localhost:56666/api/v1/tee/workreport' \ ---header 'Content-Type: application/json' \ ---header 'password: 123456' \ ---data-raw '{ - "block_hash" : "1234567890", - "files" : [], - "block_height" : 12345, - "pub_key" : "f36ba99880b16dc70d2dc43ccc97fdd17420297c597e6debf9d87df18d26e397f6f820f0badfe3f9ec72693d4fc352c1818fbe5792747d8b22b8a5173563f43f", - "reserved" : 4294967296, - "sig" : "60442bbcd0bd6c0a25af37be55d53a0749a62b28aa1d4c85f087da8ac256a38e1dbd51d0cde4b162c70a6c861fe5bd2594e3f6e1b0d1766420230dc76849e76b", - "backup": "{\"address\":\"5FqazaU79hjpEMiWTWZx81VjsYFst15eBuSBKdQLgQibD7CX\",\"encoded\":\"0x992da087a5adf2b7ad2d2d72a65aa1fe1a59f599d24badebc37a2ede36f1b6ec647ee18c0956a635ad7070d1fea2e3bf75dd99579d1b92cbca27f5763b56720200d6c5cb6d4084a25c288bd6d99f0f976caf7cd895ebc7fe7d5c9a6d27e7d9e80dcaba5cdda1e0acddd835621c70bc6075debcbe9a0f1b062bd124eee73c3b588bad251a459ef6287fcacf6e2131fa9f0a8403d900efa94672e07f6ae5\",\"encoding\":{\"content\":[\"pkcs8\",\"sr25519\"],\"type\":\"xsalsa20-poly1305\",\"version\":\"2\"},\"meta\":{\"name\":\"Yang1\",\"tags\":[],\"whenCreated\":1580628430860}}" -}' -``` - -Response: -```json -{ - "action": "reportWorks", - "status": "success", -} -``` - -### [MPoW] Get TEE work report -Request: -```shell -curl GET 'http://localhost:56666/api/v1/tee/workreport?address=5HBPJZkoLeUBdPombuYe3tcUkXcTAKyRhRgXJvHpCs9mzxfL' -``` - -Response: -```json - -{ - "pub_key": "0xb724362f5dba057704f89b769328cd71b08aa2284a5e1cc9d7131f909030eaeac30dde94229a23229015a13feb609a5adead8cb7e1c971c25a08e38e7a6a7909", - "block_height": 50, - "block_hash": "0xa49e3d5044780c8a9c9d2427f210c918f73ea0a8af40e39f69d6cb64e44c2d99", - "empty_root": "0xa49e3d5044780c8a9c9d2427f210c918f73ea0a8af40e39f69d6cb64e44c2d99", - "empty_workload": 500, - "meaningful_workload": 500, - "sig": "0xcb5496db194910fe797f4e0e74510188e493504747509058b10b393132839590564763e60eea1b470952ec99f48a6952216c2ce608b9b1718d4f98e300964bba" -} - -``` - -### [Market] Register as provider -Request: -```shell -curl POST 'http://localhost:56666/api/v1/market/register' \ ---header 'Content-Type: application/json' \ ---header 'password: 123456' \ ---data-raw '{ - "addressInfo": "ws://localhost:8080", - "storagePrice": 100, - "backup": "{\"address\":\"5FqazaU79hjpEMiWTWZx81VjsYFst15eBuSBKdQLgQibD7CX\",\"encoded\":\"0x992da087a5adf2b7ad2d2d72a65aa1fe1a59f599d24badebc37a2ede36f1b6ec647ee18c0956a635ad7070d1fea2e3bf75dd99579d1b92cbca27f5763b56720200d6c5cb6d4084a25c288bd6d99f0f976caf7cd895ebc7fe7d5c9a6d27e7d9e80dcaba5cdda1e0acddd835621c70bc6075debcbe9a0f1b062bd124eee73c3b588bad251a459ef6287fcacf6e2131fa9f0a8403d900efa94672e07f6ae5\",\"encoding\":{\"content\":[\"pkcs8\",\"sr25519\"],\"type\":\"xsalsa20-poly1305\",\"version\":\"2\"},\"meta\":{\"name\":\"Yang1\",\"tags\":[],\"whenCreated\":1580628430860}}" -}' -``` - -Response: -```json -{ - "action": "provider_register", - "status": "success", -} -``` - -### [Market] Place storage order -Request: -```shell -curl POST 'http://localhost:56666/api/v1/market/sorder' \ - --header 'Content-Type: application/json' \ - --header 'password: 123456' \ - --data-raw '{ - "sorder":"{\"provider\":\"5HpyALyFUJTDMc6iRziEKwh1BkvMHFJGHss3mJjXefuzCap3\",\"fileIdentifier\":\"0xd9bf1512e28399ae0cccdebacf5fa337b1e1f4a6b08cd43405a11f74368d023f\",\"fileSize\":205452,\"duration\":320}", - "backup": "{\"address\":\"5FjAZtpXuqNGGw4yoDo3z8ko3Edft4Q25awTr5EakW3bYarE\",\"encoded\":\"0xfbcdb94f892959b1b253145f0893bd2b1d315ced24b497b98b4eb10513a5f3ef46bafec71a538c3f25703843856c9449c02e9bc6bf33bfa7e4ce2716f225d69067888655d60a30b9da618ce4725cb1737bc9980651950edfb5da86ee82ffa5b10dbe0d26d226b15e3bb990424c543210a93bd457be856799872a5f8ef52822980bd266e2b1aea53802f4248e4213498aaf1945033cb8217250b69d00d6\",\"encoding\":{\"content\":[\"pkcs8\",\"sr25519\"],\"type\":\"xsalsa20-poly1305\",\"version\":\"2\"},\"meta\":{\"name\":\"Yang\",\"tags\":[],\"whenCreated\":1580452568110}}" - }' -``` - -Response: -```json -{ - "action": "storage_order", - "status": "success", - "order_id": "0x3be23b7d519e8600ea37964501bdc64e00888a15498fd96cff3d2c0e763bb39c" -} -``` - -### [Market] Get provider info -Request: -```shell -curl GET 'http://127.0.0.1:56666/api/v1/market/provider?address=5HpyALyFUJTDMc6iRziEKwh1BkvMHFJGHss3mJjXefuzCap3' -``` - -Response: -```json - -{ - "address": "ws://192.168.50.140:17005", - "storage_price": 200000000000, - "file_map": [ - [ - "0xa2f7830de04841b1c7672b96f4ba9ea9edaf4c3b76257e9373e960829b056697", - [ - "0x075ab6f9577e86d2b10d1d82923b2a859a1748c9d29c9fe17888d2fa49192061" - ] - ], - [ - "0xfd0483bd91062400854ca14b894d26051de27b0855e87527abcaad065bc53879", - [ - "0x351209cffe9aa06ee9f3829bba843fb47c47ab2a8692cd06b839ca2005073858" - ] - ] - ] -} - -``` - -### [Market] Get storage order -Request: -```shell -curl GET 'http://localhost:56666/api/v1/market/sorder?orderId=0x1f1e8eeac7b871ac3c603087120eb0b8a7286ee69ff01c785e52af083edaf2f5' -``` - -Response: -```json - -{ - "file_identifier": "0xfd0483bd91062400854ca14b894d26051de27b0855e87527abcaad065bc53879", - "file_size": 1000001, - "created_on": 2022, - "completed_on": 2022, - "expired_on": 3022, - "provider": "5FbxxwasgLPHJ3cEMcqJuohgrJ72E9dBwgw1Yw3VXbvEwK9u", - "client": "5DSgSSAXG8Ti2Qwsr8zcLrAsQsEEji6pEv2rUWmLXQicAiK4", - "amount": 20000000000000, - "order_status": "Pending" -} - -``` +## API +Please refer to [API](docs/API.md) ## License - [GPL v3](LICENSE) diff --git a/docs/API.md b/docs/API.md new file mode 100644 index 0000000..bfd7b1d --- /dev/null +++ b/docs/API.md @@ -0,0 +1,212 @@ +# API + + +### Get header information +Request: +```shell +curl GET 'http://localhost:56666/api/v1/block/header' +``` + +Response: +```json +{ + "number": 13871, + "hash": "0xeeadb2bd71c125c98ce0892d830931fb27c771ab0025c60735fca9419abae990" +} +``` + +### [MPoW] Get block hash by block number +Request: +```shell +curl GET 'http://localhost:56666/api/v1/block/hash?blockNumber=100' +``` + +Response: +```json +"0xeeadb2bd71c125c98ce0892d830931fb27c771ab0025c60735fca9419abae990" +``` + +### [MPoW] Register as TEE trusted node +Request: +```shell +curl POST 'http://localhost:56666/api/v1/tee/identity' \ +--header 'Content-Type: application/json' \ +--header 'password: 123456' \ +--data-raw '{ + "ias_sig": "blQCK9boBazDWj5e5TeS7PxFs1RJqlKhvkgiQvZwDa2nhVfBlGUdpBEC4QFui45R7pEFMMJcNbKIB2en/BoaNXMum7n9hYDc6wRdgveupLAJvw4KQzeIMKiUM5WfT4oTo3OZopM9Q/FiCAyoiwJ9bLOYH/HFVSFujbwJEhlhGE+3p+7hw7nB8IMvJsijwt8Y/vJiflsqJMlQSGo2CeERW37iKsK5G/mtB96ZYSkwiJEv33d0xVBEk5X3sp2FOloM6lg8Dx+205rrjS3+C1U2pFq/qrxKge1hTxQciRrBulSesJ1b8vdcpi1SYAJ8401nL/vWEa3aNCZ3Z8CiL3lhiw==", + "ias_cert": "-----BEGIN CERTIFICATE-----\nMIIEoTCCAwmgAwIBAgIJANEHdl0yo7CWMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNV\nBAYTAlVTMQswCQYDVQQIDAJDQTEUMBIGA1UEBwwLU2FudGEgQ2xhcmExGjAYBgNV\nBAoMEUludGVsIENvcnBvcmF0aW9uMTAwLgYDVQQDDCdJbnRlbCBTR1ggQXR0ZXN0\nYXRpb24gUmVwb3J0IFNpZ25pbmcgQ0EwHhcNMTYxMTIyMDkzNjU4WhcNMjYxMTIw\nMDkzNjU4WjB7MQswCQYDVQQGEwJVUzELMAkGA1UECAwCQ0ExFDASBgNVBAcMC1Nh\nbnRhIENsYXJhMRowGAYDVQQKDBFJbnRlbCBDb3Jwb3JhdGlvbjEtMCsGA1UEAwwk\nSW50ZWwgU0dYIEF0dGVzdGF0aW9uIFJlcG9ydCBTaWduaW5nMIIBIjANBgkqhkiG\n9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqXot4OZuphR8nudFrAFiaGxxkgma/Es/BA+t\nbeCTUR106AL1ENcWA4FX3K+E9BBL0/7X5rj5nIgX/R/1ubhkKWw9gfqPG3KeAtId\ncv/uTO1yXv50vqaPvE1CRChvzdS/ZEBqQ5oVvLTPZ3VEicQjlytKgN9cLnxbwtuv\nLUK7eyRPfJW/ksddOzP8VBBniolYnRCD2jrMRZ8nBM2ZWYwnXnwYeOAHV+W9tOhA\nImwRwKF/95yAsVwd21ryHMJBcGH70qLagZ7Ttyt++qO/6+KAXJuKwZqjRlEtSEz8\ngZQeFfVYgcwSfo96oSMAzVr7V0L6HSDLRnpb6xxmbPdqNol4tQIDAQABo4GkMIGh\nMB8GA1UdIwQYMBaAFHhDe3amfrzQr35CN+s1fDuHAVE8MA4GA1UdDwEB/wQEAwIG\nwDAMBgNVHRMBAf8EAjAAMGAGA1UdHwRZMFcwVaBToFGGT2h0dHA6Ly90cnVzdGVk\nc2VydmljZXMuaW50ZWwuY29tL2NvbnRlbnQvQ1JML1NHWC9BdHRlc3RhdGlvblJl\ncG9ydFNpZ25pbmdDQS5jcmwwDQYJKoZIhvcNAQELBQADggGBAGcIthtcK9IVRz4r\nRq+ZKE+7k50/OxUsmW8aavOzKb0iCx07YQ9rzi5nU73tME2yGRLzhSViFs/LpFa9\nlpQL6JL1aQwmDR74TxYGBAIi5f4I5TJoCCEqRHz91kpG6Uvyn2tLmnIdJbPE4vYv\nWLrtXXfFBSSPD4Afn7+3/XUggAlc7oCTizOfbbtOFlYA4g5KcYgS1J2ZAeMQqbUd\nZseZCcaZZZn65tdqee8UXZlDvx0+NdO0LR+5pFy+juM0wWbu59MvzcmTXbjsi7HY\n6zd53Yq5K244fwFHRQ8eOB0IWB+4PfM7FeAApZvlfqlKOlLcZL2uyVmzRkyR5yW7\n2uo9mehX44CiPJ2fse9Y6eQtcfEhMPkmHXI01sN+KwPbpA39+xOsStjhP9N1Y1a2\ntQAVo+yVgLgV2Hws73Fc0o3wC78qPEA+v2aRs/Be3ZFDgDyghc/1fgU+7C+P6kbq\nd4poyb6IW8KCJbxfMJvkordNOgOUUxndPHEi/tb/U7uLjLOgPA==\n-----END CERTIFICATE-----\n", + "sig": "a5d773d0474f572f8dfc2b4c59cdcb095f17869ed0323d760fe6be124b1f91d03775c914a4f8d6de38d52790aef2c2a1d9e0593949eabc30b1b65b7c2d6cd18b", + "account_id": "5FqazaU79hjpEMiWTWZx81VjsYFst15eBuSBKdQLgQibD7CX", + "isv_body": "{\"id\":\"123961886185477148090777879985426742743\",\"timestamp\":\"2020-06-24T05:01:29.013171\",\"version\":3,\"epidPseudonym\":\"4tcrS6EX9pIyhLyxtgpQJuMO1VdAkRDtha/N+u/rRkTsb11AhkuTHsY6UXRPLRJavxG3nsByBdTfyDuBDQTEjMYV6NBXjn3P4UyvG1Ae2+I4lE1n+oiKgLA8CR8pc2nSnSY1Wz1Pw/2l9Q5Er6hM6FdeECgMIVTZzjScYSma6rE=\",\"isvEnclaveQuoteStatus\":\"GROUP_OUT_OF_DATE\",\"platformInfoBlob\":\"1502006504000F00000F0F02040101070000000000000000000B00000B00000002000000000000142A6BA71C112E9E7C24891D0BC3FAF303549F78DDDF8EB1952908F78CC55C985D785A9DD1E3ED99C9E42FCFA81D81EDEF9612E1E2BD6862DE240564DDD5F6EFD5DF\",\"isvEnclaveQuoteBody\":\"AgABACoUAAAKAAkAAAAAAP7yPH5zo3mCPOcf8onPvAcAAAAAAAAAAAAAAAAAAAAACA7///8CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAAAAAHAAAAAAAAAOJWq0y16RNrwcERUIj8QMofQYJUXqdXaVeMINhDAozVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACD1xnnferKFHD2uvYqTXdDA8iZ22kCD5xw7h38CMfOngAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADza6mYgLFtxw0txDzMl/3RdCApfFl+bev52H3xjSbjl/b4IPC63+P57HJpPU/DUsGBj75XknR9iyK4pRc1Y/Q/\"}", + "backup": "{\"address\":\"5FqazaU79hjpEMiWTWZx81VjsYFst15eBuSBKdQLgQibD7CX\",\"encoded\":\"0x992da087a5adf2b7ad2d2d72a65aa1fe1a59f599d24badebc37a2ede36f1b6ec647ee18c0956a635ad7070d1fea2e3bf75dd99579d1b92cbca27f5763b56720200d6c5cb6d4084a25c288bd6d99f0f976caf7cd895ebc7fe7d5c9a6d27e7d9e80dcaba5cdda1e0acddd835621c70bc6075debcbe9a0f1b062bd124eee73c3b588bad251a459ef6287fcacf6e2131fa9f0a8403d900efa94672e07f6ae5\",\"encoding\":{\"content\":[\"pkcs8\",\"sr25519\"],\"type\":\"xsalsa20-poly1305\",\"version\":\"2\"},\"meta\":{\"name\":\"Yang1\",\"tags\":[],\"whenCreated\":1580628430860}}" +}' +``` + +Response: +```json +{ + "action": "identity", + "status": "success", +} +``` + +### [MPoW] Get TEE identity +Request: +```shell +curl GET 'http://localhost:56666/api/v1/tee/identity?address=5HBPJZkoLeUBdPombuYe3tcUkXcTAKyRhRgXJvHpCs9mzxfL' +``` + +Response: +```json + +{ + "ias_sig": "0x626c51434b39626f42617a44576a356535546553375078467331524a716c4b68766b676951765a774461326e685666426c475564704245433451467569343552377045464d4d4a634e624b494232656e2f426f614e584d756d376e39685944633677526467766575704c414a7677344b517a65494d4b69554d35576654346f546f334f5a6f704d39512f46694341796f69774a39624c4f59482f4846565346756a62774a45686c6847452b33702b376877376e4238494d764a73696a777438592f764a69666c73714a4d6c5153476f3243654552573337694b734b35472f6d744239365a59536b77694a457633336430785642456b355833737032464f6c6f4d366c673844782b32303572726a53332b433155327046712f7172784b676531685478516369527242756c5365734a3162387664637069315359414a383430316e4c2f7657456133614e435a335a3843694c336c6869773d3d", + "ias_cert": "0x2d2d2d2d2d424547494e2043455254494649434154452d2d2d2d2d0a4d4949456f54434341776d67417749424167494a414e4548646c30796f3743574d413047435371475349623344514542437755414d483478437a414a42674e560a42415954416c56544d517377435159445651514944414a44515445554d424947413155454277774c553246756447456751327868636d4578476a415942674e560a42416f4d45556c756447567349454e76636e4276636d4630615739754d5441774c675944565151444443644a626e526c6243425452316767515852305a584e300a5958527062323467556d567762334a3049464e705a323570626d6367513045774868634e4d5459784d5449794d446b7a4e6a55345768634e4d6a59784d5449770a4d446b7a4e6a5534576a42374d517377435159445651514745774a56557a454c4d416b474131554543417743513045784644415342674e564241634d43314e680a626e526849454e7359584a684d526f77474159445651514b4442464a626e526c6243424462334a7762334a6864476c76626a45744d437347413155454177776b0a535735305a57776755306459494546306447567a644746306157397549464a6c6347397964434254615764756157356e4d494942496a414e42676b71686b69470a397730424151454641414f43415138414d49494243674b434151454171586f74344f5a75706852386e75644672414669614778786b676d612f45732f42412b740a626543545552313036414c31454e635741344658334b2b453942424c302f375835726a356e4967582f522f317562686b4b5777396766715047334b65417449640a63762f75544f3179587635307671615076453143524368767a64532f5a45427151356f56764c54505a3356456963516a6c79744b674e39634c6e7862777475760a4c554b3765795250664a572f6b7364644f7a50385642426e696f6c596e524344326a724d525a386e424d325a5759776e586e7759654f4148562b5739744f68410a496d7752774b462f393579417356776432317279484d4a426347483730714c61675a37547479742b2b714f2f362b4b41584a754b775a716a526c457453457a380a675a51654666565967637753666f39366f534d417a56723756304c364853444c526e70623678786d625064714e6f6c3474514944415141426f34476b4d4947680a4d42384741315564497751594d426141464868446533616d66727a51723335434e2b733166447548415645384d41344741315564447745422f775145417749470a7744414d42674e5648524d4241663845416a41414d474147413155644877525a4d466377566142546f46474754326830644841364c793930636e567a6447566b0a63325679646d6c6a5a584d75615735305a577775593239744c324e76626e526c626e517651314a4d4c314e48574339426448526c6333526864476c76626c4a6c0a6347397964464e705a323570626d64445153356a636d77774451594a4b6f5a496876634e4151454c425141446767474241476349746874634b394956527a34720a52712b5a4b452b376b35302f4f7855736d57386161764f7a4b62306943783037595139727a69356e553733744d45327947524c7a6853566946732f4c704661390a6c70514c364a4c316151776d4452373454785947424149693566344935544a6f4343457152487a39316b7047365576796e32744c6d6e49644a625045347659760a574c72745858664642535350443441666e372b332f58556767416c63376f4354697a4f666262744f466c59413467354b63596753314a325a41654d51716255640a5a73655a4363615a5a5a6e363574647165653855585a6c447678302b4e644f304c522b357046792b6a754d307757627535394d767a636d5458626a73693748590a367a6435335971354b32343466774648525138654f42304957422b3450664d3746654141705a766c66716c4b4f6c4c635a4c327579566d7a526b7952357957370a32756f396d65685834344369504a32667365395936655174636645684d506b6d4858493031734e2b4b775062704133392b784f7353746a6850394e31593161320a745141566f2b7956674c67563248777337334663306f3377433738715045412b76326152732f4265335a46446744796768632f316667552b37432b50366b62710a6434706f7962364957384b434a6278664d4a766b6f72644e4f674f5555786e64504845692f74622f5537754c6a4c4f6750413d3d0a2d2d2d2d2d454e442043455254494649434154452d2d2d2d2d0a", + "account_id": "5FqazaU79hjpEMiWTWZx81VjsYFst15eBuSBKdQLgQibD7CX", + "isv_body": "0x7b226964223a22313233393631383836313835343737313438303930373737383739393835343236373432373433222c2274696d657374616d70223a22323032302d30362d32345430353a30313a32392e303133313731222c2276657273696f6e223a332c226570696450736575646f6e796d223a22347463725336455839704979684c7978746770514a754d4f315664416b52447468612f4e2b752f72526b547362313141686b755448735936555852504c524a61767847336e7342794264546679447542445154456a4d5956364e42586a6e33503455797647314165322b49346c45316e2b6f694b674c41384352387063326e536e535931577a3150772f326c395135457236684d364664654543674d4956545a7a6a536359536d613672453d222c22697376456e636c61766551756f7465537461747573223a2247524f55505f4f55545f4f465f44415445222c22706c6174666f726d496e666f426c6f62223a22313530323030363530343030304630303030304630463032303430313031303730303030303030303030303030303030303030423030303030423030303030303032303030303030303030303030313432413642413731433131324539453743323438393144304243334641463330333534394637384444444638454231393532393038463738434335354339383544373835413944443145334544393943394534324643464138314438314544454639363132453145324244363836324445323430353634444444354636454644354446222c22697376456e636c61766551756f7465426f6479223a224167414241436f554141414b41416b4141414141415037795048357a6f336d43504f6366386f6e507641634141414141414141414141414141414141414141414341372f2f2f384341414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414277414141414141414141484141414141414141414f4a577130793136524e727763455255496a38514d6f6651594a55587164586156654d494e6844416f7a56414141414141414141414141414141414141414141414141414141414141414141414141414141414141434431786e6e6665724b4648443275765971545864444138695a32326b434435787737683338434d664f6e674141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141447a61366d59674c46747877307478447a4d6c2f33526443417066466c2b62657635324833786a53626a6c2f623449504336332b503537484a7050552f44557347426a3735586b6e523969794b3470526331592f512f227d", + "pub_key": "0xf36ba99880b16dc70d2dc43ccc97fdd17420297c597e6debf9d87df18d26e397f6f820f0badfe3f9ec72693d4fc352c1818fbe5792747d8b22b8a5173563f43f", + "sig": "0xa5d773d0474f572f8dfc2b4c59cdcb095f17869ed0323d760fe6be124b1f91d03775c914a4f8d6de38d52790aef2c2a1d9e0593949eabc30b1b65b7c2d6cd18b" +} + +``` + +### [MPoW] Post TEE work report +Request: +```shell +curl POST 'http://localhost:56666/api/v1/tee/workreport' \ +--header 'Content-Type: application/json' \ +--header 'password: 123456' \ +--data-raw '{ + "block_hash" : "1234567890", + "files" : [], + "block_height" : 12345, + "pub_key" : "f36ba99880b16dc70d2dc43ccc97fdd17420297c597e6debf9d87df18d26e397f6f820f0badfe3f9ec72693d4fc352c1818fbe5792747d8b22b8a5173563f43f", + "reserved" : 4294967296, + "sig" : "60442bbcd0bd6c0a25af37be55d53a0749a62b28aa1d4c85f087da8ac256a38e1dbd51d0cde4b162c70a6c861fe5bd2594e3f6e1b0d1766420230dc76849e76b", + "backup": "{\"address\":\"5FqazaU79hjpEMiWTWZx81VjsYFst15eBuSBKdQLgQibD7CX\",\"encoded\":\"0x992da087a5adf2b7ad2d2d72a65aa1fe1a59f599d24badebc37a2ede36f1b6ec647ee18c0956a635ad7070d1fea2e3bf75dd99579d1b92cbca27f5763b56720200d6c5cb6d4084a25c288bd6d99f0f976caf7cd895ebc7fe7d5c9a6d27e7d9e80dcaba5cdda1e0acddd835621c70bc6075debcbe9a0f1b062bd124eee73c3b588bad251a459ef6287fcacf6e2131fa9f0a8403d900efa94672e07f6ae5\",\"encoding\":{\"content\":[\"pkcs8\",\"sr25519\"],\"type\":\"xsalsa20-poly1305\",\"version\":\"2\"},\"meta\":{\"name\":\"Yang1\",\"tags\":[],\"whenCreated\":1580628430860}}" +}' +``` + +Response: +```json +{ + "action": "reportWorks", + "status": "success", +} +``` + +### [MPoW] Get TEE work report +Request: +```shell +curl GET 'http://localhost:56666/api/v1/tee/workreport?address=5HBPJZkoLeUBdPombuYe3tcUkXcTAKyRhRgXJvHpCs9mzxfL' +``` + +Response: +```json + +{ + "pub_key": "0xb724362f5dba057704f89b769328cd71b08aa2284a5e1cc9d7131f909030eaeac30dde94229a23229015a13feb609a5adead8cb7e1c971c25a08e38e7a6a7909", + "block_height": 50, + "block_hash": "0xa49e3d5044780c8a9c9d2427f210c918f73ea0a8af40e39f69d6cb64e44c2d99", + "empty_root": "0xa49e3d5044780c8a9c9d2427f210c918f73ea0a8af40e39f69d6cb64e44c2d99", + "empty_workload": 500, + "meaningful_workload": 500, + "sig": "0xcb5496db194910fe797f4e0e74510188e493504747509058b10b393132839590564763e60eea1b470952ec99f48a6952216c2ce608b9b1718d4f98e300964bba" +} + +``` + +### [Market] Register as provider +Request: +```shell +curl POST 'http://localhost:56666/api/v1/market/register' \ +--header 'Content-Type: application/json' \ +--header 'password: 123456' \ +--data-raw '{ + "addressInfo": "ws://localhost:8080", + "storagePrice": 100, + "backup": "{\"address\":\"5FqazaU79hjpEMiWTWZx81VjsYFst15eBuSBKdQLgQibD7CX\",\"encoded\":\"0x992da087a5adf2b7ad2d2d72a65aa1fe1a59f599d24badebc37a2ede36f1b6ec647ee18c0956a635ad7070d1fea2e3bf75dd99579d1b92cbca27f5763b56720200d6c5cb6d4084a25c288bd6d99f0f976caf7cd895ebc7fe7d5c9a6d27e7d9e80dcaba5cdda1e0acddd835621c70bc6075debcbe9a0f1b062bd124eee73c3b588bad251a459ef6287fcacf6e2131fa9f0a8403d900efa94672e07f6ae5\",\"encoding\":{\"content\":[\"pkcs8\",\"sr25519\"],\"type\":\"xsalsa20-poly1305\",\"version\":\"2\"},\"meta\":{\"name\":\"Yang1\",\"tags\":[],\"whenCreated\":1580628430860}}" +}' +``` + +Response: +```json +{ + "action": "provider_register", + "status": "success", +} +``` + +### [Market] Place storage order +Request: +```shell +curl POST 'http://localhost:56666/api/v1/market/sorder' \ + --header 'Content-Type: application/json' \ + --header 'password: 123456' \ + --data-raw '{ + "sorder":"{\"provider\":\"5HpyALyFUJTDMc6iRziEKwh1BkvMHFJGHss3mJjXefuzCap3\",\"fileIdentifier\":\"0xd9bf1512e28399ae0cccdebacf5fa337b1e1f4a6b08cd43405a11f74368d023f\",\"fileSize\":205452,\"duration\":320}", + "backup": "{\"address\":\"5FjAZtpXuqNGGw4yoDo3z8ko3Edft4Q25awTr5EakW3bYarE\",\"encoded\":\"0xfbcdb94f892959b1b253145f0893bd2b1d315ced24b497b98b4eb10513a5f3ef46bafec71a538c3f25703843856c9449c02e9bc6bf33bfa7e4ce2716f225d69067888655d60a30b9da618ce4725cb1737bc9980651950edfb5da86ee82ffa5b10dbe0d26d226b15e3bb990424c543210a93bd457be856799872a5f8ef52822980bd266e2b1aea53802f4248e4213498aaf1945033cb8217250b69d00d6\",\"encoding\":{\"content\":[\"pkcs8\",\"sr25519\"],\"type\":\"xsalsa20-poly1305\",\"version\":\"2\"},\"meta\":{\"name\":\"Yang\",\"tags\":[],\"whenCreated\":1580452568110}}" + }' +``` + +Response: +```json +{ + "action": "storage_order", + "status": "success", + "order_id": "0x3be23b7d519e8600ea37964501bdc64e00888a15498fd96cff3d2c0e763bb39c" +} +``` + +### [Market] Get provider info +Request: +```shell +curl GET 'http://127.0.0.1:56666/api/v1/market/provider?address=5HpyALyFUJTDMc6iRziEKwh1BkvMHFJGHss3mJjXefuzCap3' +``` + +Response: +```json + +{ + "address": "ws://192.168.50.140:17005", + "storage_price": 200000000000, + "file_map": [ + [ + "0xa2f7830de04841b1c7672b96f4ba9ea9edaf4c3b76257e9373e960829b056697", + [ + "0x075ab6f9577e86d2b10d1d82923b2a859a1748c9d29c9fe17888d2fa49192061" + ] + ], + [ + "0xfd0483bd91062400854ca14b894d26051de27b0855e87527abcaad065bc53879", + [ + "0x351209cffe9aa06ee9f3829bba843fb47c47ab2a8692cd06b839ca2005073858" + ] + ] + ] +} + +``` + +### [Market] Get storage order +Request: +```shell +curl GET 'http://localhost:56666/api/v1/market/sorder?orderId=0x1f1e8eeac7b871ac3c603087120eb0b8a7286ee69ff01c785e52af083edaf2f5' +``` + +Response: +```json + +{ + "file_identifier": "0xfd0483bd91062400854ca14b894d26051de27b0855e87527abcaad065bc53879", + "file_size": 1000001, + "created_on": 2022, + "completed_on": 2022, + "expired_on": 3022, + "provider": "5FbxxwasgLPHJ3cEMcqJuohgrJ72E9dBwgw1Yw3VXbvEwK9u", + "client": "5DSgSSAXG8Ti2Qwsr8zcLrAsQsEEji6pEv2rUWmLXQicAiK4", + "amount": 20000000000000, + "order_status": "Pending" +} + +``` diff --git a/docs/docker.md b/docs/docker.md new file mode 100644 index 0000000..1afb5dc --- /dev/null +++ b/docs/docker.md @@ -0,0 +1,5 @@ +# Docker + +```shell +sudo ./build_docker.sh +```