This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SPDX-License-Identifier: MIT | |
| pragma solidity ^0.8.9; | |
| import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; | |
| contract ASTNFT is ERC721 { | |
| // Define the different categories of NFTs | |
| enum Category { Gold, Silver, Bronze } | |
| //Define token id counter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // create a new wallet | |
| const {Wallet, Network} = require('bsv-wallet'); | |
| const network = Network.defaultNetworks.mainnet; | |
| const wallet = new Wallet(network); | |
| // send bsv to an address | |
| wallet.send(toAddress, amount, feeRate); | |
| // import private key | |
| wallet.importPrivateKey(privateKey); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| contract ERC721MintBurn is ERC721 { | |
| address public owner; | |
| uint256 public default_royalty; | |
| constructor(uint256 royalty) public { | |
| owner = msg.sender; | |
| default_royalty = royalty; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Create a NFT contract | |
| const { Tokenized } = require('@bitboss/tokenized'); | |
| //Connect to the Bitcoin SV testnet | |
| const network = 'testnet'; | |
| const tokenized = new Tokenized(network); | |
| //Deploy a NFT contract | |
| const deployTransaction = await tokenized.contracts.NFT.deploy(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Import the Tokenized library | |
| const Tokenized = require('@tokenized/tokenized'); | |
| // Establish a connection to the Bitcoin SV node | |
| let config = { | |
| host: 'localhost', | |
| port: 8332, | |
| username: 'admin', | |
| password: 'password' | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Load the Bitcoin SV library | |
| const BitcoinSVCore = require('bitcoinsv-core'); | |
| // Create an instance of the Bitcoin SV library | |
| const bsvCore = new BitcoinSVCore(); | |
| // Set the network to the Bitcoin SV testnet | |
| bsvCore.Networks.defaultNetwork = bsvCore.Networks.testnet | |
| // Define the NFT contract |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| contract NFT { | |
| address public owner; | |
| uint public defaultRoyalties; | |
| mapping (uint => NFTItem) public items; | |
| mapping (uint => address) public itemOwners; | |
| struct NFTItem { | |
| uint itemId; | |
| bool isMinted; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| from BitcoinSV import Script | |
| class NFT(Script): | |
| def __init__(self): | |
| self.owner = None | |
| self.items = {} | |
| self.itemOwners = {} | |
| super(NFT, self).__init__() | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Creating a wallet | |
| const { PrivateKey } = require('bsv'); | |
| const privateKey = new PrivateKey(); | |
| const address = privateKey.toAddress(); | |
| console.log(`Your new wallet address is ${address}`); | |
| //Sending money | |
| const { Transaction } = require('bsv'); |