Skip to content

Instantly share code, notes, and snippets.

@kathyonu
Last active January 18, 2018 12:32
Show Gist options
  • Save kathyonu/63f9a9e87690526a99b0 to your computer and use it in GitHub Desktop.
Save kathyonu/63f9a9e87690526a99b0 to your computer and use it in GitHub Desktop.
Node.js and Yeoman's gulp to build Heroku hosted app in communication with the Stellar.org platform

20160226 : this gist is not yet complete, and may have sections removed during editing.

Reference Links

Stellar : Getting Started
Stellar : Home
Stellar Base
Stellar Core
Stellar Docs
Stellar Building and Installing : We begin here.
Stellar Core Testnet
Stellar Testnet
Strllar : Vanguard of Stellar Explorers stellar-core README.md
stellar/docs/stellar-core_testnet.cfg
stellar/docs/stellar-core_example.cfg
stellar/docs/other/stellar-core-validator-example.cfg
stellar/docs/validators.md
Stellar : streaming reference
Basic Examples : js-stellar-sdk
Stellar Developers Accounts
Stellar Developers Transactions
Stellar Query to Horizon
Stellar : build an app
Horizon Reference Overview
yeoman/generator-webapp/docs/README.md
yeoman/generator-generator
yeoman/yeoman.github.io/app/codelab/local-storage.md
The Past, Present & Future of Local Storage for Web Applications
yeoman.io/generator/Storage.html
yeoman/generator releases
yeoman/generator
AWS Free Tier
AWS Amazon Web Services
What is Amazon EC2
AWS Quick Start Reference Deployments
yeoman/yeoman.github.io/codelab/index.md : 1 hour tutorial
Yeoman Home Page
Yeoman Setup
AWS micro instance
Modernizer
Heroku Node.js Support
Heroku Node.js Getting Started
JavaScript Variables w3schools.com
CSS/JS Modal
heroku/node-js-example
Heroku 10 Habits of a Happy Node Hacker
creationix/nvm/nvm.sh

my new favorite commands :
cd heroku-node-starter/
heroku local web
heroku open --app stellarworks

Getting Started with Node.js on Heroku : unfinished by me
Building Transactions : JS Stellar Base
List of Operations
List of Operations : create account
Basic Examples : js-stellar-sdk
Stellar Laboratory Endpoint Explorer : connecting to https://horizon-testnet.stellar.org
Stellar Laboratory Transaction Builder : connecting to https://horizon-testnet.stellar.org
Stellar Laboratory Transaction Signer : connecting to https://horizon-testnet.stellar.org
Promise
Promise-Based Coroutines in Node.js
gulp.js automates your tasks
gulp-sass
Best Practices for Node.js Development
npm css tricks
color-hex
Stellar Consensus Protocol: Proof and Code
Node.js v5.6.0 Documentation
CSS Links w3schools
kathyonu/Rails-app-steps-to-establish-ruby-stellar-sdk.md
kathyonu/Rails-applications-health-codes.md
npm-config
Meet Yeoman
yeoman.github.io/app/codelab/keep-going.md
The Past, Present & Future of Local Storage for Web Applications
Unit Testing Best Practices in AngularJS
Write Unit Tests

"Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides resizable compute capacity in the cloud. It is designed to make web-scale cloud computing easier for developers."

[Hardware Requirements]

"The hardware requirements scale with the amount of activity in the network.
Currently stellar-core requires very modest hardware.
It would be fine to run on an AWS micro instance, for example."

Amazon Elastic Compute Cloud (Amazon EC2) provides scalable computing capacity in the
Amazon Web Services (AWS) cloud. Using Amazon EC2 eliminates your need to invest in
hardware up front, so you can develop and deploy applications faster.

QUESTION: What is an AWS micro instance ? Answer : Amazon Web Services

End of What Is Amazon EC2?

Overview

Good Works On Earth is building an interface to Stellar.org 's platform. We have
completed the installation of Node.js and its tools with
Rails-app-steps-to-establish-ruby-stellar-sdk.md. Sadly, this is misnamed on two accounts,
it has nothing to do with Rails, and we cannot yet work with the ruby-stellar-sdk.
It is nowhere near complete. As a result, that reference is entirely how to install
Node.js and friends to the point of being able to generate our first app.

We have used the following tools to arrive here,, able to generate Node.js applications:
Homebrew to install Homebrew-Cask and Node.js aka node
node to install npm
npm to install Yeoman's yo and gulp and the generator-webapp We are ready to develop, and while we do so, these definitions will come in handy.

Definitions

Stellar is a decentralized, federated peer-to-peer network that allows people to
send payments in any asset anywhere in the world instantaneously, and with minimal fee.

Stellar-core is the core component of this network. Stellar-core is a C++ implementation
of the Stellar Consensus Protocol configured to construct a chain of ledgers that are
guaranteed to be in agreement across all the participating nodes at all times.

STELLARS : A stellar, also referred to as STR ..
"is the native currency of the Stellar network.
Every transaction requires a very small amount of STR. This is a DOS protection mechanism.
STR is the only currency in the system that doesn’t have a counterparty.
This means you can send stellars to any account."

LUMENS TODO: 20160223 add definition from stellar materials with source link

End of Definitions for now.

TODO: 20160223 BEGIN

End of Stellar : Getting Started

Do not run commands indented like this.
There will be more information below them.

Install

To use as a module in a Node.js project

  1. Install it using npm:

npm install --save stellar-sdk

  1. require/import it in your JavaScript:

var StellarSdk = require('stellar-sdk');

Our app now has access to the tools of js-stellar-sdk and through this, the stellar-base.

Because we are hosting on Heroku, we are going to change the above command a bit,
and then we will see we need to adjust this code one step further. I already ran
the command, so I will show you the results, and then the change I made. Do not run
commands when indented like this:

This : npm install --save stellar-sdk : becomes this:

npm install --save --save-exact stellar-sdk

The result of running the code, which shows two npm WARN messages:


Last login: Mon Feb 22 13:54:44 on ttys018
will-i-am:~ William$ cd yo-stellar/
will-i-am:yo-stellar William$ npm install --save --save-exact stellar-sdk
npm WARN deprecated URIjs@1.16.1: package renamed to "urijs" (lower-case), please update accordingly
npm WARN prefer global marked@0.3.5 should be installed with -g

> ed25519@0.0.4 install /Users/William/yo-stellar/node_modules/stellar-base/node_modules/ed25519
> node-gyp rebuild

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

  CC(target) Release/obj.target/ed25519/src/ed25519/keypair.o
  CC(target) Release/obj.target/ed25519/src/ed25519/sign.o
  CC(target) Release/obj.target/ed25519/src/ed25519/open.o
  CC(target) Release/obj.target/ed25519/src/ed25519/crypto_verify_32.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_double_scalarmult.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_frombytes.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_scalarmult_base.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_precomp_0.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p2_0.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p2_dbl.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p3_0.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p3_dbl.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p3_to_p2.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p3_to_cached.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p3_tobytes.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_madd.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_add.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_msub.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_sub.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p1p1_to_p3.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p1p1_to_p2.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_tobytes.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_0.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_1.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_cmov.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_copy.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_neg.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_add.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_sub.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_mul.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_sq.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_sq2.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_invert.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_tobytes.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_isnegative.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_isnonzero.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_frombytes.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_pow22523.o
  CC(target) Release/obj.target/ed25519/src/ed25519/sc_reduce.o
  CC(target) Release/obj.target/ed25519/src/ed25519/sc_muladd.o
  CXX(target) Release/obj.target/ed25519/src/ed25519.o
  SOLINK_MODULE(target) Release/ed25519.node
