crust.network
Open in
urlscan Pro
119.28.72.30
Public Scan
URL:
https://crust.network/
Submission: On February 02 via api from US — Scanned from DE
Submission: On February 02 via api from US — Scanned from DE
Form analysis
0 forms found in the DOMText Content
* Home * Get Started * Crust Network * Crust Wallet * Blockchain Explorer * EVM Storage * Crust Cloud * Crust Files * IPFS Scan * Crust Swap * Build * Github * Build on Crust * Documents * Wiki * Tech Whitepaper * Economy Whitepaper * CSM Lightpaper * EVM Storage Lightpaper * Blog * Get CRU COMPLETE YOUR WEB3 JOURNEY WITH DECENTRALIZED STORAGE Build on CrustCrust MainnetEthDA 664,627.532 TB Storage capacity 1,448 DISTRIBUTED NODES 2,028,078 STORAGE ORDERS $ 0.002972 /GB/YEAR STORAGE FEE EMPOWERING DATA THROUGH DECENTRALIZATION With decentralization at its core Crust Network is a purpose built layer 1 blockchain providing composable cloud storage solutions for developers, builders and end-users of all ecosystems. DECENTRALIZED PHYSICAL INFRASTRUCTURE A global network of nodes ensures true decentralization at its foundation, along with vast storage resources. GUARANTEED STORAGE ON IPFS Powering IPFS with an incentive and service layer, to assure data availability and redundancy through a trustless protocol. OMNICHAIN INTEROPERABILITY Omnichain storage services for frictionless interoperability across multiple ecosystems and in the most native way. ON-CHAIN STORAGE MARKET Access a decentralized and permissionless storage market catering to permanent and flexible storage needs. A TECH STACK TO BE BUILT UPON * 04 APPLICATION Crust Files, Crust Cloud, IPFS Scan, etc. * 03 INTEROPERABILITY AND TOOLING EVM, XCMP, X-Chain Contracts, Pallets, SDK, APIs, etc. * 02 BLOCKCHAIN AND STORAGE PROTOCOLS GPoS, MPoW, DSM, TEE, IPFS * 01 DECENTRALIZED PHYSICAL INFRASTRUCTURE Validators, Storage providers, Gateway providers YOUR OMNICHAIN SOLUTION FOR DECENTRALIZED STORAGE IN WEB3 * IPFS * XCMP * EVM * Others IPFS * Native IPFS integrations and toolkits for all web3 and web2 users * Chain agnostic storage services for any use case scenario * Leverage Crust solutions to enhance your IPFS experience Start Building Api Code Copy Code const got = require('got'); const { create, globSource } = require('ipfs-http-client'); const { Keyring } = require('@polkadot/keyring'); function timeout(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } async function main() { // 1. Get all inputss const path = './build'; const seeds = process.argv[2]; const ipfsGateway = 'https://crustwebsites.net'; // IPFS Web3 Authed Gateway address const ipfsPinningService = 'https://pin.crustcode.com/psa'; // IPFS Web3 Authed Pinning Service address // 2. Construct auth header const keyring = new Keyring(); const pair = keyring.addFromUri(seeds); const sig = pair.sign(pair.address); const sigHex = '0x' + Buffer.from(sig).toString('hex'); const authHeader = Buffer.from(`sub-${pair.address}:${sigHex}`).toString('base64'); // 3. Create ipfs http client const ipfs = create({ url: ipfsGateway + '/api/v0', headers: { authorization: 'Basic ' + authHeader } }); const { cid } = await ipfs.add(globSource(path, '**/*')); if (cid) { console.log(cid.toV0().toString()); } else { throw new Error('IPFS add failed, please try again.'); } // 4. Pin to crust with IPFS standard W3Authed pinning service const {body} = await got.post( ipfsPinningService + '/pins', { headers: { authorization: 'Bearer ' + authHeader }, json: { cid: cid.toV0().toString(), name: 'crust-demo' } } ); if (body) { const rid = JSON.parse(body)['requestId']; console.log(body, rid); // 5. Query pinning status through pinning service while (true) { const {body: pinningStat} = await got( ipfsPinningService + `/pins/${rid}`, { headers: { authorization: 'Bearer ' + authHeader } } ); console.log(pinningStat); // After success, you can query the cid on Crust await timeout(1000); } } else { console.log(body); throw new Error('Crust pin failed, please try again.'); } } main().catch(error => { console.error(error.message); }); XCMP * Crust provides a native cross-chain communication pallet based on XCMP called xStorage * Empowering builders via native storage services across the entire Substrate universe * Store, share and retrieve data seamlessly across all Polkadot and Kusama Parachains Start Building Api Code Copy Code #[pallet::weight(1_000_000)] pub fn place_storage_order( origin: OriginFor<T>, cid: Vec<u8>, size: u64, currency_id: T::CurrencyId ) -> DispatchResult { let who = ensure_signed(origin)?; let location: MultiLocation = T::CurrencyIdToMultiLocation::convert(currency_id.clone()).ok_or(Error::<T>::NotCrossChainTransferableCurrency)?; let amount = StorageFeePerCurrency::<T>::get(¤cy_id) .ok_or(Error::<T>::NotSupportedCurrency)?; let fee: MultiAsset = MultiAsset { id: Concrete(location), fun: Fungible(amount), }; // Convert origin to multilocation let origin_as_mult = T::AccountIdToMultiLocation::convert(who.clone()); let dest_as_mult = T::AccountIdToMultiLocation::convert(Self::account_id()); T::AssetTransactor::internal_transfer_asset(&fee.clone().into(), &origin_as_mult, &dest_as_mult) .map_err(|_| Error::<T>::UnableToTransferStorageFee)?; Self::deposit_event(Event::FileSuccess { account: who, cid, size, }); Ok(().into()) } EVM * Frictionless integration with all chains. platforms and applications built on top of Ethereum * Temporary and permanent storage options for all developers and users * Fully EVM compatible storage, hosting and retrieval services Start Building Api Code Copy Code const { ethers } = require("ethers"); // Base const ABI = `[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"customer","type":"address"},{"indexed":false,"internalType":"address","name":"merchant","type":"address"},{"indexed":false,"internalType":"string","name":"cid","type":"string"},{"indexed":false,"internalType":"uint256","name":"size","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isPermanent","type":"bool"}],"name":"Order","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[{"internalType":"address","name":"nodeAddress","type":"address"}],"name":"addOrderNode","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getNodesNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"size","type":"uint256"},{"internalType":"bool","name":"isPermanent","type":"bool"}],"name":"getPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"nodeArray","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nodes","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"cid","type":"string"},{"internalType":"uint256","name":"size","type":"uint256"},{"internalType":"bool","name":"isPermanent","type":"bool"}],"name":"placeOrder","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"cid","type":"string"},{"internalType":"uint256","name":"size","type":"uint256"},{"internalType":"address","name":"nodeAddress","type":"address"},{"internalType":"bool","name":"isPermanent","type":"bool"}],"name":"placeOrderWithNode","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"priceOracle","outputs":[{"internalType":"contract IPriceOracle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nodeAddress","type":"address"}],"name":"removeOrderNode","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"priceOracleAddress","type":"address"}],"name":"setPriceOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"}]` const CONTRACT_ADDRESS = "0xE391613d2056e47F74ED5eF1d443d4CDB21AAAd9"; const CHAIN_URL = "https://ethereum-mainnet-rpc.allthatnode.com"; const PRIVATE_KEY = "0xxxxxxxxxxxxxxxxxxxxxxxxxxxx"; // File infomation const fileCid = "QmTWBmGaUhEEusN5cftWFWjcegbfd9KftRND9EdsZrUvh2"; const fileSize = 44358; const isPermanentStorage = false; // false means 6 months storage async function main() { // provider const provider = new ethers.providers.JsonRpcProvider(CHAIN_URL) // signer const signer = new ethers.Wallet(PRIVATE_KEY, provider); // contract instance const storeContract = new ethers.Contract(CONTRACT_ADDRESS, ABI, signer); console.log("Get the file storage fee"); const price = await storeContract.getPrice(fileSize, isPermanentStorage); console.log("Fee: " + price + " wei"); console.log("Place storge order"); const tx = await storeContract.placeOrder(fileCid, fileSize, isPermanentStorage, { value: price }); await tx.wait(); console.log("Done this"); } (async () => { await main(); })().catch(e => { console.error(e); }); OTHERS * Crust Network offers advanced storage smart contract integrations tailored to diverse smart contract platforms * Storage Smart Contracts allow users to seamlessly interact with Crust across a wide range of ecosystems Start Building Api Code Copy Code import fs from 'fs'; import path from 'path'; import { create, IPFSHTTPClient } from 'ipfs-http-client'; import { ethers } from 'ethers'; import { ApiPromise, WsProvider } from '@polkadot/api'; import { typesBundleForPolkadot } from '@crustio/type-definitions'; import { Keyring } from '@polkadot/keyring'; const crustChainEndpoint = 'wss://rpc.crust.network'; // More endpoints: https://github.com/crustio/crust-apps/blob/master/packages/apps-config/src/endpoints/production.ts#L9 const ipfsW3GW = 'https://crustipfs.xyz'; // More web3 authed gateways: https://github.com/crustio/ipfsscan/blob/main/lib/constans.ts#L29 const crustSeeds = 'xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx'; // Create account(seeds): https://wiki.crust.network/docs/en/crustAccount const api = new ApiPromise({ provider: new WsProvider(crustChainEndpoint), typesBundle: typesBundleForPolkadot, }); main(); async function main() { // I. Upload file to IPFS // 1. Read file const filePath = 'sampleFile.txt'; const fileContent = await fs.readFileSync(path.resolve(__dirname, filePath)); // 2. [Local] Create IPFS instance const ipfsLocal = await create({ url: 'http://localhost:5001' }); // 2. [Gateway] Create IPFS instance // Now support: ethereum-series, polkadot-series, solana, elrond, flow, near, ... // Let's take ethereum as example const pair = ethers.Wallet.createRandom(); const sig = await pair.signMessage(pair.address); const authHeaderRaw = `eth-${pair.address}:${sig}`; const authHeader = Buffer.from(authHeaderRaw).toString('base64'); const ipfsRemote = create({ url: `${ipfsW3GW}/api/v0`, headers: { authorization: `Basic ${authHeader}` } }); // 3. Add IPFS const rst = await addFile(ipfsRemote, fileContent); // Or use IPFS local console.log(rst); // II. Place storage order await placeStorageOrder(rst.cid, rst.size); // III. [OPTIONAL] Add prepaid // Learn what's prepard for: https://wiki.crust.network/docs/en/DSM#3-file-order-assurance-settlement-and-discount const addedAmount = 100; // in pCRU, 1 pCRU = 10^-12 CRU await addPrepaid(rst.cid, addedAmount); // IV. Query storage status // Query forever here ... while (true) { const orderStatus: any = (await getOrderState(rst.cid)).toJSON(); console.log('Replica count: ', orderStatus['reported_replica_count']); // Print the replica count await new Promise(f => setTimeout(f, 1500)); // Just wait 1.5s for next chain-query } } async function addFile(ipfs: IPFSHTTPClient, fileContent: any) { // 1. Add file to ipfs const cid = await ipfs.add(fileContent); // 2. Get file status from ipfs const fileStat = await ipfs.files.stat("/ipfs/" + cid.path); return { cid: cid.path, size: fileStat.cumulativeSize }; } async function placeStorageOrder(fileCid: string, fileSize: number) { // 1. Construct place-storage-order tx const tips = 0; const memo = ''; const tx = api.tx.market.placeStorageOrder(fileCid, fileSize, tips, memo); // 2. Load seeds(account) const kr = new Keyring({ type: 'sr25519' }); const krp = kr.addFromUri(crustSeeds); // 3. Send transaction await api.isReadyOrError; return new Promise((resolve, reject) => { tx.signAndSend(krp, ({events = [], status}) => { console.log(`💸 Tx status: ${status.type}, nonce: ${tx.nonce}`); if (status.isInBlock) { events.forEach(({event: {method, section}}) => { if (method === 'ExtrinsicSuccess') { console.log(`✅ Place storage order success!`); resolve(true); } }); } else { // Pass it } }).catch(e => { reject(e); }) }); } async function addPrepaid(fileCid: string, amount: number) { // 1. Construct add-prepaid tx const tx = api.tx.market.addPrepaid(fileCid, amount); // 2. Load seeds(account) const kr = new Keyring({ type: 'sr25519' }); const krp = kr.addFromUri(crustSeeds); // 3. Send transaction await api.isReadyOrError; return new Promise((resolve, reject) => { tx.signAndSend(krp, ({events = [], status}) => { console.log(`💸 Tx status: ${status.type}, nonce: ${tx.nonce}`); if (status.isInBlock) { events.forEach(({event: {method, section}}) => { if (method === 'ExtrinsicSuccess') { console.log(`✅ Add prepaid success!`); resolve(true); } }); } else { // Pass it } }).catch(e => { reject(e); }) }); } async function getOrderState(cid: string) { await api.isReadyOrError; return await api.query.market.filesV2(cid); } DSTORAGE FOR EVERY USE CASE DAPP/WEBSITE HOSTING Hosting your front-end via Crust increases uptime and reduces security related risks. Enjoy unstoppable hosting capabilities without any single-points-of-failure NFT STORAGE By housing NFT metadata on Crust, users benefit from immutable, tamper-proof storage, ensuring complete asset ownership and data persistence. PUBLIC FILE STORAGE Crust’s multi-purpose storage services provide everything you need to keep your public data always secured, replicated and accessible. DECENTRALIZED SOCIAL Users should have complete control over their content and data. Crust's storage solutions ensure that users maintain ownership of their content, granting them full control and rights. ENCRYPTED FILE STORAGE Crust provides users with different options for encrypted file storage to keep your most valuable data private and secured by a global network of nodes. GAMING Crust’s multi-purpose storage services provide everything you need to keep your public data always secured, replicated and accessible. IPFS DONE THE RIGHT WAY Elevating your IPFS experience, Crust Network serves as incentivized service layer, safeguarding your data with accessibility, replication, and long-term guarantees. DEDICATED GATEWAY SERVICE: Upload and retrieve data with Crust’s dedicated IPFS gateways. Our gateways ensure highest performance for the best user experience on IPFS. DECENTRALIZED PINNING SERVICE: Pin your data to Crust and enjoy multiple replicas per file secured via a fully decentralized protocol and infrastructure. On-demand as well as permanently. DATA QUERY SERVICE: Inspect your storage orders directly on-chain or via our IPFS storage explorer to validate data availability, number of replicas and more. PRODUCTS * DSM VIA CRUST MAINNET Everyone can place an on-chain storage order and get your data distributed on IPFS. * CRUST FILES Your first Web3.0 personal file sharing dApp, now supporting EVM chains. * CRUST CLOUD It defines what cloud storage middlewares should look like in Web3 - every storage bucket is a NFT, and every IPFS gateway is a NFT. * IPFS SCAN A free, handy and open IPFS explorer application allowing users to search and check the storage status and details of files. BACKED BY START YOUR CRUST JOURNEY NOW! Ready to dive into the world of decentralized solutions with Crust? Click below to connect with our experts and explore the possibilities! Connect with Crust Team With Crust data and storage resources can be made ownable like any other on-chain asset. Gain full control over your data * * * * WEBSITE * Home * Wiki * Blog * Contact MEDIA * Twitter * Discord * Telegram * Medium * Governance LINK * Github * Tech Whitepaper * Economy Whitepaper * Token Metrics