Skip to content

Instantly share code, notes, and snippets.

View motorina0's full-sized avatar

Vlad Stan motorina0

View GitHub Profile

Note A NIP PR has been open here, the conversation should move to the PR

Problem

Ratings give the reputation for a person, service or product. They are important for creating an open and free-market. It helps participants make decisions based on what their peers previously experienced with that person, services or product.

Having a rating system in an open and decentralized system (like nostr) is hard because anyone can join and give ratings. Thus bots will be created to overtake the honest human's votes.

Yet Another Shared UTXO Model

Prerequisites: basic understanding of BIP341.

The idea is similar with the TAPLEAF_UPDATE_VERIFY described by Anthony Towns on the Bitcoin-Dev Mailing List. However, this approach uses the concept of Stateful Tap-Tree in order to exclude certain tap-tree paths from being spent.

Overview

  • the tap-tree represents the funds of multiple participants (shared UTXO).
  • each tap-leaf in the tap-tree has its own "owner". One entity can "own" multiple tap-leafs.
  • before entering the "shared-utxo", each participant must check that the tap-tree is correctly constructed
{
"hash": "0e2b2714917bd9482baea0c8241420e813de977be5958d4c29d5f9e05b760d07",
"left": {
"hash": "0000000000000000000000000000000000000000000000000000000000000000"
},
"right": {
"hash": "abd783474f581f3392decd6b41d2e0ceb8f82257440da46a4262b48fe9b49cfd",
"left": {
"hash": "2b3bbc598ae051d6fb5981b8b3673e071965a481329156b6561508c5171f4466",
"left": {
// How to run:
// npm install -g ts-node typescript '@types/node'
// ts-node play9.ts
import * as ecc from 'tiny-secp256k1';
import { ECPairFactory } from 'ecpair'
import { Psbt } from './ts_src/psbt'
import { p2tr } from './ts_src/payments/index'
import { testnet as network } from './ts_src/networks'
@motorina0
motorina0 / lnd_single_hop_invoice_test.go
Created December 7, 2021 15:17
Update integration test for a multi-hop payment
package itest
import (
"bytes"
"context"
"encoding/hex"
"time"
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcutil"
// The time interceptor should be first
CommandExecutorImpl commandExecutor = ((CommandExecutorImpl) processEngineConfiguration.getCommandExecutor());
this.oldFirstCommandInterceptor = commandExecutor.getFirst();
TotalExecutionTimeCommandInterceptor timeCommandInterceptor = new TotalExecutionTimeCommandInterceptor();
timeCommandInterceptor.setNext(oldFirstCommandInterceptor);
commandExecutor.setFirst(timeCommandInterceptor);
public <T> T execute(CommandConfig config, Command<T> command) {
//...
long start = System.currentTimeMillis();
T result = next.execute(config, command);
long end = System.currentTimeMillis();
long totalTime = end - start;
//...
}
List<HistoricActivityInstance> processSteps = nativeHistoricActivityInstanceQuery.sql("SELECT `ID_` , `PROC_INST_ID_`, `PROC_DEF_ID_`, `START_TIME_`, `END_TIME_`, `DURATION_`, `START_USER_ID_`, `START_ACT_ID_` as `ACT_ID_` , `END_ACT_ID_`, `NAME_` as `ACT_NAME_` FROM `activiti`.`ACT_HI_PROCINST` LIMIT 1000;").list();
List<HistoricActivityInstance> processSteps = nativeHistoricActivityInstanceQuery
.sql("select RES.* from `activiti`.`ACT_HI_ACTINST` RES" + " WHERE RES.PROC_INST_ID_ = \"30\"").list();
List<HistoricVariableInstance> variables = historicVariableInstanceQuery.variableName("variable1").list();