Skip to content

Instantly share code, notes, and snippets.

View shopglobal's full-sized avatar
💻
deploying Electronero 2.0

⛓️INTERCHAINED ⚡Electronero Network ʕ•̫͡•ʔ-̫͡-ʕ•͓͡•ʔ-̫͡-ʕ•̫͡•ʔ-̫͡-ʔ shopglobal

💻
deploying Electronero 2.0
View GitHub Profile
@shopglobal
shopglobal / CryptoWs.md
Created August 19, 2024 20:29
Simple crypto website

Here’s a simple yet visually appealing template for a cryptocurrency-themed website using HTML and CSS. This example features a modern design, including a hero section, about section, and a simple cryptocurrency list.

HTML (index.html)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Crypto Hub</title>
@shopglobal
shopglobal / Dex.md
Last active August 18, 2024 19:26
Dex assembly script

Creating a simplified version of Uniswap in AssemblyScript involves implementing a decentralized exchange (DEX) where users can swap between two tokens, add liquidity, and remove liquidity. Below is a high-level overview and code example for a basic Uniswap-like smart contract in AssemblyScript.

Overview

The core functionality includes:

  1. Liquidity Pool: Manage liquidity provided by users for two tokens.
  2. Swapping: Allow users to swap one token for another based on the current reserves.
  3. Adding Liquidity: Users can add equal value of both tokens to the pool, receiving liquidity tokens in return.
  4. Removing Liquidity: Users can burn liquidity tokens to withdraw their share of the reserves.
@shopglobal
shopglobal / GPTIco.md
Created August 16, 2024 22:31
GPT ICO

Building a decentralized application (dApp) for an Initial Coin Offering (ICO) involves several components, including smart contracts, a web frontend, and integration with Ethereum or other blockchains. Here’s a step-by-step guide to creating a basic ICO dApp using Ethereum and Solidity for the smart contracts, and React for the frontend.

1. Smart Contracts

1.1. ERC20 Token Contract

Create an ERC20 token contract which will be used for the ICO.

// SPDX-License-Identifier: MIT
@shopglobal
shopglobal / BTCMobileWallet.md
Last active August 16, 2024 21:18
BTC mobile wallet

Creating a Bitcoin mobile wallet where users own their private keys involves several key components:

  1. Private Key Management: Securely generate and store private keys.
  2. Wallet Functionality: Enable sending and receiving Bitcoin transactions.
  3. User Interface: Design a user-friendly interface for mobile devices.
  4. Security Measures: Implement best practices for security and encryption.

Basic Outline for a Bitcoin Mobile Wallet

Here's a high-level overview of how you can build a Bitcoin mobile wallet, assuming you are using React Native for cross-platform development:

@shopglobal
shopglobal / OP20Tax.md
Last active August 16, 2024 21:08
Tax token assemblyscript

To implement a tax token, you need to introduce a tax mechanism into your ERC-20 token contract. The idea is to apply a tax on each transaction, which could be sent to a designated tax wallet or distributed in some way.

Here’s how to extend the previous ERC-20 implementation to include a tax feature:

  1. Add Tax Parameters: Introduce state variables for the tax rate and tax wallet.
  2. Modify Transfer Functions: Apply the tax during transfers and update balances accordingly.

Here’s an updated version of the token contract with tax functionality:

@shopglobal
shopglobal / PyChainCLI.md
Last active September 16, 2024 19:36
Python blockchain cli

This script provides a command-line interface for interacting with a blockchain via the Flask API. Here’s a summary of how it works:

  1. print_help(): Displays the usage instructions for the CLI tool.
  2. get_blocks(): Sends a GET request to fetch and print all blocks.
  3. get_balance(address): Sends a GET request to fetch and print the balance for a specific address.
  4. create_transaction(from_address, to_address, amount): Sends a POST request to create a new transaction with the specified details.
  5. mine(miner_address): Sends a POST request to mine a new block and reward the specified miner address.
  6. add_peer(peer_address): Sends a POST request to add a new peer to the network.
  7. remove_peer(peer_address): Sends a POST request to remove a peer from the network.
  8. synchronize(): Sends a GET request to synchronize the blockchain with peers.
@shopglobal
shopglobal / PyChainApi.md
Created August 16, 2024 20:53
Python Blockchain API

This Flask application provides a basic API to interact with your blockchain. Here's a brief overview of the endpoints:

  1. GET /blocks: Retrieves all blocks in the blockchain.
  2. GET /balance/<address>: Retrieves the balance of a given address.
  3. POST /transaction: Submits a new transaction to be added to the blockchain.
  4. POST /mine: Mines a new block and rewards the miner.
  5. POST /add_peer: Adds a new peer to the network.
  6. POST /remove_peer: Removes a peer from the network.
  7. GET /synchronize: Synchronizes the blockchain with peers.
  8. GET /generate_wallet: Generates a new wallet address and private key.
@shopglobal
shopglobal / PyChain.md
Last active August 16, 2024 20:47
Python Blockchain

This Python code outlines a simple blockchain implementation with features including block creation, mining, transaction handling, and synchronization with peers. Here's a breakdown and explanation of each component:

1. Block Class

  • Attributes:
    • index: The block number.
    • timestamp: Time when the block was created.
    • transactions: List of transactions in the block.
    • previous_hash: Hash of the previous block.
  • reward: Reward for mining the block.
@shopglobal
shopglobal / NFT-Market.md
Created August 16, 2024 20:41
NFT marketplace

Creating an NFT marketplace where users can lend their NFTs for auctions or sales involves several components:

  1. NFT Contract: To handle the NFTs being lent and tracked.
  2. Marketplace Contract: To manage the auctions and sales.
  3. Marketplace Logic: To ensure proper lending, bidding, and selling of NFTs.

Below is a simplified example of such a marketplace in Solidity. This example assumes the use of ERC-721 for NFTs.

1. NFT Contract

This contract uses the ERC-721 standard. For simplicity, we'll use OpenZeppelin's implementation.

@shopglobal
shopglobal / Burn token.md
Created August 16, 2024 20:31
Burn token

Creating a burn token involves implementing a mechanism where a specified percentage of tokens is burned (i.e., removed from circulation) with each transfer. Here’s an example of such a contract using Solidity and OpenZeppelin libraries:

1. Burn Token Contract

This contract includes:

  • A burn mechanism where a percentage of each transfer is burned.
  • Functions to update the burn rate and handle the transfer mechanics securely.
// SPDX-License-Identifier: MIT