https://github.com/tradle/simple-wallet
simple bitcoin wallet - for one key
https://github.com/tradle/simple-wallet
Last synced: 2 months ago
JSON representation
simple bitcoin wallet - for one key
- Host: GitHub
- URL: https://github.com/tradle/simple-wallet
- Owner: tradle
- License: mit
- Created: 2015-06-02T15:05:12.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2018-12-24T23:06:57.000Z (over 7 years ago)
- Last Synced: 2024-04-14T12:21:35.185Z (about 2 years ago)
- Language: JavaScript
- Size: 18.6 KB
- Stars: 3
- Watchers: 8
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# simple-wallet
one-key wallet using common-blockchain API
```js
var Blockchain = require('cb-blockr')
var Wallet = require('simple-wallet')
var wifKey = require('./path/to/wifPrivKey')
var networkName = 'testnet'
var wallet = new Wallet({
priv: wifKey,
blockchain: new Blockchain(networkName),
networkName: networkName
})
// get balance
wallet.balance(function(err, satoshis) {
})
// get summary (balance, other fun stuff)
wallet.summary(function(err, summary) {
})
// send money
// see [Spender API](https://github.com/mvayngrib/spender)
wallet.send()
.to(toAddress, satoshis)
.data(new Buffer('this goes in OP_RETURN'))
.change(/* defaults to wallet's own address */)
.execute(function(err, txId, tx) {
})
// dump wallet balance to another address
wallet.dumpTo(toAddress, function(err, txId, tx) {
})
```