Skip to content

Instantly share code, notes, and snippets.

View dabit3's full-sized avatar
🎡
probably nothing

Nader Dabit dabit3

🎡
probably nothing
View GitHub Profile
@dabit3
dabit3 / demoday.md
Last active October 26, 2024 01:39
How to Give a Killer Pitch or Hackathon Demo

Introduction

EigenLayer introduces the possibility of re-using ethereum consensus, and IMO the most interesting usecase for that would be building a decentralized two-way and security-optimal bridge between Bitcoin and Ethereum.

All bridges rely on the security of the two chains they connect and the security of the custodian^[1] used for bridging, since if the security of any of those 3 were to fail, it would be possible to drain the bridge (eg: if its possible to double-spend on any of the two chains an attacker can redeem the same coin multiple times).

However, if a significant amount of the total ETH staked were to be restaked securing this bridge, the custodian would be piggybacking on ethereum security, so those two become the same and thus you'd remove the custodian from your list of dependencies and you're left with only having to depend on the security of the two chains, which is the theoretical ceiling of security. In other words, you'd achieve the best possible security.

But not just that, you

@dabit3
dabit3 / react-native-walletconnectmodal.js
Last active October 6, 2023 03:02
React Native WalletConnectModal Example
/*
* Resources
* Medium: https://medium.com/walletconnect/how-to-build-a-react-native-dapp-with-walletconnect-28f08f332ed7
* YouTube: https://www.youtube.com/watch?v=mGtEPQfqMV8
* Docs: https://docs.walletconnect.com/2.0/advanced/walletconnectmodal/about?platform=react-native
*/
import { WalletConnectModal, useWalletConnectModal } from "@walletconnect/modal-react-native"
import { StyleSheet, Text, View, TouchableHighlight } from "react-native"
const projectId = 'my-project-id' // see https://cloud.walletconnect.com/
@dabit3
dabit3 / App.js
Last active February 14, 2023 03:51
Arweave client example with Matic
import { WebBundlr } from "@bundlr-network/client"
import { providers } from "ethers"
/* initialize some local state to store the bundlr instance */
const [bundlrInstance, setBundlrInstance] = useState(null)
/* connect to the user's wallet */
async function connect() {
await window.ethereum.request({ method: 'eth_requestAccounts' })
const provider = new providers.Web3Provider(window.ethereum)
@dabit3
dabit3 / basicmarket.sol
Last active January 9, 2024 08:54
Basic NFT marketplace
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
contract NFT is ERC721URIStorage {
using Counters for Counters.Counter;
@dabit3
dabit3 / react-web3-example.js
Last active March 22, 2022 01:48
Example of connecting to an Ethereum wallet using React & Web3
import { useState, useEffect } from 'react'
import Web3 from 'web3'
const [account, setAccount] = useState(null)
let [web3, setWeb3] = useState(null)
useEffect(() => {
checkAccount()
}, [])
// invoke to connect to wallet account
@beautyfree
beautyfree / snippets.js
Last active December 14, 2022 11:49
Solana Web3 Snippets
import {
Account,
clusterApiUrl,
Connection,
PublicKey,
sendAndConfirmTransaction,
SystemProgram,
Transaction,
} from '@solana/web3.js';
@dabit3
dabit3 / SingleTableAppSync.md
Last active February 24, 2023 20:05
GraphQL Single Table Design with DynamoDB and AWS AppSync

GraphQL

GraphQL Schema

type Customer {
  id: ID!
  email: String!
}
@dabit3
dabit3 / reactstreaming.js
Last active November 10, 2022 04:46
React Streaming code from live broadcast
import React from 'react';
import logo from './logo.svg';
import './App.css';
import ReactPlayer from 'react-player'
import { HashRouter, Link, Switch, Route } from 'react-router-dom'
import AuthComponent from './AuthComponent'
import { Auth, API } from 'aws-amplify'
import { createComment as CreateComment } from './graphql/mutations'
import { listComments as ListComments } from './graphql/queries'
import { onCreateComment as OnCreateComment } from './graphql/subscriptions'
@kcwinner
kcwinner / app.py
Last active October 13, 2023 04:59
Call AppSync GraphQL from Python Lambda Function
from lib import appsync
def lambda_handler(event, context):
print(event)
input = {
'name': 'test123',
'description': 'some cool description'
}