• Stars
    star
    303
  • Rank 137,655 (Top 3 %)
  • Language
    Rust
  • License
    MIT License
  • Created over 4 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Privacy-preserving Bitcoin light-client implementation in Rust

nakamoto

Nakamoto is a privacy-preserving Bitcoin light-client implementation in Rust, with a focus on low resource utilization, modularity and security.

The vision for the project is to build a set of libraries targeting light client functionality, that are easy to embed in any program and on any platform, be it mobile or desktop. The project's small cpu, memory and code footprint is made possible by its efficient runtime and minimal set of dependencies. The implementation language, Rust, opens up the possibility for programs written in other languages (eg. Swift, Python, Java), to bind directly to it via a foreign function interface (FFI).


[dependencies]
nakamoto = "0.4.0"

Design

Nakamoto is split into several crates, each handling a different aspect of the light-client protocol. Although these crates are designed to be used in tandem, swapping implementations is trivial, due to the explicit boundaries between them, and the use of traits. From a high-level, we have:

  • nakamoto-client: the core light-client library
  • nakamoto-p2p: the protocol state-machine implementation
  • nakamoto-chain: the block store and fork selection logic
  • nakamoto-net: networking primitives used by the reactor implementations
  • nakamoto-net-poll: the default poll-based networking backend
  • nakamoto-common: common functionality used by all crates
  • nakamoto-node: a standalone light-client daemon
  • nakamoto-wallet: a very basic watch-only wallet built on the above crates

For an overview of the above, see the architecture diagram in the docs folder.

Status

While the project is still in its infancy, the base functionality has been implemented. Nakamoto is able to discover peers, download and verify the longest chain and handle forks, while implementing the full header verification protocol.

Client side block filtering (BIP 157/158) is implemented and working. See nakamoto-wallet for an example of how to use it.

Once peer-to-peer layer encryption (BIP 151) lands in Core, it will also be implemented in Nakamoto.

Finally, a C FFI will be implemented, to make it easy to embed the client in mobile applications.

Though wallet functionality will slowly be added, it isn't the primary focus of this project, which sits one level below wallets.

Projects goals

  • High assurance: the library should be thoroughly tested using modern techniques such as property and model-based testing as well as discrete event simulation and fuzzing. These approaches benefit from a clean separation between I/O and protocol logic and have been shown to catch more bugs than unit testing.

  • Security: as a library that may find its way into wallet implementations, a primary goal is security and auditability. For this reason, we try to minimize the total dependency footprint, keep the code easy to read and forbid any unsafe code.

  • Efficiency: blockchain synchronization should be done as efficiently as possible, with low memory, disk and bandwidth overhead. We target resource-constrained environments, such as mobile.

  • Privacy: when possible, privacy-preserving techniques should be employed. Client Side Block Filtering (BIP 157/158) should be used over bloom filters (BIP 37) to ensure user privacy and provide censorship resistance.

Running the tests

cargo test --all

Running the daemon

cargo run --release -p nakamoto-node -- --testnet

Contributing

If you'd like to contribute to the development of Nakamoto, please get in touch! Otherwise, do read the contribution guidelines.

Donations

To help fund the project and ensure its ongoing development and maintenance, your support in Bitcoin is appreciated at the following address:

bc1qa47tl4vmz8j82wdsdkmxex30r23c9ljs84fxah

Motivation

Looking at ecosystems that aren't light-client friendly—Ethereum for example—we see that the vast majority of users are forced into trusting third parties when transacting on the network. This is completely counter to the idea and raison d'être of blockchains, and poses a giant security and privacy risk. Unfortunately, this is due to the lackluster support for light-clients, both at the protocol level, and in terms of the available implementations. Light-clients are necessary for the average user to be able to securely interface with a network like Ethereum or Bitcoin.

For this purpose, Nakamoto was conceived as a client that can efficiently run on any mobile device, with the highest standards of privacy and security achievable given the constraints.

License

