Skip to content

Instantly share code, notes, and snippets.

@ZhenQian-keystone
ZhenQian-keystone / generate_a_unsigned_psbt.rs
Last active June 20, 2024 06:53
Implement the creator role in bip174.
/// impl bip174 by rust-bitcoin crate
/// Creates the PSBT, in BIP174 parlance this is the 'Creator'.
/// reference
/// https://crates.io/crates/bitcoin
/// https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki
use third_party::bitcoin::psbt::{Psbt};
use third_party::bitcoin::{Amount, OutPoint, ScriptBuf, Sequence, Transaction, Txid, TxIn, TxOut, Witness};
use third_party::bitcoin_hashes::hex::FromHex;
use third_party::{hex};
@ZhenQian-keystone
ZhenQian-keystone / eip155_demo.js
Last active June 12, 2024 04:03
Implementing EIP-155 using Ethers.js v5.7
/// eip155 https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md
/// use ethers v5.7
const ethers = require('ethers')
const CHAIN_ID = 1
async function main() {
// private key
let private_key =
'0x4646464646464646464646464646464646464646464646464646464646464646'
let wallet = new ethers.Wallet(private_key)