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.
0100000002e2b637e0820d3633ab919988b9a5c7cf7aeb4a49f6540b1c65d1eb519c9b1d9300000000fefa132c00483045022100eee7b87742f501504a9209240fd138c838c962f37254f5d2bb4ef3a9142433e102200c9c7c108fe8162970eb0dbd8afd59badd3498aebef7c7c76b57fb8cf4376af54152520020d86940ada3f0e6900022871ff513ea05086e85b1f0bf1849affcb67bee60480120c2f7b84b92ff65ea4ab219c160c5d0f98676a303342cdeab0371eb8d171f492f20efe935c5e2b6e898735dfaf944ef626f17128892fe180a99092fe05c98909326206fde9c1251734d5d571ea330a78a530d386ac10e4d7a6609a14e5bad45d4fb1c20b4e6d70fe7fc45f1593d53209e874f811fc3cb5fc3c8fc7ffab7557326edd90e2035144fb09a3cc0da8c2e0335d9f99e013dc0f918e23f8ca72683e64907b2982f207fdaee21ed1db1e059896b4456e60c45da77c294b90088cd1143d43486ea3b1c20a7bd0eff0d0cac432877f457bccc512e2671ff8a1611b794d174d2901b0fef150210274e85122c000100000076686257c88f75313f81e3ab51e308fe811504fbbaf94c2937e182ae971edfac752adad0a7b9ceca853768aebb6965eca126a62965f698a0c1bc43d83db632ade2b637e0820d3633ab919988b9a5c7cf7aeb4a49f6540b1c65d1eb519c9b1d9300000000fee4112c000176018801a901ac20
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