Licensed under the MIT license. © 2020 Alexis Sellier (https://cloudhead.io)

More Repositories

1

rx

👾 Modern and minimalist pixel editor
Rust
2,920
star
2

node-static

rfc 2616 compliant HTTP static-file server module, with built-in caching.
JavaScript
2,171
star
3

toto

the 10 second blog-engine for hackers
Ruby
1,473
star
4

http-console

simple, intuitive HTTP REPL — Speak HTTP like a local.
JavaScript
1,358
star
5

eyes.js

a customizable value inspector for node.js
JavaScript
342
star
6

journey

liberal JSON-only HTTP request routing for node.
JavaScript
321
star
7

thingler

The amazingly simple-to-use, real-time, collaborative todo list!
JavaScript
296
star
8

dorothy

a basic template for toto, the blogging engine
Ruby
244
star
9

hijs

simple & fast javascript syntax highlighting for the browser
JavaScript
240
star
10

rgx.legacy

Modern mid-level 2D graphics library
Rust
194
star
11

popol

Minimal non-blocking I/O for Rust
Rust
157
star
12

neovim-fuzzy

Minimalistic fuzzy file finding for neovim
Vim Script
111
star
13

dotfiles

~cloudhead
Vim Script
100
star
14

mutter

the tiny command-line interface library with lots of style~
Ruby
80
star
15

resourcer

a resource-oriented object-relational mapper for document databases
JavaScript
58
star
16

pixelog

simple pixel tracking server
Go
56
star
17

node-syslog

a syslog-ng TCP client, with basic fault-tolerance.
JavaScript
32
star
18

koi

minimal task management for hackers
Ruby
31
star
19

nonempty

Correct by construction non-empty list
Rust
30
star
20

px

Superseded by `rx`
C
30
star
21

erlapp.template

minimal erlang/OTP rebar template
Erlang
29
star
22

styleguide

style-guide for various languages
27
star
23

shady.vim

Shady vim color-scheme for late night hacking
Vim Script
23
star
24

vargs

practical variable argument handling in node.js
JavaScript
22
star
25

neovim-ghcid

Provides instant haskell error feedback inside of neovim, via ghcid.
Vim Script
21
star
26

microserde

miniserde minus the dependencies
Rust
18
star
27

pilgrim

a JSON consuming JavaScript XHR client for the browser
JavaScript
15
star
28

nimbus

nimble, durable, document store
JavaScript
14
star
29

spell-correct

ruby implementation of Norvig's spell corrector
Ruby
12
star
30

node-crawler

http crawler — (project under development)
JavaScript
12
star
31

arbre

a dynamic functional programming language experiment
C
10
star
32

rig.js

temporally extend an object's capabilities.
JavaScript
9
star
33

mrchat

micro chat client for the console, in c, with some tasteful ncurses
C
9
star
34

talker-plugins

A bunch of plugins for Talker (http://talkerapp.com)
JavaScript
9
star
35

node-provider

Manage HTTP content providers. It's 'Accept'-based routing, folks!
JavaScript
9
star
36

proto.js

prototype & other core extensions
JavaScript
8
star
37

github-unwatcher

Unwatch github repos
JavaScript
8
star
38

memoir

Self-describing, reflective parser combinators
Rust
7
star
39

spinsv

a stateless service runner inspired by runit
Haskell
7
star
40

avl-auth

An authenticated AVL+ tree implementation in Haskell
Haskell
6
star
41

bloomy

Bloom filter implementation in Rust
Rust
6
star
42

gogol

a bitmap drawing & animation library for Go
Go
6
star
43

cloudhead.io

This is my website.
CSS
5
star
44

prose

lightweight text to html parser, combining the best of Markdown with a hint of Textile
Ruby
5
star
45

s3web

scripts for publishing static sites to S3
Ruby
4
star
46

github-recommend

recommendation engine for github's 2009 contest
C
4
star
47

monsv

a service runner inspired by runsv
Go
3
star
48

diffraction

even stocks can be diffracted!
Ruby
3
star
49

melon

hybrid javascript/ruby micro app engine
Ruby
3
star
50

node-intro

intro to node.js presentation for montreal.js
JavaScript
3
star
51

cryptocurrency

Cryptocurrency library for Haskell
Haskell
2
star
52

golem

pre-forking HTTP server for node (old)
JavaScript
2
star
53

ghoul

your (node) deployment minion - a work in progress.
PHP
2
star
54

rx.cloudhead.io

CSS
2
star
55

birth

graceful linux system birthing
Vim Script
2
star
56

extender

handy extensions to keep your code cleanâ„¢
Ruby
2
star
57

sokol-gfx-rs

C
1
star
58

iohk-challenge

IOHK Haskell test
Haskell
1
star
59

a-file-uploader

JavaScript
1
star
60

rgx

2D Graphics Toolkit for Rust
Rust
1
star