Following the Badge service, the platform “DotWallet for Developers” and sCrypt are working together again! It is aimed to enable developers to build Dapps based on sCrypt easily and make interactions with DotWallet available for them through the new API , lightening the load for developers so that they can build superior Dapps.
From now on, when developers build Dapps on the platform “DotWallet for Developers”, they can enjoy one-click quicker login and get connected with the massive amount of users on DotWallet. Meanwhile, at the moment they are writing smart contracts based on sCrypt, they can have direct interaction with the DotWallet. As the latter will act accordingly in line with the running results of the sCrypt smart contract. Those actions like: user’s signature, payment sent and received through the wallet, payment sent and received through “Cards” powered by Badge service, UTXO selection etc. This whole process can be done completely on chain, without the third party intervention, so that decentralization is truly realized.
The APIs opened this time are as follows:
1. listunspent: an interface for querying the available UTXO, used to make transactions with non-standard scripts on the DAPP side. If successful, the available utxo array will be returned;
2. getSignature: an interface for signing any transaction template. Dapp constructs the unsigned transaction, which is submitted by this interface to the wallet for signature. If successful, unlockscript or Signature will be returned;
3. sendRawTransaction： an interface for transaction. This one is relatively simple, mainly in charge of broadcasting the transaction. If successful, transaction ID will be returned;
4. publickey∶ to get a usable public key；
5. getRawChangeAddress∶ to get a change address；
6. balance: to check the wallet balance；
7. requestAccount∶ establish a connection with the wallet and request permission；
Here is a simple Dapp “Tic-Tac-Toe” demo to help developers better understand the above interfaces. (This game is only used as a functional demonstration, the interface design and user experience have not been optimized.)
This application is very user-friendly, only two DotWallet accounts with BSV balance is required. Here’s the guidance:
Step one: use a browser to log in DotWallet A account, and open the game window in the same browser, then click “login dotwallet” to authorize DotWallet A account login to obtain the account balance.
Step two: enter the number in the Bet amount, the minimum is 20000sat., then click “Start Bet”-“Join” to jump and open a new game window.
Step three: log out the DotWallet A account and log in the DotWallet B account. Click “login dotwallet” in the new game window to authorize DotWallet B account login to obtain the account balance and deduct the corresponding betting amount.
At this point, the same BSV betting by the two accounts will be locked in the contract without any third party intervention. Only the winning one is allowed to take the coins in the contract and send them directly to the DotWallet. If no one wins in the end, the coins bet by the two players will be automatically returned to the wallet.
New API documentation is available now, for more information, please visit the platform “DotWallet for Developers”:
— — — —
To learn more；
Touchstone source code：https://github.com/dotwallet/touchstone
DotWallet for Developers：https://developers.dotwallet.com/
New to BTC? Check out CoinGeek’s BTC for Beginners section, the ultimate resource guide to learn more about BTC—as originally envisioned by Satoshi Nakamoto—and blockchain.