Skip to content

Commit a67f8c3

Browse files
committed
network-bitcoin
1 parent a9a5ecc commit a67f8c3

20 files changed

+2871
-0
lines changed

pub/network-bitcoin/.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
*.hi
2+
*.o
3+
*.swp
4+
.dist-scion/
5+
.hsproject
6+
.project
7+
Setup.hs
8+
dist/
9+
dist-newstyle/
10+
cabal-dev/
11+
cabal.sandbox.config
12+
.cabal-sandbox/
13+
.stack-work
14+
tags

pub/network-bitcoin/.hgignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
syntax: regexp
2+
\#.*\#$
3+
\.\#
4+
\.sw[op]
5+
\.DS_Store$
6+
\.cabal-sandbox/
7+
\.hpc/
8+
\.tix$
9+
cabal\.sandbox\.config$
10+
dist/
11+
dist-newstyle/
12+
\.stack-work/
13+
^tags$

pub/network-bitcoin/.travis.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
language: haskell
2+
notifications:
3+
email:
4+
5+
on_success: always
6+
on_failure: always
7+
install:
8+
- cabal install --only-dependencies
9+
- cabal configure
10+
- cabal build
11+
- cabal haddock

pub/network-bitcoin/CHANGELOG

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
1.9.1
2+
3+
* tries to call 'generate' before falling back to 'generatetoaddress'
4+
5+
1.9.0
6+
7+
* removes 'generate' rpc call
8+
* adds test case for 'generateToAddress' and updates tests
9+
10+
1.8.5
11+
12+
* ...
13+
14+
1.1.0
15+
16+
* Added missing HashData fields
17+
* Added a ToJSON instance for HashData
18+
* Fixed getAddressesByAccount

pub/network-bitcoin/LICENSE

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Copyright (c)2011, Michael Hendricks
2+
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
* Redistributions of source code must retain the above copyright
9+
notice, this list of conditions and the following disclaimer.
10+
11+
* Redistributions in binary form must reproduce the above
12+
copyright notice, this list of conditions and the following
13+
disclaimer in the documentation and/or other materials provided
14+
with the distribution.
15+
16+
* Neither the name of Michael Hendricks nor the names of other
17+
contributors may be used to endorse or promote products derived
18+
from this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

pub/network-bitcoin/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
network-bitcoin
2+
====
3+
4+
This library supports [Bitcoin Core][1] `v0.18` only.
5+
6+
See the [Hackage documentation][2].
7+
8+
Testing
9+
----
10+
11+
The tests expect to run against a `bitcoind` node running in regtest mode.
12+
Invoke `bitcoind` with:
13+
14+
```shell
15+
$ bitcoind -regtest -rpcuser=bitcoinrpc -rpcpassword=bitcoinrpcpassword -rpcport=18444
16+
```
17+
18+
[1]: https://github.com/bitcoin/bitcoin
19+
[2]: http://hackage.haskell.org/package/network-bitcoin

