Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version/2.5 #55

Merged
merged 42 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
575304c
V2.5 Cheatsheet
oleksandrchainsafe Jul 6, 2023
4a07432
V2.5 Getting Started
oleksandrchainsafe Jul 6, 2023
5be1221
V2.5 Configuration
oleksandrchainsafe Jul 7, 2023
2a844b8
2.5 Signers and Wallets
oleksandrchainsafe Jul 18, 2023
4c9b67a
2.5 Connecting a Wallet
oleksandrchainsafe Jul 19, 2023
17498c3
2.5 Lost asset added
oleksandrchainsafe Jul 19, 2023
993ebd8
2.5 Interacting with coins
oleksandrchainsafe Jul 25, 2023
2a17f84
Update 5_configuration.md
oleksandrchainsafe Aug 1, 2023
ea574cd
Update 6_signers-and-wallets.md
oleksandrchainsafe Aug 1, 2023
8a0b59b
2.5 Interacting with NFTs
oleksandrchainsafe Aug 1, 2023
9308211
2.5 Interacting with Smart Contracts
oleksandrchainsafe Aug 2, 2023
358c85e
Update 1_cheatsheet.md
oleksandrchainsafe Aug 2, 2023
3496c09
2.5 Extending the SDK
oleksandrchainsafe Aug 4, 2023
34583aa
Edits before passing it to DevRel
oleksandrchainsafe Aug 7, 2023
9c3a9c2
Code cleanup
sneakzttv Aug 15, 2023
889f4da
Update 6_signers-and-wallets.md
sneakzttv Aug 15, 2023
eb99a34
Update 2_getting-started.md
sneakzttv Aug 15, 2023
de9b3df
Update 2_getting-started.md
sneakzttv Aug 15, 2023
c79f205
newtonsoft faq
sneakzttv Aug 28, 2023
dac3c98
Update dictionary.txt
sneakzttv Aug 28, 2023
75e1eb1
Merge branch 'main' into version/2.5
sneakzttv Sep 8, 2023
281e22b
Update dictionary.txt
sneakzttv Sep 8, 2023
69397ed
WIp
sneakzttv Sep 11, 2023
774c9f2
block racers base
sneakzttv Sep 15, 2023
0cd121b
Gelato base
sneakzttv Sep 15, 2023
f16690d
spell check cleanup
sneakzttv Sep 15, 2023
c1d61f6
Merge branch 'main' into version/2.5
sneakzttv Sep 15, 2023
a55d842
Lootboxes
sneakzttv Sep 15, 2023
065f149
info sections
sneakzttv Sep 15, 2023
604e528
Lootboxes
sneakzttv Sep 15, 2023
063786f
Lootboxes
sneakzttv Sep 15, 2023
0a9e7f8
Faq area added
sneakzttv Sep 22, 2023
f41ce40
Lootbox setup
sneakzttv Sep 22, 2023
74297ed
Update 15_lootboxes.md
sneakzttv Sep 22, 2023
554f5d7
Comments added
sneakzttv Sep 22, 2023
49bfe60
add correct gas calculation in lootboxes doc
juans-chainsafe Sep 25, 2023
0d67bbd
add documentation for open lootboxes
juans-chainsafe Sep 25, 2023
d26d3ce
resize images lootboxes
juans-chainsafe Sep 25, 2023
14df13f
fix images not found
juans-chainsafe Sep 26, 2023
28fe4d3
fix
juans-chainsafe Sep 26, 2023
65fbfd2
add missing png
juans-chainsafe Sep 26, 2023
56ecfd0
openupm
sneakzttv Sep 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
170 changes: 117 additions & 53 deletions dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@
A1
A2
ABI
Addons
addons
addon
Algorand
all-1155s
all-721s
All1155s
All721s
analytics
async
APIs
AppStore
backend
BalanceOf
Expand All @@ -22,14 +28,31 @@ Blockchains
BSC
BuyItemWebGL
BuyItemWebWallet
blockchain-enabled
blockchain's
BuildAsync
codebase
ChainSafe's
CRO
Chainstack's
cryptographic
Cheatsheet
CLR
call-custom-contracts-through-web3auth
customizations
changelogs
Chain721
call-custom-blockchain-tokens
call-custom-blockchains
chainID
ChainId
chainsafe
ChainSafe
ChainSafe's
Chainstack
ChainID's
Chainlist
cheatsheet
Cloudflare
config
contract-abi-to-json-format
Expand All @@ -42,13 +65,25 @@ crypto
cryptographically
Ctrl
Docusaurus
DApp
devs
dev
devsetup
ECDSA
EVM-compatible
EVM-compatible
Etherscan
Ethereum's
EVM-based
eg.
EIP712
ERC
ERC-1155
ERC-20
ERC-721
erc1155
ERC1155
Erc2771
erc20
ERC20
erc721
Expand All @@ -62,39 +97,76 @@ ethereum
Ethereum
EVM
evm-blockchain
extending-the-sdk
faq
fix-namespaces
fullscreen
frictionless
Frictionless
gasless-transactions-using-Gelato
gamepad
gamified
Gasless
gasless
GitHub
Gelato
getting-started-v1
getting-started-v2
goerli
Goerli
goerli's
GasLimit
getter
gamers
gameplay
GitHub
github
Goerli's
goerliETH
how-tos
HTTPS
Infura-enabled
IChainConfig
Integrable
IRpcProvider
IDE
implementing-social-logins-to-webgl-builds
importing-nfts
infura
interacting-with-nfts
IPFS
IProjectConfig
javascript
JSON
JsonRpcProvider
KPIs
Kwame
LazyMinter
Lootbox
lootbox
LootBoxes
Lootboxes
lootboxes
libcurl
ListItemWebGL
ListItemWebWallet
LoginScene
mainnet
Mainnet
mainnets
mainnetgoerli
metamask
MetaMask
minter-evm
minting-nft
MonoBehaviour
namespace
Nethereum
networkID
Newtonsoft
NewtonSoft
newtonsoft
non-EVM
NFT
NFTPixels
nft-textures
Expand All @@ -103,29 +175,50 @@ NFTPixels
NFTs
nodeJS
NodeJS
npm
onboarding
OpenSea
OPM
openupm-cli
OpenUPM
prebuilt
preconfigured
Preconfigured
QuickNode
repo
Rinkeby
rpc
RPC
RPCs
scalable
scrollable
SampleScene
SKALE
scriptable
SDK
SDK.
SDK's
SendTransaction
send-contract-through-webgl
send-transaction-through-webgl
Sepolia
sha3
SHA3
sign-through-webgl
SKALE
Sneakz
Solana
src
Rpc
RpcProvider
sign-through-web3auth
SHA-3
setting-up-an-rpc-node
tokenIds
tokenId
transfer-erc-20-token-through-web3auth
testnets
TransactionRequest
TransactionExecutor
testnet
Testnet
ToS
Expand All @@ -141,6 +234,10 @@ TypedData
TypeError
uncomment
Uncomment
UnityEnvironment
UPM
url
USDT
Unity3D
UNPKG
uri
Expand All @@ -154,7 +251,18 @@ V2
v2
VoucherMint
VSCode
wei
Woohoo
uptime
UX
URIs
UI
verify-through-web3auth
walletscene
Web2-like
Web2-Like
web2-like-authentication-using-web3auth
Web2
web3
Web3
Web3Auth
Expand All @@ -178,59 +286,15 @@ webpage
webserver
WebTemplates
WebWallet
Woohoo
xdai
XDai
YourGame
EVM-compatible
Chainlist
ChainID's
non-EVM
EVM-compatible
uptime
UX
devs
codebase
QuickNode
RPCs
ChainSafe's
Web3GL-based
scalable
dev
Infura-enabled
web3-enabled
Web3GL-enabled
analytics
GitHub
github
blockchain-enabled
EVM-based
UI
Integrable
tokenId
mainnets
testnets
SHA-3
gamers
Web3AuthSigner
Web3Builder
WebGLWallet
WebPageWallet
WebAssembly
Goerli's
goerliETH
customizations
changelogs
Ethereum's
wei
CRO
Chain721
tokenIds
URIs
url
cryptographic
setting-up-an-rpc-node
Chainstack's
APIs
HTTPS
KPIs
sign-through-web3auth
verify-through-web3auth
transfer-erc-20-token-through-web3auth
call-custom-contracts-through-web3auth
xdai
XDai
YourGame
Zenject
2 changes: 1 addition & 1 deletion docs/v1/20_faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Frequently asked questions about the ChainSafe gaming SDK.

