Gamba's open-source SDK is really easy to work with. Simply provide your Solana address and start earning on every bet made on your site.
Every result can be independently verified by the player. This means your users can start playing without worrying about trust.
Gamba exists on-chain and is completely permissionless. No license needed to start building. :)
import React from 'react';
import { GambaProvider } from "gamba-react-v2";
import { GambaPlatformProvider, GambaUi } from "gamba-react-ui-v2";
function DoubleOrNothing() {
const game = GambaUi.useGame();
const doubleOrNothing = async () => {
try {
await game.play({
bet: [0, 2],
wager: solToLamports(0.1)
})
const result = await game.result()
if (result.payout > 0) {
console.log("Win")
} else {
console.log("Loss")
}
} catch (error) {
console.error("Error:", error)
}
};
return (
<GambaUi.PlayButton onClick={doubleOrNothing}>
Double or Nothing
</GambaUi.PlayButton>
);
}
function App() {
return (
<GambaProvider>
<GambaPlatformProvider creator={"<CREATOR_ADDRESS_HERE>"}>
<DoubleOrNothing />
</GambaPlatformProvider>
</GambaProvider>
);
}
With just a static webpage you can build betting games that interact directly with the Solana blockchain, and collect fees on every bet made via your frontend.
Check out our Github to get started