/Users/William/yo-stellar
├─┬ babel-core@6.5.2
│ └── lodash@3.10.1 
├─┬ browser-sync@2.11.1
│ ├─┬ chokidar@1.4.1
│ │ ├─┬ fsevents@1.0.7
│ │ │ └─┬ node-pre-gyp@0.6.19
│ │ │   ├─┬ rimraf@2.5.0
│ │ │   │ └─┬ glob@6.0.3
│ │ │   │   └── inherits@2.0.1 
│ │ │   ├─┬ tar@2.2.1
│ │ │   │ └── inherits@2.0.1 
│ │ │   └─┬ tar-pack@3.1.2
│ │ │     └─┬ rimraf@2.4.5
│ │ │       └─┬ glob@6.0.3
│ │ │         └── inherits@2.0.1 
│ │ └── inherits@2.0.1 
│ ├─┬ serve-static@1.10.2
│ │ └─┬ send@0.13.1
│ │   └── mime@1.3.4 
│ └─┬ socket.io@1.3.7
│   └─┬ engine.io@1.5.4
│     └─┬ ws@0.8.0
│       └─┬ bufferutil@1.2.1
│         └── bindings@1.2.1 
├─┬ gulp@3.9.1
│ └─┬ orchestrator@0.3.7
│   └── sequencify@0.0.7 
├─┬ gulp-eslint@0.13.2
│ └─┬ eslint@0.22.1
│   └── espree@2.2.5 
├─┬ gulp-sass@2.2.0
│ └─┬ node-sass@3.4.2
│   └── nan@2.2.0 
└─┬ stellar-sdk@0.4.1 
  ├── axios@0.7.0 
  ├── bluebird@2.10.2 
  ├── es6-promise@3.1.2 
  ├── event-source-polyfill@0.0.6 
  ├─┬ eventsource@0.1.6 
  │ └─┬ original@1.0.0 
  │   └─┬ url-parse@1.0.5 
  │     └── querystringify@0.0.3 
  ├─┬ jsdoc@3.5.0-dev  (git://github.com/jsdoc3/jsdoc.git#3dbb94f157290e8a0cbc79cb3580130e8e2c4534)
  │ ├── async@1.4.2 
  │ ├── bluebird@2.9.34 
  │ ├─┬ catharsis@0.8.7 
  │ │ └─┬ underscore-contrib@0.3.0 
  │ │   └── underscore@1.6.0 
  │ ├── espree@2.2.5 
  │ ├── js2xmlparser@1.0.0 
  │ ├── marked@0.3.5 
  │ ├─┬ requizzle@0.2.1 
  │ │ └── underscore@1.6.0 
  │ ├── taffydb@2.6.2 
  │ ├── underscore@1.8.3 
  │ └── wrench@1.5.8 
  ├─┬ stellar-base@0.5.3 
  │ ├── base32.js@0.1.0 
  │ ├── bignumber.js@2.1.4 
  │ ├── crc@3.4.0 
  │ ├─┬ ed25519@0.0.4 
  │ │ ├── bindings@1.2.1 
  │ │ └── nan@2.2.0 
  │ ├─┬ js-xdr@0.0.12 
  │ │ ├─┬ babel-runtime@4.7.16 
  │ │ │ └── core-js@0.6.1 
  │ │ ├── cursor@0.1.5 
  │ │ ├── lodash@3.10.1 
  │ │ ├── long@2.4.0 
  │ │ └── sequencify@0.0.7 
  │ ├── lodash@4.0.1 
  │ ├─┬ sha.js@2.4.4 
  │ │ └── inherits@2.0.1 
  │ └── tweetnacl@0.13.3 
  ├─┬ superagent@1.7.2 
  │ ├── component-emitter@1.2.0 
  │ ├── cookiejar@2.0.6 
  │ ├─┬ form-data@0.2.0 
  │ │ ├── async@0.9.2 
  │ │ ├─┬ combined-stream@0.0.7 
  │ │ │ └── delayed-stream@0.0.5 
  │ │ └─┬ mime-types@2.0.14 
  │ │   └── mime-db@1.12.0 
  │ ├── methods@1.1.2 
  │ ├── mime@1.3.4 
  │ ├── qs@2.3.3 
  │ ├── readable-stream@1.0.27-1 
  │ └── reduce-component@1.0.1 
  ├── toml@2.3.0 
  └── URIjs@1.16.1 

will-i-am:yo-stellar William$

End of results from : npm install --save --save-exact stellar-sdk

We want to address these two:


npm WARN deprecated URIjs@1.16.1: package renamed to "urijs" (lower-case), please update accordingly
npm WARN prefer global marked@0.3.5 should be installed with -g

The first WARN, I do not know how to fix or if it is my place to fix it.
The package showing out of date with old name is part of this package:

└─┬ stellar-sdk@0.4.1

└── URIjs@1.16.1

TODO: 20160223 : find the fix to this, if it is something needing to be fixed

The second WARN ..
I agree, we should have used the -g switch .. the --global switch.
Because we are in our project directory, the use of the -g switch
means the stellar-sdk will install into both the global and the project.
So, to make matters right, I will uninstall, then install properly. Before
I do, I want to see where the stellar-sdk is stored, so I can verify it is
uninstalled.

cd ~/node_modules

ls

I see two entries for stellar:

stellar-base
stellar-sdk

I run these two commands, the first to undo exactly, the install,
and the second command will install properly:

cd ~/

npm uninstall --save --save-exact stellar-sdk

Now I very stellar is gone:

ls

Stellar is no more, both packages are gone.

Now I install properly ..

cd ~/

npm install --global --save --save-exact stellar-sdk


will-i-am:~ William$ npm install --global --save --save-exact stellar-sdk
/Users/William/.nvm/versions/node/v5.6.0/lib
└─┬ stellar-sdk@0.4.2 
  └── jsdoc@3.5.0-dev  (git://github.com/jsdoc3/jsdoc.git#3dbb94f157290e8a0cbc79cb3580130e8e2c4534)

will-i-am:~ William$ cd /Users/William/.nvm/versions/node/v5.6.0/lib
will-i-am:lib William$ ls
dtrace    node_modules

will-i-am:lib William$ cd node_modules/
will-i-am:node_modules William$ ls
generator-webapp  gulp-cli    stellar-sdk
grunt     npm     yo
grunt-cli   observatory

will-i-am:node_modules William$ 

Now I install in my Project:

cd ~/

cd yo-stellar

npm install --save --save-exact stellar-sdk


will-i-am:yo-stellar William$ npm install --save --save-exact stellar-sdk
npm WARN prefer global marked@0.3.5 should be installed with -g

> ed25519@0.0.4 install /Users/William/yo-stellar/node_modules/stellar-base/node_modules/ed25519
> node-gyp rebuild

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

  CC(target) Release/obj.target/ed25519/src/ed25519/keypair.o
  CC(target) Release/obj.target/ed25519/src/ed25519/sign.o
  CC(target) Release/obj.target/ed25519/src/ed25519/open.o
  CC(target) Release/obj.target/ed25519/src/ed25519/crypto_verify_32.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_double_scalarmult.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_frombytes.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_scalarmult_base.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_precomp_0.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p2_0.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p2_dbl.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p3_0.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p3_dbl.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p3_to_p2.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p3_to_cached.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p3_tobytes.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_madd.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_add.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_msub.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_sub.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p1p1_to_p3.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p1p1_to_p2.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_tobytes.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_0.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_1.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_cmov.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_copy.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_neg.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_add.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_sub.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_mul.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_sq.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_sq2.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_invert.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_tobytes.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_isnegative.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_isnonzero.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_frombytes.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_pow22523.o
  CC(target) Release/obj.target/ed25519/src/ed25519/sc_reduce.o
  CC(target) Release/obj.target/ed25519/src/ed25519/sc_muladd.o
  CXX(target) Release/obj.target/ed25519/src/ed25519.o
  SOLINK_MODULE(target) Release/ed25519.node
/Users/William/yo-stellar
├─┬ babel-core@6.5.2
│ └── lodash@3.10.1 
├─┬ browser-sync@2.11.1
│ ├─┬ chokidar@1.4.1
│ │ ├─┬ fsevents@1.0.7
│ │ │ └─┬ node-pre-gyp@0.6.19
│ │ │   ├─┬ rimraf@2.5.0
│ │ │   │ └─┬ glob@6.0.3
│ │ │   │   └── inherits@2.0.1 
│ │ │   ├─┬ tar@2.2.1
│ │ │   │ └── inherits@2.0.1 
│ │ │   └─┬ tar-pack@3.1.2
│ │ │     └─┬ rimraf@2.4.5
│ │ │       └─┬ glob@6.0.3
│ │ │         └── inherits@2.0.1 
│ │ └── inherits@2.0.1 
│ ├─┬ serve-static@1.10.2
│ │ └─┬ send@0.13.1
│ │   └── mime@1.3.4 
│ └─┬ socket.io@1.3.7
│   └─┬ engine.io@1.5.4
│     └─┬ ws@0.8.0
│       └─┬ bufferutil@1.2.1
│         └── bindings@1.2.1 
├─┬ gulp@3.9.1
│ └─┬ orchestrator@0.3.7
│   └── sequencify@0.0.7 
├─┬ gulp-eslint@0.13.2
│ └─┬ eslint@0.22.1
│   └── espree@2.2.5 
├─┬ gulp-sass@2.2.0
│ └─┬ node-sass@3.4.2
│   └── nan@2.2.0 
└─┬ stellar-sdk@0.4.2 
  ├─┬ axios@0.9.1 
  │ └── follow-redirects@0.0.7 
  ├── es6-promise@3.1.2 
  ├── event-source-polyfill@0.0.7 
  ├─┬ eventsource@0.1.6 
  │ └─┬ original@1.0.0 
  │   └─┬ url-parse@1.0.5 
  │     └── querystringify@0.0.3 
  ├─┬ jsdoc@3.5.0-dev  (git://github.com/jsdoc3/jsdoc.git#3dbb94f157290e8a0cbc79cb3580130e8e2c4534)
  │ ├── async@1.4.2 
  │ ├── bluebird@2.9.34 
  │ ├─┬ catharsis@0.8.7 
  │ │ └─┬ underscore-contrib@0.3.0 
  │ │   └── underscore@1.6.0 
  │ ├── espree@2.2.5 
  │ ├── js2xmlparser@1.0.0 
  │ ├── marked@0.3.5 
  │ ├─┬ requizzle@0.2.1 
  │ │ └── underscore@1.6.0 
  │ ├── taffydb@2.6.2 
  │ ├── underscore@1.8.3 
  │ └── wrench@1.5.8 
  ├── lodash@4.5.1 
  ├─┬ stellar-base@0.5.4 
  │ ├── base32.js@0.1.0 
  │ ├── bignumber.js@2.1.4 
  │ ├── crc@3.4.0 
  │ ├─┬ ed25519@0.0.4 
  │ │ ├── bindings@1.2.1 
  │ │ └── nan@2.2.0 
  │ ├─┬ js-xdr@0.0.12 
  │ │ ├─┬ babel-runtime@4.7.16 
  │ │ │ └── core-js@0.6.1 
  │ │ ├── cursor@0.1.5 
  │ │ ├── lodash@3.10.1 
  │ │ ├── long@2.4.0 
  │ │ └── sequencify@0.0.7 
  │ ├── lodash@4.0.1 
  │ ├─┬ sha.js@2.4.4 
  │ │ └── inherits@2.0.1 
  │ └── tweetnacl@0.13.3 
  ├─┬ superagent@1.7.2 
  │ ├── component-emitter@1.2.0 
  │ ├── cookiejar@2.0.6 
  │ ├─┬ form-data@0.2.0 
  │ │ ├── async@0.9.2 
  │ │ ├─┬ combined-stream@0.0.7 
  │ │ │ └── delayed-stream@0.0.5 
  │ │ └─┬ mime-types@2.0.14 
  │ │   └── mime-db@1.12.0 
  │ ├── methods@1.1.2 
  │ ├── mime@1.3.4 
  │ ├── qs@2.3.3 
  │ ├── readable-stream@1.0.27-1 
  │ └── reduce-component@1.0.1 
  ├── toml@2.3.0 
  └── urijs@1.17.0 

will-i-am:yo-stellar William$ 

First thing I notice is the last item is now correct, in small letters.

Second thing is we do not have the two npm WARN notices, we have only one.

End of the results from the npm install --save --save-exact stellar-sdk command.

We have one npm WARN:

npm WARN prefer global marked@0.3.5 should be installed with -g

So, I shall do what it asks, from my Project directory:

pwd


will-i-am:yo-stellar William$ pwd
/Users/William/yo-stellar


will-i-am:yo-stellar William$ 
`npm install -g marked@0.3.5`

will-i-am:yo-stellar William$ npm install -g marked@0.3.5
/Users/William/.nvm/versions/node/v5.6.0/bin/marked -> /Users/William/.nvm/versions/node/v5.6.0/lib/node_modules/marked/bin/marked
/Users/William/.nvm/versions/node/v5.6.0/lib
└── marked@0.3.5 

Now I check to make sure the stellar-sdk installed properly:

cd node_modules

ls

Sure enough, there they are again:

stellar-base
stellar-sdk

Done Deal, now what ?
Well, I think we have finally arrived at the point
where we can indeed access the stellar-sdk in a script.

Stellar Developer's js-stellar-sdk page, the Install section.

We can require/import it in our JavaScript:

var StellarSdk = require('stellar-sdk');

Our Javascript is in our app/scripts/main.js file.
However, I choose to add this variable and script to one page, so far.
I open our text editor to open this file and add the above line, combined with the
Stellar Query to Horizon code.

I enter this in app/tellurians-exchange.js


<script>
  var StellarSdk = require('stellar-sdk');
  var server = new StellarSdk.Server('https://horizon-testnet.stellar.org');
  // get a list of transactions that occurred in ledger 1400
  server.transactions()
    .forLedger(1400)
    .call().then(function(r){ console.log(r); });

  // get a list of transactions submitted by a particular account
  server.transactions()
    .forAccount('GASOCNHNNLYFNMDJYQ3XFMI7BYHIOCFW3GJEOWRPEGK2TDPGTG2E5EDW')
    .call().then(function(r){ console.log(r); });
</script>

I am certain I am have not set our secret.Key yet, and
I am certain I need to generate new keys.

TODO:
QUESTION: 20160222 : How do I set the Stellar secret.Key, again ? in node development ?
Answer : 20160223 : js-stellar-lib

QUESTION: 20160224 : Where do I generate new keys at Stellar ?
Answer : 2016022? :

Here, it becomes important to understand the terms:
accounts : Accounts are the central data structure in Stellar.

Accounts are identified by a public key and saved in the ledger.
Everything else in the ledger, such as offers or trustlines,
are owned by a particular account.

transactions : If you think of the ledger as a database,
then transactions are SQL commands.

ledger
source account
fee
sequence number
TransactionBuilder
operation.js : See operation.js for a list of possible operations you can add.
toll collector : charge small amounts for using your service
toll address : your app can publish its Stellar toll address for payments.

Stellar : run a node
TODO: 201602231334pst : per Stellar, the above link is out of date, removing.
Answer: 20160223 : far better link to find Stellar material https://www.stellar.org/developers/

Stellar : build an app

Streaming

"Certain endpoints in Horizon can be called in streaming mode using Server-Sent Events.
This mode will keep the connection to horizon open and horizon will continue to return
responses as ledgers close. All parameters for the endpoints that allow this mode are
the same. The way a caller initiates this mode is by setting Accept: text/event-stream
in the HTTP header when you make the request. You can read an example of using the
streaming mode in the Follow Received Payments tutorial."

var StellarSdk = require('stellar-sdk');

The source account is the account we will be signing and sending from.
All keys are examples from the Stellar site.

var sourceSecretKey = 'SAKRB7EE6H23EF733WFU76RPIYOPEWVOMBBUXDQYQ3OF4NF6ZY6B6VLW';

Derive Keypair object and public key (that starts with a G) from the secret

var sourceKeypair = StellarSdk.Keypair.fromSeed(sourceSecretKey);
var sourcePublicKey = sourceKeypair.accountId();

var receiverPublicKey = 'GAIRISXKPLOWZBMFRPU5XRGUUX3VMA3ZEWKBM5MSNRU3CHV6P4PYZ74D';

Configure StellarSdk to talk to the horizon instance hosted by Stellar.org
To use the live network, set the hostname to 'horizon.stellar.org'. For now,
we are working to contact testnet.

var server = new StellarSdk.Server('https://horizon-testnet.stellar.org');

.gitignore

Enter the following into your .gitignore file:

Do not make a first commit without first ensuring your .gitignore file is set.

.gitignore manual
Best .gitignore files resource
Global OSX.gitignore
GitBook.gitignore
gulp-gitignore : gulp-gitignore package : Exlude files defined on .gitignore from the stream Heroku's Getting Started with Node.js
Heroku's Best Practices for Node.js Development
Node.gitignore
Rails.gitignore
Ruby.gitignore
Sass.gitignore
Yeoman.gitignore
WordPress.gitignore : an example we won't be using

We are going to keep this next one as the last .gitignore file to enter,
and the reason is, this one adds two items, both of which may be already
included in the above additions.

# Grunt ignore created by https://www.gitignore.io/api/grunt
# Grunt usually compiles files inside this directory : dist/

# Grunt usually preprocesses files such as coffeescript, compass ..  
inside the `.tmp/` directory.

End of .gitignore

#####.slugignore

Enter the following in your .slugignore file:


*.psd  
*.pdf  
/test  
/spec

Download the Sample Project

git clone https://github.com/awslabs/aws-nodejs-sample.git

Install the SDK and Dependencies

From the aws-nodejs-sample directory, run:

npm install

Configure the Access Keys

Create your credentials file at ~/.aws/credentials (C:\Users\USER_NAME.aws\credentials for Windows users)
and save the following lines after replacing the underlined values with your own.

[default]

aws_access_key_id = YOUR_ACCESS_KEY_ID

aws_secret_access_key = YOUR_SECRET_ACCESS_KEY

Run the Sample

node sample.js

About the Sample

This sample application is designed to show you how to:

Declare a dependency on the AWS SDK for JavaScript in Node.js.
Read access keys from environment variables.
Instantiate an Amazon Simple Storage Service (Amazon S3) client.
Interact with Amazon S3 in various ways, such as creating a bucket and uploading a file.

The project's README file contains more information about this sample code.
If you have trouble getting set up or have other feedback about this sample, let us know on GitHub.
Additional Resources

For in-depth user guides, API documentation, developer forums, and other developer resources,
see the AWS SDK for JavaScript in Node.js page.
end of file reference : Getting Started with the AWS SDK for JavaScript in Node.js

Next step ?

Also, I noticed an oddity in the js-stellar-sdk page, under Quick Start.
The note says: "Using npm to include js-stellar-sdk in your own project:"
The command says: npm install --save stellar-sdk
Query : 20160206 : Where is the stellar/stellar-sdk repository ?
Answer : Verified the above is the command to run.
: Reference for npm install --save stellar-sdk.
: "stellar-sdk" is a library for working with the Stellar Horizon server
: At the above link, read the js-stellar-sdk vs js-stellar-base info.
: stellar-sdk is installed by npm
: js-stellar-sdk is installed by Bower.
: horizon 15
: js-stellar-sdk 6
: stellar-core 69
: ruby-stellar-sdk 1
: stellar-ruby-base 3
: stellar-wallet 24
: stellar-wallet-js-sdk 2
: interstellar 5
: interstellar-network 0
: interstellar-sessions 1
: interstellar-wallet 1
: stellar tutorials 0
: federation server 3
: horizon 15
: gateway-server 2
: bower-js-stellar-sdk 0
: java-stellar-sdk we will not be using this 1
: metalsmith 364
: docs 42
: stories 2
: Philosopnical note on the above:
:: In all the world, 69 developers have forked stellar-core
:: 15 developers have forked the horizon
:: 6 developers have forked js-stellar-sdk
:: 24 have forked the stellar-wallet-js-sdk
:: 2 have forked the stellar-wallet-js-sdk
:: 5 have forked insterstellar
:: 3 forked the federation serve
:: 364 forked metalsmith
:: From this, I can say Stellar is a young platform ..
:: with incomplete developer tools, and
:: What the heck is metalsmith !

Before we install stellar sdk we want to create our ~/package.json file.
Terminal will tell you so when you run the command without one.

Open a new Terminal if need be:
Run:

cd ~/
touch package.json
open -e package.json

Insert the contents of the https://github.com/creationix/nvm/blob/master/package.json
file in the new ~/package.json file.

stellar-sdk is installed by npm:

npm install --save stellar-sdk

You can see the results of this command being run in the Installation Commands with Results.

Our system is now ready to build a js-stellar-sdk project.
How shall we begin ? Where do we begin ?
See Building a Project

The above concludes the brew cask node nvm npm yo gulp workspace.

Stellar Data Flow reference

Define: XDR : External Data Representation

Define: SQL: : Structured Data Langauge

End of stellar-sdk section.

ruby-stellar-sdk

The scope of this Gist has been accomplished. The stellar-sdk and
the ruby-stellar-sdk material will become another Gist.

End of Ruby on Rails and ruby-stellar-sdk notes.

All of this building of nvm and friends, is so we can use the Stellar platform.
continuing along that thought .. I seriously doubt we can mix the use of both
the ruby-stellar-sdk and Node.js. We are not working in a Rails app, we
are working in a Node.js app.

THE STELLAR SDK's
I am going to take a few sentences from the Stellar Developers page, and translate them for Ruby.

"The JavaScript Stellar SDK facilitates client integration with the Stellar Horizon API server .."
"The Ruby Stellar SDK facilitates client integration with the Stellar Horizon API server .."

Building and installing js-stellar-sdk
Building and installing ruby-stellar-sdk

Note from Stellar: "Stellar.org only maintains the JavaScript SDK. We are looking for
maintainers for other languages. For example, a few Stellar community members are
building a Python library. Contributions are welcome."

Because we are working to build the ruby-stellar-sdk
for our use, it seems we are on our own !

Examples of using js-stellar-sdk
Examples of using ruby-stellar-sdk

"js-stellar-sdk gives you access to all the endpoints exposed by Horizon."
"ruby-stellar-sdk gives you access to all the endpoints exposed by Horizon."

"js-stellar-sdk uses the Builder pattern to create the requests to send to Horizon."
"ruby-stellar-sdk uses the Builder pattern to create the requests to send to Horizon."
See the Horizon Reference Overview

"Tests are also run on the Travis CI js-stellar-base project automatically."
"Tests are also run on the Travis CI ruby-stellar-base project automatically." ??

Where are we ?
We have to arrive at the point where we can access the https://horizon-testnet.stellar.org/ server.
Reference is stellar/horizon docs.

Still keeping our eye on the ruby-stellar-sdk goal, I noticed this sentence:
"You can interact directly with horizon via curl or a web browser but SDF provides
a JavaScript SDK for clients to use to interact with Horizon." I change the ending to:
a Ruby SDK for clients to use to interact with Horizon.
It seems to me, we can use the JavaScript SDK as a model to create the Ruby SDK.

Connecting with the Server
The server object handles a network connection to a Horizon server.
The server object provides methods that makes requests to that Horizon server easy.
It is important to note that server methods query Horizon endpoints.

CallBuilder [JS Stellar SDK]

CallBuilder is a class that allows specificity and flexibility when querying the
Horizon server. By using the Builder Pattern, CallBuilder provides methods that can be
chained together to generate a query. The reference shows five server.methods are
available: limit, cursor, order, call, stream. We will cover all of these,
but for now, I focus on call and stream.

call()

Triggers a HTTP Request to the Horizon server based on the builder's
current configuration. Returns a Promise that resolves to the server's response.
The **Promise **object is used for deferred and asynchronous computations.
A Promise represents an operation that hasn't completed yet, but is expected in the future.
A Promise is in one of these states:

  1. pending: initial state, not fulfilled or rejected.
  2. fulfilled: meaning that the operation completed successfully.
  3. rejected: meaning that the operation failed.

The Promise has Properties and Methods, please see Promise.

stream({options})

Creates an EventSource that listens for incoming messages
from the server. URL based on builder's current configuration.

stream({options})

Has a Param Type of object of properties.
Please see the stream properties information.
You will see there are five properties associated with EventSource

A quick look at EventSource:

The EventSource interface is used to receive server-sent events.
It connects to a server over HTTP and receives events in text/event-stream
format without closing the connection.

Properties
This interface also inherits properties from its parent, EventTarget.

EventSource.onerror

Is an EventHandler being called when an error occurs
and the error event is dispatched on this object.

EventSource.onmessage

Is an EventHandler being called when a message event is received,
that is when a message is coming from the source.

EventSource.onopen

Is an EventHandler being called when an open event is received,
that is when the connection was just opened.

EventSource.readyState : Read only

An unsigned short representing the state of the connection.
Possible values are CONNECTING (0), OPEN (1), or CLOSED (2).

EventSource.url : Read only

A DOMString representing the URL of the source.

Methods
"This interface also inherits properties from its parent, EventTarget."

EventSource.close()

Closes the connection, if any, and sets the readyState attribute to CLOSED.
If the connection is already closed, the method does nothing.

A quick look at EventTarget:

EventTarget is an interface implemented by objects that can receive events and
may have listeners for them.

Methods

EventTarget.addEventListener()
Register an event handler of a specific event type on the EventTarget.

EventTarget.removeEventListener()
Removes an event listener from the EventTarget.

EventTarget.dispatchEvent()
Dispatch an event to this EventTarget.

There is more to kmow about the EventTarget, please read the source link.

TODO: 20160225 : this goes in after Yo and Gulp are installed : 'stellar-sdk is installed by npm'
Now we use npm to install others:

npm install --save stellar-sdk


  will-i-am:~ William$ npm install --save stellar-sdk
npm WARN deprecated URIjs@1.16.1: package renamed to "urijs" (lower-case), please update accordingly

> ed25519@0.0.4 install /Users/William/node_modules/stellar-base/node_modules/ed25519
> node-gyp rebuild

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

  CC(target) Release/obj.target/ed25519/src/ed25519/keypair.o
  CC(target) Release/obj.target/ed25519/src/ed25519/sign.o
  CC(target) Release/obj.target/ed25519/src/ed25519/open.o
  CC(target) Release/obj.target/ed25519/src/ed25519/crypto_verify_32.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_double_scalarmult.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_frombytes.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_scalarmult_base.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_precomp_0.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p2_0.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p2_dbl.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p3_0.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p3_dbl.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p3_to_p2.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p3_to_cached.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p3_tobytes.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_madd.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_add.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_msub.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_sub.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p1p1_to_p3.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p1p1_to_p2.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_tobytes.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_0.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_1.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_cmov.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_copy.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_neg.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_add.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_sub.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_mul.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_sq.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_sq2.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_invert.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_tobytes.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_isnegative.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_isnonzero.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_frombytes.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_pow22523.o
  CC(target) Release/obj.target/ed25519/src/ed25519/sc_reduce.o
  CC(target) Release/obj.target/ed25519/src/ed25519/sc_muladd.o
  CXX(target) Release/obj.target/ed25519/src/ed25519.o
  SOLINK_MODULE(target) Release/ed25519.node
npm WARN saveError ENOENT: no such file or directory, open '/Users/William/package.json'
/Users/William
└─┬ stellar-sdk@0.4.1 
  ├── axios@0.7.0 
  ├── bluebird@2.10.2 
  ├── es6-promise@3.0.2 
  ├── event-source-polyfill@0.0.6 
  ├─┬ eventsource@0.1.6 
  │ └─┬ original@1.0.0 
  │   └─┬ url-parse@1.0.5 
  │     ├── querystringify@0.0.3 
  │     └── requires-port@1.0.0 
  ├─┬ jsdoc@3.5.0-dev  (git://github.com/jsdoc3/jsdoc.git#3dbb94f157290e8a0cbc79cb3580130e8e2c4534)
  │ ├── async@1.4.2 
  │ ├── bluebird@2.9.34 
  │ ├─┬ catharsis@0.8.7 
  │ │ └─┬ underscore-contrib@0.3.0 
  │ │   └── underscore@1.6.0 
  │ ├── escape-string-regexp@1.0.4 
  │ ├── espree@2.2.5 
  │ ├── js2xmlparser@1.0.0 
  │ ├── marked@0.3.5 
  │ ├─┬ requizzle@0.2.1 
  │ │ └── underscore@1.6.0 
  │ ├── strip-json-comments@1.0.4 
  │ ├── taffydb@2.6.2 
  │ ├── underscore@1.8.3 
  │ └── wrench@1.5.8 
  ├── lodash@3.10.1 
  ├─┬ stellar-base@0.5.1 
  │ ├─┬ babel-runtime@5.8.24 
  │ │ └── core-js@1.1.4 
  │ ├── base32.js@0.1.0 
  │ ├── bignumber.js@2.0.7 
  │ ├── crc@3.3.0 
  │ ├─┬ ed25519@0.0.4 
  │ │ ├── bindings@1.2.1 
  │ │ └── nan@2.0.9 
  │ ├─┬ js-xdr@0.0.12 
  │ │ ├─┬ babel-runtime@4.7.16 
  │ │ │ └── core-js@0.6.1 
  │ │ ├── cursor@0.1.5 
  │ │ ├── long@2.4.0 
  │ │ └── sequencify@0.0.7 
  │ ├── lodash@3.10.1 
  │ ├─┬ sha.js@2.4.4 
  │ │ └── inherits@2.0.1 
  │ └── tweetnacl@0.13.2 
  ├─┬ superagent@1.7.2 
  │ ├── component-emitter@1.2.0 
  │ ├── cookiejar@2.0.6 
  │ ├─┬ debug@2.2.0 
  │ │ └── ms@0.7.1 
  │ ├── extend@3.0.0 
  │ ├─┬ form-data@0.2.0 
  │ │ ├── async@0.9.2 
  │ │ ├─┬ combined-stream@0.0.7 
  │ │ │ └── delayed-stream@0.0.5 
  │ │ └─┬ mime-types@2.0.14 
  │ │   └── mime-db@1.12.0 
  │ ├── formidable@1.0.17 
  │ ├── methods@1.1.2 
  │ ├── mime@1.3.4 
  │ ├── qs@2.3.3 
  │ ├─┬ readable-stream@1.0.27-1 
  │ │ ├── core-util-is@1.0.2 
  │ │ ├── inherits@2.0.1 
  │ │ ├── isarray@0.0.1 
  │ │ └── string_decoder@0.10.31 
  │ └── reduce-component@1.0.1 
  ├── toml@2.3.0 
  └── URIjs@1.16.1 

npm WARN enoent ENOENT: no such file or directory, open '/Users/William/package.json'
npm WARN William No description
npm WARN William No repository field.
npm WARN William No README data
npm WARN William No license field.
will-i-am:~ William$

What command caused the above results ?
npm install --save stellar-sdk

The fact that this shows as missing, is important:
/Users/William/package.json

This command solves the problem: npm install -g mime --save
Reference for the command is Installing NPM packages conflicting with Node.js 5.0.0.
Run:
npm install -g mime --save

TODO: what is the mime that is being installed and saved ?
Answer : npm home mime will inform you : "A super simple utility library for dealing with mime-types"
Bonus : npm run test we run the above and see that npm will now test our system


will-i-am:~ William$ npm install -g mime --save
/usr/local/Cellar/nvm/HEAD/versions/node/v5.5.0/bin/mime -> /usr/local/Cellar/nvm/HEAD/versions/node/v5.5.0/lib/node_modules/mime/cli.js
/usr/local/Cellar/nvm/HEAD/versions/node/v5.5.0/lib
└── mime@1.3.4 

will-i-am:~ William$ 

That did not solve the problem, we have to create a ~/package.json file.
We can find the nvm/package.json template here:
https://github.com/creationix/nvm/blob/master/package.json

Run:
touch package.json
open -e package.json
Insert the contents of the https://github.com/creationix/nvm/blob/master/package.json file in the new ~/package.json file.

Uninstall and reinstall stellar-sdk:
npm uninstall stellar-sdk


will-i-am:~ William$ npm uninstall stellar-sdk
- stellar-sdk@0.4.1 node_modules/stellar-sdk
- async@1.4.2 node_modules/async
- axios@0.7.0 node_modules/axios
- bluebird@2.10.2 node_modules/bluebird
- catharsis@0.8.7 node_modules/catharsis
- combined-stream@0.0.7 node_modules/combined-stream
- component-emitter@1.2.0 node_modules/component-emitter
- cookiejar@2.0.6 node_modules/cookiejar
- core-util-is@1.0.2 node_modules/core-util-is
- debug@2.2.0 node_modules/debug
- delayed-stream@0.0.5 node_modules/delayed-stream
- es6-promise@3.0.2 node_modules/es6-promise
- escape-string-regexp@1.0.4 node_modules/escape-string-regexp
- espree@2.2.5 node_modules/espree
- event-source-polyfill@0.0.6 node_modules/event-source-polyfill
- eventsource@0.1.6 node_modules/eventsource
- extend@3.0.0 node_modules/extend
- form-data@0.2.0 node_modules/form-data
- async@0.9.2 node_modules/form-data/node_modules/async
- formidable@1.0.17 node_modules/formidable
- inherits@2.0.1 node_modules/inherits
- isarray@0.0.1 node_modules/isarray
- js2xmlparser@1.0.0 node_modules/js2xmlparser
- jsdoc@3.5.0-dev node_modules/jsdoc
- bluebird@2.9.34 node_modules/jsdoc/node_modules/bluebird
- lodash@3.10.1 node_modules/lodash
- marked@0.3.5 node_modules/marked
- methods@1.1.2 node_modules/methods
- mime@1.3.4 node_modules/mime
- mime-db@1.12.0 node_modules/mime-db
- mime-types@2.0.14 node_modules/mime-types
- ms@0.7.1 node_modules/ms
- original@1.0.0 node_modules/original
- qs@2.3.3 node_modules/qs
- querystringify@0.0.3 node_modules/querystringify
- readable-stream@1.0.27-1 node_modules/readable-stream
- reduce-component@1.0.1 node_modules/reduce-component
- requires-port@1.0.0 node_modules/requires-port
- requizzle@0.2.1 node_modules/requizzle
- underscore@1.6.0 node_modules/requizzle/node_modules/underscore
- stellar-base@0.5.1 node_modules/stellar-base
- babel-runtime@5.8.24 node_modules/stellar-base/node_modules/babel-runtime
- core-js@1.1.4 node_modules/stellar-base/node_modules/babel-runtime/node_modules/core-js
- base32.js@0.1.0 node_modules/stellar-base/node_modules/base32.js
- bignumber.js@2.0.7 node_modules/stellar-base/node_modules/bignumber.js
- crc@3.3.0 node_modules/stellar-base/node_modules/crc
- ed25519@0.0.4 node_modules/stellar-base/node_modules/ed25519
- bindings@1.2.1 node_modules/stellar-base/node_modules/ed25519/node_modules/bindings
- nan@2.0.9 node_modules/stellar-base/node_modules/ed25519/node_modules/nan
- js-xdr@0.0.12 node_modules/stellar-base/node_modules/js-xdr
- babel-runtime@4.7.16 node_modules/stellar-base/node_modules/js-xdr/node_modules/babel-runtime
- core-js@0.6.1 node_modules/stellar-base/node_modules/js-xdr/node_modules/babel-runtime/node_modules/core-js
- cursor@0.1.5 node_modules/stellar-base/node_modules/js-xdr/node_modules/cursor
- long@2.4.0 node_modules/stellar-base/node_modules/js-xdr/node_modules/long
- sequencify@0.0.7 node_modules/stellar-base/node_modules/js-xdr/node_modules/sequencify
- lodash@3.10.1 node_modules/stellar-base/node_modules/lodash
- sha.js@2.4.4 node_modules/stellar-base/node_modules/sha.js
- inherits@2.0.1 node_modules/stellar-base/node_modules/sha.js/node_modules/inherits
- tweetnacl@0.13.2 node_modules/stellar-base/node_modules/tweetnacl
- string_decoder@0.10.31 node_modules/string_decoder
- strip-json-comments@1.0.4 node_modules/strip-json-comments
- superagent@1.7.2 node_modules/superagent
- taffydb@2.6.2 node_modules/taffydb
- toml@2.3.0 node_modules/toml
- underscore@1.8.3 node_modules/underscore
- underscore-contrib@0.3.0 node_modules/underscore-contrib
- underscore@1.6.0 node_modules/underscore-contrib/node_modules/underscore
- URIjs@1.16.1 node_modules/URIjs
- url-parse@1.0.5 node_modules/url-parse
- wrench@1.5.8 node_modules/wrench

TODO: 20160211 : truncate the above list .. i leave it for now as i like seeing what is available.

Reinstall:
npm install --save stellar-sdk


will-i-am:~ William$ npm install --save stellar-sdk
npm WARN deprecated URIjs@1.16.1: package renamed to "urijs" (lower-case), please update accordingly
npm WARN prefer global marked@0.3.5 should be installed with -g

> ed25519@0.0.4 install /Users/William/node_modules/stellar-base/node_modules/ed25519
> node-gyp rebuild

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

  CC(target) Release/obj.target/ed25519/src/ed25519/keypair.o
  CC(target) Release/obj.target/ed25519/src/ed25519/sign.o
  CC(target) Release/obj.target/ed25519/src/ed25519/open.o
  CC(target) Release/obj.target/ed25519/src/ed25519/crypto_verify_32.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_double_scalarmult.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_frombytes.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_scalarmult_base.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_precomp_0.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p2_0.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p2_dbl.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p3_0.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p3_dbl.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p3_to_p2.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p3_to_cached.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p3_tobytes.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_madd.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_add.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_msub.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_sub.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p1p1_to_p3.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_p1p1_to_p2.o
  CC(target) Release/obj.target/ed25519/src/ed25519/ge_tobytes.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_0.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_1.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_cmov.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_copy.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_neg.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_add.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_sub.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_mul.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_sq.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_sq2.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_invert.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_tobytes.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_isnegative.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_isnonzero.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_frombytes.o
  CC(target) Release/obj.target/ed25519/src/ed25519/fe_pow22523.o
  CC(target) Release/obj.target/ed25519/src/ed25519/sc_reduce.o
  CC(target) Release/obj.target/ed25519/src/ed25519/sc_muladd.o
  CXX(target) Release/obj.target/ed25519/src/ed25519.o
  SOLINK_MODULE(target) Release/ed25519.node
nvm@0.30.2 /Users/William
└─┬ stellar-sdk@0.4.1 
  ├── axios@0.7.0 
  ├── bluebird@2.10.2 
  ├── es6-promise@3.0.2 
  ├── event-source-polyfill@0.0.6 
  ├─┬ eventsource@0.1.6 
  │ └─┬ original@1.0.0 
  │   └─┬ url-parse@1.0.5 
  │     ├── querystringify@0.0.3 
  │     └── requires-port@1.0.0 
  ├─┬ jsdoc@3.5.0-dev  (git://github.com/jsdoc3/jsdoc.git#3dbb94f157290e8a0cbc79cb3580130e8e2c4534)
  │ ├── async@1.4.2 
  │ ├── bluebird@2.9.34 
  │ ├─┬ catharsis@0.8.7 
  │ │ └─┬ underscore-contrib@0.3.0 
  │ │   └── underscore@1.6.0 
  │ ├── escape-string-regexp@1.0.4 
  │ ├── espree@2.2.5 
  │ ├── js2xmlparser@1.0.0 
  │ ├── marked@0.3.5 
  │ ├─┬ requizzle@0.2.1 
  │ │ └── underscore@1.6.0 
  │ ├── strip-json-comments@1.0.4 
  │ ├── taffydb@2.6.2 
  │ ├── underscore@1.8.3 
  │ └── wrench@1.5.8 
  ├── lodash@3.10.1 
  ├─┬ stellar-base@0.5.1 
  │ ├─┬ babel-runtime@5.8.24 
  │ │ └── core-js@1.1.4 
  │ ├── base32.js@0.1.0 
  │ ├── bignumber.js@2.0.7 
  │ ├── crc@3.3.0 
  │ ├─┬ ed25519@0.0.4 
  │ │ ├── bindings@1.2.1 
  │ │ └── nan@2.0.9 
  │ ├─┬ js-xdr@0.0.12 
  │ │ ├─┬ babel-runtime@4.7.16 
  │ │ │ └── core-js@0.6.1 
  │ │ ├── cursor@0.1.5 
  │ │ ├── long@2.4.0 
  │ │ └── sequencify@0.0.7 
  │ ├── lodash@3.10.1 
  │ ├─┬ sha.js@2.4.4 
  │ │ └── inherits@2.0.1 
  │ └── tweetnacl@0.13.2 
  ├─┬ superagent@1.7.2 
  │ ├── component-emitter@1.2.0 
  │ ├── cookiejar@2.0.6 
  │ ├─┬ debug@2.2.0 
  │ │ └── ms@0.7.1 
  │ ├── extend@3.0.0 
  │ ├─┬ form-data@0.2.0 
  │ │ ├── async@0.9.2 
  │ │ ├─┬ combined-stream@0.0.7 
  │ │ │ └── delayed-stream@0.0.5 
  │ │ └─┬ mime-types@2.0.14 
  │ │   └── mime-db@1.12.0 
  │ ├── formidable@1.0.17 
  │ ├── methods@1.1.2 
  │ ├── mime@1.3.4 
  │ ├── qs@2.3.3 
  │ ├─┬ readable-stream@1.0.27-1 
  │ │ ├── core-util-is@1.0.2 
  │ │ ├── inherits@2.0.1 
  │ │ ├── isarray@0.0.1 
  │ │ └── string_decoder@0.10.31 
  │ └── reduce-component@1.0.1 
  ├── toml@2.3.0 
  └── URIjs@1.16.1 

will-i-am:~ William$ 

stellar-sdk is now installed.

TODO: 20160211 : How do I prove it is installed ?
Proof: 20160211 : from above results ..

nvm@0.30.2 /Users/William
└─┬ stellar-sdk@0.4.1 and .. ├── lodash@3.10.1
├─┬ stellar-base@0.5.1

Some notes to attend to.
This line tells me where the stellar-base is installed :
ed25519@0.0.4 install /Users/William/node_modules/stellar-base/node_modules/ed25519
Most excellent. We now have a toe in the waters of the stellar realms. end of this one

Question: 20160213 : If I want to make sure stellar-base is using the latest lodash, what do I do ?
Answer : 20160214 : Answer : 20160213 ? Perhaps the better question would be, why is observatory set to old lodash versions ?


nvm is installed by brew
nvm is required to install npm
npm is a Node Package Manager
npm is installed by nvm
npm is used to install others, such as yo
grunt is a compliler of files, and more.
gulp is a streaming workflow space ? TODO: find best definition
yo is short for Yeoman, requires node be installed
node is Node.js, installed as node.

io.js "is a fork of Joyent's Node.js"
We will not be using io.js and that quote is from:
Install Node.js or io.js with nvm, by Fernan Morales : 03 Feb 2015.
Another quote:
"... everything written here is also clearly explained by Creationix
in the Readme from the NVM repo. Also, executing nvm alone or nvm help will
display a comprehensive list of all the commands along with a brief description.
Good to know.

To install Yo, we will run: npm install -g yo.
To install gulp, we will run: npm install -g gulp To install Grunt, we will run: npm install -g grunt-cli
To install Bower, we will run: npm install -g bower


? Would you like to include jQuery? (Y/n)

? Would you like to include jQuery? Yes
   create bower.json
 conflict package.json
? Overwrite package.json? (Ynaxdh)

Answerng with the letter d will show you the differences.
Seeing the addition to be made, I chose Y, for Yes.

QUESTION: Now what ? And how do we tie all this in to the ruby-stellar-sdk ?
Answer : Because we intend to work with the Stellar SDK, we
make sure gem "stellar" is in our Gemfile. Then we run:

bundle

Now, let's update brew:


will-i-am:~ William$ brew update
Checking out files: 100% (220/220), done.
Updated Homebrew from 468f0d9 to 6322c47.

Tests and Testings

Interstellar : easy to buiild a web app on the Stellar network.
Interstellar Client : for developer exploration,
These matters call for Urchin.
Study well.

I have not begun tests yet.

js-stellar-sdk/test/integration
js-stellar-sdk/test/integration/server_test.js
js-stellar-sdk/test/
js-stellar-sdk/test/unit/
js-stellar-sdk/test/unit/browser_test.js js-stellar-sdk/website

End of testings.

Installation Instructions

The following will be a full installation of all that is required to work
with Node.js and its supporting tools to build websites and
API's. We are building this because we want to be able to make use of
the js-stellar-sdk and eventually, the ruby-stellar-sdk.

I have removed all further mention of the Stellar materials into a new Gist
as yet incomplete, doing so for clarity and simplicity in this getting ready Gist.

You do not need to care about using the Stellar.org platform to use these
instructions to easily install your tools, just ignore the Stellar mentions.

Below these Stellar references, you will find explanations we used to meet the
requirements to be able to work with Stellar's platform, and I hope, further
develop ruby-stellar-sdk.

Below that, you will find the commands and their results after
being run. After we install nvm and npm and yo and others .. all
installations are extremely easy ..

After that I will be sharing the commands and references I used to install
Stellar, and all that is required for its use and testing of the ruby-stellar-sdk with Ruby on Rails and RSpec.

You can safely ignore all references and links to the stellar-sdk
and certainly too, the ruby-stellar-sdk. Doing so, you will find
the complete instructions for how to install nvm, with Homebrew's
lovely brew install command. Also, we found Homebrew-Cask while
doing this, so we bring that wonderful tool into the mix, too.

So as to be crystal clear, we are going to be installing nvm
and npm and all that is required to run the js-stellar-sdk
and from that, learn how to write the ruby-stellar-sdk
Today, it barely exists.

Before we arrive at the full stellar-sdk instructions, we will have a
complete gulp installation ready to build websites. Before we leave this
stellar-sdk ignore notice, I provide a few links, a deeper understanding
of how I arrived at how I installed nvm and node and other tools:

A Brief Philosophical Discussion:

Doing the normal Rails thing, I place the Stellar gem into our Gemfile:

gem "stellar" and run
bundle

As the Stellar.org documents note, the ruby-stellar-sdk
is not ready for Prime Time in production.
It is incomplete and the examples do not yet work.

I do not know if the gem "stellar" will one day encompass all
that is required to interact with the Stellar platform. I do know
the non-profit org I am coding this for intends to be an exchange
node on the Stellar systems, and so I continue to study and learn
and code.

Being conversant with Javascript and jQuery, I see the js-stellar-sdk
from the stellar materials and take a look at it. I see this note:

"js-stellar-sdk is a client-side Stellar Javascript library
for communicating with a Stellar Horizon server.
It is used for building Stellar apps
either on Node.js or in the browser." (with Bower)

Stellar Note from the Horizon link:
"Note this code is beta. It is not ready yet for production."

Okay ! Now I know something worth knowing. If the js-stellar-sdk uses
EITHER Node.js OR Bower, and after further study, we chose to use Node.js
and so node it is. Node.js is installed as node.

Horizon is the client facing API server
for the Stellar ecosystem. Horizon requires go 1.5 or higher to build. This
is the reason a Ruby on Rails developer is installing nvm, npm and family.

Regarding the Bower link telling me it is 'a package manager' system
for the web.

"Using Bower, you assemble the packages needed for your system."
You will also see, "Bower requires node, npm and git." At the time of
this writing, Bower's page is showing, "Latest release: v1.7.2" .

Why my team uses npm instead of bower will sway you to choose npm
and the reason for me is, Bower adds its own complexities to keeping
everything in sync. Late note: I have now written into the instructions
how we will be installing nvm and node, both installed by Homebrew using
Homebrew-Cask. Bower will be used as a tool of other installations, perhaps
managing jQuery and Bookstrap. I do not know yet, but I do know we will be
installing Bower as part of another installation, and we will be using
nvm and npm as our prime package manager first, not Bower.

Also, in my studies I came across the name, CommonJS.
My understanding right now is nvm is our path, and CommonJS is used
internally by other parts of the build process, we will not be installing
CommonJs directly.

As Rails developer, my study of Stellar so far leads me to see the need to
install nvm and npm, and yo and gulp with Yo's generator-webapp.

May I recommend you read this article, Gulp vs Grunt. Why one? Why the Other?.
It appears it is a case of gulp or grunt. That being said, while we will be
using gulp, other parts of the build process do use grunt.

Regarding npm: npm software wiki, a quote:

"npm, the Node Package Manager, is the default package manager
for the JavaScript runtime environment Node.js."

Another quote from the same source:

Overview:
As of Node.js version 0.6.3, npm is bundled and installed automatically
with the environment. npm runs through the command line and manages
dependencies for an application. It also allows users to install Node.js
applications that are available on the npm registry. npm is written
entirely in JavaScript and was developed by Isaac Z. Schlueter as a result
of the frustrations he had experienced while working with CommonJS . . .

That one line catches my eye ..
'npm allows users to install Node.js applications
that are available on the npm registry.'

Our tools so far definitely include nvm and npm and node, and yo,
and git and grunt and grunt-cli, gulp.

What is nvm : Node Version Manager
What is npm : Node Package Manager.
What is Yo : Yo is the tool to use for running Yeoman generators.

Yeoman
Now that we have Node.js installed on our machine, we are now ready to
install Yeoman. Yeoman is using 3 core tools. These core tools are composed
by Yo, Grunt, and Bower. So we will install them one by one using npm which
came with Node.js when we installed node.

What is grunt : grunt is the task-manager. See a great explanation a bit further below.
What is Bower : Bower is a package manager.

A note about Yo from their link:

"We now have the core tools needed for Yeoman to work, but there is one more
thing we need to do. That is to install the generator we want to use. If you want
to create a basic webapp, you just need to run npm install -g generator-webapp
or if you want to work on AngularJS, just run npm install -g generator-angular.
(Do not run the command yet.)

We now have all the things needed, and you can now kickstart your project by
running yo webapp or yo angular.

To install Go, we will run: brew install go.
To install Yo, we will run: npm install -g yo.
To install gulp, we will run: npm install -g gulp

To install Grunt, we will run: npm install -g grunt-cli
To install Bower, we will run: npm install -g bower

io.js "is a fork of Joyent's Node.js"
We will not be using io.js and that quote is from:
Install Node.js or io.js with nvm, by Fernan Morales : 03 Feb 2015.
Another quote:
"... everything written here is also clearly explained by Creationix
in the Readme from the NVM repo. Also, executing nvm alone or nvm help will
display a comprehensive list of all the commands along with a brief description.
Good to know.

A great explanation of Grunt from Treehouse.com:

" . . because Node.js can be used on your desktop computer, programmers have
created useful Node-based tools that help with the process of building web sites.
For example, Grunt is a popular tool used to automate common tasks like compiling
Sass files to CSS, making JavaScript files smaller so they load in less time, and
compressing images to smaller file size. While these tools run through the
Node.js environment, you’ll use another tool, NPM, to install them.
NPM is what’s called a “package manager.”
NPM makes installing a tool like Grunt
easy as npm install -g grunt followed by npm install -g grunt-cli.

Other tools you may run across:
gulp : A streaming build system, the g is capitalized only in the gulp logo.
gulp faq
gulp js

Place this : Important Notice for Developers

If you are actively developing on the Stellar network, please subscribe to the
official Stellar.org releases mailing list to make sure you receive future update notices.

Due to a few recent updates, you will need upgrade your JavaScript libraries to
stellar-sdk 0.4.0 and to stellar-base 0.5.0 as soon as possible. Please note
that transactions built by older versions of js sdks may fail.

These releases also remove the following deprecated methods:

Account.isValidAddress (replaced by Account.isValidAccountId)
Account.getSequenceNumber (replaced by Account.sequenceNumber)
Keypair.address (replaced by Keypair.accountId)
Network.usePublicNet (now Network.usePublicNetwork)
Network.useTestNet (now Network.useTestNetwork)
Removed TransactionBuilder.addSigner (use Transaction.sign)

Please make sure to update your code before deploying an updated version.

Thank you, and apologies for any inconvenience,

Team Stellar

What version are we running ? How do I find out ?

npm list : will show you all packages installed.

Also, you can open your /package.json file, it will show there.


├─┬ stellar-sdk@0.4.2
│ ├─┬ stellar-base@0.5.4


will-i-am:node_modules William$ npm list

├─┬ stellar-sdk@0.4.2
│ ├─┬ stellar-base@0.5.4
 
 . . truncated . .

First I learn it .. then I use it.
The following is from the reference:

Assert utility from yeoman

yeoman-assert is extending the native Node assert module.
Every method in assert also is available with yeoman-assert,
plus some code scaffolding related assertion helpers.

Install

npm install --save yeoman-assert

How does Heroku recommend we install ?

This : npm install --save yeoman-assert : becomes this:

npm install --save --save-exact yeoman-assert

and so I do ..

npm install --save --save-exact yeoman-assert

TODO: 20160225 : finish this

Usage

var assert = require('yeoman-assert');

assert(true);
assert.equal(1, 1);

assert.file()

path (String|Array) Path to a file.

Assert that a file exists.

assert.file('templates/user.hbs');

Assert that each files in the array exists.

assert.file(['templates/user.hbs', 'templates/user/edit.hbs']);

assert.noFile()

path (String|Array) Path to a file.

Assert that a file doesn't exists.

assert.noFile('templates/user.hbs');

Assert that each of an array of files doesn't exist.

assert.noFile(['templates/user.hbs', 'templates/user/edit.hbs']);

assert.fileContent()

file (String|Array) Path to a file.
reg (Regex|String) Regex or string that will be used to search the file.

Assert that a file's content matches a string.

assert.fileContent('models/user.js', 'App.User = DS.Model.extend');

Assert that a file's content matches a regex.

assert.fileContent('models/user.js', /App\.User = DS\.Model\.extend/);

Assert that each of an array of files content matches a regex or string.

assert.fileContent([
['models/user.js', 'App.User = DS.Model.extend'],
['controllers/user.js', /App\.UserController = Ember\.ObjectController\.extend/]
]);

assert.noFileContent()

file (String|Array) Path to a file.
reg (Regex|String) Regex or string that will be used to search the file.

Assert that a file's content does not match a string.

assert.noFileContent('models/user.js', 'App.User = DS.Model.extend');

Assert that a file's content does not match a regex.

assert.noFileContent('models/user.js', /App\.User = DS\.Model\.extend/);

Assert that each of an array of files content does not match a regex or string.

assert.noFileContent([
['models/user.js', 'App.User = DS.Model.extend'],
['controllers/user.js', /App\.UserController = Ember\.ObjectController\.extend/]
]);

assert.textEqual()

value (String) A string.
expected (String) The expected value of the string.

Assert that two strings are equal after standardization of newlines.

assert.textEqual('I have a yellow cat', 'I have a yellow cat');

assert.implement()

subject (Object) Subject implementing the façade. methods (Object|Array) A façace, hash or array of keys to be implemented.

Assert an Object implements an interface.

assert.implement(fs, ['readFile']);

assert.notImplement()

subject (Object) Subject not implementing the methods. methods (Object|Array) Hash or array of method names to be implemented.

Assert an Object doesn't implements any method of an interface.

assert.notImplement(fs, ['foo']);

assert.objectContent()

Assert an object contains at least a set of keys

var anObject = {a: 1};

assert.objectContent(anObject, {a: 2});

assert.JSONFileContent()

Assert a JSON file contains at least a set of keys (rely of assert.objectContent())

assert.JSONFileContent('path/to/file.json', {a: 2});

End of yeoman-assert reference

Now, how do I use it ? Right this moment, I haven't a clue.

Let's take a look. Run home on it and arrive at the Yeoman Home Page.

npm home yeoman-assert

This gives us an excellent description of yeoman-assert and what it does.

Account.isValidAccountId : replaces : Account.isValidAddress
Account.sequenceNumber : replaces : Account.getSequenceNumber
Keypair.accountId : replaces : Keypair.address
Network.usePublicNetwork : replaces : Network.usePublicNet
Network.useTestNetwork : replaces : Network.useTestNet
Transaction.sign : replaces : TransactionBuilder.addSigner

We are not done yet. As of 20160226, we have not made contact with the steller testnet server.

Authored by This Gister

Address of Node-yo-gulp-stellar-sdk.md is:
Node-yo-gulp-stellar-sdk-heroku.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment