DÆTA is designed to be blockchain-agnostic, allowing for seamless integration with multiple blockchain networks to leverage their unique features and expand the utility of decentralized storage.
Ethereum Compatibility
As DÆTA's native token ($DAETA) is an ERC-20 token, it ensures deep compatibility with the Ethereum ecosystem.
Smart Contract Interaction Example of a Solidity contract interfacing with DÆTA:
Copy pragma solidity ^0.8.0;
import "@daeta/contracts/interfaces/IDaetaStorage.sol";
contract DaetaIntegration {
IDaetaStorage private daetaStorage;
constructor(address _daetaStorageAddress) {
daetaStorage = IDaetaStorage(_daetaStorageAddress);
}
function storeData(string memory _data) public returns (bytes32) {
return daetaStorage.store(_data);
}
function retrieveData(bytes32 _fileId) public view returns (string memory) {
return daetaStorage.retrieve(_fileId);
}
}
Smart Contract Interaction Example of a Solidity contract interfacing with DÆTA:
Copy pragma solidity ^0.8.0;
import "@daeta/contracts/interfaces/IDaetaStorage.sol";
contract DaetaIntegration {
IDaetaStorage private daetaStorage;
constructor(address _daetaStorageAddress) {
daetaStorage = IDaetaStorage(_daetaStorageAddress);
}
function storeData(string memory _data) public returns (bytes32) {
return daetaStorage.store(_data);
}
function retrieveData(bytes32 _fileId) public view returns (string memory) {
return daetaStorage.retrieve(_fileId);
}
}
Token Bridge Facilitates the transfer of DÆTA tokens between Ethereum and other compatible blockchains.
Copy const { ethers } = require('ethers');
const DaetaBridge = require('@daeta/bridge');
async function bridgeTokens(amount, destChain) {
const provider = new ethers.providers.Web3Provider(window.ethereum);
const signer = provider.getSigner();
const bridge = new DaetaBridge(signer);
const tx = await bridge.transfer(amount, destChain);
await tx.wait();
console.log(`Bridged ${amount} DÆTA tokens to ${destChain}`);
}
Cross-Chain Compatibility
DÆTA supports interoperability with multiple blockchain networks.
Polkadot Integration Utilizing Polkadot's cross-chain messaging to enable DÆTA storage for parachains.
Copy use frame_support::{decl_module, dispatch::DispatchResult};
use daeta_bridge::DaetaStorageInterface;
pub trait Config: frame_system::Config {
type DaetaInterface: DaetaStorageInterface;
}
decl_module! {
pub struct Module<T: Config> for enum Call where origin: T::Origin {
#[weight = 10_000]
pub fn store_on_daeta(origin, data: Vec<u8>) -> DispatchResult {
let sender = ensure_signed(origin)?;
let file_id = T::DaetaInterface::store(data)?;
// Further processing...
Ok(())
}
}
}
Cosmos SDK Integration Implementing DÆTA storage module for Cosmos-based blockchains.
Copy package daetastorage
import (
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/daeta/daeta-cosmos-module/x/daetastorage/keeper"
"github.com/daeta/daeta-cosmos-module/x/daetastorage/types"
)
func NewHandler(k keeper.Keeper) sdk.Handler {
return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) {
switch msg := msg.(type) {
case *types.MsgStoreFile:
return handleMsgStoreFile(ctx, k, msg)
default:
return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized %s message type: %T", types.ModuleName, msg)
}
}
}
func handleMsgStoreFile(ctx sdk.Context, k keeper.Keeper, msg *types.MsgStoreFile) (*sdk.Result, error) {
fileID, err := k.StoreFile(ctx, msg.Sender, msg.Data)
if err != nil {
return nil, err
}
ctx.EventManager().EmitEvent(
sdk.NewEvent(
types.EventTypeStoreFile,
sdk.NewAttribute(types.AttributeKeyFileID, fileID.String()),
sdk.NewAttribute(types.AttributeKeySender, msg.Sender.String()),
),
)
return &sdk.Result{Events: ctx.EventManager().ABCIEvents()}, nil
}