weilu / cb-wallet Goto Github PK
View Code? Open in Web Editor NEWA crypto currency wallet backed by common-blockchain
A crypto currency wallet backed by common-blockchain
As discussed in bitcoinjs/bitcoinjs-lib#260 (comment), I feel like the 'all-in-one' design of the Wallet
right now is too overwhelming, and leads to bad separation of concerns.
In essence the design needs to cater for three things:
As an example of what this API might look like, here is an example for spending:
var satoshis = 1e5
var inputs = unspents.candidates(satoshis)
var addresses = inputs.filter(function(inputs) { return u.address })
var tx = utils.createTransaction(inputs, outputs, { change: '18eRuS...' , fee: 0 })
wallet.sign(tx).with(addresses)
blockchain.propagate(tx, function(err) {
...
})
Then perhaps even a check to see if your address is used might just be:
if (unspents.contains(address)) {
wallet.next()
}
Thoughts?
Using BIP32-utils discovery might be:
bip32utils.discovery(wallet.getExternalAccount(), 20, function(addresses, callback) {
blockchain.addresses.summary(addresses, function(err, results) {
if (err) return callback(err)
var areSpent = results.map(function(result) {
return result.totalReceived > 0
})
callback(undefined, areSpent)
})
}, function(err, k) {
if (err) return done(err)
console.warn('Discovered ' + k + ' addresses')
wallet.generate(0, k)
done()
})
See: #2 (comment)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.