├── CODEOWNERS ├── .DS_Store ├── Course_Identity_And_Smart_Contracts ├── starNotaryv1 │ ├── .gitignore │ ├── app │ │ ├── .gitignore │ │ ├── package.json │ │ ├── webpack.config.js │ │ └── src │ │ │ └── index.html │ ├── migrations │ │ ├── 1_initial_migration.js │ │ └── 2_deploy_contracts.js │ ├── README.md │ └── contracts │ │ ├── StarNotary.sol │ │ └── Migrations.sol ├── starNotaryv2 │ ├── .gitignore │ ├── app │ │ ├── .gitignore │ │ ├── package.json │ │ ├── webpack.config.js │ │ └── src │ │ │ └── index.html │ ├── migrations │ │ ├── 1_initial_migration.js │ │ └── 2_deploy_contracts.js │ ├── README.md │ └── contracts │ │ └── Migrations.sol ├── SampleToken │ ├── node_modules │ │ ├── yaeti │ │ │ ├── .npmignore │ │ │ ├── index.js │ │ │ ├── lib │ │ │ │ ├── Event.browser.js │ │ │ │ └── Event.js │ │ │ ├── .jscsrc │ │ │ ├── .jshintrc │ │ │ ├── gulpfile.js │ │ │ └── LICENSE │ │ ├── any-promise │ │ │ ├── register │ │ │ │ ├── q.d.ts │ │ │ │ ├── lie.d.ts │ │ │ │ ├── pinkie.d.ts │ │ │ │ ├── promise.d.ts │ │ │ │ ├── rsvp.d.ts │ │ │ │ ├── vow.d.ts │ │ │ │ ├── when.d.ts │ │ │ │ ├── bluebird.d.ts │ │ │ │ ├── es6-promise.d.ts │ │ │ │ ├── native-promise-only.d.ts │ │ │ │ ├── lie.js │ │ │ │ ├── q.js │ │ │ │ ├── pinkie.js │ │ │ │ ├── rsvp.js │ │ │ │ ├── vow.js │ │ │ │ ├── when.js │ │ │ │ ├── bluebird.js │ │ │ │ ├── promise.js │ │ │ │ ├── es6-promise.js │ │ │ │ └── native-promise-only.js │ │ │ ├── .jshintrc │ │ │ ├── index.js │ │ │ ├── implementation.js │ │ │ ├── implementation.d.ts │ │ │ ├── .npmignore │ │ │ ├── optional.js │ │ │ ├── register.d.ts │ │ │ ├── register-shim.js │ │ │ └── LICENSE │ │ ├── file-uri-to-path │ │ │ ├── .npmignore │ │ │ ├── index.d.ts │ │ │ ├── History.md │ │ │ ├── .travis.yml │ │ │ ├── test │ │ │ │ ├── test.js │ │ │ │ └── tests.json │ │ │ └── LICENSE │ │ ├── openzeppelin-solidity │ │ │ ├── contracts │ │ │ │ ├── drafts │ │ │ │ │ ├── .gitkeep │ │ │ │ │ ├── ERC1046 │ │ │ │ │ │ └── TokenMetadata.sol │ │ │ │ │ └── Counter.sol │ │ │ │ ├── .npmignore │ │ │ │ ├── token │ │ │ │ │ ├── ERC721 │ │ │ │ │ │ ├── ERC721Holder.sol │ │ │ │ │ │ ├── IERC721Full.sol │ │ │ │ │ │ ├── IERC721Metadata.sol │ │ │ │ │ │ ├── ERC721Burnable.sol │ │ │ │ │ │ ├── IERC721Enumerable.sol │ │ │ │ │ │ ├── ERC721Mintable.sol │ │ │ │ │ │ ├── ERC721Full.sol │ │ │ │ │ │ ├── ERC721Pausable.sol │ │ │ │ │ │ ├── ERC721MetadataMintable.sol │ │ │ │ │ │ ├── IERC721Receiver.sol │ │ │ │ │ │ └── IERC721.sol │ │ │ │ │ └── ERC20 │ │ │ │ │ │ ├── ERC20Mintable.sol │ │ │ │ │ │ ├── ERC20Capped.sol │ │ │ │ │ │ ├── ERC20Burnable.sol │ │ │ │ │ │ ├── IERC20.sol │ │ │ │ │ │ ├── ERC20Pausable.sol │ │ │ │ │ │ └── ERC20Detailed.sol │ │ │ │ ├── introspection │ │ │ │ │ ├── IERC165.sol │ │ │ │ │ └── ERC165.sol │ │ │ │ ├── crowdsale │ │ │ │ │ ├── distribution │ │ │ │ │ │ ├── RefundablePostDeliveryCrowdsale.sol │ │ │ │ │ │ ├── PostDeliveryCrowdsale.sol │ │ │ │ │ │ └── FinalizableCrowdsale.sol │ │ │ │ │ ├── validation │ │ │ │ │ │ ├── WhitelistCrowdsale.sol │ │ │ │ │ │ ├── PausableCrowdsale.sol │ │ │ │ │ │ └── CappedCrowdsale.sol │ │ │ │ │ └── emission │ │ │ │ │ │ └── MintedCrowdsale.sol │ │ │ │ ├── payment │ │ │ │ │ ├── escrow │ │ │ │ │ │ └── ConditionalEscrow.sol │ │ │ │ │ └── PullPayment.sol │ │ │ │ ├── math │ │ │ │ │ └── Math.sol │ │ │ │ ├── access │ │ │ │ │ ├── Roles.sol │ │ │ │ │ └── roles │ │ │ │ │ │ ├── CapperRole.sol │ │ │ │ │ │ ├── MinterRole.sol │ │ │ │ │ │ ├── PauserRole.sol │ │ │ │ │ │ ├── SignerRole.sol │ │ │ │ │ │ └── WhitelistAdminRole.sol │ │ │ │ ├── utils │ │ │ │ │ ├── Address.sol │ │ │ │ │ └── ReentrancyGuard.sol │ │ │ │ ├── ownership │ │ │ │ │ └── Secondary.sol │ │ │ │ ├── cryptography │ │ │ │ │ └── MerkleProof.sol │ │ │ │ └── lifecycle │ │ │ │ │ └── Pausable.sol │ │ │ └── LICENSE │ │ ├── debug │ │ │ ├── node.js │ │ │ ├── .coveralls.yml │ │ │ ├── .npmignore │ │ │ ├── .travis.yml │ │ │ ├── .eslintrc │ │ │ ├── src │ │ │ │ ├── index.js │ │ │ │ └── inspector-log.js │ │ │ ├── component.json │ │ │ ├── LICENSE │ │ │ └── Makefile │ │ ├── websocket │ │ │ ├── index.js │ │ │ ├── lib │ │ │ │ ├── version.js │ │ │ │ ├── Validation.fallback.js │ │ │ │ ├── websocket.js │ │ │ │ ├── BufferUtil.js │ │ │ │ ├── Validation.js │ │ │ │ ├── browser.js │ │ │ │ ├── Deprecation.js │ │ │ │ └── BufferUtil.fallback.js │ │ │ ├── build │ │ │ │ ├── binding.Makefile │ │ │ │ └── Release │ │ │ │ │ ├── bufferutil.node │ │ │ │ │ ├── validation.node │ │ │ │ │ ├── obj.target │ │ │ │ │ ├── bufferutil │ │ │ │ │ │ └── src │ │ │ │ │ │ │ └── bufferutil.o │ │ │ │ │ └── validation │ │ │ │ │ │ └── src │ │ │ │ │ │ └── validation.o │ │ │ │ │ └── .deps │ │ │ │ │ └── Release │ │ │ │ │ ├── bufferutil.node.d │ │ │ │ │ └── validation.node.d │ │ │ ├── Makefile │ │ │ ├── gulpfile.js │ │ │ └── binding.gyp │ │ ├── nan │ │ │ ├── include_dirs.js │ │ │ ├── tools │ │ │ │ ├── README.md │ │ │ │ └── package.json │ │ │ ├── nan_define_own_property_helper.h │ │ │ ├── LICENSE.md │ │ │ ├── doc │ │ │ │ └── script.md │ │ │ └── nan_converters_pre_43_inl.h │ │ ├── truffle-hdwallet-provider │ │ │ ├── .travis.yml │ │ │ ├── LICENSE.md │ │ │ └── webpack │ │ │ │ └── webpack.config.js │ │ ├── typedarray-to-buffer │ │ │ ├── .airtap.yml │ │ │ ├── .travis.yml │ │ │ ├── index.js │ │ │ └── LICENSE │ │ ├── is-typedarray │ │ │ ├── README.md │ │ │ ├── LICENSE.md │ │ │ ├── index.js │ │ │ └── test.js │ │ ├── ms │ │ │ └── license.md │ │ └── bindings │ │ │ └── LICENSE.md │ ├── migrations │ │ ├── 1_initial_migration.js │ │ └── 2_initial_migration.js │ └── contracts │ │ ├── SampleToken.sol │ │ └── Migrations.sol ├── .DS_Store ├── solidity │ ├── .DS_Store │ ├── migrations │ │ ├── 1_initial_migration.js │ │ └── 2_initial_migration.js │ ├── README.md │ └── contracts │ │ ├── MainContract.sol │ │ ├── EnumsContract.sol │ │ ├── Migrations.sol │ │ ├── TypesConversion.sol │ │ ├── MappingsContract.sol │ │ ├── BasicDataType.sol │ │ ├── FunctionsContract.sol │ │ ├── ExceptionsContract.sol │ │ ├── StructsContract.sol │ │ └── GlobalVariables.sol └── Smart_Contracts_With_Solidity │ ├── constructorContract.sol │ ├── mainContract.sol │ ├── enumsContract.sol │ ├── modifiers.sol │ ├── typeConversionContract.sol │ ├── mappingContract.sol │ ├── basicDataTypesContract.sol │ ├── functionsContract.sol │ ├── exceptionsContract.sol │ ├── structsContract.sol │ └── globalVariablesContract.sol ├── Course_Blockchain_Data ├── .DS_Store ├── Project_2_es6_starter_code │ ├── notes.txt │ ├── Block.js │ ├── package.json │ └── LevelSandbox.js ├── Practice_Block_Data │ ├── README.md │ ├── package.json │ ├── app.js │ └── .gitignore ├── Practice_LevelDB_And_Promises │ ├── package.json │ ├── README.md │ ├── app.js │ └── .gitignore ├── Practice_Create_Transaction │ ├── package.json │ └── .gitignore └── Practice_Private_Blockchain_Code_Session │ ├── package.json │ ├── README.md │ └── .gitignore ├── Course_Blockchain_Identity ├── .DS_Store ├── bitcoin-wallet │ ├── .DS_Store │ ├── bitcoin-wallet-app │ │ ├── server │ │ │ ├── app.yaml │ │ │ └── package.json │ │ ├── .gitignore │ │ ├── images │ │ │ ├── favicon.ico │ │ │ └── manifest │ │ │ │ ├── icon-48x48.png │ │ │ │ ├── icon-72x72.png │ │ │ │ ├── icon-96x96.png │ │ │ │ ├── icon-144x144.png │ │ │ │ ├── icon-192x192.png │ │ │ │ └── icon-512x512.png │ │ ├── test │ │ │ ├── integration │ │ │ │ └── screenshots-baseline │ │ │ │ │ ├── wide │ │ │ │ │ ├── index.png │ │ │ │ │ ├── view1.png │ │ │ │ │ ├── view2.png │ │ │ │ │ ├── view3.png │ │ │ │ │ └── batmanNotAView.png │ │ │ │ │ └── narrow │ │ │ │ │ ├── index.png │ │ │ │ │ ├── view1.png │ │ │ │ │ ├── view2.png │ │ │ │ │ ├── view3.png │ │ │ │ │ └── batmanNotAView.png │ │ │ └── unit │ │ │ │ └── index.html │ │ ├── wct.conf.json │ │ ├── README.md │ │ ├── manifest.json │ │ ├── service-worker.js │ │ ├── src │ │ │ └── components │ │ │ │ ├── page-view-element.js │ │ │ │ ├── button-shared-styles.js │ │ │ │ ├── my-view404.js │ │ │ │ ├── my-signature.js │ │ │ │ ├── my-latestblocks.js │ │ │ │ ├── my-blockhashutil.js │ │ │ │ └── my-walletinfo.js │ │ ├── sw-precache-config.js │ │ ├── push-manifest.json │ │ ├── polymer.json │ │ └── gulpfile.js │ └── bitcoin-wallet-api │ │ ├── blockController.js │ │ ├── package.json │ │ ├── README.md │ │ ├── app.js │ │ └── .gitignore ├── Practice_Block │ ├── package.json │ ├── README.md │ ├── package-lock.json │ ├── app.js │ ├── block.js │ └── .gitignore └── Practice_Hashing │ ├── README.md │ ├── package.json │ ├── package-lock.json │ ├── app.js │ └── .gitignore ├── Course_Blockchain_Web_Services ├── .DS_Store ├── Practice_RestAPI_Hapi │ ├── package.json │ ├── Block.js │ ├── README.md │ ├── app.js │ └── .gitignore ├── Practice_Client_Server_Features │ ├── package.json │ ├── package-lock.json │ ├── README.md │ ├── app.js │ └── .gitignore └── Practice_RestApi_Express │ ├── Block.js │ ├── package.json │ ├── app.js │ └── .gitignore └── README.md /CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @udacity/active-public-content -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udacity/nd1309-work-code/HEAD/.DS_Store -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/starNotaryv1/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | build 3 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/starNotaryv2/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | build 3 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/starNotaryv1/app/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/starNotaryv2/app/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/yaeti/.npmignore: -------------------------------------------------------------------------------- 1 | /node_modules/ 2 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/any-promise/register/q.d.ts: -------------------------------------------------------------------------------- 1 | export {} 2 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/any-promise/register/lie.d.ts: -------------------------------------------------------------------------------- 1 | export {} 2 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/any-promise/register/pinkie.d.ts: -------------------------------------------------------------------------------- 1 | export {} 2 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/any-promise/register/promise.d.ts: -------------------------------------------------------------------------------- 1 | export {} 2 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/any-promise/register/rsvp.d.ts: -------------------------------------------------------------------------------- 1 | export {} 2 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/any-promise/register/vow.d.ts: -------------------------------------------------------------------------------- 1 | export {} 2 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/any-promise/register/when.d.ts: -------------------------------------------------------------------------------- 1 | export {} 2 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/file-uri-to-path/.npmignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/drafts/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/any-promise/register/bluebird.d.ts: -------------------------------------------------------------------------------- 1 | export {} 2 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/any-promise/register/es6-promise.d.ts: -------------------------------------------------------------------------------- 1 | export {} 2 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/debug/node.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./src/node'); 2 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/any-promise/register/native-promise-only.d.ts: -------------------------------------------------------------------------------- 1 | export {} 2 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/websocket/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./lib/websocket'); -------------------------------------------------------------------------------- /Course_Blockchain_Data/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udacity/nd1309-work-code/HEAD/Course_Blockchain_Data/.DS_Store -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/.npmignore: -------------------------------------------------------------------------------- 1 | mocks 2 | examples 3 | -------------------------------------------------------------------------------- /Course_Blockchain_Identity/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udacity/nd1309-work-code/HEAD/Course_Blockchain_Identity/.DS_Store -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/any-promise/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node":true, 3 | "strict":true 4 | } 5 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/debug/.coveralls.yml: -------------------------------------------------------------------------------- 1 | repo_token: SIAeZjKYlHK74rbcFvNHMUzjRiMpflxve 2 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/any-promise/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./register')().Promise 2 | -------------------------------------------------------------------------------- /Course_Blockchain_Web_Services/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udacity/nd1309-work-code/HEAD/Course_Blockchain_Web_Services/.DS_Store -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/nan/include_dirs.js: -------------------------------------------------------------------------------- 1 | console.log(require('path').relative('.', __dirname)); 2 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/websocket/lib/version.js: -------------------------------------------------------------------------------- 1 | module.exports = require('../package.json').version; 2 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udacity/nd1309-work-code/HEAD/Course_Identity_And_Smart_Contracts/.DS_Store -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/any-promise/implementation.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./register')().implementation 2 | -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udacity/nd1309-work-code/HEAD/Course_Blockchain_Identity/bitcoin-wallet/.DS_Store -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/server/app.yaml: -------------------------------------------------------------------------------- 1 | runtime: nodejs 2 | env: flex 3 | automatic_scaling: 4 | min_num_instances: 1 5 | -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | node_modules/ 3 | test/integration/screenshots-current/ 4 | _site/ 5 | .DS_Store 6 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/any-promise/implementation.d.ts: -------------------------------------------------------------------------------- 1 | declare var implementation: string; 2 | 3 | export = implementation; 4 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/any-promise/register/lie.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | require('../register')('lie', {Promise: require('lie')}) 3 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/solidity/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udacity/nd1309-work-code/HEAD/Course_Identity_And_Smart_Contracts/solidity/.DS_Store -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/any-promise/.npmignore: -------------------------------------------------------------------------------- 1 | .git* 2 | test/ 3 | test-browser/ 4 | build/ 5 | .travis.yml 6 | *.swp 7 | Makefile 8 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/any-promise/register/q.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | require('../register')('q', {Promise: require('q').Promise}) 3 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/file-uri-to-path/index.d.ts: -------------------------------------------------------------------------------- 1 | declare function fileUriToPath(uri: string): string; 2 | export = fileUriToPath; 3 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/any-promise/register/pinkie.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | require('../register')('pinkie', {Promise: require('pinkie')}) 3 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/any-promise/register/rsvp.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | require('../register')('rsvp', {Promise: require('rsvp').Promise}) 3 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/any-promise/register/vow.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | require('../register')('vow', {Promise: require('vow').Promise}) 3 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/any-promise/register/when.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | require('../register')('when', {Promise: require('when').Promise}) 3 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/any-promise/register/bluebird.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | require('../register')('bluebird', {Promise: require('bluebird')}) 3 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/any-promise/register/promise.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | require('../register')('promise', {Promise: require('promise')}) 3 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/debug/.npmignore: -------------------------------------------------------------------------------- 1 | support 2 | test 3 | examples 4 | example 5 | *.sock 6 | dist 7 | yarn.lock 8 | coverage 9 | bower.json 10 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/yaeti/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | EventTarget : require('./lib/EventTarget'), 3 | Event : require('./lib/Event') 4 | }; 5 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/yaeti/lib/Event.browser.js: -------------------------------------------------------------------------------- 1 | /** 2 | * In browsers export the native Event interface. 3 | */ 4 | 5 | module.exports = global.Event; 6 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/any-promise/register/es6-promise.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | require('../register')('es6-promise', {Promise: require('es6-promise').Promise}) 3 | -------------------------------------------------------------------------------- /Course_Blockchain_Data/Project_2_es6_starter_code/notes.txt: -------------------------------------------------------------------------------- 1 | // Block data model 2 | { 3 | "hash" : "", 4 | "height" : 0, 5 | "body": [], 6 | "time": 0, 7 | previousblockhash: "" 8 | 9 | } -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udacity/nd1309-work-code/HEAD/Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/images/favicon.ico -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/any-promise/register/native-promise-only.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | require('../register')('native-promise-only', {Promise: require('native-promise-only')}) 3 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/any-promise/optional.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | try { 3 | module.exports = require('./register')().Promise || null 4 | } catch(e) { 5 | module.exports = null 6 | } 7 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/yaeti/.jscsrc: -------------------------------------------------------------------------------- 1 | { 2 | "preset": "crockford", 3 | "validateIndentation": "\t", 4 | "disallowKeywords": ["with"], 5 | "disallowDanglingUnderscores": null 6 | } 7 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/solidity/migrations/1_initial_migration.js: -------------------------------------------------------------------------------- 1 | var Migrations = artifacts.require("./Migrations.sol"); 2 | 3 | module.exports = function(deployer) { 4 | deployer.deploy(Migrations); 5 | }; 6 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/starNotaryv1/migrations/1_initial_migration.js: -------------------------------------------------------------------------------- 1 | const Migrations = artifacts.require("Migrations"); 2 | 3 | module.exports = function(deployer) { 4 | deployer.deploy(Migrations); 5 | }; 6 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/starNotaryv1/migrations/2_deploy_contracts.js: -------------------------------------------------------------------------------- 1 | const StarNotary = artifacts.require("StarNotary"); 2 | 3 | module.exports = function(deployer) { 4 | deployer.deploy(StarNotary); 5 | }; 6 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/starNotaryv2/migrations/1_initial_migration.js: -------------------------------------------------------------------------------- 1 | const Migrations = artifacts.require("Migrations"); 2 | 3 | module.exports = function(deployer) { 4 | deployer.deploy(Migrations); 5 | }; 6 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/starNotaryv2/migrations/2_deploy_contracts.js: -------------------------------------------------------------------------------- 1 | const StarNotary = artifacts.require("StarNotary"); 2 | 3 | module.exports = function(deployer) { 4 | deployer.deploy(StarNotary); 5 | }; 6 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/migrations/1_initial_migration.js: -------------------------------------------------------------------------------- 1 | var Migrations = artifacts.require("./Migrations.sol"); 2 | 3 | module.exports = function(deployer) { 4 | deployer.deploy(Migrations); 5 | }; 6 | -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/images/manifest/icon-48x48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udacity/nd1309-work-code/HEAD/Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/images/manifest/icon-48x48.png -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/images/manifest/icon-72x72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udacity/nd1309-work-code/HEAD/Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/images/manifest/icon-72x72.png -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/images/manifest/icon-96x96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udacity/nd1309-work-code/HEAD/Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/images/manifest/icon-96x96.png -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/images/manifest/icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udacity/nd1309-work-code/HEAD/Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/images/manifest/icon-144x144.png -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/images/manifest/icon-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udacity/nd1309-work-code/HEAD/Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/images/manifest/icon-192x192.png -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/images/manifest/icon-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udacity/nd1309-work-code/HEAD/Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/images/manifest/icon-512x512.png -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/websocket/build/binding.Makefile: -------------------------------------------------------------------------------- 1 | # This file is generated by gyp; do not edit. 2 | 3 | export builddir_name ?= ./build/. 4 | .PHONY: all 5 | all: 6 | $(MAKE) bufferutil validation 7 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/migrations/2_initial_migration.js: -------------------------------------------------------------------------------- 1 | var SampleToken = artifacts.require("SampleToken"); 2 | 3 | module.exports = function(deployer) { 4 | deployer.deploy(SampleToken, "UdacityExampleToken", "UET", 18, 1000); 5 | }; -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/websocket/build/Release/bufferutil.node: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udacity/nd1309-work-code/HEAD/Course_Identity_And_Smart_Contracts/SampleToken/node_modules/websocket/build/Release/bufferutil.node -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/websocket/build/Release/validation.node: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udacity/nd1309-work-code/HEAD/Course_Identity_And_Smart_Contracts/SampleToken/node_modules/websocket/build/Release/validation.node -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/truffle-hdwallet-provider/.travis.yml: -------------------------------------------------------------------------------- 1 | dist: trusty 2 | sudo: required 3 | language: node_js 4 | node_js: 5 | - "8" 6 | 7 | install: 8 | - npm install 9 | 10 | script: 11 | - npm test 12 | 13 | -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/test/integration/screenshots-baseline/wide/index.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udacity/nd1309-work-code/HEAD/Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/test/integration/screenshots-baseline/wide/index.png -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/test/integration/screenshots-baseline/wide/view1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udacity/nd1309-work-code/HEAD/Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/test/integration/screenshots-baseline/wide/view1.png -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/test/integration/screenshots-baseline/wide/view2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udacity/nd1309-work-code/HEAD/Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/test/integration/screenshots-baseline/wide/view2.png -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/test/integration/screenshots-baseline/wide/view3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udacity/nd1309-work-code/HEAD/Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/test/integration/screenshots-baseline/wide/view3.png -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/Smart_Contracts_With_Solidity/constructorContract.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.21; 2 | 3 | contract constructorContract { 4 | uint public amount; 5 | 6 | constructor (uint value) public { 7 | amount = value; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/test/integration/screenshots-baseline/narrow/index.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udacity/nd1309-work-code/HEAD/Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/test/integration/screenshots-baseline/narrow/index.png -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/test/integration/screenshots-baseline/narrow/view1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udacity/nd1309-work-code/HEAD/Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/test/integration/screenshots-baseline/narrow/view1.png -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/test/integration/screenshots-baseline/narrow/view2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udacity/nd1309-work-code/HEAD/Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/test/integration/screenshots-baseline/narrow/view2.png -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/test/integration/screenshots-baseline/narrow/view3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udacity/nd1309-work-code/HEAD/Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/test/integration/screenshots-baseline/narrow/view3.png -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/debug/.travis.yml: -------------------------------------------------------------------------------- 1 | 2 | language: node_js 3 | node_js: 4 | - "6" 5 | - "5" 6 | - "4" 7 | 8 | install: 9 | - make node_modules 10 | 11 | script: 12 | - make lint 13 | - make test 14 | - make coveralls 15 | -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/test/integration/screenshots-baseline/narrow/batmanNotAView.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udacity/nd1309-work-code/HEAD/Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/test/integration/screenshots-baseline/narrow/batmanNotAView.png -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/test/integration/screenshots-baseline/wide/batmanNotAView.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udacity/nd1309-work-code/HEAD/Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/test/integration/screenshots-baseline/wide/batmanNotAView.png -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/websocket/build/Release/obj.target/bufferutil/src/bufferutil.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udacity/nd1309-work-code/HEAD/Course_Identity_And_Smart_Contracts/SampleToken/node_modules/websocket/build/Release/obj.target/bufferutil/src/bufferutil.o -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/websocket/build/Release/obj.target/validation/src/validation.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/udacity/nd1309-work-code/HEAD/Course_Identity_And_Smart_Contracts/SampleToken/node_modules/websocket/build/Release/obj.target/validation/src/validation.o -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/debug/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "node": true 5 | }, 6 | "rules": { 7 | "no-console": 0, 8 | "no-empty": [1, { "allowEmptyCatch": true }] 9 | }, 10 | "extends": "eslint:recommended" 11 | } 12 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/websocket/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | node-gyp configure build 3 | 4 | clean: 5 | node-gyp clean 6 | 7 | autobahn: 8 | @NODE_PATH=lib node test/autobahn-test-client.js --host=127.0.0.1 --port=9000 9 | 10 | autobahn-server: 11 | @NODE_PATH=lib node test/echo-server.js 12 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/yaeti/lib/Event.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Expose the Event class. 3 | */ 4 | module.exports = _Event; 5 | 6 | 7 | function _Event(type) { 8 | this.type = type; 9 | this.isTrusted = false; 10 | 11 | // Set a flag indicating this is not a DOM Event object 12 | this._yaeti = true; 13 | } 14 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/websocket/build/Release/.deps/Release/bufferutil.node.d: -------------------------------------------------------------------------------- 1 | cmd_Release/bufferutil.node := c++ -bundle -undefined dynamic_lookup -Wl,-no_pie -Wl,-search_paths_first -mmacosx-version-min=10.7 -arch x86_64 -L./Release -stdlib=libc++ -o Release/bufferutil.node Release/obj.target/bufferutil/src/bufferutil.o 2 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/websocket/build/Release/.deps/Release/validation.node.d: -------------------------------------------------------------------------------- 1 | cmd_Release/validation.node := c++ -bundle -undefined dynamic_lookup -Wl,-no_pie -Wl,-search_paths_first -mmacosx-version-min=10.7 -arch x86_64 -L./Release -stdlib=libc++ -o Release/validation.node Release/obj.target/validation/src/validation.o 2 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/solidity/README.md: -------------------------------------------------------------------------------- 1 | # Testing Smart Contracts with Solidity in Truffle 2 | 3 | 1. Check you have Truffle installed and it is the latest version (V5.0.2) 4 | 2. Run `truffle develop` or `sudo truffle develop` 5 | 3. Run `compile` 6 | 4. Run `migrate --reset` 7 | 8 | Play around with the contracts and make some tests. Happy learning -------------------------------------------------------------------------------- /Course_Blockchain_Data/Practice_Block_Data/README.md: -------------------------------------------------------------------------------- 1 | # Block Explorer Exercise 2 | 3 | To use this boilerplate code locally follow this steps: 4 | 5 | 1. Clone or download the project. 6 | 2. Open your project with your favorite IDE. 7 | 3. Run `npm install` to install the dependencies. 8 | 4. Implement your code. 9 | 5. Use `node app.js` to run the application. 10 | -------------------------------------------------------------------------------- /Course_Blockchain_Identity/Practice_Block/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "block_data", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "app.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "crypto-js": "^3.1.9-1" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Course_Blockchain_Identity/Practice_Hashing/README.md: -------------------------------------------------------------------------------- 1 | # Hashing Code Exercise 2 | 3 | To use this boilerplate code locally follow this steps: 4 | 5 | 1. Clone or download the project. 6 | 2. Open your project with your favorite IDE. 7 | 3. Run `npm install` to install the dependencies. 8 | 4. Implement your code. 9 | 5. Use `node app.js` to run the application. 10 | -------------------------------------------------------------------------------- /Course_Blockchain_Identity/Practice_Hashing/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hashing", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "app.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "crypto-js": "^3.1.9-1" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Course_Blockchain_Data/Practice_Block_Data/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "block_expl", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "app.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "blockexplorer": "^1.0.1" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Course_Blockchain_Data/Practice_LevelDB_And_Promises/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "leveldb_exercise", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "app.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "level": "^4.0.0" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Course_Blockchain_Identity/Practice_Block/README.md: -------------------------------------------------------------------------------- 1 | # Practice Block Data Exercise 2 | 3 | 4 | To use this boilerplate code locally follow this steps: 5 | 6 | 1. Clone or download the project. 7 | 2. Open your project with your favorite IDE. 8 | 3. Run `npm install` to install the dependencies. 9 | 4. Implement your code. 10 | 5. Use `node app.js` to run the application. 11 | -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/wct.conf.json: -------------------------------------------------------------------------------- 1 | { 2 | "suites": ["test/unit"], 3 | "plugins": { 4 | "local": { 5 | "browserOptions": { 6 | "chrome": [ 7 | "headless", 8 | "disable-gpu" 9 | ], 10 | "firefox": [ 11 | "-headless" 12 | ] 13 | } 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/debug/src/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Detect Electron renderer process, which is node, but we should 3 | * treat as a browser. 4 | */ 5 | 6 | if (typeof process !== 'undefined' && process.type === 'renderer') { 7 | module.exports = require('./browser.js'); 8 | } else { 9 | module.exports = require('./node.js'); 10 | } 11 | -------------------------------------------------------------------------------- /Course_Blockchain_Data/Project_2_es6_starter_code/Block.js: -------------------------------------------------------------------------------- 1 | /* ===== Block Class ============================== 2 | | Class with a constructor for block | 3 | | ===============================================*/ 4 | 5 | class Block { 6 | constructor(data){ 7 | // Add your Block properties 8 | // Example: this.hash = ""; 9 | } 10 | } 11 | 12 | module.exports.Block = Block; -------------------------------------------------------------------------------- /Course_Blockchain_Data/Practice_Create_Transaction/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "createtransaction", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "bitcoin-core": "^2.0.0" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Course_Blockchain_Data/Practice_LevelDB_And_Promises/README.md: -------------------------------------------------------------------------------- 1 | # LevelDB With Promises Exercise 2 | 3 | To use this boilerplate code locally follow this steps: 4 | 5 | 1. Clone or download the project. 6 | 2. Open your project with your favorite IDE. 7 | 3. Run `npm install` to install the dependencies. 8 | 4. Implement your code. 9 | 5. Use `node app.js` to run the application. 10 | 11 | -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "prpl-server --root build/ --host 0.0.0.0 --https-redirect --bot-proxy https://render-tron.appspot.com/render" 5 | }, 6 | "engines": { 7 | "node": "8.x.x" 8 | }, 9 | "dependencies": { 10 | "prpl-server": "^1.2.0" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/websocket/lib/Validation.fallback.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * UTF-8 Validation Fallback Code originally from: 3 | * ws: a node.js websocket client 4 | * Copyright(c) 2011 Einar Otto Stangvik 5 | * MIT Licensed 6 | */ 7 | 8 | module.exports.Validation = { 9 | isValidUTF8: function() { 10 | return true; 11 | } 12 | }; 13 | -------------------------------------------------------------------------------- /Course_Blockchain_Data/Project_2_es6_starter_code/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "project_2", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "crypto-js": "^3.1.9-1", 13 | "level": "^4.0.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/token/ERC721/ERC721Holder.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | import "./IERC721Receiver.sol"; 4 | 5 | contract ERC721Holder is IERC721Receiver { 6 | function onERC721Received(address, address, uint256, bytes memory) public returns (bytes4) { 7 | return this.onERC721Received.selector; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Course_Blockchain_Web_Services/Practice_RestAPI_Hapi/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rest_api_hapi", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "app.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "crypto-js": "^3.1.9-1", 13 | "hapi": "^17.6.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Course_Blockchain_Identity/Practice_Block/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "block_data", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "crypto-js": { 8 | "version": "3.1.9-1", 9 | "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-3.1.9-1.tgz", 10 | "integrity": "sha1-/aGedh/Ad+Af+/3G6f38WeiAbNg=" 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Course_Blockchain_Identity/Practice_Hashing/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hashing", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "crypto-js": { 8 | "version": "3.1.9-1", 9 | "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-3.1.9-1.tgz", 10 | "integrity": "sha1-/aGedh/Ad+Af+/3G6f38WeiAbNg=" 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Course_Blockchain_Web_Services/Practice_Client_Server_Features/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "client_server", 3 | "version": "1.0.0", 4 | "description": "Client Server exercise with Node.js", 5 | "main": "app.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "crypto-js": "^3.1.9-1" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/typedarray-to-buffer/.airtap.yml: -------------------------------------------------------------------------------- 1 | sauce_connect: true 2 | loopback: airtap.local 3 | browsers: 4 | - name: chrome 5 | version: latest 6 | - name: firefox 7 | version: latest 8 | - name: safari 9 | version: latest 10 | - name: microsoftedge 11 | version: latest 12 | - name: ie 13 | version: latest 14 | - name: iphone 15 | version: latest 16 | -------------------------------------------------------------------------------- /Course_Blockchain_Web_Services/Practice_Client_Server_Features/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "client_server", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "crypto-js": { 8 | "version": "3.1.9-1", 9 | "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-3.1.9-1.tgz", 10 | "integrity": "sha1-/aGedh/Ad+Af+/3G6f38WeiAbNg=" 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Course_Blockchain_Web_Services/Practice_RestAPI_Hapi/Block.js: -------------------------------------------------------------------------------- 1 | /* ===== Block Class ============================== 2 | | Class with a constructor for block | 3 | | ===============================================*/ 4 | 5 | class Block { 6 | constructor(data){ 7 | this.hash = ""; 8 | this.height = 0; 9 | this.body = data; 10 | this.time = new Date().getTime().toString().slice(0,-3); 11 | } 12 | } 13 | 14 | module.exports.Block = Block; -------------------------------------------------------------------------------- /Course_Blockchain_Web_Services/Practice_RestApi_Express/Block.js: -------------------------------------------------------------------------------- 1 | /* ===== Block Class ============================== 2 | | Class with a constructor for block | 3 | | ===============================================*/ 4 | 5 | class Block { 6 | constructor(data){ 7 | this.hash = ""; 8 | this.height = 0; 9 | this.body = data; 10 | this.time = new Date().getTime().toString().slice(0,-3); 11 | } 12 | } 13 | 14 | module.exports.Block = Block; -------------------------------------------------------------------------------- /Course_Blockchain_Web_Services/Practice_RestApi_Express/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rest_api_exp", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "app.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "body-parser": "^1.18.3", 13 | "crypto-js": "^3.1.9-1", 14 | "express": "^4.16.3" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/solidity/contracts/MainContract.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.24; 2 | 3 | contract MainContract { 4 | 5 | uint internal value; 6 | 7 | constructor (uint amount) public { 8 | value = amount; 9 | } 10 | 11 | function deposit (uint amount) public { 12 | value += amount; 13 | } 14 | 15 | function withdraw (uint amount) public { 16 | value -= amount; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/starNotaryv1/README.md: -------------------------------------------------------------------------------- 1 | # Lesson 3. Star Notary V1 2 | 3 | For this you will need to use the latest version of Truffle and Metamask 4 | 5 | - Truffle: Truffle v5.0.2 - a development framework for Ethereum 6 | - Metamask: 5.3.1 7 | 8 | If you need to update truffle to the latest version use: 9 | `npm install -g truffle` 10 | 11 | If you need to update Metamask just delete your Metamask extension and install it again. -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/README.md: -------------------------------------------------------------------------------- 1 | ## How to run this application. 2 | 3 | 1. You need to have installed Git, Node.js and NPM with the latest version. 4 | 2. You will need to install polymer-cli: `sudo npm install -g polymer-cli@latest --unsafe-perm` 5 | 3. Use the command `npm install` to install the dependencies. 6 | 4. You need to have running previously your API project. 7 | 5. Use the command: `npm start` to run the application. -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/starNotaryv2/README.md: -------------------------------------------------------------------------------- 1 | # Lesson 3. Star Notary V2 2 | 3 | For this you will need to use the latest version of Truffle and Metamask 4 | 5 | - Truffle: Truffle v5.0.2 - a development framework for Ethereum 6 | - Metamask: 5.3.1 7 | 8 | If you need to update truffle to the latest version use: 9 | `npm install -g truffle` 10 | 11 | If you need to update Metamask just delete your Metamask extension and install it again. 12 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/Smart_Contracts_With_Solidity/mainContract.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.24; 2 | 3 | contract MainContract { 4 | 5 | uint internal value; 6 | 7 | constructor (uint amount) public { 8 | value = amount; 9 | } 10 | 11 | function deposit (uint amount) public { 12 | value += amount; 13 | } 14 | 15 | function withdraw (uint amount) public { 16 | value -= amount; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/debug/component.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debug", 3 | "repo": "visionmedia/debug", 4 | "description": "small debugging utility", 5 | "version": "2.6.9", 6 | "keywords": [ 7 | "debug", 8 | "log", 9 | "debugger" 10 | ], 11 | "main": "src/browser.js", 12 | "scripts": [ 13 | "src/browser.js", 14 | "src/debug.js" 15 | ], 16 | "dependencies": { 17 | "rauchg/ms.js": "0.7.1" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/websocket/gulpfile.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Dependencies. 3 | */ 4 | var gulp = require('gulp'); 5 | var jshint = require('gulp-jshint'); 6 | 7 | gulp.task('lint', function() { 8 | return gulp.src(['gulpfile.js', 'lib/**/*.js', 'test/**/*.js']) 9 | .pipe(jshint('.jshintrc')) 10 | .pipe(jshint.reporter('jshint-stylish', {verbose: true})) 11 | .pipe(jshint.reporter('fail')); 12 | }); 13 | 14 | gulp.task('default', gulp.series('lint')); 15 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/starNotaryv1/contracts/StarNotary.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.24; 2 | 3 | contract StarNotary { 4 | 5 | string public starName; 6 | address public starOwner; 7 | 8 | event starClaimed(address owner); 9 | 10 | constructor() public { 11 | starName = "Awesome Udacity Star"; 12 | } 13 | 14 | function claimStar() public { 15 | starOwner = msg.sender; 16 | emit starClaimed(msg.sender); 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/starNotaryv1/app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "app", 3 | "version": "1.0.0", 4 | "description": "", 5 | "private": true, 6 | "scripts": { 7 | "build": "webpack", 8 | "dev": "webpack-dev-server" 9 | }, 10 | "devDependencies": { 11 | "copy-webpack-plugin": "^4.6.0", 12 | "webpack": "^4.28.1", 13 | "webpack-cli": "^3.2.1", 14 | "webpack-dev-server": "^3.1.14" 15 | }, 16 | "dependencies": { 17 | "web3": "^1.0.0-beta.37" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/starNotaryv2/app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "app", 3 | "version": "1.0.0", 4 | "description": "", 5 | "private": true, 6 | "scripts": { 7 | "build": "webpack", 8 | "dev": "webpack-dev-server" 9 | }, 10 | "devDependencies": { 11 | "copy-webpack-plugin": "^4.6.0", 12 | "webpack": "^4.28.1", 13 | "webpack-cli": "^3.2.1", 14 | "webpack-dev-server": "^3.1.14" 15 | }, 16 | "dependencies": { 17 | "web3": "^1.0.0-beta.37" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/any-promise/register.d.ts: -------------------------------------------------------------------------------- 1 | import Promise = require('./index'); 2 | 3 | declare function register (module?: string, options?: register.Options): register.Register; 4 | 5 | declare namespace register { 6 | export interface Register { 7 | Promise: typeof Promise; 8 | implementation: string; 9 | } 10 | 11 | export interface Options { 12 | Promise?: typeof Promise; 13 | global?: boolean 14 | } 15 | } 16 | 17 | export = register; 18 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/debug/src/inspector-log.js: -------------------------------------------------------------------------------- 1 | module.exports = inspectorLog; 2 | 3 | // black hole 4 | const nullStream = new (require('stream').Writable)(); 5 | nullStream._write = () => {}; 6 | 7 | /** 8 | * Outputs a `console.log()` to the Node.js Inspector console *only*. 9 | */ 10 | function inspectorLog() { 11 | const stdout = console._stdout; 12 | console._stdout = nullStream; 13 | console.log.apply(console, arguments); 14 | console._stdout = stdout; 15 | } 16 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/starNotaryv1/app/webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const CopyWebpackPlugin = require("copy-webpack-plugin"); 3 | 4 | module.exports = { 5 | entry: "./src/index.js", 6 | output: { 7 | filename: "index.js", 8 | path: path.resolve(__dirname, "dist"), 9 | }, 10 | plugins: [ 11 | new CopyWebpackPlugin([{ from: "./src/index.html", to: "index.html" }]), 12 | ], 13 | devServer: { contentBase: path.join(__dirname, "dist"), compress: true }, 14 | }; 15 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/starNotaryv2/app/webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const CopyWebpackPlugin = require("copy-webpack-plugin"); 3 | 4 | module.exports = { 5 | entry: "./src/index.js", 6 | output: { 7 | filename: "index.js", 8 | path: path.resolve(__dirname, "dist"), 9 | }, 10 | plugins: [ 11 | new CopyWebpackPlugin([{ from: "./src/index.html", to: "index.html" }]), 12 | ], 13 | devServer: { contentBase: path.join(__dirname, "dist"), compress: true }, 14 | }; 15 | -------------------------------------------------------------------------------- /Course_Blockchain_Web_Services/Practice_RestAPI_Hapi/README.md: -------------------------------------------------------------------------------- 1 | # Hapi.js Exercise with Node.js 2 | 3 | In this exercise you will practice a creation of a web service that respond with the block hash. 4 | 5 | ## Steps to follow 6 | 7 | 1. Clone the repository to your local computer. 8 | 2. Open the terminal and install the packages: `npm install`. 9 | 3. Open the file `app.js`and `BlockController.js` and start coding. 10 | 4. Run your application `node app.js` 11 | 5. Test your Endpoints with Curl or Postman. 12 | 6. Answer the quiz in the classroom. 13 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/token/ERC721/IERC721Full.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | import "./IERC721.sol"; 4 | import "./IERC721Enumerable.sol"; 5 | import "./IERC721Metadata.sol"; 6 | 7 | /** 8 | * @title ERC-721 Non-Fungible Token Standard, full implementation interface 9 | * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md 10 | */ 11 | contract IERC721Full is IERC721, IERC721Enumerable, IERC721Metadata { 12 | // solhint-disable-previous-line no-empty-blocks 13 | } 14 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/websocket/binding.gyp: -------------------------------------------------------------------------------- 1 | { 2 | 'targets': [ 3 | { 4 | 'target_name': 'validation', 5 | 'include_dirs': [" 9 | 10 | Options: 11 | 12 | -h, --help output usage information 13 | -V, --version output the version number 14 | ``` 15 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/websocket/lib/websocket.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 'server' : require('./WebSocketServer'), 3 | 'client' : require('./WebSocketClient'), 4 | 'router' : require('./WebSocketRouter'), 5 | 'frame' : require('./WebSocketFrame'), 6 | 'request' : require('./WebSocketRequest'), 7 | 'connection' : require('./WebSocketConnection'), 8 | 'w3cwebsocket' : require('./W3CWebSocket'), 9 | 'deprecation' : require('./Deprecation'), 10 | 'version' : require('./version') 11 | }; 12 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/solidity/contracts/EnumsContract.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.24; 2 | 3 | contract EnumsContract { 4 | 5 | // Create an Enumeration 6 | enum names {Joe, Brandy, Rachna, Jessica} 7 | 8 | // get the value at specified index 9 | function getNames(uint8 arg) public pure returns (string memory){ 10 | if(arg == uint8(names.Joe)) return "Joe"; 11 | if(arg == uint8(names.Brandy)) return "Brandy"; 12 | if(arg == uint8(names.Rachna)) return "Rachna"; 13 | if(arg == uint8(names.Jessica)) return "Jessica"; 14 | } 15 | } -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "My App", 3 | "short_name": "My App", 4 | "description": "My App description", 5 | "start_url": "/", 6 | "display": "standalone", 7 | "theme_color": "#3f51b5", 8 | "background_color": "#3f51b5", 9 | "icons": [ 10 | { 11 | "src": "images/manifest/icon-192x192.png", 12 | "sizes": "192x192", 13 | "type": "image/png" 14 | }, 15 | { 16 | "src": "images/manifest/icon-512x512.png", 17 | "sizes": "512x512", 18 | "type": "image/png" 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/nan/tools/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "1to2", 3 | "version": "1.0.0", 4 | "description": "NAN 1 -> 2 Migration Script", 5 | "main": "1to2.js", 6 | "repository": { 7 | "type": "git", 8 | "url": "git://github.com/nodejs/nan.git" 9 | }, 10 | "contributors": [ 11 | "Benjamin Byholm (https://github.com/kkoopa/)", 12 | "Mathias Küsel (https://github.com/mathiask88/)" 13 | ], 14 | "dependencies": { 15 | "glob": "~5.0.10", 16 | "commander": "~2.8.1" 17 | }, 18 | "license": "MIT" 19 | } 20 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/file-uri-to-path/History.md: -------------------------------------------------------------------------------- 1 | 2 | 1.0.0 / 2017-07-06 3 | ================== 4 | 5 | * update "mocha" to v3 6 | * fixed unicode URI decoding (#6) 7 | * add typings for Typescript 8 | * README: use SVG Travis-CI badge 9 | * add LICENSE file (MIT) 10 | * add .travis.yml file (testing Node.js 0.8 through 8 currently) 11 | * add README.md file 12 | 13 | 0.0.2 / 2014-01-27 14 | ================== 15 | 16 | * index: invert the path separators on Windows 17 | 18 | 0.0.1 / 2014-01-27 19 | ================== 20 | 21 | * initial commit 22 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/Smart_Contracts_With_Solidity/enumsContract.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.24; 2 | 3 | contract EnumsContract { 4 | 5 | // Create an Enumeration 6 | enum names {Joe, Brandy, Rachna, Jessica} 7 | 8 | // get the value at specified index 9 | function getNames(uint8 arg) public pure returns (string memory){ 10 | if(arg == uint8(names.Joe)) return "Joe"; 11 | if(arg == uint8(names.Brandy)) return "Brandy"; 12 | if(arg == uint8(names.Rachna)) return "Rachna"; 13 | if(arg == uint8(names.Jessica)) return "Jessica"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/typedarray-to-buffer/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - lts/* 4 | addons: 5 | sauce_connect: true 6 | hosts: 7 | - airtap.local 8 | env: 9 | global: 10 | - secure: i51rE9rZGHbcZWlL58j3H1qtL23OIV2r0X4TcQKNI3pw2mubdHFJmfPNNO19ItfReu8wwQMxOehKamwaNvqMiKWyHfn/QcThFQysqzgGZ6AgnUbYx9od6XFNDeWd1sVBf7QBAL07y7KWlYGWCwFwWjabSVySzQhEBdisPcskfkI= 11 | - secure: BKq6/5z9LK3KDkTjs7BGeBZ1KsWgz+MsAXZ4P64NSeVGFaBdXU45+ww1mwxXFt5l22/mhyOQZfebQl+kGVqRSZ+DEgQeCymkNZ6CD8c6w6cLuOJXiXwuu/cDM2DD0tfGeu2YZC7yEikP7BqEFwH3D324rRzSGLF2RSAAwkOI7bE= 12 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/token/ERC721/IERC721Metadata.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | import "./IERC721.sol"; 4 | 5 | /** 6 | * @title ERC-721 Non-Fungible Token Standard, optional metadata extension 7 | * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md 8 | */ 9 | contract IERC721Metadata is IERC721 { 10 | function name() external view returns (string memory); 11 | function symbol() external view returns (string memory); 12 | function tokenURI(uint256 tokenId) external view returns (string memory); 13 | } 14 | -------------------------------------------------------------------------------- /Course_Blockchain_Web_Services/Practice_Client_Server_Features/README.md: -------------------------------------------------------------------------------- 1 | # Client-Server Exercise with Node.js 2 | 3 | In this exercise you will practice a creation of a web service that respond with the block hash. 4 | 5 | ## Steps to follow 6 | 7 | 1. Clone the repository to your local computer. 8 | 2. Open the terminal and install the packages: `npm install`. 9 | 3. Open the file `app.js` and start coding. 10 | 4. Run your application `node app.js` 11 | 5. Go to yur browser and type: `http://localhost:8080/` 12 | 6. Get the hash generated in your browser and answer the quiz in your classroom. 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/websocket/lib/BufferUtil.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copied from: 3 | * ws: a node.js websocket client 4 | * Copyright(c) 2011 Einar Otto Stangvik 5 | * MIT Licensed 6 | */ 7 | 8 | try { 9 | module.exports = require('../build/Release/bufferutil'); 10 | } catch (e) { try { 11 | module.exports = require('../build/default/bufferutil'); 12 | } catch (e) { try { 13 | module.exports = require('./BufferUtil.fallback'); 14 | } catch (e) { 15 | console.error('bufferutil.node seems to not have been built. Run npm install.'); 16 | throw e; 17 | }}} 18 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/yaeti/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "bitwise": false, 3 | "curly": true, 4 | "eqeqeq": true, 5 | "forin": true, 6 | "freeze": true, 7 | "latedef": "function", 8 | "noarg": true, 9 | "nonbsp": true, 10 | "nonew": true, 11 | "plusplus": false, 12 | "undef": true, 13 | "unused": true, 14 | "strict": false, 15 | "maxparams": 6, 16 | "maxdepth": 4, 17 | "maxstatements": false, 18 | "maxlen": 200, 19 | "browser": true, 20 | "browserify": true, 21 | "devel": true, 22 | "jquery": false, 23 | "mocha": true, 24 | "node": false, 25 | "shelljs": false, 26 | "worker": false 27 | } 28 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/Smart_Contracts_With_Solidity/modifiers.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.25; 2 | 3 | contract ModifiersContract { 4 | // State variable 5 | address owner; 6 | uint value; 7 | modifier ownerOnly { 8 | if(owner == msg.sender) { 9 | _; 10 | } else { 11 | revert(); 12 | } 13 | } 14 | 15 | function anyoneCanCall () public returns (bool) { 16 | value = 100; 17 | return true; 18 | } 19 | 20 | function onlyOwnerCanCall () ownerOnly public returns (bool) { 21 | value = 100; 22 | return true; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/contracts/SampleToken.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.24; 2 | 3 | import "../node_modules/openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; 4 | import "../node_modules/openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol"; 5 | 6 | contract SampleToken is ERC20Detailed, ERC20 { 7 | 8 | constructor(string memory _name, string memory _symbol, uint8 _decimals, uint _initialSupply) 9 | ERC20Detailed(_name, _symbol, _decimals) public { 10 | require(_initialSupply > 0, "INITIAL_SUPPLY has to be greater than 0"); 11 | _mint(msg.sender, _initialSupply); 12 | } 13 | } -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/token/ERC721/ERC721Burnable.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | import "./ERC721.sol"; 4 | 5 | /** 6 | * @title ERC721 Burnable Token 7 | * @dev ERC721 Token that can be irreversibly burned (destroyed). 8 | */ 9 | contract ERC721Burnable is ERC721 { 10 | /** 11 | * @dev Burns a specific ERC721 token. 12 | * @param tokenId uint256 id of the ERC721 token to be burned. 13 | */ 14 | function burn(uint256 tokenId) public { 15 | require(_isApprovedOrOwner(msg.sender, tokenId)); 16 | _burn(tokenId); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Course_Blockchain_Data/Practice_Private_Blockchain_Code_Session/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "practice_private_blockchain_code_session", 3 | "version": "1.0.0", 4 | "description": "Blockchain has the potential to change the way that the world approaches data. Develop Blockchain skills by understanding the data model behind Blockchain by developing your own simplified private blockchain.", 5 | "main": "simpleChain.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "crypto-js": "^3.1.9-1", 13 | "level": "^4.0.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/introspection/IERC165.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | /** 4 | * @title IERC165 5 | * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md 6 | */ 7 | interface IERC165 { 8 | /** 9 | * @notice Query if a contract implements an interface 10 | * @param interfaceId The interface identifier, as specified in ERC-165 11 | * @dev Interface identification is specified in ERC-165. This function 12 | * uses less than 30,000 gas. 13 | */ 14 | function supportsInterface(bytes4 interfaceId) external view returns (bool); 15 | } 16 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/websocket/lib/Validation.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * UTF-8 Validation Code originally from: 3 | * ws: a node.js websocket client 4 | * Copyright(c) 2011 Einar Otto Stangvik 5 | * MIT Licensed 6 | */ 7 | 8 | try { 9 | module.exports = require('../build/Release/validation'); 10 | } catch (e) { try { 11 | module.exports = require('../build/default/validation'); 12 | } catch (e) { try { 13 | module.exports = require('./Validation.fallback'); 14 | } catch (e) { 15 | console.error('validation.node seems not to have been built. Run npm install.'); 16 | throw e; 17 | }}} 18 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/token/ERC721/IERC721Enumerable.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | import "./IERC721.sol"; 4 | 5 | /** 6 | * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension 7 | * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md 8 | */ 9 | contract IERC721Enumerable is IERC721 { 10 | function totalSupply() public view returns (uint256); 11 | function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256 tokenId); 12 | 13 | function tokenByIndex(uint256 index) public view returns (uint256); 14 | } 15 | -------------------------------------------------------------------------------- /Course_Blockchain_Identity/Practice_Block/app.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Importing the Block class 3 | */ 4 | // 5 | const BlockClass = require('./block.js'); 6 | 7 | /** 8 | * Creating a block object 9 | */ 10 | const block = new BlockClass.Block("Test Block"); 11 | 12 | // Generating the block hash 13 | block.generateHash().then((result) => { 14 | console.log(`Block Hash: ${result.hash}`); 15 | console.log(`Block: ${JSON.stringify(result)}`); 16 | }).catch((error) => {console.log(error)}); 17 | 18 | /** 19 | * Step 3: Run the application in node.js 20 | * 21 | */ 22 | 23 | // From the terminal: cd into Project folder 24 | // From the terminal: Run node app.js to run the code -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/contracts/Migrations.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.21 <0.6.0; 2 | 3 | contract Migrations { 4 | address public owner; 5 | uint public last_completed_migration; 6 | 7 | constructor() public { 8 | owner = msg.sender; 9 | } 10 | 11 | modifier restricted() { 12 | if (msg.sender == owner) _; 13 | } 14 | 15 | function setCompleted(uint completed) public restricted { 16 | last_completed_migration = completed; 17 | } 18 | 19 | function upgrade(address new_address) public restricted { 20 | Migrations upgraded = Migrations(new_address); 21 | upgraded.setCompleted(last_completed_migration); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/solidity/contracts/Migrations.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.21 <0.6.0; 2 | 3 | contract Migrations { 4 | address public owner; 5 | uint public last_completed_migration; 6 | 7 | constructor() public { 8 | owner = msg.sender; 9 | } 10 | 11 | modifier restricted() { 12 | if (msg.sender == owner) _; 13 | } 14 | 15 | function setCompleted(uint completed) public restricted { 16 | last_completed_migration = completed; 17 | } 18 | 19 | function upgrade(address new_address) public restricted { 20 | Migrations upgraded = Migrations(new_address); 21 | upgraded.setCompleted(last_completed_migration); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/solidity/contracts/TypesConversion.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.24; 2 | 3 | contract TypesConversion { 4 | uint8 a = 255; // a is 1 bytes unsigned integer 5 | uint ownerInitialBalance; // uint256 6 | 7 | function conversion ( ) public { 8 | int b; // b is 32 bytes signed integer...256 bits 9 | b = a; // Compilation successful, since a 8bytes type can easily fit in a 32bytes type 10 | // a = b; // Fails compilation as the maximum value of int256 cannot be accomodated in uint8 11 | a = uint8(b); // Explicit type coversion...converting a 32bytes to 1bytes 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Course_Blockchain_Data/Practice_Block_Data/app.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Importing BlockExplorer API to search Block Data 3 | */ 4 | const be = require('blockexplorer'); 5 | 6 | /** 7 | * Explore Block Data function 8 | * @param {*} index 9 | * 10 | * Start by requesting the hash then request the block and use console.log() 11 | * 12 | */ 13 | function getBlock(index) { 14 | //add your code here 15 | 16 | } 17 | 18 | /** 19 | * Function to execute the `getBlock(index)` function 20 | * Nothing to implement here. 21 | */ 22 | 23 | (function theLoop (i) { 24 | setTimeout(function () { 25 | getBlock(i); 26 | i++; 27 | if (i < 3) theLoop(i); 28 | }, 3000); 29 | })(0); -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/file-uri-to-path/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | 3 | language: node_js 4 | 5 | node_js: 6 | - "0.8" 7 | - "0.10" 8 | - "0.12" 9 | - "1" 10 | - "2" 11 | - "3" 12 | - "4" 13 | - "5" 14 | - "6" 15 | - "7" 16 | - "8" 17 | 18 | install: 19 | - PATH="`npm bin`:`npm bin -g`:$PATH" 20 | # Node 0.8 comes with a too obsolete npm 21 | - if [[ "`node --version`" =~ ^v0\.8\. ]]; then npm install -g npm@1.4.28 ; fi 22 | # Install dependencies and build 23 | - npm install 24 | 25 | script: 26 | # Output useful info for debugging 27 | - node --version 28 | - npm --version 29 | # Run tests 30 | - npm test 31 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/Smart_Contracts_With_Solidity/typeConversionContract.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.24; 2 | 3 | contract TypesConversion { 4 | uint8 a = 255; // a is 1 bytes unsigned integer 5 | uint ownerInitialBalance; // uint256 6 | 7 | function conversion ( ) public { 8 | int b; // b is 32 bytes signed integer...256 bits 9 | b = a; // Compilation successful, since a 8bytes type can easily fit in a 32bytes type 10 | // a = b; // Fails compilation as the maximum value of int256 cannot be accomodated in uint8 11 | a = uint8(b); // Explicit type coversion...converting a 32bytes to 1bytes 12 | } 13 | } -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/is-typedarray/README.md: -------------------------------------------------------------------------------- 1 | # is-typedarray [![locked](http://badges.github.io/stability-badges/dist/locked.svg)](http://github.com/badges/stability-badges) 2 | 3 | Detect whether or not an object is a 4 | [Typed Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays). 5 | 6 | ## Usage 7 | 8 | [![NPM](https://nodei.co/npm/is-typedarray.png)](https://nodei.co/npm/is-typedarray/) 9 | 10 | ### isTypedArray(array) 11 | 12 | Returns `true` when array is a Typed Array, and `false` when it is not. 13 | 14 | ## License 15 | 16 | MIT. See [LICENSE.md](http://github.com/hughsk/is-typedarray/blob/master/LICENSE.md) for details. 17 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/any-promise/register-shim.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | module.exports = require('./loader')(window, loadImplementation) 3 | 4 | /** 5 | * Browser specific loadImplementation. Always uses `window.Promise` 6 | * 7 | * To register a custom implementation, must register with `Promise` option. 8 | */ 9 | function loadImplementation(){ 10 | if(typeof window.Promise === 'undefined'){ 11 | throw new Error("any-promise browser requires a polyfill or explicit registration"+ 12 | " e.g: require('any-promise/register/bluebird')") 13 | } 14 | return { 15 | Promise: window.Promise, 16 | implementation: 'window.Promise' 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/starNotaryv1/contracts/Migrations.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.21 <0.6.0; 2 | 3 | contract Migrations { 4 | address public owner; 5 | uint public last_completed_migration; 6 | 7 | constructor() public { 8 | owner = msg.sender; 9 | } 10 | 11 | modifier restricted() { 12 | if (msg.sender == owner) _; 13 | } 14 | 15 | function setCompleted(uint completed) public restricted { 16 | last_completed_migration = completed; 17 | } 18 | 19 | function upgrade(address new_address) public restricted { 20 | Migrations upgraded = Migrations(new_address); 21 | upgraded.setCompleted(last_completed_migration); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/starNotaryv2/contracts/Migrations.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.21 <0.6.0; 2 | 3 | contract Migrations { 4 | address public owner; 5 | uint public last_completed_migration; 6 | 7 | constructor() public { 8 | owner = msg.sender; 9 | } 10 | 11 | modifier restricted() { 12 | if (msg.sender == owner) _; 13 | } 14 | 15 | function setCompleted(uint completed) public restricted { 16 | last_completed_migration = completed; 17 | } 18 | 19 | function upgrade(address new_address) public restricted { 20 | Migrations upgraded = Migrations(new_address); 21 | upgraded.setCompleted(last_completed_migration); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/yaeti/gulpfile.js: -------------------------------------------------------------------------------- 1 | var 2 | /** 3 | * Dependencies. 4 | */ 5 | gulp = require('gulp'), 6 | jscs = require('gulp-jscs'), 7 | jshint = require('gulp-jshint'), 8 | stylish = require('gulp-jscs-stylish'); 9 | 10 | 11 | gulp.task('lint', function () { 12 | var src = ['gulpfile.js', 'index.js', 'lib/**/*.js']; 13 | 14 | return gulp.src(src) 15 | .pipe(jshint('.jshintrc')) // Enforce good practics. 16 | .pipe(jscs('.jscsrc')) // Enforce style guide. 17 | .pipe(stylish.combineWithHintResults()) 18 | .pipe(jshint.reporter('jshint-stylish', {verbose: true})) 19 | .pipe(jshint.reporter('fail')); 20 | }); 21 | 22 | 23 | gulp.task('default', gulp.task('lint')); 24 | -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/service-worker.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright (c) 2016 The Polymer Project Authors. All rights reserved. 4 | * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt 5 | * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 6 | * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt 7 | * Code distributed by Google as part of the polymer project is also 8 | * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt 9 | */ 10 | 11 | console.info('Service worker disabled for development, will be generated at build time.'); 12 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/solidity/contracts/MappingsContract.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.24; 2 | 3 | contract MappingsContract { 4 | // Creates in Storage 5 | mapping(string => string) relations; 6 | 7 | // Add a relation 8 | function addRelation(string memory name, string memory relation) public { 9 | // Store the relation 10 | relations[name] = relation; 11 | } 12 | 13 | // Returns a Relation 14 | function getRelation(string memory name) public view returns (string memory){ 15 | return relations[name]; 16 | } 17 | 18 | // Remove the key value pair from the mapping 19 | function removeRelation(string memory name) public { 20 | delete(relations[name]); 21 | } 22 | } -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/Smart_Contracts_With_Solidity/mappingContract.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.24; 2 | 3 | contract MappingsContract { 4 | // Creates in Storage 5 | mapping(string => string) relations; 6 | 7 | // Add a relation 8 | function addRelation(string memory name, string memory relation) public { 9 | // Store the relation 10 | relations[name] = relation; 11 | } 12 | 13 | // Returns a Relation 14 | function getRelation(string memory name) public view returns (string memory){ 15 | return relations[name]; 16 | } 17 | 18 | // Remove the key value pair from the mapping 19 | function removeRelation(string memory name) public { 20 | delete(relations[name]); 21 | } 22 | } -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/token/ERC20/ERC20Mintable.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | import "./ERC20.sol"; 4 | import "../../access/roles/MinterRole.sol"; 5 | 6 | /** 7 | * @title ERC20Mintable 8 | * @dev ERC20 minting logic 9 | */ 10 | contract ERC20Mintable is ERC20, MinterRole { 11 | /** 12 | * @dev Function to mint tokens 13 | * @param to The address that will receive the minted tokens. 14 | * @param value The amount of tokens to mint. 15 | * @return A boolean that indicates if the operation was successful. 16 | */ 17 | function mint(address to, uint256 value) public onlyMinter returns (bool) { 18 | _mint(to, value); 19 | return true; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/token/ERC721/ERC721Mintable.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | import "./ERC721.sol"; 4 | import "../../access/roles/MinterRole.sol"; 5 | 6 | /** 7 | * @title ERC721Mintable 8 | * @dev ERC721 minting logic 9 | */ 10 | contract ERC721Mintable is ERC721, MinterRole { 11 | /** 12 | * @dev Function to mint tokens 13 | * @param to The address that will receive the minted tokens. 14 | * @param tokenId The token id to mint. 15 | * @return A boolean that indicates if the operation was successful. 16 | */ 17 | function mint(address to, uint256 tokenId) public onlyMinter returns (bool) { 18 | _mint(to, tokenId); 19 | return true; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/token/ERC721/ERC721Full.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | import "./ERC721.sol"; 4 | import "./ERC721Enumerable.sol"; 5 | import "./ERC721Metadata.sol"; 6 | 7 | /** 8 | * @title Full ERC721 Token 9 | * This implementation includes all the required and some optional functionality of the ERC721 standard 10 | * Moreover, it includes approve all functionality using operator terminology 11 | * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md 12 | */ 13 | contract ERC721Full is ERC721, ERC721Enumerable, ERC721Metadata { 14 | constructor (string memory name, string memory symbol) public ERC721Metadata(name, symbol) { 15 | // solhint-disable-previous-line no-empty-blocks 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/crowdsale/distribution/RefundablePostDeliveryCrowdsale.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | import "./RefundableCrowdsale.sol"; 4 | import "./PostDeliveryCrowdsale.sol"; 5 | 6 | 7 | /** 8 | * @title RefundablePostDeliveryCrowdsale 9 | * @dev Extension of RefundableCrowdsale contract that only delivers the tokens 10 | * once the crowdsale has closed and the goal met, preventing refunds to be issued 11 | * to token holders. 12 | */ 13 | contract RefundablePostDeliveryCrowdsale is RefundableCrowdsale, PostDeliveryCrowdsale { 14 | function withdrawTokens(address beneficiary) public { 15 | require(finalized()); 16 | require(goalReached()); 17 | 18 | super.withdrawTokens(beneficiary); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/token/ERC20/ERC20Capped.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | import "./ERC20Mintable.sol"; 4 | 5 | /** 6 | * @title Capped token 7 | * @dev Mintable token with a token cap. 8 | */ 9 | contract ERC20Capped is ERC20Mintable { 10 | uint256 private _cap; 11 | 12 | constructor (uint256 cap) public { 13 | require(cap > 0); 14 | _cap = cap; 15 | } 16 | 17 | /** 18 | * @return the cap for the token minting. 19 | */ 20 | function cap() public view returns (uint256) { 21 | return _cap; 22 | } 23 | 24 | function _mint(address account, uint256 value) internal { 25 | require(totalSupply().add(value) <= _cap); 26 | super._mint(account, value); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Course_Blockchain_Web_Services/Practice_RestAPI_Hapi/app.js: -------------------------------------------------------------------------------- 1 | const Hapi = require('hapi'); 2 | 3 | /** 4 | * Class Definition for the REST API 5 | */ 6 | class BlockAPI { 7 | 8 | /** 9 | * Constructor that allows initialize the class 10 | */ 11 | constructor() { 12 | this.server = Hapi.Server({ 13 | port: 3000, 14 | host: 'localhost' 15 | }); 16 | this.initControllers(); 17 | this.start(); 18 | } 19 | 20 | /** 21 | * Initilization of all the controllers 22 | */ 23 | initControllers() { 24 | require("./BlockController.js")(this.server); 25 | } 26 | 27 | async start() { 28 | await this.server.start(); 29 | console.log(`Server running at: ${this.server.info.uri}`); 30 | } 31 | 32 | } 33 | 34 | new BlockAPI(); -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/solidity/contracts/BasicDataType.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.24; 2 | 3 | contract BasicDataType { 4 | 5 | uint8 a = 255; // 1 bytes unsigned integer 6 | address public owner; // Address types variable, called owner 7 | bool public flag = true; 8 | uint ownerInitialBalance; // uint type variable 9 | 10 | // Function takes in an address, and returns the balance of this address 11 | function test (address addr) public returns (uint) { 12 | owner = addr; 13 | ownerInitialBalance = owner.balance; 14 | // if(1){ } will not compile 15 | if (1 > 0) { 16 | // This will work because expression evaluates to bool 17 | // Do something 18 | } 19 | return ownerInitialBalance; 20 | } 21 | } -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/starNotaryv2/app/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | StarNotary Token DAPP 5 | 6 | 12 | 13 |

