The complete guide to full stack BSV blockchain development – CoinGeek
This post was first published onMedium.
In this guide, youll learn a Web3 tech stack that will allow you to build full stack decentralized apps on the Bitcoin SV blockchain. We will walk through the entire process of building a full stack decentralized Tic-Tac-Toe, including:
By the end, you will have a fully functionalTic-Tac-Toe Apprunning on Bitcoin.
What we will use
Lets go over the main pieces we will be using and how they fit into the stack.
1. sCrypt Framework
sCrypt is a TypeScript framework to develop smart contracts on Bitcoin. It offers a complete tech stack:
2. Yours Wallet
Yours Walletis an open-source digital wallet for BSV and1Sat Ordinalsthat enables access to decentralized applications developed onBitcoin SV. Yours Wallet generates and manages private keys for its users in a non-custodial manner, ensuring that the users have full control over their funds and transactions. These keys can be utilized within the wallet to securely store funds and authorize transactions.
3. React
React.js, often simply referred to as React, is a JavaScript library developed by Facebook. Its primarily used for building user interfaces (UIs) for web applications. It simplifies the process of building dynamic and interactive web applications and continues to be seemingly dominating the front-end space.
What we will Build
We will build a very simple Tic-Tac-Toe game on chain. It uses the Bitcoin addresses of two players (Alice and Bob respectively) to initialize a smart contract. They each bet the same amount and lock it into the contract. The winner takes all bitcoins locked in the contract. If no one wins and there is a draw, the two players can each withdraw half of the money. Tic-Tac-Toe, the age-old game of strategy and skill, has now found its way onto the blockchain thanks to the power of sCrypt.
Prerequisites
Getting Started
Lets simply create a new React project.
Firstly lets create a new React project with TypeScript template.
Then, change the directory to the tic-tac-toe project directory and also run theinitcommand of theCLIto addsCryptsupport in your project.
Tic-tac-toe Contract
Next, lets create a contract atsrc/contracts/tictactoe.ts:
Properties
The Tic-Tac-Toe contract features several essential properties that define its functionality:
Constructor
Upon deployment, the constructor initializes the contract with the public keys of Alice and Bob. Additionally, it sets up an empty game board to kickstart the game play.
Public methods
Each contract must have at least one public@method. It is denoted with thepublicmodifier and does not return any value. It is visible outside the contract and acts as the main method into the contract (likemainin C and Java).
The public method in the contract ismove(), which allows players to make their moves on the board. This method validates the moves, checks the players signature, updates the game state, and determines the outcome of the game.
Signature verification
Once the game contract is deployed, anyone can view and potentially interact with it. We need an authentication mechanism to ensure only the desired player can update the contract if its their turn. This is achieved using digital signatures.
Only the authorized player can make a move during their turn, validated through their respective public key stored in the contract.
Non-Public methods
The contract includes two non-public methods,won()andfull(), responsible for determining whether a player has won the game and if the board is full, leading to a draw.
Tx Builder: buildTxForMove
Bitcoin transaction can have multiple inputs and outputs. We need to build a transaction when calling a contract.
Here, we have implement acustomize transactionbuilder for themove()method as below:
Integrate Front-end (React)
After we have written/tested our contract, we can integrate it with front-end so that users can play our game.
First, lets compile the contract and get the contract artifact json file by running the command below:
You should see an artifact filetictactoe.jsonin theartifactsdirectory. It can be used to initialize a contract at the front end.
Install and Fund Wallet
Before deploying a contract, we need to connect a wallet first. We useYours Wallet, a MetaMask-like wallet.
After installing the wallet, click thesettingsbutton in the upper right corner to switch to testnet. Then copy your wallet address and go to ourfaucetto fund it.
Connect to wallet
We callrequestAuth()to request to connect to the wallet. If the request is approved by the user, we now have full access to the wallet. We can, for example, callgetDefaultPubKey()to get its public key.
Initialize the contract
We have obtained the contract classTictactoe by loading the contract artifact file. When a user clicks thestartbutton, the contract is initialized with the public keys of two playersaliceandbob. The public key can be obtained through callingetDefaultPubKey()ofSigner.
The following code initializes the contract.
Call the contract
Now we can start playing the game. Every move is a call to the contract and triggers a change in the state of the contract.
After finishing with the front-end you can simply run :
You can now view it at `http://localhost:3000/` in your browser.
Conclusion
Congratulations! You have just built your first full stack dApp on Bitcoin. Now you can playtic-tac-toeor build your favorite game on Bitcoin. Now would be a good time to pop some champagne if you havent already :).
One session of play can be viewed here:
All the code can be found atthis github repo.
By default, we deploy the contract on testnet. You can easily change it to mainnet.
Watch: sCrypt Hackathon 2024 (17th March 2024, PM)
New to blockchain? Check out CoinGeeks Blockchain for Beginners section, the ultimate resource guide to learn more about blockchain technology.
More:
The complete guide to full stack BSV blockchain development - CoinGeek
- AI-Driven Smart Contracts in Crypto: Navigating Legal Risks and Seizing Strategic Opportunities - AInvest - August 24th, 2025 [August 24th, 2025]
- How Transforming Industries in 2025: The Power of Smart Contracts - Vocal - August 22nd, 2025 [August 22nd, 2025]
- Flow Q2 DeFi Report: Record growth in TVL, smart contracts, and Disney partnership - FXStreet - August 22nd, 2025 [August 22nd, 2025]
- Institutional Capital's New Playground: Why Ethereum's Smart Contracts Are Winning Over Bitcoin - AInvest - August 22nd, 2025 [August 22nd, 2025]
- Federal Reserve Examines Tokenization, Smart Contracts, and AI for Payments - CoinCentral - August 22nd, 2025 [August 22nd, 2025]
- Sports Stars and Smart Contracts: How BlockDAG and ADA Are Rewriting the Crypto Playbook - AInvest - August 22nd, 2025 [August 22nd, 2025]
- Fed is studying tokenization, smart contracts, and AI in payments, says Governor Waller - Crypto Briefing - August 20th, 2025 [August 20th, 2025]
- Fed's Waller: Fed researching tokenization, smart contracts, and AI in payments - MSN - August 20th, 2025 [August 20th, 2025]
- Before Ethereum Had Smart Contracts, It Had Believers Lyno AI Finds Its Own Early Supporters - Live Bitcoin News - August 20th, 2025 [August 20th, 2025]
- Fed Seeks Tech-Driven Payment Revolution: AI, Stablecoins, and Smart Contracts Take Center Stage - AInvest - August 20th, 2025 [August 20th, 2025]
- Ethereum News Today: Ethereum's Smart Contracts Rewrite FinanceInstitutional Bet on Blockchain's Future - AInvest - August 20th, 2025 [August 20th, 2025]
- Smart contracts have dumb insurance, and it's hurting the industry - Cointelegraph - August 20th, 2025 [August 20th, 2025]
- XRP News Today: SolMining Launches XRP-Powered Smart Contracts for Passive Income with Fixed Returns - AInvest - August 9th, 2025 [August 9th, 2025]
- Threat Actors Exploit Smart Contracts to Drain Over $900K from Crypto Wallets - gbhackers.com - August 7th, 2025 [August 7th, 2025]
- Powering Trust: The Secure, Automated, and Transparent Technology Behind Sunny Minings XRP Smart Contracts - StreetInsider - August 6th, 2025 [August 6th, 2025]
- Sunny Mining : From Airdrop Rewards to Smart Contracts - The Profit Toolkit of XRP Mining - openPR.com - August 3rd, 2025 [August 3rd, 2025]
- AMMs Reshape DeFi Trading with Smart Contracts and Liquidity Pools - AInvest - August 1st, 2025 [August 1st, 2025]
- Unlocking The Power: How Smart Contracts Drive The Utility And Flexibility Of Crypto Tokens - Outlook India - August 1st, 2025 [August 1st, 2025]
- Stellar XLM Targets $3.43 by 2031 Driven by Smart Contracts and Deflationary Model - AInvest - August 1st, 2025 [August 1st, 2025]
- By 2025, over 60% of global food supply chains will use blockchain-based smart contracts for traceability. - Farmonaut - August 1st, 2025 [August 1st, 2025]
- Smart contracts and staking arrive on Bitcoins base layer - Cointelegraph - July 30th, 2025 [July 30th, 2025]
- [LIVE] Ten Years of Ethereum: From Smart Contracts to a Global Financial Layer - Cryptonews - July 30th, 2025 [July 30th, 2025]
- Ethereum (ETH) Launch Anniversary: Impact on Smart Contracts, DeFi, and Trading Strategies in 2025 - Blockchain News - July 30th, 2025 [July 30th, 2025]
- [LIVE] Ten Years of Ethereum: From Smart Contracts to a Global Financial Layer - TradingView - July 30th, 2025 [July 30th, 2025]
- Ethereum News Today: Ethereum ETFs Attract $1.85B Inflows 25-Fold Bitcoin as Institutions Shift to Smart Contracts and Regulatory Clarity - AInvest - July 28th, 2025 [July 28th, 2025]
- Beyond the XRP Price Boom: JAMining's Smart Contracts Offer Overlooked Stability in Crypto Income - International Business Times Australia - July 24th, 2025 [July 24th, 2025]
- Zama And OpenZeppelin Team Up To Deliver Confidential Smart Contracts For Institutions - BlockchainReporter - July 24th, 2025 [July 24th, 2025]
- How Smart Contracts Are Transforming 21st Century Business Operations - Vocal - July 22nd, 2025 [July 22nd, 2025]
- Which sectors are fastest adopting smart contracts development, and how can we access these markets - Vocal - July 20th, 2025 [July 20th, 2025]
- A New Tool Uncovers Over $11.2 Billion at Risk in Ethereum Smart Contracts - HackerNoon - July 18th, 2025 [July 18th, 2025]
- Learn How to Create Smart Contracts on Ethereum with Solidity - NASSCOM Community - July 18th, 2025 [July 18th, 2025]
- Enecuum (ENQ): For Building And Deploying dApps And Smart Contracts - CoinIdol - July 18th, 2025 [July 18th, 2025]
- Smart Contracts Market Size Predicted to Cross USD 9.2 Billion at 21.40% CAGR by 2032 - openPR.com - July 16th, 2025 [July 16th, 2025]
- EarnMining Debuts Smart Cloud Mining Platform with Free Bitcoin Contracts and App Integration - Morningstar - July 14th, 2025 [July 14th, 2025]
- Bitcoin Hyper Emerges as a Leading Crypto Presale, Bringing Smart Contracts and Solana Speed to the Bitcoin Network - CryptoNinjas - July 12th, 2025 [July 12th, 2025]
- Grayscales Q2 2025 Fund Rebalancing: Strategic Moves in DeFi, Smart Contracts, and AI Blockchain - OKX - July 12th, 2025 [July 12th, 2025]
- EarnMining Debuts Smart Cloud Mining Platform with Free Bitcoin Contracts and App Integration - GlobeNewswire - July 12th, 2025 [July 12th, 2025]
- Solana vs. Ozak AI Price Forecast: Smart Contracts or Smart AIWhich Will 100x? - Live Bitcoin News - July 10th, 2025 [July 10th, 2025]
- Smart traceable framework for transportation of transplantable organs using IPFS, iot, and smart contracts - Nature - July 10th, 2025 [July 10th, 2025]
- Revolutionizing Digital Transactions with Ethereum Smart Contracts - Vocal - July 6th, 2025 [July 6th, 2025]
- Why the Outlook for the Smart Contracts Market Is So Positive - International Banker - July 4th, 2025 [July 4th, 2025]
- The Role of Smart Contracts in RWA Tokenization - NASSCOM Community - July 2nd, 2025 [July 2nd, 2025]
- Stablecoins, Smart Contracts and The Rise of More Intelligent Cash - HackerNoon - July 2nd, 2025 [July 2nd, 2025]
- Stablecoins, smart contracts and the rise of more intelligent cash - ChannelLife New Zealand - June 29th, 2025 [June 29th, 2025]
- XRP News Today: XRP Ledger Introduces Version 2.5.0 With Smart Contracts And Enhanced Interoperability - AInvest - June 29th, 2025 [June 29th, 2025]
- Smart Contracts at the Card Table: Automating Trust in Online Poker Rooms - TechSpective - June 28th, 2025 [June 28th, 2025]
- From Idea to Code: Building Smart Contracts with Remix Solidity - NFTevening - June 24th, 2025 [June 24th, 2025]
- Ethereum Just Dropped the Fusaka Upgrade And It Could Change Smart Contracts Forever! - Pintu - June 24th, 2025 [June 24th, 2025]
- Ethereum Rolls Out 4 New EIPs in Fusaka Upgrade to Power the Future of Smart Contracts - TronWeekly - June 22nd, 2025 [June 22nd, 2025]
- Smart Contracts on the Blockchain: What They Are, How They Work, and Examples - NASSCOM Community - June 20th, 2025 [June 20th, 2025]
- From Smart Contracts to Privacy Coins: Leading Crypto to Buy Includes BlockDAG - NFTevening - June 14th, 2025 [June 14th, 2025]
- How Ethereum Fuels Web3 Innovations: Smart Contracts, DeFi, and dApps - Greensboro News and Record - May 28th, 2025 [May 28th, 2025]
- How Ethereum Fuels Web3 Innovations: Smart Contracts, DeFi, and dApps - Greensboro News and Record - May 28th, 2025 [May 28th, 2025]
- ETH Rallies Toward $2600 amid Smart Contracts and Whale Activity Spike - Benzinga - May 28th, 2025 [May 28th, 2025]
- Bitlayer Teams Up With Major Bitcoin Miners to Bring Smart Contracts to Bitcoin - eGamers.io - May 28th, 2025 [May 28th, 2025]
- OP_CTV and Smart Contracts on Bitcoin: Is Programmable Bitcoin Finally Here? - CCN.com - May 17th, 2025 [May 17th, 2025]
- Smart contracts can think and respond like AI agents Heres how - Cointelegraph - April 30th, 2025 [April 30th, 2025]
- Analyst Says Think Bigger Now, as Cardano Hit $90B Market Cap in 2021 Without Smart Contracts - The Crypto Basic - April 30th, 2025 [April 30th, 2025]
- Ethereum: The Blockchain Powering Smart Contracts, DeFi, and More - The Danville Register and Bee - April 18th, 2025 [April 18th, 2025]
- Smart Contracts Market Poised for Significant Growth Amidst Rising Blockchain Adoption and Demand for Automated Agreements FMIBlog - FMIBlog - April 10th, 2025 [April 10th, 2025]
- South Africa: Blockchain and smart contracts to transform agriculture - ZAWYA - April 10th, 2025 [April 10th, 2025]
- Ethereum 2.0: The Future Of Smart Contracts - Outlook India - April 10th, 2025 [April 10th, 2025]
- Hacker Exploits Smart Contracts Vulnerability, Steals $13 Million in Ethereum - Cryptodnes.bg - March 28th, 2025 [March 28th, 2025]
- Scam Alert: Another 6,260 ETH Lost in GMX-Linked Smart Contracts - TradingView - March 28th, 2025 [March 28th, 2025]
- Trends Shaping the $3.2 Billion Smart Contracts Market, - GlobeNewswire - March 25th, 2025 [March 25th, 2025]
- Smart Contracts Market Size, Share 2025 Analysis of Rising - openPR - March 25th, 2025 [March 25th, 2025]
- Ethereum: the king of smart contracts or a victim of its own ambitions? - Binance - March 25th, 2025 [March 25th, 2025]
- What is a Blockchain Oracle? | Connecting Smart Contracts to the Real World | Get Started with Bitcoin.com - Bitcoin.com - March 5th, 2025 [March 5th, 2025]
- The Impact Of AI Generated Smart Contracts On Automation And Security - Outlook India - March 5th, 2025 [March 5th, 2025]
- Russian Central Bank Governor Says Interest in Smart Contracts Rising, Hints at Rollout of New Digital Ruble - The Daily Hodl - March 3rd, 2025 [March 3rd, 2025]
- Top Cryptos to Buy and Hold for Short Term: Qubetics QubeQode IDE, Ethereums Smart Contracts, and Bitcoins Scarcity - NewsWatch - March 3rd, 2025 [March 3rd, 2025]
- Transitioning from Sharded Blockchain to Sharded Smart Contracts - Tekedia - March 3rd, 2025 [March 3rd, 2025]
- Jamie Dimon's Longstanding Belief In Smart Contracts Revealed Ahead Of JPMorgan's Ethereum ETF Deal - MSN - March 1st, 2025 [March 1st, 2025]
- AGII Revolutionizes Smart Contracts and Automation with Adaptive AI Technology - EIN News - March 1st, 2025 [March 1st, 2025]
- Crypto's New Frontier: AI-Smart Contracts Are Here! - Be3 - March 1st, 2025 [March 1st, 2025]
- How Smart Contracts Are Revolutionizing Business And Finance - Outlook India - March 1st, 2025 [March 1st, 2025]
- Decentralizing Finance: How Smart Contracts Are Reshaping The Financial Landscape - Outlook India - March 1st, 2025 [March 1st, 2025]
- What is possible on Cardano (ADA) without Smart Contracts? - The Currency Analytics - February 23rd, 2025 [February 23rd, 2025]
- Healthcare smart contracts to reach $10B by 2030 - CoinGeek - February 23rd, 2025 [February 23rd, 2025]
- Qubetics ($TICS), Tron (TRX), and Cronos (CRO): The Future of Blockchain Development, Scalable Smart Contracts, and Crypto Payments Best Coins to Buy... - February 23rd, 2025 [February 23rd, 2025]