Skip to content

Instantly share code, notes, and snippets.

View zhfnjust's full-sized avatar
💭
bitcoin sv is everything

hh zhfnjust

💭
bitcoin sv is everything
View GitHub Profile
#!/bin/bash
# Check if the script is running as root
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root. Please use sudo or log in as the root user."
exit 1
fi
# Define Bitcoin Core version
BITCOIN_VERSION="25.0"
This file has been truncated, but you can view the full file.
import { Provider } from "../../abstract-provider";
import { Signer, SignatureRequest, SignatureResponse } from "../../abstract-signer";
import { bsv } from "scryptlib";
import { parseAddresses } from "../../utils"
import { AddressOption } from "../../types";
@zhfnjust
zhfnjust / dotwallet-signer.ts
Last active October 1, 2023 01:59
dotwallet-signer.ts
import { Networks, PublicKey, Transaction } from "bsv";
import { bsv, DEFAULT_SIGHASH_TYPE, toHex } from "scryptlib";
import { Provider, UtxoQueryOptions } from "../abstract-provider";
import { Signer, SignTransactionOptions, SignatureRequest, SignatureResponse } from "../abstract-signer";
import { AddressOption, UTXO } from "../types";
import { filterUTXO, parseAddresses } from "../utils"
import superagent from 'superagent';
const DAPP_API_PATHS = {
import {
assert,
MethodCallOptions,
ContractTransaction,
ByteString,
hash256,
method,
prop,
PubKey,
Sig,
import { Test } from './src/contracts/aaaa'
import {
bsv,
TestWallet,
DefaultProvider,
sha256,
toByteString,
toHex,
PubKey,
findSig,
import { PublicKey, Transaction } from "bsv";
import { bsv, toHex, DEFAULT_SIGHASH_TYPE } from "scryptlib";
import { Provider } from "../abstract-provider";
import { Signer, SignTransactionOptions, SignatureRequest, SignatureResponse } from "../abstract-signer";
import { AddressOption } from "../types";
import { parseAddresses } from "../utils"
// see https://doc.sensilet.com/guide/sensilet-api.html
interface SensiletWalletAPI {
isConnect(): Promise<boolean>;
@zhfnjust
zhfnjust / OP_CODESEPARATOR.js
Created February 18, 2023 03:25
Put a signature in the output so that this output cannot be copied to other tx
const { expect } = require('chai');
const { bsv, signTx, toHex } = require('scryptlib');
const crypto = require('crypto');
/**
* an example test for contract containing signature verification
*/
const { inputSatoshis, dummyTxId } = require('../../helper');
const privateKey = bsv.PrivateKey.fromRandom('testnet')
import { HashedMapState } from '../contracts/hashedMapState';
import { ByteString, HashedMap, toByteString, getSortedItem, MethodCallOptions } from '../scrypt-ts';
import { getDefaultSigner } from '../utils/helper';
const initBalance = 1;
function insert(map: Map<bigint, ByteString>, instance: HashedMapState, key: bigint, val: ByteString) {
const newInstance = instance.next();
map.set(key, val);
@zhfnjust
zhfnjust / compiler.benchmark.txt
Created October 26, 2022 03:00
sCrypt compiler benchmark result
escrow.scrypt False 0.8086118698120117
faucet.scrypt False 0.36995792388916016
faucetV2.scrypt False 0.39221715927124023
final_loop_import.scrypt False 0.2203052043914795
final_loop_library.scrypt False 0.27123188972473145
final_loop_main.scrypt False 0.44572019577026367
fixedPoint.scrypt False 0.2210087776184082
fixedPointTest.scrypt False 0.28333210945129395
forward.scrypt False 0.2912466526031494
fractionMath.scrypt False 0.2535989284515381