/uplink

A distributed ledger for secure multiparty workflows in financial markets.

Primary LanguageHaskellApache License 2.0Apache-2.0

Community Edition

Uplink

CircleCI

Uplink is a distributed database built for orchestrating secure multiparty workflows found in financial markets.

Uplink operates as a federation of nodes which communicate over a private network to provide an append-only database in which all transactions are cryptographically signed and where all members participate in a consensus protocol to maintain and verify the ledger state.

Uplink also has the capacity to run so-called smart contracts which are units of logic which run across the network and allow counterparties to interact through arbitrarily sophisticated programs that can model common business processes and financial instruments. Provided with the ledger is a new scripting language FCL (Financial Core Language) built on a verified core and designed as a target for contract modeling tools.

The community version of Adjoint's software is released under an Apache License and is part of a larger suite of tools and languages offered commercially.

Running a Node

To run an Uplink node that has the ability to construct and sign blocks, you must supply a filepath to an existing private key located in the config/validators directory. Accounts correspoding to these key pairs are created on boot and added to the genesis world state, and the list of addresses defining the validator nodes is defined in config/chain.config.local.

Without Docker

$ stack install --no-docker

To boot a validator node (needed to create & sign blocks):

$ uplink chain init -b "leveldb:///uplink1" -p 8001 -d node1 -k config/validators/auth0/key -v

And two non-validator nodes:

$ uplink chain init -b "leveldb:///uplink2" -p 8002 --rpc-port 8546 -d node2 -v
$ uplink chain init -b "leveldb:///uplink3" -p 8003 --rpc-port 8547 -d node3 -v

When prompted whether we want to provide a private key, you can enter n.

We can open up the console:

$ uplink console

Running the command listPeers in the Uplink console should give us a list containing the three peers we just started.

With Docker

The run-container script will compile and run a node using docker and bind the P2P and RPC ports to the host.

$ stack install
$ ./run-container 
Please supply three args: <db dir suffix> <p2pPort> <rpcPort>
Examples: $ ./run-container 1 8001 8545
          $ ./run-container 2 8002 8546

To boot a validator node (needed to create & sign blocks):

$ ./run-container 1 8001 8545 "-k config/validators/auth0/key" 

And two non-validator nodes:

$ ./run-container 2 8002 8546
$ ./run-container 3 8003 8547

When prompted whether we want to provide a private key, you can enter n.

We can open up the console:

$ uplink console --hostname 127.0.1.1

Running the command listPeers in the Uplink console should give us a list containing the three peers we just started.

With optimizations:

$ stack build --flag uplink:optimized

If you follow either of these examples, booting 3 Uplink nodes (one validator and two non-validating nodes), then transactions issued to any of the nodes will propagate through the network and blocks will be generated by the validating node at intervals defined in the blockPeriod field of config/chain.config.

Uplink Console

To interact with an Uplink node with a separate console process (instead of through the RPC), refer to the documentation.

Interactive Smart Contract (FCL) Shell

$ uplink scripts 
Available options:
  -h,--help                Show this help text

  Available commands:
    compile                  Compile and typecheck a script.
    repl                     Compile, typecheck a script, and load it into a REPL.
    format                   Format a script
    lint                     Lint a script.
    graph                    Extract graph from a script.
$ uplink scripts repl <fcl-file>

Documentation

Extensive documentation can be found here.