Skip to content

Instantly share code, notes, and snippets.

@mahdiidarabi
mahdiidarabi / multisig-redeemscript.go
Last active December 4, 2020 13:28
redeem script of a 2 of 3 multi sig, to put in a P2SH address
package main
import (
"github.com/btcsuite/btcd/txscript"
"github.com/btcsuite/btcutil"
)
func BuildMultiSigRedeemScript() (string, error) {
// you can use your wif
@mahdiidarabi
mahdiidarabi / multisig-p2sh-address.go
Last active December 4, 2020 13:55
build a multi sig P2SH address in go
package main
import (
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/txscript"
"github.com/btcsuite/btcutil"
)
func BuildMultiSigP2SHAddr() (string, error) {
@mahdiidarabi
mahdiidarabi / dis-asemble.go
Created December 4, 2020 13:56
dis asemble a bitcoin script to human readable one in go
package main
import (
"encoding/hex"
"github.com/btcsuite/btcd/txscript"
)
func DisAsembleScript() (string, error) {
// you can provide your locking script to dis asemble
lockingScript := "a914f63e2cbcc678236f683d267e7bb298ffdcd57b0487"
@mahdiidarabi
mahdiidarabi / sign-multisgi-p2sh.go
Created December 4, 2020 14:17
sign a multi sig transaction in the format of P2SH in go
package main
import (
"bytes"
"encoding/hex"
"fmt"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/txscript"
"github.com/btcsuite/btcd/wire"
@mahdiidarabi
mahdiidarabi / multi-send-smart-contract
Last active October 10, 2024 16:50
this is a smart contract with solidity to implement multi send transactions on ethereum
pragma solidity >=0.7.0 <0.9.0;
contract MultiSend {
// to save the owner of the contract in construction
address private owner;
// to save the amount of ethers in the smart-contract
uint total_value;
@mahdiidarabi
mahdiidarabi / simpleERC20Token.sol
Created June 18, 2022 05:29
a very simple code of an ERC20 token
// contracts/SimpleToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
/**
* @title SimpleToken
* @dev Very simple ERC20 Token example, where all tokens are pre-assigned to the creator.
* Note they can later distribute these tokens as they wish using `transfer` and other