This file contains 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 { Transaction } = require('bitcore-lib') | |
const { decrypt } = require('bip38') | |
const encryptedKey = '<private key beginning with 6>' | |
const password = '<private key password>' | |
const privateKey = decrypt(encryptedKey, password).privateKey | |
// Check UTXO info at https://insight.bitpay.com/api/addr/<origin address>/utxo | |
const utxo = { |
This file contains 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 Web3 = require('web3') | |
const erc20Abi = abi = require('human-standard-token-abi') | |
const config = { | |
node: 'localhost:8546', | |
address: '0x0000000000000000000000000000000000000000' // set to contract address | |
} | |
const provider = new Web3.providers.WebsocketProvider(`ws://${config.node}`) | |
const web3 = new Web3(provider) |
This file contains 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 bash | |
date > env.log | |
lsb_release -a >> env.log | |
echo "node: $(node --version)" >> env.log | |
echo "nodejs: $(nodejs --version)" >> env.log | |
echo "npm: $(npm --version)" >> env.log | |
echo "git HEAD: $(git rev-parse --short HEAD)" >> env.log | |
git status >> env.log |
This file contains 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
'use strict' | |
const bitcore = require('bitcore-lib') | |
const ROUNDS = 15 | |
const targetStrings = { | |
networkMagic: 'mYnT', | |
pubkeyhash: 'G', | |
scripthash: '2', |
This file contains 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
Show hidden characters
{ | |
"parserOptions": { | |
"ecmaVersion": 6, | |
"sourceType": "script", | |
"ecmaFeatures": { | |
"globalReturn": false, | |
"impliedStrict": false, | |
"jsx": true, | |
"experimentalObjectRestSpread": false | |
} |
This file contains 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 mapFields = (obj, map) => | |
Object.keys(map) | |
.map(key => ({ key, value: obj[map[key]] })) | |
.reduce((res, { key, value }) => Object.assign(res, { [key]: value }), {}) |
This file contains 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 waterfall = promises => init => promises.reduce((chain, promise) => chain.then(promise), Promise.resolve(init)) |
This file contains 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
#!/bin/bash | |
if [ ! -d .git ]; then | |
echo Not a git repo | |
exit | |
fi | |
if ! (git remote | grep -q origin); then | |
echo No origin remote | |
exit |
This file contains 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
-----BEGIN PGP PUBLIC KEY BLOCK----- | |
mQENBFhqXdYBCADLd6j3IgA+ziom/ZLPkX1niDZ6EiDkA98rP3q+T7nSuQKpIooq | |
Kt0mTRpqxdroCp9O+IOizvJDpK6pb1kefDvTfren5xvVU3O/X4ihm9/W8VHCjgaF | |
zKzsIL3vH+Q61yTOxyfmq6nHbuoYPsyWcRoYOShCQTz/4XmUB9HHe/+Y46qEERcp | |
sbkJci0yDYCEtPk/Dri21NvNcRf8dJkYud36sRVesvWziXvY+eJCsP8+LgsP7wLA | |
5V4rhpV5eyWzFdxhX3q8qhKzOJlJeoudIAH0WmeDvWVHlWcOCp1WVoCdT4IVLduf | |
drEd1uO5vjv3y22H2KRaaibSFdYRO6T408IHABEBAAG0IUdhYnJpZWwgTW9udGVz | |
IDxnYWJyaWVsQGJsb3EuY29tPokBNwQTAQgAIQUCWGpd1gIbAwULCQgHAgYVCAkK | |
CwIEFgIDAQIeAQIXgAAKCRCYoLLoABE9pT5jB/0aoRG9AxqzanQydh+zB8QlWuXA |
This file contains 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
function JsonParser() {} | |
function convert(token, type) { | |
if (type === "number") { | |
return Number(token); | |
} else if (type === "string") { | |
return String(token); | |
} | |
} |