Po.et Node 2.0 Beta Release

Developers welcome

The Po.et team is excited to announce the release of the first beta version of Po.et Node 2.0. Node 2.0 is the core component of the Po.et protocol, which uses the Bitcoin blockchain to track ownership of various forms of digital content.

The Po.et protocol is built on:

Initially, we planned to create several individual components to implement the functionality of the Po.et Node. However, after further evaluation we concluded that this approach would lead to an overly complex software stack that would make the Po.et protocol more difficult to understand for third-party developers who we want to help build decentralized applications on top of it. Thus in November 2017, we announced plans to build Node 2.0, which combines all of Node's functionality into a single application.

How to Test Node 2.0 Beta

We released the beta version of Po.et Node 2.0 in late December 2017. The code is available on GitHub for anyone to download and run. We hope you'll give Node 2.0 a try and share your feedback with us.

Running The Po.et Node

To run the Node, first you'll need to install NodeJS. You can do that with these commands on any modern Linux or Mac system:

# Install Node Version Manager
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash

# Activate NVM
. ~/.nvm/nvm.sh

# Install NodeJS
nvm install 9.3.0

Next, check out the Node code, build it and run it with npm:

# Clone The Po.et Node
git clone https://github.com/poetapp/node.git

# Build The Po.et Node
cd node
npm i
npm run build

# Run The Po.et Node
npm start

In order for Node to work properly, you need to have the following dependencies installed:

To make it easy to run the Po.et Node, we've made these dependencies available via Docker containers. With Docker installed, to build the containers, simply run this command one time:

sudo make mongo rabbit ipfs

This command will build and run the containers. If they go down for whatever reason (shutting down computer, for example), they can easily be started again running:

sudo make start-all

The Po.et Node also makes use of the Insight API, but you can omit installing this altogether — the Node will default to using https://test-insight.bitpay.com/api, the publicly available Insight API provided by BitPay.

In a production environment it's recommended that you run your own Insight API. Take a look at the instructions on their GitHub repo for info on how to do this. In the future, we intend to provide docker and terraform files to ease this processes.

Running a First Test

Go to your browser and open the url http://localhost:18080/works?publicKey=02cab54b227f16dd4866310799842cdd239f2adb56d0a3789519c6f43a892a61f6. This will retrieve all the works owned by that public key. Since you just started running the Node, if should return an empty array.

Now go ahead and run npm test. This will run all the automated tests, including one that publishes a work to your local Node with the attributes { name: 'Name' }. After the tests finish running, open the same URL again in the browser. Voilà! It should now return several works.

[
  {
   "id": "1cb7fd2a3d5a64f4ef911e478a39ec17726868cecf444a65030c2c52a87cb741",
    "publicKey": "02cab54b227f16dd4866310799842cdd239f2adb56d0a3789519c6f43a892a61f6",
    "signature": "304402203c39452fa36e30128a0309563af18b4eff2918bdcdf483525d5e1b4a8247fff40220182a610b5d85cf04c2b20cd1f6a1228583b44858b1c3a563226708210bfa0625",
    "type": "Work",
    "dateCreated": "2018-01-04T02:04:40.373Z",
    "attributes": {
      "name": "Name"
    }
  },
  ...
]

What's going on under the hood? This test run. The code of the test looks like this:

const claim = createClaim(Key1.privateKey, ClaimType.Work, {
  name: 'Name'
})
const postResponse = await postWork(claim)

postWork is a simple function that uses JavaScript's Fetch API to POST the claim generated by createClaim to http://localhost:18080/works, where the Po.et Node is listening.

createClaim is a function we provide that takes care of transforming the work ({name: 'Name'} in this test case) into a valid, cryptographically signed Po.et Claim. Under the hood, it uses Google's Protocol Buffers to deterministically generate the claim's Id and Bitcore's ECDSA Crypto to sign it with the provided private key.

Enabling Timestamping

By default, the Po.et Node will run with timestamping disabled. We can change this by providing a configuration file at ~/.po.et/configuration.json.

To enable timestamping to the Bitcoin blockchain, you need to set enableTimestamping to true and provide a valid bitcoinAddress and the bitcoinAddressPrivateKey that owns it.

{
  "enableTimestamping": true,
  "bitcoinAddress": "n3pq...",
  "bitcoinAddressPrivateKey": "cVTnq..."
}

You can get a testnet bitcoin address and corresponding private key using Ian Coleman's Mnemonic Code Converter. Just pick "BTC — Bitcoin Testnet" in the "Coin" input, then "Generate". Then scroll down to "Derived Addresses". Choose any one of this addresses.

Then you'll need to put some bitcoins into that address in order to afford transaction fees. To get some free testnet bitcoins you can use flyingkiwi's testnet faucet. Simply enter the address you just generated and click "Give me some coins".

You'll need to restart the Node for these configuration changes to apply.

Once the Node is running with timestamping enabled, works published to it will be timestamped to the Bitcoin Blockchain.

API Documentation, Running as Daemon and more…

More in-depth details about installation and configuration, as well as how to contribute, are available on the Po.et Node GitHub repo.

Next Steps

With Po.et Node 2.0 now ready for widespread testing, we look forward to honing the application over the coming months. We will also continue to build out the rest of the Po.et protocol and platform in order to enable secure, seamless management of digital content via the blockchain.

You can follow us on Twitter to stay up-to-date with the status of Po.et development, and reach us anytime on Telegram.


Originally published on Medium.

A newsletter for programmers

Yo! This is Taro. I've been doing JavaScript for years and TypeScript for years. I have experience with many programming languages, libraries, frameworks; both backend and frontend, and in a few company roles/positions.

I learned a few things over the years. Some took more effort than I wish they had. My goal with this blog and newsletter is to help frontend and backend developers by sharing what I learned in a friendlier, more accessible and thorough manner.

I write about cool and new JavaScript, TypeScript and CSS features, architecture, the human side of working in IT, my experience and software-related things I enjoy in general.

Subscribe to my newsletter to receive notifications when I publish new articles, as well as some newsletter-exclusive content.

No spam. Unsubscribe at any time. I'll never share your details with anyone. 1 email a week at most.

Success!
You have subscribed to Taro's newsletter
Shoot!
The server blew up. I'll go get my fire extinguisher — please check back in 5.