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
const pushdata = require('pushdata-bitcoin') | |
const MAX_SIGNATURE_SIZE = 73 | |
const COMPRESSED_PUBKEY_SIZE = 33 | |
const VERSION_SIZE = 4 | |
const LOCKTIME_SIZE = 4 | |
// txin size | |
const PREVIOUS_OUTPUT_SIZE = 36 |
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
const bitcoinMessage = require('bitcoinjs-message') | |
const messagePrefix = "\x19Monacoin Signed Message:\n" | |
const address = 'MU4FQNVv75wEU5a2TTBs7ZRMrpHU5nLEk5' | |
const message = 'hello' | |
const signature = 'IPL7L5NAMAPnLYFIeUaFAddK+IaFi9Q0FdsoMft2gl3IDdeUzBttq/kcUQz1AkiW32ohIGpXVrqH5VeO9B3CMtc=' | |
console.log(bitcoinMessage.verify(message, address, signature, messagePrefix)) |
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 'package:bitcoin_flutter/bitcoin_flutter.dart'; | |
import 'package:bip32/bip32.dart' as bip32; | |
import 'package:bip39/bip39.dart' as bip39; | |
final MONACOIN = new NetworkType( | |
messagePrefix: '\x19Monacoin Signed Message:\n', | |
bech32: 'mona', | |
bip32: new Bip32Type( | |
public: 0x0488b21e, | |
private: 0x0488ade4 |
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
const bitcoin = require('bitcoinjs-lib') | |
// for testnet | |
/* | |
const network = { | |
messagePrefix: '\x19Monacoin Signed Message:\n', | |
bip32: { | |
public: 0x043587cf, | |
private: 0x04358394 | |
}, |
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
const { | |
bip32, | |
payments | |
} = require('bitcoinjs-lib') | |
const mnemonic = require('./external/mnemonic.js') // https://github.com/ggozad/mnemonic.js | |
const buffer = require("safe-buffer") | |
const words = "like like like like like like like like like like like like" // your mnemonic | |
const network = { | |
bip32: { |
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
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<title>mpurse sign message example</title> | |
<meta charset="UTF-8"> | |
</head> | |
<body> | |
<script> | |
window.addEventListener("load", async (ev) => { | |
if (window.mpurse) { |
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
const Socket = require('json-rpc-tls').Socket; | |
Socket.tlsSocket('electrum-mona.nope.work', 50002, { | |
rejectUnauthorized: false | |
}).then(async (socket) => { | |
socket.setEncoding('utf8') | |
socket.setKeepAlive(true, 0) | |
socket.setNoDelay(true) | |
const banner = await Socket.request(socket, 1, 'server.banner', []) |
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
/** | |
* fnBの前に実行したい処理 | |
* コールバックを引数として取る | |
**/ | |
function fnA (successCb, failedCb) { | |
let result = foo() | |
if (result) { | |
successCb(result) | |
} else { | |
failedCb(new Error('fnA error')) |
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
let fn = () => { | |
let array = [1, 2, 3, 4, 5] | |
console.log(array) | |
array.reverse() | |
} | |
fn() // => [1, 2, 3, 4, 5] | |
fn() // I expect to be `[1, 2, 3, 4, 5]`, but in the case of Safari 12 it will be `[5, 4, 3, 2, 1]` |
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
<html> | |
<head></head> | |
<body> | |
<a href="vipstarcoin:VYLPUGaj6WzXTsbcyigAYGV7TNWgyAyNTx?amount=1.00000000&label=BIP21%20URI%20Scheme%20test&message=hello%2C%20VIPSTARCOIN%21">ここをクリックすると製作者さんに1VIPSが!!!!</a> | |
</body> | |
</html> |
NewerOlder