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
pragma solidity ^0.5.6; | |
contract Auth { | |
enum Op { NONE, EQ, NEQ, GT, LT, GTE, LTE, RET, NOT, AND, OR, XOR, IF_ELSE } | |
bytes32 paramHash; | |
mapping (bytes32 => bytes32) public permissions; // permissions hash => params hash | |
mapping (bytes32 => Param[]) public permissionParams; // params hash => params |
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
require "blockstream_satellite" | |
order = BlockstreamSatellite::Order.create(path: '/path/to/file') | |
puts order.status #=> pending | |
order.pay # sends the lightning payment using the configured lnd client | |
puts order.status #=> transmitting | |
order.refresh | |
puts order.status #=> sent |
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
# initialize a client | |
client = Faraday.new(url: 'https://lightning-2pdf.herokuapp.com/') do |faraday| | |
faraday.use FaradayLnPaywall::Middleware, { max_amount: 100 } | |
faraday.adapter Faraday.default_adapter | |
end | |
# use the client to do API calls: | |
puts client.post("/convert/pdf", "# Hallo Welt").body |
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
[Application Options] | |
lnddir=/home/bitcoin/lnd_data | |
maxpendingchannels=10 | |
alias=YOURALIAS | |
rpclisten=0.0.0.0:10009 | |
[Bitcoin] | |
bitcoin.active=1 | |
bitcoin.mainnet=1 | |
bitcoin.node=bitcoind |
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
# use https://jlopp.github.io/bitcoin-core-config-generator/ to generate your config file | |
datadir=/home/bitcoin/bitcoind_data | |
txindex=1 | |
disablewallet=1 | |
zmqpubrawblock=tcp://127.0.0.1:28332 | |
zmqpubrawtx=tcp://127.0.0.1:28333 |
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 { LiveOrderStream, TickerStream, CURRENCY } = require("node-bitstamp"); | |
const liveOrderStream = new LiveOrderStream(); | |
const liveOrderTopic = liveOrderStream.subscribe(CURRENCY.BTC_EUR); | |
liveOrderStream.on("connected", () => { console.log('connected to live orders'); }); | |
liveOrderStream.on("disconnected", () => { console.log('disconnected'); }); | |
liveOrderStream.on(liveOrderTopic, data => { | |
console.log(`${data.id}: ${data.order_type === 1 ? 'SELL' : 'BUY'} ${data.amount}@${data.price}`); |
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
from peewee import CharField, TextField, ForeignKeyField | |
from peewee import Model, SqliteDatabase | |
import post # !!!! imports post which imports blog | |
class Blog(Model): | |
title = CharFiled() | |
body = TextField() | |
def import_posts(self, backup): |
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
Coin recipientAmount = (total wallet amount) - fees needed / this.recipients.length // if not dividable the rest should be ignored and go to the miners. I don't want change | |
// create a new transactions with the NetworkParameters | |
Transaction sendTx = new Transaction(params); | |
// add the outputs | |
for(String address : this.recipients){ | |
sendTx.addOutput(recipientAmount, Address.fromBase58(params, address)); | |
} |
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
# also have a look at the nice Takecharge Server: https://github.com/controlshift/prague-server and its BOP70 implementation this is based on | |
class PaymentRequest | |
def initialize(options) | |
@options = options | |
output = create_output | |
details = create_payment_details(output) | |
@payment_request = Payments::PaymentRequest.new |
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
require 'sinatra/base' | |
# wrapper to easily translate tap coordinates to readable methods | |
class Calculate | |
PAD = { | |
'1' => [100, 1200], | |
'2' => [400, 1200], | |
'3' => [700, 1200], | |
'4' => [100, 1350], | |
'5' => [400, 1350], |