pub/network-bitcoin/Setup.lhs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env runhaskell
2+
3+
> import Distribution.Simple
4+
> main = defaultMain
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
Name: network-bitcoin
2+
Version: 1.9.1
3+
Synopsis: An interface to bitcoind.
4+
Description:
5+
This can be used to send Bitcoins, query balances, etc. It
6+
requires the Bitcoin daemon to be running and accessible via
7+
HTTP.
8+
.
9+
> import Network.Bitcoin
10+
>
11+
> main = do
12+
> client <- getClient "http://127.0.0.1:8332" "user" "password"
13+
> balance <- getBalance client
14+
> putStrLn $ show balance ++ " BTC"
15+
.
16+
To learn more about Bitcoin, see <http://www.bitcoin.org>.
17+
License: BSD3
18+
License-file: LICENSE
19+
Author: Michael Hendricks <[email protected]>
20+
Clark Gaebel <[email protected]>
21+
Maintainer: Matt Wraith <[email protected]>
22+
Homepage: http://github.com/bitnomial/network-bitcoin
23+
Bug-reports: http://github.com/bitnomial/network-bitcoin/issues
24+
Copyright: 2012 Michael Hendricks <[email protected]>
25+
2013 Clark Gaebel <[email protected]>
26+
Stability: experimental
27+
Category: Network
28+
Build-type: Simple
29+
Cabal-version: >=1.8
30+
tested-with: GHC ==8.4.3
31+
32+
Library
33+
hs-source-dirs: src
34+
ghc-options: -Wall
35+
36+
Exposed-modules:
37+
Network.Bitcoin
38+
Network.Bitcoin.BlockChain
39+
Network.Bitcoin.Dump
40+
Network.Bitcoin.Internal
41+
Network.Bitcoin.Mining
42+
Network.Bitcoin.Net
43+
Network.Bitcoin.RawTransaction
44+
Network.Bitcoin.Types
45+
Network.Bitcoin.Wallet
46+
Network.Bitcoin.BtcEnv
47+
Network.Bitcoin.BtcMultiEnv
48+
49+
Build-depends:
50+
aeson >= 0.8,
51+
bytestring >= 0.9 && < 0.11,
52+
cookie >= 0.4,
53+
attoparsec >= 0.12,
54+
unordered-containers >= 0.2,
55+
HTTP >= 4000,
56+
http-types >= 0.8.5,
57+
network >= 2.3,
58+
text >= 0.11,
59+
vector >= 0.10,
60+
base == 4.*,
61+
time >= 1.4.2,
62+
http-client >= 0.4.6,
63+
network-uri,
64+
transformers
65+
66+
Source-repository head
67+
type: git
68+
location: git://github.com/bitnomial/network-bitcoin.git
69+
70+
Test-suite network-bitcoin-tests
71+
hs-source-dirs: src/Test
72+
main-is: Main.hs
73+
type: exitcode-stdio-1.0
74+
build-depends:
75+
aeson >= 0.8,
76+
bytestring >= 0.9 && < 0.11,
77+
cookie >= 0.4,
78+
attoparsec >= 0.12,
79+
unordered-containers >= 0.2,
80+
HTTP >= 4000,
81+
http-types >= 0.8.5,
82+
network >= 2.3,
83+
text >= 0.11,
84+
vector >= 0.10,
85+
base == 4.*,
86+
time >= 1.4.2,
87+
QuickCheck >= 2.6,
88+
tasty >= 1.0,
89+
tasty-quickcheck >= 0.10,
90+
http-client >= 0.4.6,
91+
network-bitcoin
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
{-# OPTIONS_GHC -Wall #-}
2+
-- | A Haskell binding to the bitcoind server.
3+
module Network.Bitcoin
4+
(
5+
-- * Common Types
6+
Client
7+
, getClient
8+
, BitcoinException(..)
9+
, HexString
10+
, TransactionID
11+
, Satoshi(..)
12+
, BTC
13+
, Account
14+
, Address
15+
, ScriptSig
16+
-- * Block Chain Operations
17+
, getBlockCount
18+
, getDifficulty
19+
, setTransactionFee
20+
, getRawMemoryPool
21+
, BlockHash
22+
, getBlockHash
23+
, Block(..)
24+
, BlockVerbose(..)
25+
, getBlock
26+
, getBlockVerbose
27+
, OutputSetInfo(..)
28+
, getOutputSetInfo
29+
, OutputInfo(..)
30+
, getOutputInfo
31+
-- * Private Key Operations
32+
, importPrivateKey
33+
, dumpPrivateKey
34+
-- * Mining Operations
35+
, generate
36+
, generateToAddress
37+
, getGenerate
38+
, setGenerate
39+
, getHashesPerSec
40+
, MiningInfo(..)
41+
, getMiningInfo
42+
, HashData(..)
43+
, getWork
44+
, solveBlock
45+
, Transaction(..)
46+
, CoinBaseAux(..)
47+
, BlockTemplate(..)
48+
, getBlockTemplate
49+
, submitBlock
50+
-- * Network Operations
51+
, getConnectionCount
52+
, PeerInfo(..)
53+
, getPeerInfo
54+
, AddNodeCommand(..)
55+
, addNode
56+
, disconnectNode
57+
, setNetworkActive
58+
-- * Raw Transaction Operations
59+
, RawTransaction
60+
, getRawTransaction
61+
, TxIn(..)
62+
, TxnOutputType(..)
63+
, ScriptPubKey(..)
64+
, TxOut(..)
65+
, BlockInfo(..)
66+
, RawTransactionInfo(..)
67+
, getRawTransactionInfo
68+
, UnspentTransaction(..)
69+
, listUnspent
70+
, createRawTransaction
71+
, DecodedRawTransaction(..)
72+
, decodeRawTransaction
73+
, WhoCanPay(..)
74+
, RawSignedTransaction(..)
75+
, signRawTransaction
76+
, sendRawTransaction
77+
-- * Wallet Operations
78+
, BitcoindInfo(..)
79+
, getBitcoindInfo
80+
, getNewAddress
81+
, getAccountAddress
82+
, getAccount
83+
, setAccount
84+
, getAddressesByAccount
85+
, sendToAddress
86+
, AddressInfo(..)
87+
, listAddressGroupings
88+
, Signature
89+
, signMessage
90+
, verifyMessage
91+
, getReceivedByAddress
92+
, getReceivedByAddress'
93+
, getReceivedByAccount
94+
, getReceivedByAccount'
95+
, getBalance
96+
, getBalance'
97+
, getBalance''
98+
, moveBitcoins
99+
, sendFromAccount
100+
, sendMany
101+
, EstimationMode (..)
102+
, estimateSmartFee
103+
-- , createMultiSig
104+
, ReceivedByAddress(..)
105+
, listReceivedByAddress
106+
, listReceivedByAddress'
107+
, ReceivedByAccount(..)
108+
, listReceivedByAccount
109+
, listReceivedByAccount'
110+
, listTransactions
111+
, listTransactions'
112+
, listAccounts
113+
, importAddress
114+
, SinceBlock(..)
115+
, SimpleTransaction(..)
116+
, TransactionCategory(..)
117+
, listSinceBlock
118+
, listSinceBlock'
119+
, DetailedTransaction(..)
120+
, DetailedTransactionDetails(..)
121+
, getTransaction
122+
, backupWallet
123+
, keyPoolRefill
124+
, unlockWallet
125+
, lockWallet
126+
, changePassword
127+
, encryptWallet
128+
, isAddressValid
129+
, DecodedPsbt (..)
130+
) where
131+
132+
import Network.Bitcoin.BlockChain
133+
import Network.Bitcoin.Dump
134+
import Network.Bitcoin.Mining
135+
import Network.Bitcoin.Net
136+
import Network.Bitcoin.RawTransaction
137+
import Network.Bitcoin.Types
138+
import Network.Bitcoin.Wallet

0 commit comments

Comments
 (0)