https://github.com/0x4139/bitcoin-p2sh
Golang implementation of the bitcoin multisig protocol
https://github.com/0x4139/bitcoin-p2sh
bitcoin bitcoin-p2sh golang multisig
Last synced: about 1 year ago
JSON representation
Golang implementation of the bitcoin multisig protocol
- Host: GitHub
- URL: https://github.com/0x4139/bitcoin-p2sh
- Owner: 0x4139
- Created: 2018-04-18T11:52:40.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-18T11:53:02.000Z (about 8 years ago)
- Last Synced: 2025-03-24T05:22:12.332Z (over 1 year ago)
- Topics: bitcoin, bitcoin-p2sh, golang, multisig
- Language: Go
- Size: 20.5 KB
- Stars: 3
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
Bitcoin p2sh (multisig)
======
[](http://ansicolortags.readthedocs.io/?badge=latest) [](http://makeapullrequest.com)
### Important: Be sure that you use golang < 1.9.4 due to the fact of this [Issue](https://github.com/golang/go/issues/23739)
### Install go bindings for bitcoin secp256k1 first
```
cd $GOPATH/src/github.com/0x4139/secp256k1
git submodule update
cd c-secp256k1
make distclean && ./autogen.sh && ./configure && make
cd ..
go clean && go install
```
### Run the tests
```
go test tests
```
### Features
For a more detailed usage please see the folder `tests`
```
GenerateAddress(m int, n int, rawPublicKeys string) (string, string, error)
GenerateFund(rawPrivateKey string, inputTx string, amount int, p2shDestination string) (string, error)
SignP2PKHTransaction(rawTransaction []byte, privateKey []byte, scriptPubKey []byte, inputTx string, amount int) ([]byte, error)
GenerateKeys(keyCount int) ([]string, []string, []string, error)
GenerateSpend(rawPrivateKeys string, destination string, rawRedeemScript string, inputTx string, amount int) (string, error)
SignMultiSigTransaction(rawTransaction []byte, orderedPrivateKeys [][]byte, scriptPubKey []byte, redeemScript []byte, inputTx string, amount int) ([]byte, error)
```
#### Important Information
As per protocol rfc, private keys in ort to spend a multisig wallet have to be provided in the same order (skipping is ok but in the same order) as provided when the P2SH address was created
### License
````
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2018
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
````