Skip to content

Instantly share code, notes, and snippets.

View mneresc's full-sized avatar

MARCELO NERES mneresc

  • Brasília
View GitHub Profile
public function v4()
{
return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
// 32 bits for "time_low"
mt_rand(0, 0xffff), mt_rand(0, 0xffff),
// 16 bits for "time_mid"
mt_rand(0, 0xffff),
@mneresc
mneresc / pkcs11_a3_reading.js
Created October 22, 2020 15:36
Exemplo de como fazer um acesso a certificados A3 com pkcs11 utilizando javascript
const pkcs11js = require("pkcs11js");
/**
* 1 - Carregando a lib que dara suporte as operacoes com PKCS11
*/
const pkcs11 = new pkcs11js.PKCS11();
pkcs11.load("/usr/local/lib/softhsm/libsofthsm2.so");
pkcs11.C_Initialize();
const moduleInfo = pkcs11.C_GetInfo();
TP's TestNet Faucet: https://testnet-faucet.mempool.co/
Bitcoin Testnet Sandbox Faucet: https://bitcoinfaucet.uo1.net/
RBF (Replace By Fee) Testnet Faucet: https://tbtc.bitaps.com/
Bitcoin Testnet3 Faucet: https://testnet.coinfaucet.eu/
1ML Testnet Faucet: https://1ml.com/testnet/faucet
——-
from bitcoinlib.keys import HDKey
from bitcoin.wallet import CBitcoinSecret, P2TRAddress
from bitcoin.core import b2x, CMutableTxIn, CMutableTxOut, CMutableTransaction
from bitcoin.taproot import TaprootSignatureHash, TaprootSignatureHashV1
# Chave privada
private_key = CBitcoinSecret('cVrHYYy9y2cCqscexG38CFSjRqKkzKZrfsGBpsE6jTHuRPz9jYS6')
# Endereço Taproot
taproot_address = P2TRAddress('tb1qykkq90ss7xj92vgz79fcjv3kmhyv2n6smlt9qh')
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
from bitcoin.core import CMutableTransaction, CMutableTxIn, CMutableTxOut, COutPoint, CScript, x, lx
# Configurações de conexão RPC
rpc_user = '<seu usuário RPC>'
rpc_password = '<sua senha RPC>'
rpc_host = '<endereço do seu nó Bitcoin Core>'
rpc_port = '<porta do seu nó Bitcoin Core>'
# Configuração das informações da transação
from bitcoin.wallet import CBitcoinSecret, P2WPKHScriptHashSegwitAddress
from bitcoin.core import CMutableTxIn, CMutableTxOut, CMutableTransaction, Hash160, CTxInWitness, Hash
from bitcoin.core.script import CScript, OP_0
from ecdsa import SigningKey, SECP256k1
# Definindo informações da transação
prev_txid = "..." # TXID da transação de entrada anterior
prev_vout = 0 # Índice da saída de transação de entrada anterior
destination_address = "tb1..."
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
# Configurações de conexão com o Bitcoin Core
rpc_user = 'seu_rpc_user'
rpc_password = 'seu_rpc_password'
rpc_host = 'localhost'
rpc_port = 8332
# Conecte-se ao nó do Bitcoin Core
rpc_connection = AuthServiceProxy(f'http://{rpc_user}:{rpc_password}@{rpc_host}:{rpc_port}')
const bitcoin = require('bitcoinjs-lib');
// Replace these values with your actual transaction details
const network = bitcoin.networks.testnet;
const senderAddress = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
const senderPrivateKey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
const recipientAddress = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
const amount = 0.001;
const fee = 5000; // Fee in satoshis
import os
import re
import sys
from pathlib import Path
from datetime import datetime
from docling.document_converter import DocumentConverter
from urllib.parse import urlparse, unquote
# =========================
import os
import re
import sys
from pathlib import Path
from datetime import datetime
from docling.document_converter import DocumentConverter
from urllib.parse import urlparse, unquote
# =========================