Integriere vertrauenslose Treuhand in deine dApp mit unserem umfassenden SDK und Smart-Contract-APIs.
SchnellstartStarte in wenigen Minuten mit YBZ. Folge diesen einfachen Schritten, um Escrow in deine Anwendung zu integrieren.
Installiere das YBZ SDK über npm oder yarn
Verbinde dich mit dem YBZ Smart Contract
Initialisiere deinen ersten Escrow
Höre auf Contract-Events und Statusänderungen
Choose the integration method that best fits your stack — from direct contract calls to high-level SDKs.
Direct integration with Ethers.js or Web3.js for maximum control and flexibility.
High-level TypeScript SDK with built-in error handling and type safety.
Query historical deal data with GraphQL via The Graph subgraph.
See how easy it is to integrate YBZ escrow into your application with these real-world examples.
import { ethers } from 'ethers';
import YBZCore from './YBZCore.json';
const CONTRACT_ADDRESS = '0xAe1D3Af...Ec15611';
async function createDeal() {
const provider = new ethers.providers.Web3Provider(window.ethereum);
const signer = provider.getSigner();
const contract = new ethers.Contract(CONTRACT_ADDRESS, YBZCore.abi, signer);
const seller = '0x...'; // Seller address
const amount = ethers.utils.parseEther('1.0'); // 1 ETH
const acceptWindow = 86400; // 24 hours
const submitWindow = 604800; // 7 days
const confirmWindow = 259200; // 3 days
const tx = await contract.createDealETH(
seller,
acceptWindow,
submitWindow,
confirmWindow,
ethers.constants.AddressZero, // No arbiter
'', // No description
{ value: amount }
);
const receipt = await tx.wait();
console.log('Deal created:', receipt);
}
async function acceptDeal(dealId) {
const provider = new ethers.providers.Web3Provider(window.ethereum);
const signer = provider.getSigner();
const contract = new ethers.Contract(CONTRACT_ADDRESS, YBZCore.abi, signer);
// Accept the deal as seller
const tx = await contract.acceptDeal(dealId);
await tx.wait();
console.log(`Deal ${dealId} accepted`);
}
async function submitWork(dealId, proofHash) {
const provider = new ethers.providers.Web3Provider(window.ethereum);
const signer = provider.getSigner();
const contract = new ethers.Contract(CONTRACT_ADDRESS, YBZCore.abi, signer);
// Submit work proof (IPFS hash)
const tx = await contract.submitWork(dealId, proofHash);
await tx.wait();
console.log(`Work submitted for deal ${dealId}`);
}
async function listenToEvents() {
const provider = new ethers.providers.Web3Provider(window.ethereum);
const contract = new ethers.Contract(CONTRACT_ADDRESS, YBZCore.abi, provider);
// Listen for DealCreated events
contract.on('DealCreated', (dealId, buyer, seller, amount, token) => {
console.log('New deal created:', {
dealId: dealId.toString(),
buyer,
seller,
amount: ethers.utils.formatEther(amount),
token
});
});
// Listen for DealAccepted events
contract.on('DealAccepted', (dealId, seller) => {
console.log(`Deal ${dealId} accepted by ${seller}`);
});
}
Complete reference of YBZ Core contract functions, events, and view methods.
| Function | Description | Access |
|---|---|---|
createDealETH() |
Create a new escrow deal with ETH | Public |
createDealERC20() |
Create a new escrow deal with ERC20 token | Public |
acceptDeal()
|
Seller accepts the deal | Seller |
submitWork()
|
Seller submits work proof | Seller |
approveDeal()
|
Buyer approves completed work | Buyer |
raiseDispute() |
Either party raises a dispute | Public |
resolveDispute() |
Arbiter resolves the dispute | Arbiter |
| Event | Emitted When |
|---|---|
DealCreated
|
New escrow deal is created |
DealAccepted
|
Seller accepts the deal |
WorkSubmitted
|
Seller submits work proof |
DealApproved
|
Buyer approves the work |
DisputeRaised
|
A dispute is raised |
DisputeResolved |
Arbiter resolves the dispute |
Everything you need to build, test, and deploy your integration with YBZ.
Complete API reference and integration guides
Browse source code and SDK examples
Get help from developers and the team
Install SDK via npm or yarn
View verified contract on Etherscan
Get test ETH for development
Follow these guidelines to build secure and reliable integrations with YBZ.
Join our developer community and start integrating trustless escrow into your dApp today.