Professional Documents
Culture Documents
Christopher
Jeffrey (JJ)
CTO at purse.io
Twitter: @_chjj
Email: chjj@purse.io
GitHub: https://github.com/
bcoin-org/bcoin
bitcoind
Str8 up menace
Menace implementations:
BitcoinJ: Java (bad)
btcd: Golang (good)
NBitcoin: C# (good)
bcoin: JS (good?)
Quote
"A fucked up childhood is why the
way I am." - MC Eiht
Conclusion: Bitcoin's
childhood is what led to the
creation of menaces.
Bitcoins Childhood
Satoshi releases whitepaper.
Satoshi releases a working C+
+ implementation of his
protocol.
The implementation itself has
no tests, docs, and global
state everywhere.
Global state.
C++
Quote
"Whoever Satoshi was, he showed no familiarity with
post-1995 software development techniques and that includes
a complete lack of any unit tests and therefore a testable
codebase. Any modern implementation should do better....
More fleshed out API (more RPC calls and REST API)
Global state.
Code insanity
Notifications
C++ (unfortunately)
So,
lets
make
something
-bitcoind
better: something more
readable, more hackable, more
maintainable.
Hard Parts
Vastness
Complexity
Consensus
Policy
Consensus (Lockstep)
Bugs become consensus
rules (Why? Because were
not Ethereum)
TX#2:
2c63aa814701cef5dbd4bbaddab3fea9117028f2434dddcdab8339141e9b14d1
Chicken-or-egg
SIGHASH_SINGLE flag: The initial bitcoin release had
a bug which implicity cast an error code of 1 to a
sha256 hash (explicit typing protects us, right?).
This results in a predictable signature hash of
01000000."
uint256 SignatureHash(CScript scriptCode, const CTransaction& txTo,
unsigned int nIn, int nHashType)
{
...
unsigned int nOut = nIn;
if (nOut >= txTmp.vout.size())
{
printf("ERROR: SignatureHash() : nOut=%d out of range\n", nOut);
return 1; // This gets cast to a uint256!
}
...
}
It gets weirder:
. Recent
WTXID
bcoin
Creating a blockchain technology
(TM)
var bcoin = require('bcoin');
var chain = new bcoin.chain();
chain.open().then(() =>
chain.db.getBlock(0)).then(console.log);
Block Event
Chain
Pool
TX Event
Mempool
Chain
Connect/Disconnect
Event
Wallet DB/
Mempool/Miner
Mempool
TX Event
Wallet DB/Miner
Miner
Block Event
Chain
Wallet DB
Send Event
Pool
Wallet DB
TX Event
Websocket Server
HTTP Client
TX
HTTP Server
Mempool
Javascript, why?
Benefits
Ubiquitous
Drawbacks
Single threaded.
Single threaded
Example
Bcoin Features
Supported?
Versionbits
CSV
SegWit
Future Development
Plasma: Javascript Lightning
Implementation (LND Compatible)
fin?
slides by McKie :D
Coming
Soon
Starring:
Olaolu
(Roasbeef)
&
JJ