Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View Siimone's full-sized avatar
🎯
Focusing

Simone Da Re Siimone

🎯
Focusing
View GitHub Profile
@Siimone
Siimone / liquid-move-asset.sh
Last active February 21, 2022 11:25
Error on Liquid Asset
elements-cli -rpcwallet=$$$ listunspent | jq '.[] | select(.asset == "54421555c89fbda44787e4b65866a98bdae65f030401b0a05fdc8988b6c4f162")'
{
"txid": "e561c30c8d6c95441740321d6cf7a667ebd43e37d2b0d0be41eebab5a9319bdc",
"vout": 0,
"address": "ert1qfthk6r730pd85ecrkz9xqm2hx23fapheh27weh",
"scriptPubKey": "00144aef6d0fd1785a7a6703b08a606d5732a29e86f9",
"amount": 0.0001,
"asset": "54421555c89fbda44787e4b65866a98bdae65f030401b0a05fdc8988b6c4f162",
"amountblinder": "0000000000000000000000000000000000000000000000000000000000000000",
"assetblinder": "0000000000000000000000000000000000000000000000000000000000000000",
@Siimone
Siimone / redis.conf
Last active July 17, 2019 20:05
Exam
# Redis configuration file example.
#
# Note that in order to read the configuration file, Redis must be
# started with the file path as first argument:
#
# ./redis-server /path/to/redis.conf
# Note on units: when memory size is needed, it is possible to specify
# it in the usual form of 1k 5GB 4M and so forth:
#
@Siimone
Siimone / postgresql.conf
Created July 16, 2019 13:16
postgresql.conf
# -----------------------------
# PostgreSQL configuration file
# -----------------------------
#
# This file consists of lines of the form:
#
# name = value
#
# (The "=" is optional.) Whitespace may be used. Comments are introduced with
# "#" anywhere on a line. The complete list of parameter names and allowed
# PostgreSQL Client Authentication Configuration File
# ===================================================
#
# Refer to the "Client Authentication" section in the PostgreSQL
# documentation for a complete description of this file. A short
# synopsis follows.
#
# This file controls: which hosts are allowed to connect, how clients
# are authenticated, which PostgreSQL user names they can use, which
# databases they can access. Records take one of these forms:
@Siimone
Siimone / validation.cpp
Created July 14, 2019 10:06
Bitcoin validation rules
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2017 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <validation.h>
#include <arith_uint256.h>
#include <chain.h>
#include <chainparams.h>
@Siimone
Siimone / miner.cpp
Created July 14, 2019 10:04
Bitcoin miners job analysis
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2019 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <miner.h>
#include <amount.h>
#include <chain.h>
#include <chainparams.h>
@Siimone
Siimone / ChainParams.cpp
Created July 8, 2019 13:39
Bitcoin Analysis #1 - Genesis Block
// Copyright (c) 2010 Satoshi Nakamoto
// Copyright (c) 2009-2018 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <chainparams.h>
#include <chainparamsseeds.h>
#include <consensus/merkle.h>
#include <tinyformat.h>
@Siimone
Siimone / rfc003_bitcoin_htlc.rs
Created December 21, 2018 12:50
redeem_htlc_with_secret - Bitcoin HTLC - COMIT
#[test]
fn redeem_htlc_with_secret() {
let _ = pretty_env_logger::try_init();
let docker = Cli::default();
let container = docker.run(BitcoinCore::default());
let client = tc_bitcoincore_client::new(&container);
client.generate(432).unwrap().unwrap();
let (txid, vout, input_amount, htlc, _, secret, keypair, _) = fund_htlc(&client);
@Siimone
Siimone / htlc.rs
Created December 20, 2018 22:16
can_be_unlocked_with - Bitcoin HTLC - COMIT
pub fn can_be_unlocked_with(
&self,
got_secret: Secret,
got_keypair: KeyPair,
) -> Result<(), UnlockingError> {
let got_pubkey_hash: PubkeyHash = got_keypair.public_key().into();
let got_secret_hash = got_secret.hash();
let expected_pubkey_hash = self.recipient_redeem_pubkey_hash;
let expected_secret_hash = &self.secret_hash;
@Siimone
Siimone / htlc.rs
Created December 19, 2018 11:33
Bitcoin HTLC constructor - COMIT
fn create_htlc(
recipient_pubkey_hash: &PubkeyHash,
sender_pubkey_hash: &PubkeyHash,
secret_hash: &[u8],
redeem_block_height: u32,
) -> Script {
let script = Builder::new()
.push_opcode(OP_IF)
.push_opcode(OP_SHA256)
.push_slice(secret_hash)