Skip to content

Instantly share code, notes, and snippets.

Avatar
👋

Matt DesLauriers mattdesl

👋
View GitHub Profile
View game-l2.md

L2 Games and On-Boarding Flow

This is some loose thinking about how to securely bridge assets from L1 to a L2 for a blockchain game. See Dark Forest game as a reference.

The user experience flow should work like this:

  1. To create an account, the user is prompted with a unique private "serial key" and must copy it safely.
  2. The user can use this key to initialize a game account along with a payment of, say, $5 USD.
  3. Then the user can open the game interface, paste their serial key, and they will see their account has been pre-allocated with $5 USD worth tokens. These tokens can be used for gas fees (to cover the first ~100-1000 transactions depending on L2 network) or to pay for gameplay elements such as expansions and user-created content.
  4. When the user is finished playing, they can withdraw any remaining tokens from the game back to their L1 address—including any new assets or verifiable achievements they might have gained through their gameplay.
View Verifier.sol
//
// Copyright 2017 Christian Reitwiessner
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTW
View PlonkVerifier.sol
// SPDX-License-Identifier: GPL-3.0
/*
Copyright 2021 0KIMS association.
This file is generated with [snarkJS](https://github.com/iden3/snarkjs).
snarkJS is a free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
View game-nfts.md

on game NFTs

Minecraft Marketplace is an online store that lets users purchase game skins, texture packs, mods, mini games, and other user-created game content for Minecraft. To buy content on this market, users must first exchange their fiat dollars to virtual tokens known as Minecoins. Minecoins are non-refundable and non-transferable, and can be purchased through App Stores or Microsoft account.

Monetizing user-generated content is one of the more profitable areas of Minecraft's business model, generating more than $500 million in revenue in the years since it has launched. Exactly how much of the Minecoin and Marketplace revenue is split with content creators is not publicly known, but—after accounting for 30% take-rates on App Stores—the remainder is [assumed to be in the range of 50% shared with content creators](https://www.destructoid.com/minecraft-is-getting-it

@mattdesl
mattdesl / zkproof01.json
Created Jun 12, 2022
zero-knowledge proof that I know the coordinates to "impossible" treasure https://zk-treasure-hunt.glitch.me/
View zkproof01.json
{"proof":{"A":["17449230182385608549739937383075881546483765808691909124706281312692807714804","19899319621970761685248799018755740044715297739760834732535773987823693622231","1"],"B":["3672931078908235154236352901061877838095222059104321938148414375361026933","1678882455299646345749140912743451764360216737358906299258107907557158080393","1"],"C":["21226093540817603091525712047325089368958730693399215898483401301746680187351","2302554353719115267226435859169251436739458510074692117957124764639569741149","1"],"Z":["13128167650963345188520076485466668087078868679048603756847956219283879827863","10323622276841347627771102600171798616336409375373259253189208575095627971049","1"],"T1":["16900134199583638356254786687471812705845076998067903251872115809420699440450","12196389057585380925419772802366356513130525489553233295746087810658119301704","1"],"T2":["8797753442072019184044196683905941214727596019333410653665716859074660633418","621800000210342783114919327800158735742471663856178144919309536773368911962","1"],"
@mattdesl
mattdesl / FA2_Networks.py
Created Jan 5, 2022
FA2 contract with "social network" (follow/unfollow list) attached to each minted token
View FA2_Networks.py
import smartpy as sp
class FA2(sp.Contract):
"""This contract tries to simplify the FA2 contract template example in
smartpy.io v0.8.4
It has been modified to include basic "social graph" functionality by @mattdesl
The contract follows the FA2 standard definition:
View MRKT_2.py
import smartpy as sp
# Reference:
# https://github.com/hen-community/objkt-swap/blob/jagracar/v3-prototype/smart-py/objkt_swap_v3.py
##
## ## Meta-Programming Configuration
##
## The `FA2_config` class holds the meta-programming configuration.
View MRKT.py
import smartpy as sp
# Reference:
# https://github.com/hen-community/objkt-swap/blob/jagracar/v3-prototype/smart-py/objkt_swap_v3.py
##
## ## Meta-Programming Configuration
##
## The `FA2_config` class holds the meta-programming configuration.
View about.md
View contract.py
import smartpy as sp
class SpectrumColors(sp.Contract):
def __init__(self):
self.init(
# fixed dimensions of the board
columns = 16,
rows = 16,
# limit to the total number of colors possible
max_colors = 12,