Skip to content

Instantly share code, notes, and snippets.

import bitcore from 'bitcore-lib-cash';
const {
crypto: { BN, Signature },
PublicKey,
Script,
Transaction,
} = bitcore;
function main(txHex, satoshisStr) {
@takuto-h
takuto-h / Dockerfile.node-gyp
Last active June 23, 2022 06:42
Use node-gyp with node:*-slim
FROM node:10.15.1-slim
COPY ./package.json ./yarn.lock /app/
# Install dependencies for node-gyp
# https://github.com/nodejs/node-gyp#on-unix
RUN buildDeps='g++ make python' \
&& apt-get update \
&& apt-get install -y --no-install-recommends $buildDeps \
&& cd /app \
@takuto-h
takuto-h / bch-covenants.md
Last active January 5, 2019 04:14
Bitcoin Cash redeem script enforcing fixed output destination powered by OP_CHECKDATASIG

Stack

<sig> <1:nVersion> <2:hashPrevouts> <3:hashSequence> <4:outpoint> <5:scriptCode> <6:value> <7:nSequence>
<8-1:outputValue> <8-2:outputScript> <8-3:changeValue> <8-4:changeScript> <9:nLockTime> <10:sighashType>

Redeem Script

DUP            : ..<10> <10>                                       :
<sighashType>  : ..<10> <10> <sighashType>                         :
@takuto-h
takuto-h / play-with-bitcore-lib-cash.mjs
Last active November 5, 2018 01:19
anyone-can-spend P2SH address
'use strict';
import bitcore from 'bitcore-lib-cash';
const Script = bitcore.Script;
const Networks = bitcore.Networks;
const Interpreter = Script.Interpreter;
const redeemScript = Script('OP_TRUE');
const scriptSig = Script().add(redeemScript.toBuffer());
escape ^Jj
install: --no-document
update: --no-document
@takuto-h
takuto-h / validation.php
Last active October 8, 2016 20:42 — forked from syokunin/validation.php
Laravel 5.1 日本語バリデーションメッセージファイル
<?php
return [
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used by
[core]
editor = emacs -nw
[alias]
co = checkout
br = branch
ci = commit
st = status
[push]
default = simple
[fetch]
#!/usr/bin/env perl
$latex = 'platex -shell-escape -synctex=1';
$latex_silent = 'platex -shell-escape -synctex=1 -interaction=batchmode';
$bibtex = 'pbibtex';
$dvipdf = 'dvipdfmx %O -o %D %S';
$makeindex = 'mendex %O -o %D %S';
$max_repeat = 5;
$pdf_mode = 3; # generates pdf via dvipdfmx
# Prevent latexmk from removing PDF after typeset.
@takuto-h
takuto-h / .mayu
Last active August 29, 2015 14:07
include "109.mayu"
keymap Global
key ~S-*半角/全角 = $GRAVE_ACCENT
key S-*半角/全角 = $TILDE
key A-半角/全角 = $ToggleIME
key ~S-*E0半角/全角 = $GRAVE_ACCENT
key S-*E0半角/全角 = $TILDE
key A-E0半角/全角 = $ToggleIME