**Q:** I'm seeing the following error when I install the package. **The type or namespace name 'Newtonsoft' could not be found**

**A:** NewtonSoft is a dependency of the SDK and needs to be installed for the SDK to work. This can be found by going to window->package manager->pressing the + button on the top left, pressing add via git url and pasting in "[email protected]".
**A:** NewtonSoft is a dependency of the SDK and needs to be installed for the SDK to work. If you see a newtonsoft error you can manually install the package by going to window->package manager->pressing the + button on the top left, pressing add via git url and pasting in "[email protected]".

**Q:** I'm getting the following error when trying to import an NFT texture into the SDK. **Curl error 1: Protocol "ipfs" not supported or disabled in libcurl**

Expand Down
80 changes: 80 additions & 0 deletions docs/v2.5/10_minting-nft.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
slug: /current/minting-nft
sidebar_position: 10
sidebar_label: Minting NFT
---


# Minting NFTs

:::info

This pages explains minting an NFT using ECDSA to authorize transactions with the SDK.

:::
## Minting an NFT Via The Marketplace
NFTs can easily be minted via our marketplace [here](https://marketplace.chainsafe.io/) These NFTs follow ERC standards and be used with our all NFT calls without much hassle at all. Simply add your NFT details, an image and away you go!

## Minting an NFT In Game Via ECDSA Verification
We've decided to move away from server voucher minting and replace it with ECDSA verification. This is a lot easier to setup and maintain as it's done solidity side and can be controlled solely by the developer for their users. For examples sake we've included an ERC20 private key to show you how it all works. Please do not use this in production. You can generate your own key [here](https://vanity-eth.tk/) to replace the example one. It is entirely up to you how you would like to secure this key, Please do not send an app into production without locking this down properly. As there are many ways to secure this we've decided to leave this up to you as any methods we offer would undoubtedly be reverse engineered.

## What Is ECDSA?
ECDSA stands for elliptical curve digital signature algorithm. It is the process of reverse engineering a signature to check which wallet it originated from. This way you can place a private key within the game files and make it fire off a signature whenever you need something authorized. This can be anything from allowing a claim to minting NFTs, the possibilities are endless. More information can be found [here](https://cryptobook.nakov.com/digital-signatures/ecdsa-sign-verify-messages)

## Using ECDSA With A Private Key In Unity
The sign with private key methods may be used here to generate a signature from your authorization wallet. This can then passed into a function and read solidity side as bytes. You may then use the functions below solidity side to reverse engineer the signature via ECDSA to check that it has actually originated from your authorization wallet. In the next step we'll show you how this can be checked solidity side.

## Passing The signature Into A Transaction For Verification Purposes In A Solidity Contract
```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Strings.sol";

contract ExampleContract is ReentrancyGuard {
/// @dev Variables & mappings
authWallet = "Your auth wallet here";
mapping(uint256 => address) public userWalletScores;

/// @dev Example function for saving a score
function saveScore(uint _score, bytes memory _sig) external nonReentrant() returns (bool) {
bytes32 messageHash = getMessageHash(Strings.toString(_score));
bytes32 ethSignedMessageHash = getEthSignedMessageHash(messageHash);
require(recover(ethSignedMessageHash, _sig) == authWallet, "Sig not made by auth");
// Add score to wallet mapping
userWalletScores[_score] = msg.sender;
return true;
}

/// @dev Used for ECDSA verification to check if values came from a specific address following solidity standards
function VerifySig(address _signer, string memory _message, bytes memory _sig) external pure returns (bool) {
bytes32 messageHash = getMessageHash(_message);
bytes32 ethSignedMessageHash = getEthSignedMessageHash(messageHash);
return recover(ethSignedMessageHash, _sig) == _signer;
}

function getMessageHash(string memory _message) internal pure returns (bytes32) {
return keccak256(abi.encodePacked(_message));
}

function getEthSignedMessageHash(bytes32 _messageHash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32",_messageHash));
}

function recover(bytes32 _ethSignedMessageHash, bytes memory _sig) internal pure returns (address) {
(bytes32 r, bytes32 s, uint8 v) = _split(_sig);
return ecrecover(_ethSignedMessageHash, v, r, s);
}

function _split (bytes memory _sig) internal pure returns (bytes32 r, bytes32 s, uint8 v) {
require(_sig.length == 65, "Invalid signature length");
assembly {
r := mload(add(_sig, 32))
s := mload(add(_sig, 64))
v := byte(0, mload(add(_sig, 96)))
}
}
}
```

Adding the above require function with the methods below it will enable a function to check the origin of a signature. If the origin matches your defined address in the require step, the call will pass, If not it will fail. This adds a much needed layer of security to sensitive transactions.
Loading