Skip to content

Instantly share code, notes, and snippets.

View matthewjablack's full-sized avatar

Matt Black matthewjablack

View GitHub Profile
@matthewjablack
matthewjablack / covenant_support_rationale.md
Created December 13, 2024 21:04
Covenant Support Rationale

OP_CTV

  • Most reviewed and tested
  • 30x+ performance improvement for DLCs
  • Enables basic vaults, payment pools, congestion control

More details on DLC improvement: https://covenants.info/use-cases/dlcs/

OP_CSFS

# %%
import requests
lightning_address = "matthewjablack@walletofsatoshi.com"
amount_in_sats = 3000
amount = amount_in_sats * 1000
# Split the lightning address into username and domain
username, domain = lightning_address.split('@')
# diff cli for hex strings
# add to your .bashrc or .zshrc
hexdiff() {
# convert hex strings to binary and then back to formatted hex
echo "$1" | xxd -r -p | xxd -p -c 1 > /tmp/file1.hex
echo "$2" | xxd -r -p | xxd -p -c 1 > /tmp/file2.hex
# use diff and process output with awk
diff -u /tmp/file1.hex /tmp/file2.hex | awk '
initiator_funding_input: 41 + script_sig_len bytes
	- previous_out_point: 36 bytes
		- hash: 32 bytes
		- index: 4 bytes
	- var_int: 1 byte (script_sig length)
	- script_sig: script_sig_len bytes
	- witness <----	"witness" is stored
 			separately, and the cost for its size is smaller. So,
 		    the calculation of ordinary data is separated

Atmoic Loans Liquid Example

The goal of this is to show how an Atomic Loan can be achieved using Liquid (L-BTC as collateral and elements stablecoin asset such as L-USDT)

Parties involved:

  1. Alice - Lender

  2. Bob - Borrower

diff --git a/packages/core-wallet-state/src/reducers/networks.js b/packages/core-wallet-state/src/reducers/networks.js
index be622680..c83a39b7 100644
--- a/packages/core-wallet-state/src/reducers/networks.js
+++ b/packages/core-wallet-state/src/reducers/networks.js
@@ -2,11 +2,11 @@ import {
UPDATE_CURRENT_NETWORK,
UPDATE_NETWORK_LIST
} from '../actions/networks';
-import { TESTNET } from '../constants/networks';
+import { MAINNET } from '../constants/networks';
diff --git a/packages/core-bitcoin/src/apis/transaction.js b/packages/core-bitcoin/src/apis/transaction.js
index 889a3502..535c0c71 100644
--- a/packages/core-bitcoin/src/apis/transaction.js
+++ b/packages/core-bitcoin/src/apis/transaction.js
@@ -17,15 +17,17 @@ const isValidTxnAmount = (balance, totalAmount) => balance.gt(totalAmount);
export const transfer = async (transaction, network, account) => {
const { to, amount, unit } = transaction;
const { transactionUrl } = network;
- const { balance } = await BalanceAPI.getBalance({
- account,
const config = {
bitcoin: {
rpc: {
host: 'http://localhost:18443',
username: 'bitcoin',
password: 'local321'
},
network: 'bitcoin_regtest',
value: 1000000,
mineBlocks: true
const config = {
bitcoin: {
rpc: {
host: 'http://localhost:18443',
username: 'bitcoin',
password: 'local321'
},
network: 'bitcoin_regtest',
value: 1000000,
mineBlocks: true
pragma solidity ^0.5.10;
/// @title ISPVConsumer
/// @author Summa (https://summa.one)
/// @notice This interface consumes validated transaction information.
/// It is the primary way that user contracts accept
/// @dev Implement this interface to process transactions provided by
/// the Relay system.
interface ISPVConsumer {
/// @notice A consumer for Bitcoin transaction information.