Skip to content

Commit

Permalink
WIP: Implement gRPC
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenroose committed Mar 4, 2018
1 parent e70a0fe commit fd4343d
Show file tree
Hide file tree
Showing 10 changed files with 6,418 additions and 143 deletions.
3,846 changes: 3,846 additions & 0 deletions btcrpc/btcrpc.pb.go

Large diffs are not rendered by default.

633 changes: 633 additions & 0 deletions btcrpc/btcrpc.proto

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions btcrpc/generate-protos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

# Generate the protos.
protoc -I/usr/local/include -I. \
-I$GOPATH/src \
--go_out=plugins=grpc:. \
btcrpc.proto

21 changes: 21 additions & 0 deletions btcrpc/rpcutils.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package btcrpc

import "github.com/btcsuite/btcd/chaincfg/chainhash"

// NewBlockLocatorHash creates a new BlockLocator using the given block hash.
func NewBlockLocatorHash(hash *chainhash.Hash) *BlockLocator {
return &BlockLocator{
Locator: &BlockLocator_Hash{
Hash: hash[:],
},
}
}

// NewBlockLocatorHeight creates a new BlockLocator using the given block height.
func NewBlockLocatorHeight(height int32) *BlockLocator {
return &BlockLocator{
Locator: &BlockLocator_Height{
Height: height,
},
}
}
79 changes: 79 additions & 0 deletions grpc-progress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@


All current methods and the new methods that cover them:

- [x] addnode: ConnectPeer
- [x] createrawtransaction: deprecated
- [x] debuglevel: SetDebugLevel
- [x] decoderawtransaction: deprecated
- [x] decodescript: deprecated
- [x] generate: GenerateBlocks
- [x] getaddednodeinfo: GetPeers
- [x] getbestblock: GetBestBlockInfo
- [x] getbestblockhash: GetBestBlockInfo
- [x] getblock: GetBlock
- [ ] **getblockchaininfo: could add to GetNetworkInfo**
- [x] getblockcount: GetBestBlockInfo
- [x] getblockhash: GetBlockInfo
- [x] getblockheader: GetBlockInfo
- [ ] **getblocktemplate**
- [x] getconnectioncount: GetSystemInfo
- [x] getcurrentnet: GetNetworkInfo
- [x] getdifficulty: GetNetworkInfo or GetMiningInfo
- [x] getgenerate: GetGenerate
- [x] gethashespersec: GetHashRate (or GetNetworkInfo or GetMiningInfo for network HR)
- [ ] **getheaders**
- [x] getinfo: GetSystemInfo and GetNetworkInfo
- [x] getmempoolinfo: GetMempoolInfo
- [x] getmininginfo: GetMiningInfo
- [x] getnettotals: GetSystemInfo
- [x] getnetworkhashps: GetNetworkInfo or GetMiningInfo
- [x] getpeerinfo: GetPeers
- [x] getrawmempool: GetMempool and GetRawMempool
- [x] getrawtransaction: GetRawTransactions
- [ ] **gettxout**
- [x] help: deprecated
- [x] node: ConnectPeer, DisconnectPeer, GetPeers
- [x] ping: deprecated
- [ ] **searchrawtransactions: how is this different than rescan?**
- [x] sendrawtransaction: SubmitTransactions
- [x] setgenerate: SetGenerate
- [x] stop: StopDaemon
- [x] submitblock: SubmitBlock
- [x] uptime: GetSystemInfoo
- [x] validateaddress: deprecated
- [ ] **verifychain**
- [ ] **verifymessage**
- [x] version: GetSystemInfo

There are WebSocket-only commands:
- [x] loadtxfilter
- [x] notifyblocks: SubscsribeBlocks
- [x] notifynewtransactions: SubscribeTransactions
- [x] notifyreceived: potentially SubscribeTransactions
- [x] notifyspent: potentially SubscribeTransactions
- [x] rescan: RescanTransactions
- [ ] **rescanblocks: why is this useful?**
- [x] session: deprecated
- [x] stopnotifyblocks: SubscribeBlocks
- [x] stopnotifynewtransactions: SubscribeTransaction
- [x] stopnotifyspent: potentially SubscribeTransaction
- [x] stopnotifyreceived: potentially SubscribeTransaction

These are mentioned in the code as not implemented, but desired:
- estimatefee
- estimatepriority
- getchaintips
- getmempoolentry
- getnetworkinfo: GetNetworkInfo
- getwork
- invalidateblock
- preciousblock
- reconsiderblock

Other TODOs:

- [x] implement listening
- [ ] add GRPC dependenies (waiting for dep PR)
- [ ] correct error handling
- [ ] REST proxy? (cfr lnd)

0 comments on commit fd4343d

Please sign in to comment.