StarNotary Token DAPP

14 | 15 |
16 | 17 |
18 |

Create a Star

19 |
20 |
21 |

22 |

23 |
24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-api/blockController.js: -------------------------------------------------------------------------------- 1 | const SHA256 = require('crypto-js/sha256'); 2 | 3 | class BlockController { 4 | 5 | constructor(app) { 6 | this.app = app; 7 | this.getBlockHash(); 8 | } 9 | 10 | 11 | getBlockHash() { 12 | this.app.post("/api/utilityblockhash", (req, res) => { 13 | if(req.body.height) { 14 | 15 | let hash = SHA256(JSON.stringify({height:req.body.height, body: req.body.body})).toString(); 16 | return res.status(200).json(hash); 17 | 18 | } else { 19 | return res.status(500).send("Check the Body Parameter!"); 20 | } 21 | }); 22 | } 23 | 24 | 25 | } 26 | 27 | module.exports = (app) => { return new BlockController(app);} -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/token/ERC721/ERC721Pausable.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | import "./ERC721.sol"; 4 | import "../../lifecycle/Pausable.sol"; 5 | 6 | /** 7 | * @title ERC721 Non-Fungible Pausable token 8 | * @dev ERC721 modified with pausable transfers. 9 | **/ 10 | contract ERC721Pausable is ERC721, Pausable { 11 | function approve(address to, uint256 tokenId) public whenNotPaused { 12 | super.approve(to, tokenId); 13 | } 14 | 15 | function setApprovalForAll(address to, bool approved) public whenNotPaused { 16 | super.setApprovalForAll(to, approved); 17 | } 18 | 19 | function transferFrom(address from, address to, uint256 tokenId) public whenNotPaused { 20 | super.transferFrom(from, to, tokenId); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/Smart_Contracts_With_Solidity/basicDataTypesContract.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.24; 2 | 3 | contract BasicDataType { 4 | 5 | uint8 a = 255; // 1 bytes unsigned integer 6 | address public owner; // Address types variable, called owner 7 | bool public flag = true; 8 | uint ownerInitialBalance; // uint type variable 9 | 10 | // Function takes in an address, and returns the balance of this address 11 | function test (address addr) public returns (uint) { 12 | owner = addr; 13 | ownerInitialBalance = owner.balance; 14 | // if(1){ } will not compile 15 | if (1 > 0) { 16 | // This will work because expression evaluates to bool 17 | // Do something 18 | } 19 | return ownerInitialBalance; 20 | } 21 | } -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/file-uri-to-path/test/test.js: -------------------------------------------------------------------------------- 1 | 2 | var sep = require('path').sep || '/'; 3 | var assert = require('assert'); 4 | var uri2path = require('../'); 5 | var tests = require('./tests.json'); 6 | 7 | describe('file-uri-to-path', function () { 8 | 9 | Object.keys(tests).forEach(function (uri) { 10 | 11 | // the test cases were generated from Windows' PathCreateFromUrlA() function. 12 | // On Unix, we have to replace the path separator with the Unix one instead of 13 | // the Windows one. 14 | var expected = tests[uri].replace(/\\/g, sep); 15 | 16 | it('should convert ' + JSON.stringify(uri) + ' to ' + JSON.stringify(expected), 17 | function () { 18 | var actual = uri2path(uri); 19 | assert.equal(actual, expected); 20 | }); 21 | 22 | }); 23 | 24 | }); 25 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/drafts/ERC1046/TokenMetadata.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | import "../../token/ERC20/IERC20.sol"; 4 | 5 | /** 6 | * @title ERC-1047 Token Metadata 7 | * @dev See https://eips.ethereum.org/EIPS/eip-1046 8 | * @dev tokenURI must respond with a URI that implements https://eips.ethereum.org/EIPS/eip-1047 9 | */ 10 | contract ERC20TokenMetadata is IERC20 { 11 | function tokenURI() external view returns (string memory); 12 | } 13 | 14 | contract ERC20WithMetadata is ERC20TokenMetadata { 15 | string private _tokenURI; 16 | 17 | constructor (string memory tokenURI) public { 18 | _tokenURI = tokenURI; 19 | } 20 | 21 | function tokenURI() external view returns (string memory) { 22 | return _tokenURI; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Course_Blockchain_Web_Services/Practice_Client_Server_Features/app.js: -------------------------------------------------------------------------------- 1 | 2 | // Http library 3 | const http = require('http'); 4 | 5 | //Step 1. Import crypto-js/sha256 6 | 7 | 8 | // Http port 9 | const port = 8080; 10 | 11 | //Mock Data 12 | var blocks = []; 13 | let block_1 = {"height":"0","body":"Udacity Blockchain Developer", "time": 1538509789}; 14 | let block_2 = {"height":"1","body":"Udacity Blockchain Developer Rock!", "time": 1538509789}; 15 | blocks.push(block_1); 16 | blocks.push(block_2); 17 | 18 | //Step 2. Configure web service 19 | /** 20 | * Take the block_2 data from the array "blocks" and generate the hash to be written into the response. 21 | */ 22 | //Add your code here 23 | 24 | 25 | 26 | // Notify console 27 | console.log("Web Server started on port 8080\nhttp://localhost:"+port); 28 | // Start server with http port 29 | app.listen(port); -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-api/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "udacity-wallet", 3 | "version": "1.0.0", 4 | "description": "Udacity wallet is client wallet api.", 5 | "main": "app.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [ 10 | "Udacity", 11 | "Wallet", 12 | "Bitcoin", 13 | "client" 14 | ], 15 | "author": "Jose R. Perera Morales", 16 | "license": "ISC", 17 | "dependencies": { 18 | "@types/bitcoinjs-lib": "^4.0.0", 19 | "bitcoin-core": "^2.0.0", 20 | "bitcoinjs-lib": "^4.0.2", 21 | "bitcoinjs-message": "^2.0.0", 22 | "body-parser": "^1.18.3", 23 | "cors": "^2.8.5", 24 | "crypto-js": "^3.1.9-1", 25 | "express": "^4.16.4", 26 | "hex2ascii": "0.0.3", 27 | "level": "^4.0.0", 28 | "morgan": "^1.9.1" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/payment/escrow/ConditionalEscrow.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | import "./Escrow.sol"; 4 | 5 | /** 6 | * @title ConditionalEscrow 7 | * @dev Base abstract escrow to only allow withdrawal if a condition is met. 8 | * @dev Intended usage: See Escrow.sol. Same usage guidelines apply here. 9 | */ 10 | contract ConditionalEscrow is Escrow { 11 | /** 12 | * @dev Returns whether an address is allowed to withdraw their funds. To be 13 | * implemented by derived contracts. 14 | * @param payee The destination address of the funds. 15 | */ 16 | function withdrawalAllowed(address payee) public view returns (bool); 17 | 18 | function withdraw(address payable payee) public { 19 | require(withdrawalAllowed(payee)); 20 | super.withdraw(payee); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Github Repository for Blockchain ND 2 | 3 | Welcome to your Github repository for the Blockchain ND, in this repository you will find the boilerplate code for all the code exercises and code sessions. 4 | 5 | We are still working on this repository so if you find that a piece of code is missing please let us know submitting an issue using the waffle board: https://waffle.io/udacity/blockchain-nanodegree-issues. 6 | 7 | The repository is divided in Courses and the projects or code sessions that is being use in each Course. 8 | 9 | ## How to use the project? 10 | 11 | To use this boilerplate code locally follow this steps: 12 | 13 | 1. Clone or download the Github Repository. 14 | 2. Open your project with your favorite IDE. 15 | 3. Run `npm install` to install the dependencies. 16 | 4. Implement your code. 17 | 5. Use `node app.js` to run the application. 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/file-uri-to-path/test/tests.json: -------------------------------------------------------------------------------- 1 | { 2 | "file://host/path": "\\\\host\\path", 3 | "file://localhost/etc/fstab": "\\etc\\fstab", 4 | "file:///etc/fstab": "\\etc\\fstab", 5 | "file:///c:/WINDOWS/clock.avi": "c:\\WINDOWS\\clock.avi", 6 | "file://localhost/c|/WINDOWS/clock.avi": "c:\\WINDOWS\\clock.avi", 7 | "file:///c|/WINDOWS/clock.avi": "c:\\WINDOWS\\clock.avi", 8 | "file://localhost/c:/WINDOWS/clock.avi": "c:\\WINDOWS\\clock.avi", 9 | "file://hostname/path/to/the%20file.txt": "\\\\hostname\\path\\to\\the file.txt", 10 | "file:///c:/path/to/the%20file.txt": "c:\\path\\to\\the file.txt", 11 | "file:///C:/Documents%20and%20Settings/davris/FileSchemeURIs.doc": "C:\\Documents and Settings\\davris\\FileSchemeURIs.doc", 12 | "file:///C:/caf%C3%A9/%C3%A5r/d%C3%BCnn/%E7%89%9B%E9%93%83/Ph%E1%BB%9F/%F0%9F%98%B5.exe": "C:\\café\\år\\dünn\\牛铃\\Phở\\😵.exe" 13 | } 14 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/token/ERC20/ERC20Burnable.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | import "./ERC20.sol"; 4 | 5 | /** 6 | * @title Burnable Token 7 | * @dev Token that can be irreversibly burned (destroyed). 8 | */ 9 | contract ERC20Burnable is ERC20 { 10 | /** 11 | * @dev Burns a specific amount of tokens. 12 | * @param value The amount of token to be burned. 13 | */ 14 | function burn(uint256 value) public { 15 | _burn(msg.sender, value); 16 | } 17 | 18 | /** 19 | * @dev Burns a specific amount of tokens from the target address and decrements allowance 20 | * @param from address The address which you want to send tokens from 21 | * @param value uint256 The amount of token to be burned 22 | */ 23 | function burnFrom(address from, uint256 value) public { 24 | _burnFrom(from, value); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/typedarray-to-buffer/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Convert a typed array to a Buffer without a copy 3 | * 4 | * Author: Feross Aboukhadijeh 5 | * License: MIT 6 | * 7 | * `npm install typedarray-to-buffer` 8 | */ 9 | 10 | var isTypedArray = require('is-typedarray').strict 11 | 12 | module.exports = function typedarrayToBuffer (arr) { 13 | if (isTypedArray(arr)) { 14 | // To avoid a copy, use the typed array's underlying ArrayBuffer to back new Buffer 15 | var buf = Buffer.from(arr.buffer) 16 | if (arr.byteLength !== arr.buffer.byteLength) { 17 | // Respect the "view", i.e. byteOffset and byteLength, without doing a copy 18 | buf = buf.slice(arr.byteOffset, arr.byteOffset + arr.byteLength) 19 | } 20 | return buf 21 | } else { 22 | // Pass through all other types to `Buffer.from` 23 | return Buffer.from(arr) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/crowdsale/validation/WhitelistCrowdsale.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | import "../Crowdsale.sol"; 3 | import "../../access/roles/WhitelistedRole.sol"; 4 | 5 | 6 | /** 7 | * @title WhitelistCrowdsale 8 | * @dev Crowdsale in which only whitelisted users can contribute. 9 | */ 10 | contract WhitelistCrowdsale is WhitelistedRole, Crowdsale { 11 | /** 12 | * @dev Extend parent behavior requiring beneficiary to be whitelisted. Note that no 13 | * restriction is imposed on the account sending the transaction. 14 | * @param _beneficiary Token beneficiary 15 | * @param _weiAmount Amount of wei contributed 16 | */ 17 | function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal view { 18 | require(isWhitelisted(_beneficiary)); 19 | super._preValidatePurchase(_beneficiary, _weiAmount); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/crowdsale/emission/MintedCrowdsale.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | import "../Crowdsale.sol"; 4 | import "../../token/ERC20/ERC20Mintable.sol"; 5 | 6 | /** 7 | * @title MintedCrowdsale 8 | * @dev Extension of Crowdsale contract whose tokens are minted in each purchase. 9 | * Token ownership should be transferred to MintedCrowdsale for minting. 10 | */ 11 | contract MintedCrowdsale is Crowdsale { 12 | /** 13 | * @dev Overrides delivery by minting tokens upon purchase. 14 | * @param beneficiary Token purchaser 15 | * @param tokenAmount Number of tokens to be minted 16 | */ 17 | function _deliverTokens(address beneficiary, uint256 tokenAmount) internal { 18 | // Potentially dangerous assumption about the type of the token. 19 | require(ERC20Mintable(address(token())).mint(beneficiary, tokenAmount)); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/token/ERC20/IERC20.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | /** 4 | * @title ERC20 interface 5 | * @dev see https://github.com/ethereum/EIPs/issues/20 6 | */ 7 | interface IERC20 { 8 | function transfer(address to, uint256 value) external returns (bool); 9 | 10 | function approve(address spender, uint256 value) external returns (bool); 11 | 12 | function transferFrom(address from, address to, uint256 value) external returns (bool); 13 | 14 | function totalSupply() external view returns (uint256); 15 | 16 | function balanceOf(address who) external view returns (uint256); 17 | 18 | function allowance(address owner, address spender) external view returns (uint256); 19 | 20 | event Transfer(address indexed from, address indexed to, uint256 value); 21 | 22 | event Approval(address indexed owner, address indexed spender, uint256 value); 23 | } 24 | -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/src/components/page-view-element.js: -------------------------------------------------------------------------------- 1 | /** 2 | @license 3 | Copyright (c) 2018 The Polymer Project Authors. All rights reserved. 4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt 5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt 7 | Code distributed by Google as part of the polymer project is also 8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt 9 | */ 10 | 11 | import { LitElement } from '@polymer/lit-element'; 12 | 13 | export class PageViewElement extends LitElement { 14 | // Only render this page if it's actually visible. 15 | shouldUpdate() { 16 | return this.active; 17 | } 18 | 19 | static get properties() { 20 | return { 21 | active: { type: Boolean } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/token/ERC721/ERC721MetadataMintable.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | import "./ERC721Metadata.sol"; 4 | import "../../access/roles/MinterRole.sol"; 5 | 6 | 7 | /** 8 | * @title ERC721MetadataMintable 9 | * @dev ERC721 minting logic with metadata 10 | */ 11 | contract ERC721MetadataMintable is ERC721, ERC721Metadata, MinterRole { 12 | /** 13 | * @dev Function to mint tokens 14 | * @param to The address that will receive the minted tokens. 15 | * @param tokenId The token id to mint. 16 | * @param tokenURI The token URI of the minted token. 17 | * @return A boolean that indicates if the operation was successful. 18 | */ 19 | function mintWithTokenURI(address to, uint256 tokenId, string memory tokenURI) public onlyMinter returns (bool) { 20 | _mint(to, tokenId); 21 | _setTokenURI(tokenId, tokenURI); 22 | return true; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Course_Blockchain_Identity/Practice_Block/block.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Import crypto-js/SHA256 library 3 | */ 4 | const SHA256 = require('crypto-js/sha256'); 5 | 6 | /** 7 | * Class with a constructor for block 8 | */ 9 | class Block { 10 | 11 | constructor(data){ 12 | this.id = 0; 13 | this.nonce = 144444; 14 | this.body = data; 15 | this.hash = ""; 16 | } 17 | 18 | /** 19 | * Step 1. Implement `generateHash()` 20 | * method that return the `self` block with the hash. 21 | * 22 | * Create a Promise that resolve with `self` after you create 23 | * the hash of the object and assigned to the hash property `self.hash = ...` 24 | */ 25 | // 26 | generateHash() { 27 | // Use this to create a temporary reference of the class object 28 | let self = this; 29 | //Implement your code here 30 | 31 | } 32 | } 33 | 34 | // Exporting the class Block to be reuse in other files 35 | module.exports.Block = Block; -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/sw-precache-config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright (c) 2018 The Polymer Project Authors. All rights reserved. 4 | * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt 5 | * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 6 | * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt 7 | * Code distributed by Google as part of the polymer project is also 8 | * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt 9 | */ 10 | 11 | module.exports = { 12 | staticFileGlobs: [ 13 | 'manifest.json', 14 | 'src/**/*', 15 | ], 16 | runtimeCaching: [ 17 | { 18 | urlPattern: /\/@webcomponents\/webcomponentsjs\//, 19 | handler: 'fastest' 20 | }, 21 | { 22 | urlPattern: /^https:\/\/fonts.gstatic.com\//, 23 | handler: 'fastest' 24 | } 25 | ] 26 | }; 27 | -------------------------------------------------------------------------------- /Course_Blockchain_Data/Practice_LevelDB_And_Promises/app.js: -------------------------------------------------------------------------------- 1 | //Importing levelSandbox class 2 | const LevelSandboxClass = require('./levelSandbox.js'); 3 | 4 | // Creating the levelSandbox class object 5 | const db = new LevelSandboxClass.LevelSandbox(); 6 | 7 | // Creating Data 8 | (function theLoop (i) { 9 | setTimeout(function () { 10 | //Test Object 11 | let objAux = {id: i, data: `Data #: ${i}`}; 12 | db.addLevelDBData(i, JSON.stringify(objAux).toString()).then((result) => { 13 | if(!result) { 14 | console.log("Error Adding data"); 15 | }else { 16 | console.log(result); 17 | } 18 | }).catch((err) => { console.log(err); }); 19 | i++; 20 | if (i < 10) { 21 | theLoop(i) 22 | } else { 23 | db.getBlocksCount().then((count) => { 24 | console.log(`The id for your next object is: ${count}`); 25 | }).catch((err) => { console.log(err); }); 26 | } 27 | }, 5600); 28 | })(0); 29 | 30 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/crowdsale/validation/PausableCrowdsale.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | import "../Crowdsale.sol"; 4 | import "../../lifecycle/Pausable.sol"; 5 | 6 | /** 7 | * @title PausableCrowdsale 8 | * @dev Extension of Crowdsale contract where purchases can be paused and unpaused by the pauser role. 9 | */ 10 | contract PausableCrowdsale is Crowdsale, Pausable { 11 | /** 12 | * @dev Validation of an incoming purchase. Use require statements to revert state when conditions are not met. 13 | * Use super to concatenate validations. 14 | * Adds the validation that the crowdsale must not be paused. 15 | * @param _beneficiary Address performing the token purchase 16 | * @param _weiAmount Value in wei involved in the purchase 17 | */ 18 | function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal view whenNotPaused { 19 | return super._preValidatePurchase(_beneficiary, _weiAmount); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/src/components/button-shared-styles.js: -------------------------------------------------------------------------------- 1 | /** 2 | @license 3 | Copyright (c) 2018 The Polymer Project Authors. All rights reserved. 4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt 5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt 7 | Code distributed by Google as part of the polymer project is also 8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt 9 | */ 10 | 11 | import { html } from '@polymer/lit-element'; 12 | 13 | export const ButtonSharedStyles = html` 14 | 27 | `; 28 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/math/Math.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | /** 4 | * @title Math 5 | * @dev Assorted math operations 6 | */ 7 | library Math { 8 | /** 9 | * @dev Returns the largest of two numbers. 10 | */ 11 | function max(uint256 a, uint256 b) internal pure returns (uint256) { 12 | return a >= b ? a : b; 13 | } 14 | 15 | /** 16 | * @dev Returns the smallest of two numbers. 17 | */ 18 | function min(uint256 a, uint256 b) internal pure returns (uint256) { 19 | return a < b ? a : b; 20 | } 21 | 22 | /** 23 | * @dev Calculates the average of two numbers. Since these are integers, 24 | * averages of an even and odd number cannot be represented, and will be 25 | * rounded down. 26 | */ 27 | function average(uint256 a, uint256 b) internal pure returns (uint256) { 28 | // (a + b) / 2 can overflow, so we distribute 29 | return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/drafts/Counter.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | /** 4 | * @title Counter 5 | * @author Matt Condon (@shrugs) 6 | * @dev Provides an incrementing uint256 id acquired by the `Counter#next` getter. 7 | * Use this for issuing ERC721 ids or keeping track of request ids, anything you want, really. 8 | * 9 | * Include with `using Counter for Counter.Counter;` 10 | * @notice Does not allow an Id of 0, which is popularly used to signify a null state in solidity. 11 | * Does not protect from overflows, but if you have 2^256 ids, you have other problems. 12 | * (But actually, it's generally impossible to increment a counter this many times, energy wise 13 | * so it's not something you have to worry about.) 14 | */ 15 | library Counter { 16 | struct Counter { 17 | uint256 current; // default: 0 18 | } 19 | 20 | function next(Counter storage index) internal returns (uint256) { 21 | index.current += 1; 22 | return index.current; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Course_Blockchain_Identity/Practice_Hashing/app.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Step 1: Verify 'crypto-js' module is installed for your project 3 | * After verifying it is installed, move on to Step 2. No code needs to be written here. 4 | */ 5 | 6 | /** 7 | * Step 2: Import from crypto-js module the sha265 library 8 | */ 9 | 10 | // Write your code here 11 | 12 | /** 13 | * Variables: Do not change variable values to be able to answer the quiz 14 | */ 15 | 16 | const data1 = "Blockchain Rock!"; 17 | const dataObject = { 18 | id: 1, 19 | body: "With Object Works too", 20 | time: new Date().getTime().toString().slice(0,-3) 21 | }; 22 | 23 | /** 24 | * Step 3: Add code to the `generate hash function 25 | * Function that generate the SHA256 Hash 26 | * @param {*} obj 27 | */ 28 | 29 | function generateHash(obj) { 30 | // Write your code here 31 | } 32 | 33 | console.log(`SHA256 Hash: ${generateHash(data1)}`); 34 | console.log("************************************"); 35 | console.log(`SHA256 Hash: ${generateHash(dataObject)}`); 36 | 37 | /** 38 | * Run your application using `node app.js` 39 | */ -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/starNotaryv1/app/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | StarNotary DAPP Front End 5 | 6 | 7 | 13 | 14 | 15 |

StarNotary DAPP

16 | 17 |

Star Name:

18 |

19 |
20 |

Star Owner:

21 |

22 |

23 |
24 |
25 |

Claim Star

26 |

27 |

28 |
29 |
30 | 31 |
32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-api/README.md: -------------------------------------------------------------------------------- 1 | ## How to run this application. 2 | 3 | To be able to connect your application with your local Bitcoin Node you will need to install: 4 | 5 | 1. Bitcoin Core: https://bitcoin.org/en/download, You will need to download and install it. 6 | 2. Then you will use the following configuration for your bitcoin.conf file: 7 | ``` 8 | 9 | rpcuser=test 10 | rpcpassword=Passw0rd! 11 | 12 | server=1 13 | 14 | testnet = 1 15 | 16 | prune=550 17 | 18 | ``` 19 | This connect your bitcoin core to the testnet network and will use `prune` to save disk space. The rest of parameters allows you to serve your node as a server. 20 | 21 | 3. You will need to install bitcoin deamon: In this link you have the installations process: https://bitcoin.org/en/full-node#mac-os-x-yosemite-1010x 22 | It is simple just use the curl url to download the executables. 23 | 4. You will need to start the deamon that will expose the rpc command: `bitcoind -testnet -daemon` and use the command `bitcoin-cli stop` to stop it. 24 | 5. Install all your project dependencies `npm install`. 25 | 6. Run your application using: `node app.js` -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/solidity/contracts/FunctionsContract.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.24; 2 | 3 | contract FunctionsContract { 4 | 5 | string ownerName; 6 | uint8 ownerAge; 7 | 8 | // Constructor 9 | constructor (string memory name, uint8 age) public { 10 | ownerName = name; 11 | ownerAge = age; 12 | } 13 | 14 | // We are changing the owner name and age 15 | function setOwnerInfo(string memory name, uint8 age) public { 16 | ownerName = name; 17 | ownerAge = age; 18 | } 19 | 20 | function secretFunction() private pure { 21 | // Not available outside this contract 22 | } 23 | 24 | // Get owner name and age 25 | function getOwnerInfo() public view returns (string memory name, uint8 age){ 26 | name = ownerName; 27 | age = ownerAge; 28 | } 29 | 30 | // Get the name 31 | // 2 ways to return values from a function 32 | function getOwnerName() public view returns (string memory) { 33 | return ownerName; 34 | } 35 | 36 | // Get the age 37 | function getOwnerAge() public view returns (uint8 age){ 38 | age = ownerAge; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/any-promise/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2014-2016 Kevin Beaty 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/Smart_Contracts_With_Solidity/functionsContract.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.24; 2 | 3 | contract FunctionsContract { 4 | 5 | string ownerName; 6 | uint8 ownerAge; 7 | 8 | // Constructor 9 | constructor (string memory name, uint8 age) public { 10 | ownerName = name; 11 | ownerAge = age; 12 | } 13 | 14 | // We are changing the owner name and age 15 | function setOwnerInfo(string memory name, uint8 age) public { 16 | ownerName = name; 17 | ownerAge = age; 18 | } 19 | 20 | function secretFunction() private pure { 21 | // Not available outside this contract 22 | } 23 | 24 | // Get owner name and age 25 | function getOwnerInfo() public view returns (string memory name, uint8 age){ 26 | name = ownerName; 27 | age = ownerAge; 28 | } 29 | 30 | // Get the name 31 | // 2 ways to return values from a function 32 | function getOwnerName() public view returns (string memory) { 33 | return ownerName; 34 | } 35 | 36 | // Get the age 37 | function getOwnerAge() public view returns (uint8 age){ 38 | age = ownerAge; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/is-typedarray/LICENSE.md: -------------------------------------------------------------------------------- 1 | This software is released under the MIT license: 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 7 | the Software, and to permit persons to whom the Software is furnished to do so, 8 | subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 15 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/ms/license.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Zeit, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/access/Roles.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | /** 4 | * @title Roles 5 | * @dev Library for managing addresses assigned to a Role. 6 | */ 7 | library Roles { 8 | struct Role { 9 | mapping (address => bool) bearer; 10 | } 11 | 12 | /** 13 | * @dev give an account access to this role 14 | */ 15 | function add(Role storage role, address account) internal { 16 | require(account != address(0)); 17 | require(!has(role, account)); 18 | 19 | role.bearer[account] = true; 20 | } 21 | 22 | /** 23 | * @dev remove an account's access to this role 24 | */ 25 | function remove(Role storage role, address account) internal { 26 | require(account != address(0)); 27 | require(has(role, account)); 28 | 29 | role.bearer[account] = false; 30 | } 31 | 32 | /** 33 | * @dev check if an account has this role 34 | * @return bool 35 | */ 36 | function has(Role storage role, address account) internal view returns (bool) { 37 | require(account != address(0)); 38 | return role.bearer[account]; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/file-uri-to-path/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Nathan Rajlich 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | 'Software'), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/nan/nan_define_own_property_helper.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | * NAN - Native Abstractions for Node.js 3 | * 4 | * Copyright (c) 2018 NAN contributors 5 | * 6 | * MIT License 7 | ********************************************************************/ 8 | 9 | #ifndef NAN_DEFINE_OWN_PROPERTY_HELPER_H_ 10 | #define NAN_DEFINE_OWN_PROPERTY_HELPER_H_ 11 | 12 | namespace imp { 13 | 14 | inline Maybe DefineOwnPropertyHelper( 15 | v8::PropertyAttribute current 16 | , v8::Handle obj 17 | , v8::Handle key 18 | , v8::Handle value 19 | , v8::PropertyAttribute attribs = v8::None) { 20 | return !(current & v8::DontDelete) || // configurable OR 21 | (!(current & v8::ReadOnly) && // writable AND 22 | !((attribs ^ current) & ~v8::ReadOnly)) // same excluding RO 23 | ? Just(obj->ForceSet(key, value, attribs)) 24 | : Nothing(); 25 | } 26 | 27 | } // end of namespace imp 28 | 29 | #endif // NAN_DEFINE_OWN_PROPERTY_HELPER_H_ 30 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/debug/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2014 TJ Holowaychuk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software 6 | and associated documentation files (the 'Software'), to deal in the Software without restriction, 7 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 9 | subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all copies or substantial 12 | portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 15 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 16 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 17 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 18 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | 20 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/access/roles/CapperRole.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | import "../Roles.sol"; 4 | 5 | contract CapperRole { 6 | using Roles for Roles.Role; 7 | 8 | event CapperAdded(address indexed account); 9 | event CapperRemoved(address indexed account); 10 | 11 | Roles.Role private _cappers; 12 | 13 | constructor () internal { 14 | _addCapper(msg.sender); 15 | } 16 | 17 | modifier onlyCapper() { 18 | require(isCapper(msg.sender)); 19 | _; 20 | } 21 | 22 | function isCapper(address account) public view returns (bool) { 23 | return _cappers.has(account); 24 | } 25 | 26 | function addCapper(address account) public onlyCapper { 27 | _addCapper(account); 28 | } 29 | 30 | function renounceCapper() public { 31 | _removeCapper(msg.sender); 32 | } 33 | 34 | function _addCapper(address account) internal { 35 | _cappers.add(account); 36 | emit CapperAdded(account); 37 | } 38 | 39 | function _removeCapper(address account) internal { 40 | _cappers.remove(account); 41 | emit CapperRemoved(account); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/access/roles/MinterRole.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | import "../Roles.sol"; 4 | 5 | contract MinterRole { 6 | using Roles for Roles.Role; 7 | 8 | event MinterAdded(address indexed account); 9 | event MinterRemoved(address indexed account); 10 | 11 | Roles.Role private _minters; 12 | 13 | constructor () internal { 14 | _addMinter(msg.sender); 15 | } 16 | 17 | modifier onlyMinter() { 18 | require(isMinter(msg.sender)); 19 | _; 20 | } 21 | 22 | function isMinter(address account) public view returns (bool) { 23 | return _minters.has(account); 24 | } 25 | 26 | function addMinter(address account) public onlyMinter { 27 | _addMinter(account); 28 | } 29 | 30 | function renounceMinter() public { 31 | _removeMinter(msg.sender); 32 | } 33 | 34 | function _addMinter(address account) internal { 35 | _minters.add(account); 36 | emit MinterAdded(account); 37 | } 38 | 39 | function _removeMinter(address account) internal { 40 | _minters.remove(account); 41 | emit MinterRemoved(account); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/access/roles/PauserRole.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | import "../Roles.sol"; 4 | 5 | contract PauserRole { 6 | using Roles for Roles.Role; 7 | 8 | event PauserAdded(address indexed account); 9 | event PauserRemoved(address indexed account); 10 | 11 | Roles.Role private _pausers; 12 | 13 | constructor () internal { 14 | _addPauser(msg.sender); 15 | } 16 | 17 | modifier onlyPauser() { 18 | require(isPauser(msg.sender)); 19 | _; 20 | } 21 | 22 | function isPauser(address account) public view returns (bool) { 23 | return _pausers.has(account); 24 | } 25 | 26 | function addPauser(address account) public onlyPauser { 27 | _addPauser(account); 28 | } 29 | 30 | function renouncePauser() public { 31 | _removePauser(msg.sender); 32 | } 33 | 34 | function _addPauser(address account) internal { 35 | _pausers.add(account); 36 | emit PauserAdded(account); 37 | } 38 | 39 | function _removePauser(address account) internal { 40 | _pausers.remove(account); 41 | emit PauserRemoved(account); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/access/roles/SignerRole.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | import "../Roles.sol"; 4 | 5 | contract SignerRole { 6 | using Roles for Roles.Role; 7 | 8 | event SignerAdded(address indexed account); 9 | event SignerRemoved(address indexed account); 10 | 11 | Roles.Role private _signers; 12 | 13 | constructor () internal { 14 | _addSigner(msg.sender); 15 | } 16 | 17 | modifier onlySigner() { 18 | require(isSigner(msg.sender)); 19 | _; 20 | } 21 | 22 | function isSigner(address account) public view returns (bool) { 23 | return _signers.has(account); 24 | } 25 | 26 | function addSigner(address account) public onlySigner { 27 | _addSigner(account); 28 | } 29 | 30 | function renounceSigner() public { 31 | _removeSigner(msg.sender); 32 | } 33 | 34 | function _addSigner(address account) internal { 35 | _signers.add(account); 36 | emit SignerAdded(account); 37 | } 38 | 39 | function _removeSigner(address account) internal { 40 | _signers.remove(account); 41 | emit SignerRemoved(account); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/truffle-hdwallet-provider/LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 CONSENSUS SYSTEMS 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/typedarray-to-buffer/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) Feross Aboukhadijeh 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/yaeti/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Iñaki Baz Castillo, 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Smart Contract Solutions, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/bindings/LICENSE.md: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2012 Nathan Rajlich <nathan@tootallnate.net> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | 'Software'), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/token/ERC20/ERC20Pausable.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | import "./ERC20.sol"; 4 | import "../../lifecycle/Pausable.sol"; 5 | 6 | /** 7 | * @title Pausable token 8 | * @dev ERC20 modified with pausable transfers. 9 | **/ 10 | contract ERC20Pausable is ERC20, Pausable { 11 | function transfer(address to, uint256 value) public whenNotPaused returns (bool) { 12 | return super.transfer(to, value); 13 | } 14 | 15 | function transferFrom(address from, address to, uint256 value) public whenNotPaused returns (bool) { 16 | return super.transferFrom(from, to, value); 17 | } 18 | 19 | function approve(address spender, uint256 value) public whenNotPaused returns (bool) { 20 | return super.approve(spender, value); 21 | } 22 | 23 | function increaseAllowance(address spender, uint addedValue) public whenNotPaused returns (bool success) { 24 | return super.increaseAllowance(spender, addedValue); 25 | } 26 | 27 | function decreaseAllowance(address spender, uint subtractedValue) public whenNotPaused returns (bool success) { 28 | return super.decreaseAllowance(spender, subtractedValue); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/is-typedarray/index.js: -------------------------------------------------------------------------------- 1 | module.exports = isTypedArray 2 | isTypedArray.strict = isStrictTypedArray 3 | isTypedArray.loose = isLooseTypedArray 4 | 5 | var toString = Object.prototype.toString 6 | var names = { 7 | '[object Int8Array]': true 8 | , '[object Int16Array]': true 9 | , '[object Int32Array]': true 10 | , '[object Uint8Array]': true 11 | , '[object Uint8ClampedArray]': true 12 | , '[object Uint16Array]': true 13 | , '[object Uint32Array]': true 14 | , '[object Float32Array]': true 15 | , '[object Float64Array]': true 16 | } 17 | 18 | function isTypedArray(arr) { 19 | return ( 20 | isStrictTypedArray(arr) 21 | || isLooseTypedArray(arr) 22 | ) 23 | } 24 | 25 | function isStrictTypedArray(arr) { 26 | return ( 27 | arr instanceof Int8Array 28 | || arr instanceof Int16Array 29 | || arr instanceof Int32Array 30 | || arr instanceof Uint8Array 31 | || arr instanceof Uint8ClampedArray 32 | || arr instanceof Uint16Array 33 | || arr instanceof Uint32Array 34 | || arr instanceof Float32Array 35 | || arr instanceof Float64Array 36 | ) 37 | } 38 | 39 | function isLooseTypedArray(arr) { 40 | return names[toString.call(arr)] 41 | } 42 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/utils/Address.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | /** 4 | * Utility library of inline functions on addresses 5 | */ 6 | library Address { 7 | /** 8 | * Returns whether the target address is a contract 9 | * @dev This function will return false if invoked during the constructor of a contract, 10 | * as the code is not actually created until after the constructor finishes. 11 | * @param account address of the account to check 12 | * @return whether the target address is a contract 13 | */ 14 | function isContract(address account) internal view returns (bool) { 15 | uint256 size; 16 | // XXX Currently there is no better way to check if there is a contract in an address 17 | // than to check the size of the code at that address. 18 | // See https://ethereum.stackexchange.com/a/14016/36603 19 | // for more details about how this works. 20 | // TODO Check this again before the Serenity release, because all addresses will be 21 | // contracts then. 22 | // solhint-disable-next-line no-inline-assembly 23 | assembly { size := extcodesize(account) } 24 | return size > 0; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/src/components/my-view404.js: -------------------------------------------------------------------------------- 1 | /** 2 | @license 3 | Copyright (c) 2018 The Polymer Project Authors. All rights reserved. 4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt 5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt 7 | Code distributed by Google as part of the polymer project is also 8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt 9 | */ 10 | 11 | import { html } from '@polymer/lit-element'; 12 | import { PageViewElement } from './page-view-element.js'; 13 | 14 | // These are the shared styles needed by this element. 15 | import { SharedStyles } from './shared-styles.js'; 16 | 17 | class MyView404 extends PageViewElement { 18 | render() { 19 | return html` 20 | ${SharedStyles} 21 |
22 |

Oops! You hit a 404

23 |

The page you're looking for doesn't seem to exist. Head back 24 | home and try again? 25 |

26 |
27 | ` 28 | } 29 | } 30 | 31 | window.customElements.define('my-view404', MyView404); 32 | -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-api/app.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const morgan = require("morgan"); 3 | const bodyParser = require("body-parser"); 4 | const cors = require("cors"); 5 | const Client = require('bitcoin-core'); 6 | 7 | class ApplicationServer { 8 | 9 | constructor() { 10 | this.app = express(); 11 | this.app.client = new Client({ network: 'testnet', port: 18332, password: 'Passw0rd!', username: 'test' }); 12 | this.initExpress(); 13 | this.initExpressMiddleWare(); 14 | this.initControllers(); 15 | this.start(); 16 | } 17 | 18 | initExpress() { 19 | this.app.set("port", 8000); 20 | } 21 | 22 | initExpressMiddleWare() { 23 | this.app.use(morgan("dev")); 24 | this.app.use(bodyParser.urlencoded({extended:true})); 25 | this.app.use(bodyParser.json()); 26 | this.app.use(cors()); 27 | } 28 | 29 | initControllers() { 30 | require("./walletController.js")(this.app); 31 | require("./blockchainController.js")(this.app); 32 | require("./blockController.js")(this.app); 33 | } 34 | 35 | start() { 36 | let self = this; 37 | this.app.listen(this.app.get("port"), () => { 38 | console.log(`Server Listening for port: ${self.app.get("port")}`); 39 | }); 40 | } 41 | 42 | } 43 | 44 | new ApplicationServer(); -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/is-typedarray/test.js: -------------------------------------------------------------------------------- 1 | var test = require('tape') 2 | var ista = require('./') 3 | 4 | test('strict', function(t) { 5 | t.ok(ista.strict(new Int8Array), 'Int8Array') 6 | t.ok(ista.strict(new Int16Array), 'Int16Array') 7 | t.ok(ista.strict(new Int32Array), 'Int32Array') 8 | t.ok(ista.strict(new Uint8Array), 'Uint8Array') 9 | t.ok(ista.strict(new Uint16Array), 'Uint16Array') 10 | t.ok(ista.strict(new Uint32Array), 'Uint32Array') 11 | t.ok(ista.strict(new Float32Array), 'Float32Array') 12 | t.ok(ista.strict(new Float64Array), 'Float64Array') 13 | 14 | t.ok(!ista.strict(new Array), 'Array') 15 | t.ok(!ista.strict([]), '[]') 16 | 17 | t.end() 18 | }) 19 | 20 | test('loose', function(t) { 21 | t.ok(ista.loose(new Int8Array), 'Int8Array') 22 | t.ok(ista.loose(new Int16Array), 'Int16Array') 23 | t.ok(ista.loose(new Int32Array), 'Int32Array') 24 | t.ok(ista.loose(new Uint8Array), 'Uint8Array') 25 | t.ok(ista.loose(new Uint16Array), 'Uint16Array') 26 | t.ok(ista.loose(new Uint32Array), 'Uint32Array') 27 | t.ok(ista.loose(new Float32Array), 'Float32Array') 28 | t.ok(ista.loose(new Float64Array), 'Float64Array') 29 | 30 | t.ok(!ista.loose(new Array), 'Array') 31 | t.ok(!ista.loose([]), '[]') 32 | 33 | t.end() 34 | }) 35 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | import "./IERC20.sol"; 4 | 5 | /** 6 | * @title ERC20Detailed token 7 | * @dev The decimals are only for visualization purposes. 8 | * All the operations are done using the smallest and indivisible token unit, 9 | * just as on Ethereum all the operations are done in wei. 10 | */ 11 | contract ERC20Detailed is IERC20 { 12 | string private _name; 13 | string private _symbol; 14 | uint8 private _decimals; 15 | 16 | constructor (string memory name, string memory symbol, uint8 decimals) public { 17 | _name = name; 18 | _symbol = symbol; 19 | _decimals = decimals; 20 | } 21 | 22 | /** 23 | * @return the name of the token. 24 | */ 25 | function name() public view returns (string memory) { 26 | return _name; 27 | } 28 | 29 | /** 30 | * @return the symbol of the token. 31 | */ 32 | function symbol() public view returns (string memory) { 33 | return _symbol; 34 | } 35 | 36 | /** 37 | * @return the number of decimals of the token. 38 | */ 39 | function decimals() public view returns (uint8) { 40 | return _decimals; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/nan/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | ===================== 3 | 4 | Copyright (c) 2018 NAN contributors 5 | ----------------------------------- 6 | 7 | *NAN contributors listed at * 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 14 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/truffle-hdwallet-provider/webpack/webpack.config.js: -------------------------------------------------------------------------------- 1 | const { resolve, join } = require("path"); 2 | const { IgnorePlugin } = require("webpack"); 3 | const path = require("path"); 4 | 5 | const moduleRoot = resolve(__dirname, ".."); 6 | const outputPath = join(moduleRoot, "dist"); 7 | 8 | module.exports = { 9 | mode: "production", 10 | entry: join(moduleRoot, "src", "index.js"), 11 | target: "node", 12 | devtool: "source-map", 13 | output: { 14 | path: outputPath, 15 | filename: "index.js", 16 | library: "truffle-hdwallet-provider", 17 | libraryTarget: "umd", 18 | umdNamedDefine: true 19 | }, 20 | externals: ["fs", "bindings", "any-promise", "websocket"], 21 | resolve: { 22 | alias: { 23 | // eth-block-tracker is es6 but automatically builds an es5 version for us on install. thanks eth-block-tracker! 24 | "eth-block-tracker": "eth-block-tracker/dist/es5/index.js", 25 | 26 | // replace native `scrypt` module with pure js `js-scrypt` 27 | "scrypt": "js-scrypt", 28 | 29 | // replace native `secp256k1` with pure js `elliptic.js` 30 | "secp256k1": "secp256k1/elliptic.js", 31 | } 32 | }, 33 | plugins: [ 34 | // ignore these plugins completely 35 | new IgnorePlugin(/^(?:electron|ws)$/) 36 | ] 37 | }; 38 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/debug/Makefile: -------------------------------------------------------------------------------- 1 | # get Makefile directory name: http://stackoverflow.com/a/5982798/376773 2 | THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) 3 | THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd) 4 | 5 | # BIN directory 6 | BIN := $(THIS_DIR)/node_modules/.bin 7 | 8 | # Path 9 | PATH := node_modules/.bin:$(PATH) 10 | SHELL := /bin/bash 11 | 12 | # applications 13 | NODE ?= $(shell which node) 14 | YARN ?= $(shell which yarn) 15 | PKG ?= $(if $(YARN),$(YARN),$(NODE) $(shell which npm)) 16 | BROWSERIFY ?= $(NODE) $(BIN)/browserify 17 | 18 | .FORCE: 19 | 20 | install: node_modules 21 | 22 | node_modules: package.json 23 | @NODE_ENV= $(PKG) install 24 | @touch node_modules 25 | 26 | lint: .FORCE 27 | eslint browser.js debug.js index.js node.js 28 | 29 | test-node: .FORCE 30 | istanbul cover node_modules/mocha/bin/_mocha -- test/**.js 31 | 32 | test-browser: .FORCE 33 | mkdir -p dist 34 | 35 | @$(BROWSERIFY) \ 36 | --standalone debug \ 37 | . > dist/debug.js 38 | 39 | karma start --single-run 40 | rimraf dist 41 | 42 | test: .FORCE 43 | concurrently \ 44 | "make test-node" \ 45 | "make test-browser" 46 | 47 | coveralls: 48 | cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js 49 | 50 | .PHONY: all install clean distclean 51 | -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/test/unit/index.html: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 14 | 15 | Tests 16 | 17 | 18 | 19 | 20 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/websocket/lib/browser.js: -------------------------------------------------------------------------------- 1 | var _global = (function() { return this; })(); 2 | var NativeWebSocket = _global.WebSocket || _global.MozWebSocket; 3 | var websocket_version = require('./version'); 4 | 5 | 6 | /** 7 | * Expose a W3C WebSocket class with just one or two arguments. 8 | */ 9 | function W3CWebSocket(uri, protocols) { 10 | var native_instance; 11 | 12 | if (protocols) { 13 | native_instance = new NativeWebSocket(uri, protocols); 14 | } 15 | else { 16 | native_instance = new NativeWebSocket(uri); 17 | } 18 | 19 | /** 20 | * 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket 21 | * class). Since it is an Object it will be returned as it is when creating an 22 | * instance of W3CWebSocket via 'new W3CWebSocket()'. 23 | * 24 | * ECMAScript 5: http://bclary.com/2004/11/07/#a-13.2.2 25 | */ 26 | return native_instance; 27 | } 28 | if (NativeWebSocket) { 29 | ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED'].forEach(function(prop) { 30 | Object.defineProperty(W3CWebSocket, prop, { 31 | get: function() { return NativeWebSocket[prop]; } 32 | }); 33 | }); 34 | } 35 | 36 | /** 37 | * Module exports. 38 | */ 39 | module.exports = { 40 | 'w3cwebsocket' : NativeWebSocket ? W3CWebSocket : null, 41 | 'version' : websocket_version 42 | }; 43 | -------------------------------------------------------------------------------- /Course_Blockchain_Data/Practice_Private_Blockchain_Code_Session/README.md: -------------------------------------------------------------------------------- 1 | # Blockchain Data 2 | 3 | To use this boilerplate code locally follow this steps: 4 | 5 | 1. Clone or download the project. 6 | 2. Open your project with your favorite IDE. 7 | 3. Run `npm install` to install the dependencies. 8 | 4. Implement your code. 9 | 5. Use `node simpleChain.js` to run the application. 10 | 11 | ## Testing 12 | 13 | To test code: 14 | 1: Open a command prompt or shell terminal after install node.js. 15 | 2: Enter a node session, also known as REPL (Read-Evaluate-Print-Loop). 16 | ``` 17 | node 18 | ``` 19 | 3: Copy and paste your code into your node session 20 | 4: Instantiate blockchain with blockchain variable 21 | ``` 22 | let blockchain = new Blockchain(); 23 | ``` 24 | 5: Generate 10 blocks using a for loop 25 | ``` 26 | for (var i = 0; i <= 10; i++) { 27 | blockchain.addBlock(new Block("test data "+i)); 28 | } 29 | ``` 30 | 6: Validate blockchain 31 | ``` 32 | blockchain.validateChain(); 33 | ``` 34 | 7: Induce errors by changing block data 35 | ``` 36 | let inducedErrorBlocks = [2,4,7]; 37 | for (var i = 0; i < inducedErrorBlocks.length; i++) { 38 | blockchain.chain[inducedErrorBlocks[i]].data='induced chain error'; 39 | } 40 | ``` 41 | 8: Validate blockchain. The chain should now fail with blocks 2,4, and 7. 42 | ``` 43 | blockchain.validateChain(); 44 | ``` 45 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | /** 4 | * @title Helps contracts guard against reentrancy attacks. 5 | * @author Remco Bloemen , Eenae 6 | * @dev If you mark a function `nonReentrant`, you should also 7 | * mark it `external`. 8 | */ 9 | contract ReentrancyGuard { 10 | /// @dev counter to allow mutex lock with only one SSTORE operation 11 | uint256 private _guardCounter; 12 | 13 | constructor () internal { 14 | // The counter starts at one to prevent changing it from zero to a non-zero 15 | // value, which is a more expensive operation. 16 | _guardCounter = 1; 17 | } 18 | 19 | /** 20 | * @dev Prevents a contract from calling itself, directly or indirectly. 21 | * Calling a `nonReentrant` function from another `nonReentrant` 22 | * function is not supported. It is possible to prevent this from happening 23 | * by making the `nonReentrant` function external, and make it call a 24 | * `private` function that does the actual work. 25 | */ 26 | modifier nonReentrant() { 27 | _guardCounter += 1; 28 | uint256 localCounter = _guardCounter; 29 | _; 30 | require(localCounter == _guardCounter); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Course_Blockchain_Web_Services/Practice_RestApi_Express/app.js: -------------------------------------------------------------------------------- 1 | //Importing Express.js module 2 | const express = require("express"); 3 | //Importing BodyParser.js module 4 | const bodyParser = require("body-parser"); 5 | 6 | /** 7 | * Class Definition for the REST API 8 | */ 9 | class BlockAPI { 10 | 11 | /** 12 | * Constructor that allows initialize the class 13 | */ 14 | constructor() { 15 | this.app = express(); 16 | this.initExpress(); 17 | this.initExpressMiddleWare(); 18 | this.initControllers(); 19 | this.start(); 20 | } 21 | 22 | /** 23 | * Initilization of the Express framework 24 | */ 25 | initExpress() { 26 | this.app.set("port", 8000); 27 | } 28 | 29 | /** 30 | * Initialization of the middleware modules 31 | */ 32 | initExpressMiddleWare() { 33 | this.app.use(bodyParser.urlencoded({extended:true})); 34 | this.app.use(bodyParser.json()); 35 | } 36 | 37 | /** 38 | * Initilization of all the controllers 39 | */ 40 | initControllers() { 41 | require("./BlockController.js")(this.app); 42 | } 43 | 44 | /** 45 | * Starting the REST Api application 46 | */ 47 | start() { 48 | let self = this; 49 | this.app.listen(this.app.get("port"), () => { 50 | console.log(`Server Listening for port: ${self.app.get("port")}`); 51 | }); 52 | } 53 | 54 | } 55 | 56 | new BlockAPI(); -------------------------------------------------------------------------------- /Course_Blockchain_Data/Project_2_es6_starter_code/LevelSandbox.js: -------------------------------------------------------------------------------- 1 | /* ===== Persist data with LevelDB ================== 2 | | Learn more: level: https://github.com/Level/level | 3 | /===================================================*/ 4 | 5 | const level = require('level'); 6 | const chainDB = './chaindata'; 7 | 8 | class LevelSandbox { 9 | 10 | constructor() { 11 | this.db = level(chainDB); 12 | } 13 | 14 | // Get data from levelDB with key (Promise) 15 | getLevelDBData(key){ 16 | let self = this; 17 | return new Promise(function(resolve, reject) { 18 | // Add your code here, remember in Promises you need to resolve() or reject() 19 | }); 20 | } 21 | 22 | // Add data to levelDB with key and value (Promise) 23 | addLevelDBData(key, value) { 24 | let self = this; 25 | return new Promise(function(resolve, reject) { 26 | // Add your code here, remember in Promises you need to resolve() or reject() 27 | }); 28 | } 29 | 30 | // Method that return the height 31 | getBlocksCount() { 32 | let self = this; 33 | return new Promise(function(resolve, reject){ 34 | // Add your code here, remember in Promises you need to resolve() or reject() 35 | }); 36 | } 37 | 38 | 39 | } 40 | 41 | module.exports.LevelSandbox = LevelSandbox; 42 | -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/src/components/my-signature.js: -------------------------------------------------------------------------------- 1 | /** 2 | @license 3 | Copyright (c) 2018 The Polymer Project Authors. All rights reserved. 4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt 5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt 7 | Code distributed by Google as part of the polymer project is also 8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt 9 | */ 10 | 11 | import { html } from '@polymer/lit-element'; 12 | import { PageViewElement } from './page-view-element.js'; 13 | 14 | // These are the shared styles needed by this element. 15 | import { SharedStyles } from './shared-styles.js'; 16 | import { MySignatureForm } from './my-signatureform.js'; 17 | 18 | class MySignature extends PageViewElement { 19 | 20 | constructor() { 21 | super(); 22 | } 23 | 24 | render() { 25 | return html` 26 | ${SharedStyles} 27 |
28 |

Sign messages

29 | 30 |
31 | `; 32 | } 33 | 34 | 35 | } 36 | 37 | window.customElements.define('my-signature', MySignature); -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/payment/PullPayment.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | import "./escrow/Escrow.sol"; 4 | 5 | /** 6 | * @title PullPayment 7 | * @dev Base contract supporting async send for pull payments. Inherit from this 8 | * contract and use _asyncTransfer instead of send or transfer. 9 | */ 10 | contract PullPayment { 11 | Escrow private _escrow; 12 | 13 | constructor () internal { 14 | _escrow = new Escrow(); 15 | } 16 | 17 | /** 18 | * @dev Withdraw accumulated balance. 19 | * @param payee Whose balance will be withdrawn. 20 | */ 21 | function withdrawPayments(address payable payee) public { 22 | _escrow.withdraw(payee); 23 | } 24 | 25 | /** 26 | * @dev Returns the credit owed to an address. 27 | * @param dest The creditor's address. 28 | */ 29 | function payments(address dest) public view returns (uint256) { 30 | return _escrow.depositsOf(dest); 31 | } 32 | 33 | /** 34 | * @dev Called by the payer to store the sent amount as credit to be pulled. 35 | * @param dest The destination address of the funds. 36 | * @param amount The amount to transfer. 37 | */ 38 | function _asyncTransfer(address dest, uint256 amount) internal { 39 | _escrow.deposit.value(amount)(dest); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/websocket/lib/Deprecation.js: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2010-2015 Brian McKelvey. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | ***********************************************************************/ 16 | 17 | var Deprecation = { 18 | disableWarnings: false, 19 | 20 | deprecationWarningMap: { 21 | 22 | }, 23 | 24 | warn: function(deprecationName) { 25 | if (!this.disableWarnings && this.deprecationWarningMap[deprecationName]) { 26 | console.warn('DEPRECATION WARNING: ' + this.deprecationWarningMap[deprecationName]); 27 | this.deprecationWarningMap[deprecationName] = false; 28 | } 29 | } 30 | }; 31 | 32 | module.exports = Deprecation; 33 | -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/src/components/my-latestblocks.js: -------------------------------------------------------------------------------- 1 | /** 2 | @license 3 | Copyright (c) 2018 The Polymer Project Authors. All rights reserved. 4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt 5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt 7 | Code distributed by Google as part of the polymer project is also 8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt 9 | */ 10 | 11 | import { html } from '@polymer/lit-element'; 12 | import { PageViewElement } from './page-view-element.js'; 13 | 14 | // These are the shared styles needed by this element. 15 | import { SharedStyles } from './shared-styles.js'; 16 | import { MyLatestBlock } from './my-latestblock.js'; 17 | 18 | class MyLatestBlocks extends PageViewElement { 19 | 20 | constructor() { 21 | super(); 22 | } 23 | 24 | render() { 25 | return html` 26 | ${SharedStyles} 27 |
28 |

Browse Latest Blocks

29 | 30 |
31 | `; 32 | } 33 | 34 | 35 | } 36 | 37 | window.customElements.define('my-latestblocks', MyLatestBlocks); -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/token/ERC721/IERC721Receiver.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | /** 4 | * @title ERC721 token receiver interface 5 | * @dev Interface for any contract that wants to support safeTransfers 6 | * from ERC721 asset contracts. 7 | */ 8 | contract IERC721Receiver { 9 | /** 10 | * @notice Handle the receipt of an NFT 11 | * @dev The ERC721 smart contract calls this function on the recipient 12 | * after a `safeTransfer`. This function MUST return the function selector, 13 | * otherwise the caller will revert the transaction. The selector to be 14 | * returned can be obtained as `this.onERC721Received.selector`. This 15 | * function MAY throw to revert and reject the transfer. 16 | * Note: the ERC721 contract address is always the message sender. 17 | * @param operator The address which called `safeTransferFrom` function 18 | * @param from The address which previously owned the token 19 | * @param tokenId The NFT identifier which is being transferred 20 | * @param data Additional data with no specified format 21 | * @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` 22 | */ 23 | function onERC721Received(address operator, address from, uint256 tokenId, bytes memory data) 24 | public returns (bytes4); 25 | } 26 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/ownership/Secondary.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | /** 4 | * @title Secondary 5 | * @dev A Secondary contract can only be used by its primary account (the one that created it) 6 | */ 7 | contract Secondary { 8 | address private _primary; 9 | 10 | event PrimaryTransferred( 11 | address recipient 12 | ); 13 | 14 | /** 15 | * @dev Sets the primary account to the one that is creating the Secondary contract. 16 | */ 17 | constructor () internal { 18 | _primary = msg.sender; 19 | emit PrimaryTransferred(_primary); 20 | } 21 | 22 | /** 23 | * @dev Reverts if called from any account other than the primary. 24 | */ 25 | modifier onlyPrimary() { 26 | require(msg.sender == _primary); 27 | _; 28 | } 29 | 30 | /** 31 | * @return the address of the primary. 32 | */ 33 | function primary() public view returns (address) { 34 | return _primary; 35 | } 36 | 37 | /** 38 | * @dev Transfers contract to a new primary. 39 | * @param recipient The address of new primary. 40 | */ 41 | function transferPrimary(address recipient) public onlyPrimary { 42 | require(recipient != address(0)); 43 | _primary = recipient; 44 | emit PrimaryTransferred(_primary); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/src/components/my-blockhashutil.js: -------------------------------------------------------------------------------- 1 | /** 2 | @license 3 | Copyright (c) 2018 The Polymer Project Authors. All rights reserved. 4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt 5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt 7 | Code distributed by Google as part of the polymer project is also 8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt 9 | */ 10 | 11 | import { html } from '@polymer/lit-element'; 12 | import { PageViewElement } from './page-view-element.js'; 13 | 14 | // These are the shared styles needed by this element. 15 | import { SharedStyles } from './shared-styles.js'; 16 | 17 | import { MyBlockHashUtilityForm } from './my-blockhashutilityform.js' 18 | 19 | class MyBlockHashUtil extends PageViewElement { 20 | 21 | constructor() { 22 | super(); 23 | } 24 | 25 | render() { 26 | return html` 27 | ${SharedStyles} 28 |
29 |

Block Hash Utility

30 | 31 |
32 | `; 33 | } 34 | 35 | 36 | } 37 | 38 | window.customElements.define('my-blockhashutil', MyBlockHashUtil); -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/token/ERC721/IERC721.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | import "../../introspection/IERC165.sol"; 4 | 5 | /** 6 | * @title ERC721 Non-Fungible Token Standard basic interface 7 | * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md 8 | */ 9 | contract IERC721 is IERC165 { 10 | event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); 11 | event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); 12 | event ApprovalForAll(address indexed owner, address indexed operator, bool approved); 13 | 14 | function balanceOf(address owner) public view returns (uint256 balance); 15 | function ownerOf(uint256 tokenId) public view returns (address owner); 16 | 17 | function approve(address to, uint256 tokenId) public; 18 | function getApproved(uint256 tokenId) public view returns (address operator); 19 | 20 | function setApprovalForAll(address operator, bool _approved) public; 21 | function isApprovedForAll(address owner, address operator) public view returns (bool); 22 | 23 | function transferFrom(address from, address to, uint256 tokenId) public; 24 | function safeTransferFrom(address from, address to, uint256 tokenId) public; 25 | 26 | function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public; 27 | } 28 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/introspection/ERC165.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | import "./IERC165.sol"; 4 | 5 | /** 6 | * @title ERC165 7 | * @author Matt Condon (@shrugs) 8 | * @dev Implements ERC165 using a lookup table. 9 | */ 10 | contract ERC165 is IERC165 { 11 | bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7; 12 | /** 13 | * 0x01ffc9a7 === 14 | * bytes4(keccak256('supportsInterface(bytes4)')) 15 | */ 16 | 17 | /** 18 | * @dev a mapping of interface id to whether or not it's supported 19 | */ 20 | mapping(bytes4 => bool) private _supportedInterfaces; 21 | 22 | /** 23 | * @dev A contract implementing SupportsInterfaceWithLookup 24 | * implement ERC165 itself 25 | */ 26 | constructor () internal { 27 | _registerInterface(_INTERFACE_ID_ERC165); 28 | } 29 | 30 | /** 31 | * @dev implement supportsInterface(bytes4) using a lookup table 32 | */ 33 | function supportsInterface(bytes4 interfaceId) external view returns (bool) { 34 | return _supportedInterfaces[interfaceId]; 35 | } 36 | 37 | /** 38 | * @dev internal method for registering an interface 39 | */ 40 | function _registerInterface(bytes4 interfaceId) internal { 41 | require(interfaceId != 0xffffffff); 42 | _supportedInterfaces[interfaceId] = true; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/solidity/contracts/ExceptionsContract.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.24; 2 | 3 | contract ExceptionsContract { 4 | 5 | // Public variable lastCaller, with a value of none 6 | string public lastCaller = "none"; 7 | 8 | // Function revertBehavior that takes in a name as an argument, 9 | //and sets the lastCaller variable to this argument received 10 | function revertBehavior(string memory name) public returns (bool) { 11 | lastCaller = name; 12 | 13 | // Check if length of the string is zero 14 | // If the argument received has zero length, it throws an exception... 15 | // Once an exception is thrown, the variable lastCaller rolls back to its initial value 16 | if (bytes(name).length == 0) { 17 | revert("The length of the string is zero"); 18 | } 19 | // This is the same thing...just using require to check the length of the input string. 20 | // The code will only be exceuted if the length is greater than 0 21 | // The above lines of code may be replaced with this 22 | require(bytes(name).length > 0, "The length of the string is zero"); 23 | 24 | return true; 25 | } 26 | 27 | } 28 | 29 | // So, what is going on is that in the function revertBehavior 30 | // lastCaller is being changed to the input argument 31 | // and then an exception is thrown, and the lastCaller reverts back 32 | // to its orginial value, thus nullifying the effect 33 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/Smart_Contracts_With_Solidity/exceptionsContract.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.24; 2 | 3 | contract ExceptionsContract { 4 | 5 | // Public variable lastCaller, with a value of none 6 | string public lastCaller = "none"; 7 | 8 | // Function revertBehavior that takes in a name as an argument, 9 | //and sets the lastCaller variable to this argument received 10 | function revertBehavior(string memory name) public returns (bool) { 11 | lastCaller = name; 12 | 13 | // Check if length of the string is zero 14 | // If the argument received has zero length, it throws an exception... 15 | // Once an exception is thrown, the variable lastCaller rolls back to its initial value 16 | if (bytes(name).length == 0) { 17 | revert("The length of the string is zero"); 18 | } 19 | // This is the same thing...just using require to check the length of the input string. 20 | // The code will only be exceuted if the length is greater than 0 21 | // The above lines of code may be replaced with this 22 | require(bytes(name).length > 0, "The length of the string is zero"); 23 | 24 | return true; 25 | } 26 | 27 | } 28 | 29 | // So, what is going on is that in the function revertBehavior 30 | // lastCaller is being changed to the input argument 31 | // and then an exception is thrown, and the lastCaller reverts back 32 | // to its orginial value, thus nullifying the effect -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/solidity/contracts/StructsContract.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.24; 2 | 3 | contract StructsContract { 4 | 5 | // Family 6 | struct Family { 7 | bytes32 lastName; 8 | uint8 houseNo; 9 | uint16 age; 10 | } 11 | 12 | // Creating an array of type family..which is a struct 13 | Family[] myFamily; 14 | 15 | // Getting a lastName, and returning complete 16 | // family details 17 | // We cannot compare 2 strings in solidity... 18 | function getName(bytes32 name) public view returns (bytes32, uint8, uint16) { 19 | // Search the array 20 | for(uint8 i = 0; i < myFamily.length; i++){ 21 | if(name == myFamily[i].lastName) { 22 | return (myFamily[i].lastName,uint8(myFamily[i].houseNo), myFamily[i].age); 23 | } 24 | } 25 | } 26 | 27 | // Structs Cannot be passed as argument so we are passing all elements/attributes of struct as args 28 | function addName(bytes32 _lastName, uint8 _value, uint16 _age) public returns (bool) { 29 | // Declare the struct variable in memory... 30 | Family memory newFamily; 31 | // use the . notation to access members of a struct 32 | newFamily.lastName = _lastName; 33 | newFamily.houseNo = _value; 34 | newFamily.age = _age; 35 | // Push the newFamily struct...into our myFamily array 36 | myFamily.push(newFamily); 37 | return true; 38 | } 39 | } -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/Smart_Contracts_With_Solidity/structsContract.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.24; 2 | 3 | contract StructsContract { 4 | 5 | // Family 6 | struct Family { 7 | bytes32 lastName; 8 | uint8 houseNo; 9 | uint16 age; 10 | } 11 | 12 | // Creating an array of type family..which is a struct 13 | Family[] myFamily; 14 | 15 | // Getting a lastName, and returning complete 16 | // family details 17 | // We cannot compare 2 strings in solidity... 18 | function getName(bytes32 name) public view returns (bytes32, uint8, uint16) { 19 | // Search the array 20 | for(uint8 i = 0; i < myFamily.length; i++){ 21 | if(name == myFamily[i].lastName) { 22 | return (myFamily[i].lastName,uint8(myFamily[i].houseNo), myFamily[i].age); 23 | } 24 | } 25 | } 26 | 27 | // Structs Cannot be passed as argument so we are passing all elements/attributes of struct as args 28 | function addName(bytes32 _lastName, uint8 _value, uint16 _age) public returns (bool) { 29 | // Declare the struct variable in memory... 30 | Family memory newFamily; 31 | // use the . notation to access members of a struct 32 | newFamily.lastName = _lastName; 33 | newFamily.houseNo = _value; 34 | newFamily.age = _age; 35 | // Push the newFamily struct...into our myFamily array 36 | myFamily.push(newFamily); 37 | return true; 38 | } 39 | } -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/solidity/migrations/2_initial_migration.js: -------------------------------------------------------------------------------- 1 | var BasicDataType = artifacts.require("BasicDataType"); 2 | var TypesConversion = artifacts.require("TypesConversion"); 3 | var ArraysContract = artifacts.require("ArraysContract"); 4 | var StringBytes = artifacts.require("StringBytes"); 5 | var MappingsContract = artifacts.require("MappingsContract"); 6 | var EnumsContract = artifacts.require("EnumsContract"); 7 | var StructsContract = artifacts.require("StructsContract"); 8 | var GlobalVariables = artifacts.require("GlobalVariables"); 9 | var FunctionsContract = artifacts.require("FunctionsContract"); 10 | var ExceptionsContract = artifacts.require("ExceptionsContract"); 11 | var MainContract = artifacts.require("MainContract"); 12 | var InheritanceContract = artifacts.require("InheritanceContract"); 13 | var EventsContract = artifacts.require("EventsContract"); 14 | 15 | module.exports = function(deployer) { 16 | deployer.deploy(BasicDataType); 17 | deployer.deploy(TypesConversion); 18 | deployer.deploy(ArraysContract); 19 | deployer.deploy(StringBytes); 20 | deployer.deploy(MappingsContract); 21 | deployer.deploy(EnumsContract); 22 | deployer.deploy(StructsContract); 23 | deployer.deploy(GlobalVariables); 24 | deployer.deploy(FunctionsContract, "Test", 28); 25 | deployer.deploy(ExceptionsContract); 26 | deployer.deploy(MainContract, 100); 27 | deployer.deploy(InheritanceContract, "Test"); 28 | deployer.deploy(EventsContract); 29 | }; -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/nan/doc/script.md: -------------------------------------------------------------------------------- 1 | ## Script 2 | 3 | NAN provides a `v8::Script` helpers as the API has changed over the supported versions of V8. 4 | 5 | - Nan::CompileScript() 6 | - Nan::RunScript() 7 | 8 | 9 | 10 | ### Nan::CompileScript() 11 | 12 | A wrapper around [`v8::ScriptCompiler::Compile()`](https://v8docs.nodesource.com/node-8.11/da/da5/classv8_1_1_script_compiler.html#a93f5072a0db55d881b969e9fc98e564b). 13 | 14 | Note that `Nan::BoundScript` is an alias for `v8::Script`. 15 | 16 | Signature: 17 | 18 | ```c++ 19 | Nan::MaybeLocal Nan::CompileScript( 20 | v8::Local s, 21 | const v8::ScriptOrigin& origin); 22 | Nan::MaybeLocal Nan::CompileScript(v8::Local s); 23 | ``` 24 | 25 | 26 | 27 | ### Nan::RunScript() 28 | 29 | Calls `script->Run()` or `script->BindToCurrentContext()->Run(Nan::GetCurrentContext())`. 30 | 31 | Note that `Nan::BoundScript` is an alias for `v8::Script` and `Nan::UnboundScript` is an alias for `v8::UnboundScript` where available and `v8::Script` on older versions of V8. 32 | 33 | Signature: 34 | 35 | ```c++ 36 | Nan::MaybeLocal Nan::RunScript(v8::Local script) 37 | Nan::MaybeLocal Nan::RunScript(v8::Local script) 38 | ``` 39 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/nan/nan_converters_pre_43_inl.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | * NAN - Native Abstractions for Node.js 3 | * 4 | * Copyright (c) 2018 NAN contributors 5 | * 6 | * MIT License 7 | ********************************************************************/ 8 | 9 | #ifndef NAN_CONVERTERS_PRE_43_INL_H_ 10 | #define NAN_CONVERTERS_PRE_43_INL_H_ 11 | 12 | #define X(TYPE) \ 13 | imp::ToFactory::return_t \ 14 | imp::ToFactory::convert(v8::Local val) { \ 15 | return val->To ## TYPE(); \ 16 | } 17 | 18 | X(Boolean) 19 | X(Number) 20 | X(String) 21 | X(Object) 22 | X(Integer) 23 | X(Uint32) 24 | X(Int32) 25 | 26 | #undef X 27 | 28 | #define X(TYPE, NAME) \ 29 | imp::ToFactory::return_t \ 30 | imp::ToFactory::convert(v8::Local val) { \ 31 | return Just(val->NAME ## Value()); \ 32 | } 33 | 34 | X(bool, Boolean) 35 | X(double, Number) 36 | X(int64_t, Integer) 37 | X(uint32_t, Uint32) 38 | X(int32_t, Int32) 39 | 40 | #undef X 41 | 42 | #endif // NAN_CONVERTERS_PRE_43_INL_H_ 43 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/solidity/contracts/GlobalVariables.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.24; 2 | 3 | contract GlobalVariables { 4 | 5 | string public lastCaller = "not-set"; 6 | 7 | // Demonstrates the use of the ether subdenominations 8 | function etherUnitsTest() public pure returns(bool) { 9 | // True 10 | bool value = (1 ether == 1000 finney); 11 | return value; 12 | } 13 | 14 | // Demonstrates the use of the time units 15 | function timeUnits() public view returns (uint) { 16 | uint timeNow = now; //storing current time using now 17 | //returns block time in seconds since 1970 18 | if (timeNow == 1000 days) { // converting 1000 literal to days, using the suffix days 19 | return timeNow; 20 | } 21 | } 22 | 23 | // Demonstrates the use of block object 24 | function getBlockInformation() public view returns (uint number, bytes32 hash, address coinbase, uint difficulty) { 25 | number = block.number; // Previous block 26 | hash = blockhash(number - 1); // -1 because excluding current...same as block.blockhash() 27 | // Current block 28 | coinbase = block.coinbase; 29 | difficulty = block.difficulty; 30 | } 31 | 32 | // Demonstrates the use of the msg object 33 | function getMsgInformation() public view returns (bytes memory data, bytes4 sig, address sender) { 34 | data = msg.data; 35 | sig = msg.sig; 36 | sender = msg.sender; 37 | } 38 | 39 | } -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/access/roles/WhitelistAdminRole.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | import "../Roles.sol"; 4 | 5 | /** 6 | * @title WhitelistAdminRole 7 | * @dev WhitelistAdmins are responsible for assigning and removing Whitelisted accounts. 8 | */ 9 | contract WhitelistAdminRole { 10 | using Roles for Roles.Role; 11 | 12 | event WhitelistAdminAdded(address indexed account); 13 | event WhitelistAdminRemoved(address indexed account); 14 | 15 | Roles.Role private _whitelistAdmins; 16 | 17 | constructor () internal { 18 | _addWhitelistAdmin(msg.sender); 19 | } 20 | 21 | modifier onlyWhitelistAdmin() { 22 | require(isWhitelistAdmin(msg.sender)); 23 | _; 24 | } 25 | 26 | function isWhitelistAdmin(address account) public view returns (bool) { 27 | return _whitelistAdmins.has(account); 28 | } 29 | 30 | function addWhitelistAdmin(address account) public onlyWhitelistAdmin { 31 | _addWhitelistAdmin(account); 32 | } 33 | 34 | function renounceWhitelistAdmin() public { 35 | _removeWhitelistAdmin(msg.sender); 36 | } 37 | 38 | function _addWhitelistAdmin(address account) internal { 39 | _whitelistAdmins.add(account); 40 | emit WhitelistAdminAdded(account); 41 | } 42 | 43 | function _removeWhitelistAdmin(address account) internal { 44 | _whitelistAdmins.remove(account); 45 | emit WhitelistAdminRemoved(account); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/Smart_Contracts_With_Solidity/globalVariablesContract.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.24; 2 | 3 | contract GlobalVariables { 4 | 5 | string public lastCaller = "not-set"; 6 | 7 | // Demonstrates the use of the ether subdenominations 8 | function etherUnitsTest() public pure returns(bool) { 9 | // True 10 | bool value = (1 ether == 1000 finney); 11 | return value; 12 | } 13 | 14 | // Demonstrates the use of the time units 15 | function timeUnits() public view returns (uint) { 16 | uint timeNow = now; //storing current time using now 17 | //returns block time in seconds since 1970 18 | if (timeNow == 1000 days) { // converting 1000 literal to days, using the suffix days 19 | return timeNow; 20 | } 21 | } 22 | 23 | // Demonstrates the use of block object 24 | function getBlockInformation() public view returns (uint number, bytes32 hash, address coinbase, uint difficulty) { 25 | number = block.number; // Previous block 26 | hash = blockhash(number - 1); // -1 because excluding current...same as block.blockhash() 27 | // Current block 28 | coinbase = block.coinbase; 29 | difficulty = block.difficulty; 30 | } 31 | 32 | // Demonstrates the use of the msg object 33 | function getMsgInformation() public view returns (bytes memory data, bytes4 sig, address sender) { 34 | data = msg.data; 35 | sig = msg.sig; 36 | sender = msg.sender; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/push-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "/": { 3 | "src/components/my-app.js": { 4 | "type": "script", 5 | "weight": 1 6 | }, 7 | "src/components/my-view1.js": { 8 | "type": "script", 9 | "weight": 1 10 | }, 11 | "node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js": { 12 | "type": "script", 13 | "weight": 1 14 | } 15 | }, 16 | "/view1": { 17 | "src/components/my-app.js": { 18 | "type": "script", 19 | "weight": 1 20 | }, 21 | "src/components/my-view1.js": { 22 | "type": "script", 23 | "weight": 1 24 | }, 25 | "node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js": { 26 | "type": "script", 27 | "weight": 1 28 | } 29 | }, 30 | "/view2": { 31 | "src/components/my-app.js": { 32 | "type": "script", 33 | "weight": 1 34 | }, 35 | "src/components/my-view2.js": { 36 | "type": "script", 37 | "weight": 1 38 | }, 39 | "node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js": { 40 | "type": "script", 41 | "weight": 1 42 | } 43 | }, 44 | "/view3": { 45 | "src/components/my-app.js": { 46 | "type": "script", 47 | "weight": 1 48 | }, 49 | "src/components/my-view3.js": { 50 | "type": "script", 51 | "weight": 1 52 | }, 53 | "node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js": { 54 | "type": "script", 55 | "weight": 1 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/src/components/my-walletinfo.js: -------------------------------------------------------------------------------- 1 | /** 2 | @license 3 | Copyright (c) 2018 The Polymer Project Authors. All rights reserved. 4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt 5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt 7 | Code distributed by Google as part of the polymer project is also 8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt 9 | */ 10 | 11 | import { html } from '@polymer/lit-element'; 12 | import { PageViewElement } from './page-view-element.js'; 13 | 14 | // These are the shared styles needed by this element. 15 | import { SharedStyles } from './shared-styles.js'; 16 | 17 | import { MyBalance } from './my-balance.js'; 18 | import { MyTransaction } from './my-transaction.js' 19 | 20 | class MyWalletInfo extends PageViewElement { 21 | 22 | constructor() { 23 | super(); 24 | } 25 | 26 | render() { 27 | return html` 28 | ${SharedStyles} 29 |
30 |

Balances

31 | 32 |
33 |
34 |

Transactions

35 | 36 |
37 | `; 38 | } 39 | 40 | 41 | } 42 | 43 | window.customElements.define('my-walletinfo', MyWalletInfo); -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/crowdsale/distribution/PostDeliveryCrowdsale.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | import "../validation/TimedCrowdsale.sol"; 4 | import "../../math/SafeMath.sol"; 5 | 6 | /** 7 | * @title PostDeliveryCrowdsale 8 | * @dev Crowdsale that locks tokens from withdrawal until it ends. 9 | */ 10 | contract PostDeliveryCrowdsale is TimedCrowdsale { 11 | using SafeMath for uint256; 12 | 13 | mapping(address => uint256) private _balances; 14 | 15 | /** 16 | * @dev Withdraw tokens only after crowdsale ends. 17 | * @param beneficiary Whose tokens will be withdrawn. 18 | */ 19 | function withdrawTokens(address beneficiary) public { 20 | require(hasClosed()); 21 | uint256 amount = _balances[beneficiary]; 22 | require(amount > 0); 23 | _balances[beneficiary] = 0; 24 | _deliverTokens(beneficiary, amount); 25 | } 26 | 27 | /** 28 | * @return the balance of an account. 29 | */ 30 | function balanceOf(address account) public view returns (uint256) { 31 | return _balances[account]; 32 | } 33 | 34 | /** 35 | * @dev Overrides parent by storing balances instead of issuing tokens right away. 36 | * @param beneficiary Token purchaser 37 | * @param tokenAmount Amount of tokens purchased 38 | */ 39 | function _processPurchase(address beneficiary, uint256 tokenAmount) internal { 40 | _balances[beneficiary] = _balances[beneficiary].add(tokenAmount); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/crowdsale/validation/CappedCrowdsale.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | import "../../math/SafeMath.sol"; 4 | import "../Crowdsale.sol"; 5 | 6 | /** 7 | * @title CappedCrowdsale 8 | * @dev Crowdsale with a limit for total contributions. 9 | */ 10 | contract CappedCrowdsale is Crowdsale { 11 | using SafeMath for uint256; 12 | 13 | uint256 private _cap; 14 | 15 | /** 16 | * @dev Constructor, takes maximum amount of wei accepted in the crowdsale. 17 | * @param cap Max amount of wei to be contributed 18 | */ 19 | constructor (uint256 cap) public { 20 | require(cap > 0); 21 | _cap = cap; 22 | } 23 | 24 | /** 25 | * @return the cap of the crowdsale. 26 | */ 27 | function cap() public view returns (uint256) { 28 | return _cap; 29 | } 30 | 31 | /** 32 | * @dev Checks whether the cap has been reached. 33 | * @return Whether the cap was reached 34 | */ 35 | function capReached() public view returns (bool) { 36 | return weiRaised() >= _cap; 37 | } 38 | 39 | /** 40 | * @dev Extend parent behavior requiring purchase to respect the funding cap. 41 | * @param beneficiary Token purchaser 42 | * @param weiAmount Amount of wei contributed 43 | */ 44 | function _preValidatePurchase(address beneficiary, uint256 weiAmount) internal view { 45 | super._preValidatePurchase(beneficiary, weiAmount); 46 | require(weiRaised().add(weiAmount) <= _cap); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/cryptography/MerkleProof.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | /** 4 | * @title MerkleProof 5 | * @dev Merkle proof verification based on 6 | * https://github.com/ameensol/merkle-tree-solidity/blob/master/src/MerkleProof.sol 7 | */ 8 | library MerkleProof { 9 | /** 10 | * @dev Verifies a Merkle proof proving the existence of a leaf in a Merkle tree. Assumes that each pair of leaves 11 | * and each pair of pre-images are sorted. 12 | * @param proof Merkle proof containing sibling hashes on the branch from the leaf to the root of the Merkle tree 13 | * @param root Merkle root 14 | * @param leaf Leaf of Merkle tree 15 | */ 16 | function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { 17 | bytes32 computedHash = leaf; 18 | 19 | for (uint256 i = 0; i < proof.length; i++) { 20 | bytes32 proofElement = proof[i]; 21 | 22 | if (computedHash < proofElement) { 23 | // Hash(current computed hash + current element of the proof) 24 | computedHash = keccak256(abi.encodePacked(computedHash, proofElement)); 25 | } else { 26 | // Hash(current element of the proof + current computed hash) 27 | computedHash = keccak256(abi.encodePacked(proofElement, computedHash)); 28 | } 29 | } 30 | 31 | // Check if the computed hash (root) is equal to the provided root 32 | return computedHash == root; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/crowdsale/distribution/FinalizableCrowdsale.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | import "../../math/SafeMath.sol"; 4 | import "../validation/TimedCrowdsale.sol"; 5 | 6 | /** 7 | * @title FinalizableCrowdsale 8 | * @dev Extension of Crowdsale with a one-off finalization action, where one 9 | * can do extra work after finishing. 10 | */ 11 | contract FinalizableCrowdsale is TimedCrowdsale { 12 | using SafeMath for uint256; 13 | 14 | bool private _finalized; 15 | 16 | event CrowdsaleFinalized(); 17 | 18 | constructor () internal { 19 | _finalized = false; 20 | } 21 | 22 | /** 23 | * @return true if the crowdsale is finalized, false otherwise. 24 | */ 25 | function finalized() public view returns (bool) { 26 | return _finalized; 27 | } 28 | 29 | /** 30 | * @dev Must be called after crowdsale ends, to do some extra finalization 31 | * work. Calls the contract's finalization function. 32 | */ 33 | function finalize() public { 34 | require(!_finalized); 35 | require(hasClosed()); 36 | 37 | _finalized = true; 38 | 39 | _finalization(); 40 | emit CrowdsaleFinalized(); 41 | } 42 | 43 | /** 44 | * @dev Can be overridden to add finalization logic. The overriding function 45 | * should call super._finalization() to ensure the chain of finalization is 46 | * executed entirely. 47 | */ 48 | function _finalization() internal { 49 | // solhint-disable-previous-line no-empty-blocks 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/polymer.json: -------------------------------------------------------------------------------- 1 | { 2 | "entrypoint": "index.html", 3 | "shell": "src/components/my-app.js", 4 | "sources": [ 5 | "images/**/*" 6 | ], 7 | "extraDependencies": [ 8 | "manifest.json", 9 | "node_modules/@webcomponents/webcomponentsjs/**", 10 | "push-manifest.json" 11 | ], 12 | "builds": [ 13 | { 14 | "name": "esm-bundled", 15 | "browserCapabilities": [ 16 | "es2015", 17 | "modules" 18 | ], 19 | "js": { 20 | "minify": true 21 | }, 22 | "css": { 23 | "minify": true 24 | }, 25 | "html": { 26 | "minify": true 27 | }, 28 | "bundle": true, 29 | "addServiceWorker": true 30 | }, 31 | { 32 | "name": "es6-bundled", 33 | "browserCapabilities": [ 34 | "es2015" 35 | ], 36 | "js": { 37 | "compile": "es2015", 38 | "minify": true, 39 | "transformModulesToAmd": true 40 | }, 41 | "css": { 42 | "minify": true 43 | }, 44 | "html": { 45 | "minify": true 46 | }, 47 | "bundle": true, 48 | "addServiceWorker": true 49 | }, 50 | { 51 | "name": "es5-bundled", 52 | "js": { 53 | "compile": "es5", 54 | "minify": true, 55 | "transformModulesToAmd": true 56 | }, 57 | "css": { 58 | "minify": true 59 | }, 60 | "html": { 61 | "minify": true 62 | }, 63 | "bundle": true, 64 | "addServiceWorker": true 65 | } 66 | ], 67 | "moduleResolution": "node", 68 | "npm": true 69 | } 70 | -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/openzeppelin-solidity/contracts/lifecycle/Pausable.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | import "../access/roles/PauserRole.sol"; 4 | 5 | /** 6 | * @title Pausable 7 | * @dev Base contract which allows children to implement an emergency stop mechanism. 8 | */ 9 | contract Pausable is PauserRole { 10 | event Paused(address account); 11 | event Unpaused(address account); 12 | 13 | bool private _paused; 14 | 15 | constructor () internal { 16 | _paused = false; 17 | } 18 | 19 | /** 20 | * @return true if the contract is paused, false otherwise. 21 | */ 22 | function paused() public view returns (bool) { 23 | return _paused; 24 | } 25 | 26 | /** 27 | * @dev Modifier to make a function callable only when the contract is not paused. 28 | */ 29 | modifier whenNotPaused() { 30 | require(!_paused); 31 | _; 32 | } 33 | 34 | /** 35 | * @dev Modifier to make a function callable only when the contract is paused. 36 | */ 37 | modifier whenPaused() { 38 | require(_paused); 39 | _; 40 | } 41 | 42 | /** 43 | * @dev called by the owner to pause, triggers stopped state 44 | */ 45 | function pause() public onlyPauser whenNotPaused { 46 | _paused = true; 47 | emit Paused(msg.sender); 48 | } 49 | 50 | /** 51 | * @dev called by the owner to unpause, returns to normal state 52 | */ 53 | function unpause() public onlyPauser whenPaused { 54 | _paused = false; 55 | emit Unpaused(msg.sender); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Course_Blockchain_Identity/Practice_Block/.gitignore: -------------------------------------------------------------------------------- 1 | # Visual Studeio Code Editor 2 | /.vscode/* 3 | !/.vscode/settings.json 4 | !/.vscode/tasks.json 5 | !/.vscode/launch.json 6 | !/.vscode/extensions.json 7 | # Build directories 8 | /build/* 9 | # OSX 10 | /.DS_Store 11 | # Logs 12 | logs 13 | *.log 14 | npm-debug.log* 15 | yarn-debug.log* 16 | yarn-error.log* 17 | 18 | # Runtime data 19 | pids 20 | *.pid 21 | *.seed 22 | *.pid.lock 23 | 24 | # Directory for instrumented libs generated by jscoverage/JSCover 25 | lib-cov 26 | 27 | # Coverage directory used by tools like istanbul 28 | coverage 29 | 30 | # nyc test coverage 31 | .nyc_output 32 | 33 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 34 | .grunt 35 | 36 | # Bower dependency directory (https://bower.io/) 37 | bower_components 38 | 39 | # node-waf configuration 40 | .lock-wscript 41 | 42 | # Compiled binary addons (https://nodejs.org/api/addons.html) 43 | build/Release 44 | 45 | # Dependency directories 46 | node_modules/ 47 | jspm_packages/ 48 | 49 | # TypeScript v1 declaration files 50 | typings/ 51 | 52 | # Optional npm cache directory 53 | .npm 54 | 55 | # Optional eslint cache 56 | .eslintcache 57 | 58 | # Optional REPL history 59 | .node_repl_history 60 | 61 | # Output of 'npm pack' 62 | *.tgz 63 | 64 | # Yarn Integrity file 65 | .yarn-integrity 66 | 67 | # dotenv environment variables file 68 | .env 69 | 70 | # parcel-bundler cache (https://parceljs.org/) 71 | .cache 72 | 73 | # next.js build output 74 | .next 75 | 76 | # nuxt.js build output 77 | .nuxt 78 | 79 | # vuepress build output 80 | .vuepress/dist 81 | 82 | # Serverless directories 83 | .serverless -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-app/gulpfile.js: -------------------------------------------------------------------------------- 1 | /** 2 | @license 3 | Copyright (c) 2018 The Polymer Project Authors. All rights reserved. 4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt 5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt 7 | Code distributed by Google as part of the polymer project is also 8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt 9 | */ 10 | 11 | const gulp = require('gulp'); 12 | const rename = require('gulp-rename'); 13 | const replace = require('gulp-replace'); 14 | const del = require('del'); 15 | 16 | /** 17 | * Cleans the prpl-server build in the server directory. 18 | */ 19 | gulp.task('prpl-server:clean', () => { 20 | return del('server/build'); 21 | }); 22 | 23 | /** 24 | * Copies the prpl-server build to the server directory while renaming the 25 | * node_modules directory so services like App Engine will upload it. 26 | */ 27 | gulp.task('prpl-server:build', () => { 28 | const pattern = 'node_modules'; 29 | const replacement = 'node_assets'; 30 | 31 | return gulp.src('build/**') 32 | .pipe(rename(((path) => { 33 | path.basename = path.basename.replace(pattern, replacement); 34 | path.dirname = path.dirname.replace(pattern, replacement); 35 | }))) 36 | .pipe(replace(pattern, replacement)) 37 | .pipe(gulp.dest('server/build')); 38 | }); 39 | 40 | gulp.task('prpl-server', gulp.series( 41 | 'prpl-server:clean', 42 | 'prpl-server:build' 43 | )); 44 | -------------------------------------------------------------------------------- /Course_Blockchain_Data/Practice_Block_Data/.gitignore: -------------------------------------------------------------------------------- 1 | # Visual Studeio Code Editor 2 | /.vscode/* 3 | !/.vscode/settings.json 4 | !/.vscode/tasks.json 5 | !/.vscode/launch.json 6 | !/.vscode/extensions.json 7 | # Build directories 8 | /build/* 9 | # OSX 10 | /.DS_Store 11 | # Logs 12 | logs 13 | *.log 14 | npm-debug.log* 15 | yarn-debug.log* 16 | yarn-error.log* 17 | 18 | # Runtime data 19 | pids 20 | *.pid 21 | *.seed 22 | *.pid.lock 23 | 24 | # Directory for instrumented libs generated by jscoverage/JSCover 25 | lib-cov 26 | 27 | # Coverage directory used by tools like istanbul 28 | coverage 29 | 30 | # nyc test coverage 31 | .nyc_output 32 | 33 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 34 | .grunt 35 | 36 | # Bower dependency directory (https://bower.io/) 37 | bower_components 38 | 39 | # node-waf configuration 40 | .lock-wscript 41 | 42 | # Compiled binary addons (https://nodejs.org/api/addons.html) 43 | build/Release 44 | 45 | # Dependency directories 46 | node_modules/ 47 | jspm_packages/ 48 | 49 | # TypeScript v1 declaration files 50 | typings/ 51 | 52 | # Optional npm cache directory 53 | .npm 54 | 55 | # Optional eslint cache 56 | .eslintcache 57 | 58 | # Optional REPL history 59 | .node_repl_history 60 | 61 | # Output of 'npm pack' 62 | *.tgz 63 | 64 | # Yarn Integrity file 65 | .yarn-integrity 66 | 67 | # dotenv environment variables file 68 | .env 69 | 70 | # parcel-bundler cache (https://parceljs.org/) 71 | .cache 72 | 73 | # next.js build output 74 | .next 75 | 76 | # nuxt.js build output 77 | .nuxt 78 | 79 | # vuepress build output 80 | .vuepress/dist 81 | 82 | # Serverless directories 83 | .serverless -------------------------------------------------------------------------------- /Course_Blockchain_Identity/Practice_Hashing/.gitignore: -------------------------------------------------------------------------------- 1 | # Visual Studeio Code Editor 2 | /.vscode/* 3 | !/.vscode/settings.json 4 | !/.vscode/tasks.json 5 | !/.vscode/launch.json 6 | !/.vscode/extensions.json 7 | # Build directories 8 | /build/* 9 | # OSX 10 | /.DS_Store 11 | # Logs 12 | logs 13 | *.log 14 | npm-debug.log* 15 | yarn-debug.log* 16 | yarn-error.log* 17 | 18 | # Runtime data 19 | pids 20 | *.pid 21 | *.seed 22 | *.pid.lock 23 | 24 | # Directory for instrumented libs generated by jscoverage/JSCover 25 | lib-cov 26 | 27 | # Coverage directory used by tools like istanbul 28 | coverage 29 | 30 | # nyc test coverage 31 | .nyc_output 32 | 33 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 34 | .grunt 35 | 36 | # Bower dependency directory (https://bower.io/) 37 | bower_components 38 | 39 | # node-waf configuration 40 | .lock-wscript 41 | 42 | # Compiled binary addons (https://nodejs.org/api/addons.html) 43 | build/Release 44 | 45 | # Dependency directories 46 | node_modules/ 47 | jspm_packages/ 48 | 49 | # TypeScript v1 declaration files 50 | typings/ 51 | 52 | # Optional npm cache directory 53 | .npm 54 | 55 | # Optional eslint cache 56 | .eslintcache 57 | 58 | # Optional REPL history 59 | .node_repl_history 60 | 61 | # Output of 'npm pack' 62 | *.tgz 63 | 64 | # Yarn Integrity file 65 | .yarn-integrity 66 | 67 | # dotenv environment variables file 68 | .env 69 | 70 | # parcel-bundler cache (https://parceljs.org/) 71 | .cache 72 | 73 | # next.js build output 74 | .next 75 | 76 | # nuxt.js build output 77 | .nuxt 78 | 79 | # vuepress build output 80 | .vuepress/dist 81 | 82 | # Serverless directories 83 | .serverless -------------------------------------------------------------------------------- /Course_Blockchain_Data/Practice_Create_Transaction/.gitignore: -------------------------------------------------------------------------------- 1 | # Visual Studeio Code Editor 2 | /.vscode/* 3 | !/.vscode/settings.json 4 | !/.vscode/tasks.json 5 | !/.vscode/launch.json 6 | !/.vscode/extensions.json 7 | # Build directories 8 | /build/* 9 | # OSX 10 | /.DS_Store 11 | # Logs 12 | logs 13 | *.log 14 | npm-debug.log* 15 | yarn-debug.log* 16 | yarn-error.log* 17 | 18 | # Runtime data 19 | pids 20 | *.pid 21 | *.seed 22 | *.pid.lock 23 | 24 | # Directory for instrumented libs generated by jscoverage/JSCover 25 | lib-cov 26 | 27 | # Coverage directory used by tools like istanbul 28 | coverage 29 | 30 | # nyc test coverage 31 | .nyc_output 32 | 33 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 34 | .grunt 35 | 36 | # Bower dependency directory (https://bower.io/) 37 | bower_components 38 | 39 | # node-waf configuration 40 | .lock-wscript 41 | 42 | # Compiled binary addons (https://nodejs.org/api/addons.html) 43 | build/Release 44 | 45 | # Dependency directories 46 | node_modules/ 47 | jspm_packages/ 48 | 49 | # TypeScript v1 declaration files 50 | typings/ 51 | 52 | # Optional npm cache directory 53 | .npm 54 | 55 | # Optional eslint cache 56 | .eslintcache 57 | 58 | # Optional REPL history 59 | .node_repl_history 60 | 61 | # Output of 'npm pack' 62 | *.tgz 63 | 64 | # Yarn Integrity file 65 | .yarn-integrity 66 | 67 | # dotenv environment variables file 68 | .env 69 | 70 | # parcel-bundler cache (https://parceljs.org/) 71 | .cache 72 | 73 | # next.js build output 74 | .next 75 | 76 | # nuxt.js build output 77 | .nuxt 78 | 79 | # vuepress build output 80 | .vuepress/dist 81 | 82 | # Serverless directories 83 | .serverless -------------------------------------------------------------------------------- /Course_Blockchain_Data/Practice_LevelDB_And_Promises/.gitignore: -------------------------------------------------------------------------------- 1 | # Visual Studeio Code Editor 2 | /.vscode/* 3 | !/.vscode/settings.json 4 | !/.vscode/tasks.json 5 | !/.vscode/launch.json 6 | !/.vscode/extensions.json 7 | # Build directories 8 | /build/* 9 | # OSX 10 | /.DS_Store 11 | # Logs 12 | logs 13 | *.log 14 | npm-debug.log* 15 | yarn-debug.log* 16 | yarn-error.log* 17 | 18 | # Runtime data 19 | pids 20 | *.pid 21 | *.seed 22 | *.pid.lock 23 | 24 | # Directory for instrumented libs generated by jscoverage/JSCover 25 | lib-cov 26 | 27 | # Coverage directory used by tools like istanbul 28 | coverage 29 | 30 | # nyc test coverage 31 | .nyc_output 32 | 33 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 34 | .grunt 35 | 36 | # Bower dependency directory (https://bower.io/) 37 | bower_components 38 | 39 | # node-waf configuration 40 | .lock-wscript 41 | 42 | # Compiled binary addons (https://nodejs.org/api/addons.html) 43 | build/Release 44 | 45 | # Dependency directories 46 | node_modules/ 47 | jspm_packages/ 48 | 49 | # TypeScript v1 declaration files 50 | typings/ 51 | 52 | # Optional npm cache directory 53 | .npm 54 | 55 | # Optional eslint cache 56 | .eslintcache 57 | 58 | # Optional REPL history 59 | .node_repl_history 60 | 61 | # Output of 'npm pack' 62 | *.tgz 63 | 64 | # Yarn Integrity file 65 | .yarn-integrity 66 | 67 | # dotenv environment variables file 68 | .env 69 | 70 | # parcel-bundler cache (https://parceljs.org/) 71 | .cache 72 | 73 | # next.js build output 74 | .next 75 | 76 | # nuxt.js build output 77 | .nuxt 78 | 79 | # vuepress build output 80 | .vuepress/dist 81 | 82 | # Serverless directories 83 | .serverless -------------------------------------------------------------------------------- /Course_Blockchain_Web_Services/Practice_RestAPI_Hapi/.gitignore: -------------------------------------------------------------------------------- 1 | # Visual Studeio Code Editor 2 | /.vscode/* 3 | !/.vscode/settings.json 4 | !/.vscode/tasks.json 5 | !/.vscode/launch.json 6 | !/.vscode/extensions.json 7 | # Build directories 8 | /build/* 9 | # OSX 10 | /.DS_Store 11 | # Logs 12 | logs 13 | *.log 14 | npm-debug.log* 15 | yarn-debug.log* 16 | yarn-error.log* 17 | 18 | # Runtime data 19 | pids 20 | *.pid 21 | *.seed 22 | *.pid.lock 23 | 24 | # Directory for instrumented libs generated by jscoverage/JSCover 25 | lib-cov 26 | 27 | # Coverage directory used by tools like istanbul 28 | coverage 29 | 30 | # nyc test coverage 31 | .nyc_output 32 | 33 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 34 | .grunt 35 | 36 | # Bower dependency directory (https://bower.io/) 37 | bower_components 38 | 39 | # node-waf configuration 40 | .lock-wscript 41 | 42 | # Compiled binary addons (https://nodejs.org/api/addons.html) 43 | build/Release 44 | 45 | # Dependency directories 46 | node_modules/ 47 | jspm_packages/ 48 | 49 | # TypeScript v1 declaration files 50 | typings/ 51 | 52 | # Optional npm cache directory 53 | .npm 54 | 55 | # Optional eslint cache 56 | .eslintcache 57 | 58 | # Optional REPL history 59 | .node_repl_history 60 | 61 | # Output of 'npm pack' 62 | *.tgz 63 | 64 | # Yarn Integrity file 65 | .yarn-integrity 66 | 67 | # dotenv environment variables file 68 | .env 69 | 70 | # parcel-bundler cache (https://parceljs.org/) 71 | .cache 72 | 73 | # next.js build output 74 | .next 75 | 76 | # nuxt.js build output 77 | .nuxt 78 | 79 | # vuepress build output 80 | .vuepress/dist 81 | 82 | # Serverless directories 83 | .serverless -------------------------------------------------------------------------------- /Course_Blockchain_Web_Services/Practice_RestApi_Express/.gitignore: -------------------------------------------------------------------------------- 1 | # Visual Studeio Code Editor 2 | /.vscode/* 3 | !/.vscode/settings.json 4 | !/.vscode/tasks.json 5 | !/.vscode/launch.json 6 | !/.vscode/extensions.json 7 | # Build directories 8 | /build/* 9 | # OSX 10 | /.DS_Store 11 | # Logs 12 | logs 13 | *.log 14 | npm-debug.log* 15 | yarn-debug.log* 16 | yarn-error.log* 17 | 18 | # Runtime data 19 | pids 20 | *.pid 21 | *.seed 22 | *.pid.lock 23 | 24 | # Directory for instrumented libs generated by jscoverage/JSCover 25 | lib-cov 26 | 27 | # Coverage directory used by tools like istanbul 28 | coverage 29 | 30 | # nyc test coverage 31 | .nyc_output 32 | 33 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 34 | .grunt 35 | 36 | # Bower dependency directory (https://bower.io/) 37 | bower_components 38 | 39 | # node-waf configuration 40 | .lock-wscript 41 | 42 | # Compiled binary addons (https://nodejs.org/api/addons.html) 43 | build/Release 44 | 45 | # Dependency directories 46 | node_modules/ 47 | jspm_packages/ 48 | 49 | # TypeScript v1 declaration files 50 | typings/ 51 | 52 | # Optional npm cache directory 53 | .npm 54 | 55 | # Optional eslint cache 56 | .eslintcache 57 | 58 | # Optional REPL history 59 | .node_repl_history 60 | 61 | # Output of 'npm pack' 62 | *.tgz 63 | 64 | # Yarn Integrity file 65 | .yarn-integrity 66 | 67 | # dotenv environment variables file 68 | .env 69 | 70 | # parcel-bundler cache (https://parceljs.org/) 71 | .cache 72 | 73 | # next.js build output 74 | .next 75 | 76 | # nuxt.js build output 77 | .nuxt 78 | 79 | # vuepress build output 80 | .vuepress/dist 81 | 82 | # Serverless directories 83 | .serverless -------------------------------------------------------------------------------- /Course_Blockchain_Identity/bitcoin-wallet/bitcoin-wallet-api/.gitignore: -------------------------------------------------------------------------------- 1 | # Visual Studeio Code Editor 2 | /.vscode/* 3 | !/.vscode/settings.json 4 | !/.vscode/tasks.json 5 | !/.vscode/launch.json 6 | !/.vscode/extensions.json 7 | # Build directories 8 | /build/* 9 | # OSX 10 | /.DS_Store 11 | # Logs 12 | logs 13 | *.log 14 | npm-debug.log* 15 | yarn-debug.log* 16 | yarn-error.log* 17 | 18 | # Runtime data 19 | pids 20 | *.pid 21 | *.seed 22 | *.pid.lock 23 | 24 | # Directory for instrumented libs generated by jscoverage/JSCover 25 | lib-cov 26 | 27 | # Coverage directory used by tools like istanbul 28 | coverage 29 | 30 | # nyc test coverage 31 | .nyc_output 32 | 33 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 34 | .grunt 35 | 36 | # Bower dependency directory (https://bower.io/) 37 | bower_components 38 | 39 | # node-waf configuration 40 | .lock-wscript 41 | 42 | # Compiled binary addons (https://nodejs.org/api/addons.html) 43 | build/Release 44 | 45 | # Dependency directories 46 | node_modules/ 47 | jspm_packages/ 48 | 49 | # TypeScript v1 declaration files 50 | typings/ 51 | 52 | # Optional npm cache directory 53 | .npm 54 | 55 | # Optional eslint cache 56 | .eslintcache 57 | 58 | # Optional REPL history 59 | .node_repl_history 60 | 61 | # Output of 'npm pack' 62 | *.tgz 63 | 64 | # Yarn Integrity file 65 | .yarn-integrity 66 | 67 | # dotenv environment variables file 68 | .env 69 | 70 | # parcel-bundler cache (https://parceljs.org/) 71 | .cache 72 | 73 | # next.js build output 74 | .next 75 | 76 | # nuxt.js build output 77 | .nuxt 78 | 79 | # vuepress build output 80 | .vuepress/dist 81 | 82 | # Serverless directories 83 | .serverless -------------------------------------------------------------------------------- /Course_Blockchain_Data/Practice_Private_Blockchain_Code_Session/.gitignore: -------------------------------------------------------------------------------- 1 | # Visual Studeio Code Editor 2 | /.vscode/* 3 | !/.vscode/settings.json 4 | !/.vscode/tasks.json 5 | !/.vscode/launch.json 6 | !/.vscode/extensions.json 7 | # Build directories 8 | /build/* 9 | # OSX 10 | /.DS_Store 11 | # Logs 12 | logs 13 | *.log 14 | npm-debug.log* 15 | yarn-debug.log* 16 | yarn-error.log* 17 | 18 | # Runtime data 19 | pids 20 | *.pid 21 | *.seed 22 | *.pid.lock 23 | 24 | # Directory for instrumented libs generated by jscoverage/JSCover 25 | lib-cov 26 | 27 | # Coverage directory used by tools like istanbul 28 | coverage 29 | 30 | # nyc test coverage 31 | .nyc_output 32 | 33 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 34 | .grunt 35 | 36 | # Bower dependency directory (https://bower.io/) 37 | bower_components 38 | 39 | # node-waf configuration 40 | .lock-wscript 41 | 42 | # Compiled binary addons (https://nodejs.org/api/addons.html) 43 | build/Release 44 | 45 | # Dependency directories 46 | node_modules/ 47 | jspm_packages/ 48 | 49 | # TypeScript v1 declaration files 50 | typings/ 51 | 52 | # Optional npm cache directory 53 | .npm 54 | 55 | # Optional eslint cache 56 | .eslintcache 57 | 58 | # Optional REPL history 59 | .node_repl_history 60 | 61 | # Output of 'npm pack' 62 | *.tgz 63 | 64 | # Yarn Integrity file 65 | .yarn-integrity 66 | 67 | # dotenv environment variables file 68 | .env 69 | 70 | # parcel-bundler cache (https://parceljs.org/) 71 | .cache 72 | 73 | # next.js build output 74 | .next 75 | 76 | # nuxt.js build output 77 | .nuxt 78 | 79 | # vuepress build output 80 | .vuepress/dist 81 | 82 | # Serverless directories 83 | .serverless -------------------------------------------------------------------------------- /Course_Blockchain_Web_Services/Practice_Client_Server_Features/.gitignore: -------------------------------------------------------------------------------- 1 | # Visual Studeio Code Editor 2 | /.vscode/* 3 | !/.vscode/settings.json 4 | !/.vscode/tasks.json 5 | !/.vscode/launch.json 6 | !/.vscode/extensions.json 7 | # Build directories 8 | /build/* 9 | # OSX 10 | /.DS_Store 11 | # Logs 12 | logs 13 | *.log 14 | npm-debug.log* 15 | yarn-debug.log* 16 | yarn-error.log* 17 | 18 | # Runtime data 19 | pids 20 | *.pid 21 | *.seed 22 | *.pid.lock 23 | 24 | # Directory for instrumented libs generated by jscoverage/JSCover 25 | lib-cov 26 | 27 | # Coverage directory used by tools like istanbul 28 | coverage 29 | 30 | # nyc test coverage 31 | .nyc_output 32 | 33 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 34 | .grunt 35 | 36 | # Bower dependency directory (https://bower.io/) 37 | bower_components 38 | 39 | # node-waf configuration 40 | .lock-wscript 41 | 42 | # Compiled binary addons (https://nodejs.org/api/addons.html) 43 | build/Release 44 | 45 | # Dependency directories 46 | node_modules/ 47 | jspm_packages/ 48 | 49 | # TypeScript v1 declaration files 50 | typings/ 51 | 52 | # Optional npm cache directory 53 | .npm 54 | 55 | # Optional eslint cache 56 | .eslintcache 57 | 58 | # Optional REPL history 59 | .node_repl_history 60 | 61 | # Output of 'npm pack' 62 | *.tgz 63 | 64 | # Yarn Integrity file 65 | .yarn-integrity 66 | 67 | # dotenv environment variables file 68 | .env 69 | 70 | # parcel-bundler cache (https://parceljs.org/) 71 | .cache 72 | 73 | # next.js build output 74 | .next 75 | 76 | # nuxt.js build output 77 | .nuxt 78 | 79 | # vuepress build output 80 | .vuepress/dist 81 | 82 | # Serverless directories 83 | .serverless -------------------------------------------------------------------------------- /Course_Identity_And_Smart_Contracts/SampleToken/node_modules/websocket/lib/BufferUtil.fallback.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copied from: 3 | * ws: a node.js websocket client 4 | * Copyright(c) 2011 Einar Otto Stangvik 5 | * MIT Licensed 6 | */ 7 | 8 | /* jshint -W086 */ 9 | 10 | module.exports.BufferUtil = { 11 | merge: function(mergedBuffer, buffers) { 12 | var offset = 0; 13 | for (var i = 0, l = buffers.length; i < l; ++i) { 14 | var buf = buffers[i]; 15 | buf.copy(mergedBuffer, offset); 16 | offset += buf.length; 17 | } 18 | }, 19 | mask: function(source, mask, output, offset, length) { 20 | var maskNum = mask.readUInt32LE(0); 21 | var i = 0; 22 | for (; i < length - 3; i += 4) { 23 | var num = maskNum ^ source.readUInt32LE(i); 24 | if (num < 0) { num = 4294967296 + num; } 25 | output.writeUInt32LE(num, offset + i); 26 | } 27 | switch (length % 4) { 28 | case 3: output[offset + i + 2] = source[i + 2] ^ mask[2]; 29 | case 2: output[offset + i + 1] = source[i + 1] ^ mask[1]; 30 | case 1: output[offset + i] = source[i] ^ mask[0]; 31 | case 0: 32 | } 33 | }, 34 | unmask: function(data, mask) { 35 | var maskNum = mask.readUInt32LE(0); 36 | var length = data.length; 37 | var i = 0; 38 | for (; i < length - 3; i += 4) { 39 | var num = maskNum ^ data.readUInt32LE(i); 40 | if (num < 0) { num = 4294967296 + num; } 41 | data.writeUInt32LE(num, i); 42 | } 43 | switch (length % 4) { 44 | case 3: data[i + 2] = data[i + 2] ^ mask[2]; 45 | case 2: data[i + 1] = data[i + 1] ^ mask[1]; 46 | case 1: data[i] = data[i] ^ mask[0]; 47 | case 0: 48 | } 49 | } 50 | }; 51 | 52 | /* jshint +W086 */ --------------------------------------------------------------------------------