SourceTrust is a decentralized marketplace for AI datasets, leveraging Story Protocol for intellectual property registration and protection. The application is built using Next.js, TypeScript, and integrates with blockchain technologies.
- Frontend: Next.js, TypeScript, TailwindCSS
- Blockchain: Story Protocol SDK, Wagmi, Viem
- Storage: IPFS via Pinata
- Authentication: MetaMask Wallet
- Implements MetaMask wallet connection
- Handles wallet state management
- Provides wallet address display and disconnection
- Uses Wagmi hooks for Web3 interactions
- Core functionality for dataset management
- Implements Story Protocol IP registration
- Features:
- Dataset listing
- Dataset addition
- IP registration
- IPFS metadata storage
- Handles metadata upload to IPFS
- Uses Pinata SDK for reliable IPFS storage
- Returns IPFS hashes for metadata URIs
const registerDatasetAsIP = async (dataset: NewDataset) => {
const client = await setupStoryClient();
// Generate metadata
const ipMetadata = client.ipAsset.generateIpMetadata({
title: dataset.name,
description: dataset.description,
ipType: 'dataset',
attributes: [{ key: 'Category', value: dataset.category }],
creators: [{
name: 'Dataset Owner',
contributionPercent: 100,
address: wallet?.account.address as Address,
}],
});
// Upload to IPFS and register IP
const ipIpfsHash = await uploadJSONToIPFS(ipMetadata);
const ipHash = createHash('sha256').update(JSON.stringify(ipMetadata)).digest('hex');
const response = await client.ipAsset.mintAndRegisterIp({
spgNftContract: "0xc32A8a0FF3beDDDa58393d022aF433e78739FAbc",
recipient: wallet?.account.address as Address,
ipMetadata: {
ipMetadataURI: `https://ipfs.io/ipfs/${ipIpfsHash}`,
ipMetadataHash: `0x${ipHash}`,
// ... additional metadata
},
});
}
Required environment variables:
NEXT_PUBLIC_SPG_NFT_CONTRACT_ADDRESS=0xc32A8a0FF3beDDDa58393d022aF433e78739FAbc
NEXT_PUBLIC_PINATA_JWT=your_pinata_jwt_here
-
Install dependencies:
npm install
-
Configure environment variables:
- Copy
.env.example
to.env.local
- Add required API keys and contract addresses
- Copy
-
Run development server:
npm run dev
- User connects wallet
- Creates dataset entry
- Metadata generated and uploaded to IPFS
- IP registered through Story Protocol
- NFT minted to user's wallet
- UI updated with new dataset
- Wallet connection required for sensitive operations
- Metadata hashing for integrity
- IPFS for decentralized storage
- Smart contract security through Story Protocol
- SPG NFT Contract (Aeneid):
0xc32A8a0FF3beDDDa58393d022aF433e78739FAbc
- Dataset search and filtering
- Advanced metadata management
- Dataset version control
- Access control mechanisms
- Dataset analytics
Core dependencies:
- @story-protocol/core-sdk
- wagmi
- viem
- pinata-web3
- ethers
- next
- react
- tailwindcss