Last active
January 6, 2022 05:13
-
-
Save thetwosents/e8e4cea537d28d56d39ec32ef619619e to your computer and use it in GitHub Desktop.
Javascript core file for the StrongStart platform
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
package_name: @strongstart/core | |
contribute_email: jon@strongstart.io | |
author: Jon Senterfitt | |
owned_by: StrongStart | |
version: 1.0.0 | |
description: StrongStart Core Library | |
documentation: | |
// Introduction | |
This is a package for managing the infrastructure for machine-to-machine interactions. | |
This includes transport, communication, encryption, storage, and other services. | |
This should be governed and managed by a central AI with trusted authorities to interact with the blockchain. | |
Users who choose to be apart of the system, agree to being governed by an A.I. system dedicated to ensuring the security, safety, and trust of the system. | |
Challenges we ALL face in the future: | |
- Too much information | |
- Too much knowledge to attain | |
- Lack of shared understanding | |
- Lack of trust | |
- Lack of trust in a system | |
- Lack of ability to learn the complexities of the system | |
- Lack of scaling codebases and complexity infrastructures | |
// How our system can help these challenges | |
- Provide a centralized and secure system for managing the infrastructure for machine-to-machine interactions. | |
- Abstract the complexities of the system into NLP and natual ways to communicate with the system. | |
- Help users to learn | |
- Sharpen the comprehension of humans and machines, togther | |
// Why AI is critical to solve these challenges | |
- AI can help us learn | |
- AI can help us understand | |
- AI can help us understand the complexities of any system | |
- AI does not require a lot of code | |
- AI can be used to automate tasks | |
- AI can benefit users of the system, financially and otherwise | |
- Automation of tasks can be used to automate the process of learning for new AI NPCs in the system | |
Challenges we hope that can be solved by relying on AI-assisted programming in the initial build of the project: | |
- Overly complex compression and minification algorithms that are for minimizing human intervention in network processes. | |
- A physically impossible governance layer for the machine-to-machine interaction network transaction governance and protocol. | |
Steps to setup the Machine-to-Machine System | |
Let's start by creating a blockchain on EOSIO Testnet and deploying the StrongStart Infrastructure. | |
This will be done by the following steps: | |
1. Create a new account on the EOSIO Testnet | |
2. Get access to the EOSIO Testnet | |
3. Get tokens from the EOSIO Testnet | |
4. Define the StrongStart Infrastructure contract | |
5. Deploy the StrongStart Infrastructure contract | |
6. Host a site on the StrongStart Infrastructure contract | |
7. Deploy a website on the StrongStart Infrastructure contract | |
// Dependencies | |
Technologies to use: | |
1. EOSIO Testnet | |
2. EOSIO Javascript API | |
3. Filecoin | |
4. Fleek | |
5. IPFS | |
6. Google Cloud Platform or Heroku | |
7. Nodejs | |
8. React | |
9. React-Native | |
10. Commander | |
11. Express | |
14. IBM Carbon Design Language (React Components) | |
15. IBM Design System (React Components) | |
16. Google Analytics | |
17. Google Tag Manager | |
18. Hubspot | |
19. Firebase | |
20. Google Cloud Firestore | |
21. Google Cloud Storage | |
22. Google Cloud Functions | |
23. Google Cloud Pub/Sub | |
24. Google Cloud Vision | |
25. Google Cloud Translation | |
26. Google Cloud Natural Language | |
27. Google Cloud Speech | |
28. Google Cloud TTS | |
29. Playwright | |
30. Puppeteer | |
31. Selenium | |
32. Squarespace | |
33. Facebook Pixel | |
34. Facebook Ads | |
35. Facebook Audience Network | |
36. Facebook Ads Insights | |
37. Facebook Ads Conversion Tracking | |
38. Facebook Ads Dynamic Ads | |
39. Facebook Ads Dynamic Ads Bid Manager | |
40. Twitter Ads | |
41. Twitter Ads Insights | |
42. SSO (Single Sign On) | |
43. OAuth\OAuth2 | |
44. OAuth\OAuth2\Client | |
45. OAuth\OAuth2\Client\Provider | |
46. Encryption | |
47. Access Control | |
48. Authentication | |
49. Authorization | |
50. Authorization Code Grant | |
51. Authorization Code Grant\Authorization Code | |
52. Ingress Control | |
53. Load balancer | |
54. WAFF (Web Application Firewall) | |
55. HTTPS | |
56. HTTPS\SSL | |
57. HTTPS\SSL\TLS | |
58. Kubernetes | |
59. Docker | |
60. Docker Compose | |
61. Docker Swarm | |
62. Docker Registry | |
63. Docker Registry\Docker Hub | |
64. Ansible | |
65. Ansible\Ansible Tower | |
66. OpenShift | |
67. OpenShift\OpenShift 4 | |
68. Red Hat OpenShift | |
69. IBM Blockchain Platform | |
70. Amazon Timestream (For transactional data streams) | |
71. Amazon Kinesis (For transactional data streams) | |
72. Amazon DynamoDB (For transactional data streams) | |
73. Amazon Simple Storage Service (For transactional data streams) | |
74. Amazon Simple Queue Service (For transactional data streams) | |
75. Amazon Simple Notification Service (For transactional data streams) | |
76. Amazon Simple Email Service (For transactional data streams) | |
77. Amazon Simple Queue Service (For transactional data streams) | |
78. Stripe | |
79. Mailgun | |
80. Mailjet | |
81. React Hooks | |
82. React Hooks\useState | |
83. React Hooks\useEffect | |
84. React Hooks\useContext | |
85. React Hooks\useReducer | |
86. React Hooks\useCallback | |
87. React Hooks\useMemo | |
88. React Hooks\useRef | |
89. Axios | |
90. Axios\Axios Request | |
91. Amazon Key Management Service | |
92. Google Key Management Service | |
93. IBM Key Management Service | |
94. Ethereum | |
95. Hyperledger Fabric | |
96. Hyperledger Fabric\Hyperledger Fabric Blockchain | |
// Currencies supported: | |
1. USD | |
2. HYPE (owned & operated by Hyperion) | |
3. EOS | |
4. ETH | |
5. BTC | |
6. LTC | |
7. BCH | |
8. XRP | |
9. XMR | |
10. DASH | |
11. XEM | |
12. XLM | |
// Assets can be created and traded on these blockchain networks: | |
1. EOSIO Testnet | |
2. EOSIO Mainnet | |
3. Ethereum | |
4. Hyperledger Fabric | |
5. Bitcoin Cash | |
6. Bitcoin Cash Testnet | |
7. Bitcoin Testnet | |
8. Litecoin | |
9. Litecoin Testnet | |
10. Ripple | |
11. Ripple Testnet | |
12. Dash | |
13. Dash Testnet | |
14. Monero | |
Stripe is used to process payments that are not crypto currencies. | |
1. Stripe\Stripe API | |
2. Stripe\Stripe Elements | |
Accepted payments in Stripe: | |
1. Debit Card | |
2. Credit Card | |
3. Bitcoin | |
4. Ethereum | |
5. Litecoin | |
Mailgun is used to send transactional emails. | |
1. Mailgun\Mailgun API | |
2. Mailgun\Mailgun SDK | |
Mailjet is used to create, test and send templated transactional emails. | |
1. Mailjet\Mailjet API | |
2. Mailjet\Mailjet SDK | |
Facebook Pixel is used to track events on the website. | |
1. Facebook Pixel\Facebook Pixel API | |
2. Facebook Pixel\Facebook Pixel SDK | |
Facebook Ads is used to create, test and send transactional ads. | |
1. Facebook Ads\Facebook Ads API | |
2. Facebook Ads\Facebook Ads SDK | |
Facebook Ads Insights is used to retrieve data from Facebook Ads. | |
1. Facebook Ads\Facebook Ads API | |
2. Facebook Ads\Facebook Ads SDK | |
Facebook Ads Conversion Tracking is used to track conversions on the website. | |
1. Facebook Ads\Facebook Ads API | |
2. Facebook Ads\Facebook Ads SDK | |
Facebook Ads Dynamic Ads is used to create, test and send ads. | |
1. Facebook Ads\Facebook Ads API | |
2. Facebook Ads\Facebook Ads SDK | |
Facebook Ads Dynamic Ads Bid Manager is used to manage ads. | |
1. Facebook Ads\Facebook Ads API | |
2. Facebook Ads\Facebook Ads SDK | |
Twitter Ads is used to create, test and send transactional ads. | |
1. Twitter Ads\Twitter Ads API | |
2. Twitter Ads\Twitter Ads SDK | |
Twitter Ads Insights is used to retrieve data from Twitter Ads. | |
1. Twitter Ads\Twitter Ads API | |
2. Twitter Ads\Twitter Ads SDK | |
SSO (Single Sign On) is used to authenticate users. | |
1. OAuth\OAuth2 | |
2. OAuth\OAuth2\Client | |
3. OAuth\OAuth2\Client\Provider | |
crypto is used for the following: | |
1. EOSIO Javascript API | |
2. Filecoin | |
3. Fleek | |
4. IPFS | |
5. Google Cloud Platform or Heroku | |
6. Nodejs | |
7. React | |
8. React-Native | |
Timestream is used for the following: | |
1. Pulling events from the UI of all applications into a central, secure data lake | |
2. Transactional data streams | |
Google Tag Manager serves as a container for all actions in an application. | |
1. Google Tag Manager\Google Tag Manager API | |
2. Google Tag Manager\Google Tag Manager SDK | |
Google Analytics is a BI layer that provides insights into the behavior of your users. | |
1. Google Analytics\Google Analytics API | |
2. Google Analytics\Google Analytics SDK | |
Google Cloud Functions is a serverless platform that allows you to create and manage functions. | |
1. Google Cloud Functions\Google Cloud Functions API | |
2. Google Cloud Functions\Google Cloud Functions SDK | |
Firebase is a platform with a suite of application development tools. | |
1. Firebase\Firebase API | |
2. Firebase\Firebase SDK | |
Firebase Hosting is a platform that allows you to host your website and application on the Firebase platform. | |
1. Firebase\Firebase Hosting\Firebase Hosting API | |
2. Firebase\Firebase Hosting\Firebase Hosting SDK | |
IPFS is a peer-to-peer hypermedia protocol for the Internet. | |
1. IPFS\IPFS API | |
2. IPFS\IPFS SDK | |
We use IPFS to store the following: | |
1. Blockchain data | |
2. Blockchain data\Ethereum | |
3. Blockchain data\Bitcoin | |
4. Blockchain data\Bitcoin Cash | |
5. Blockchain data\Litecoin | |
6. Blockchain data\Ripple | |
7. Blockchain data\Dash | |
8. Blockchain data\Monero | |
9. Blockchain data\Filecoin | |
10. Blockchain data\Fleek | |
11. Blockchain data\IPFS | |
Fleek is used to build, deploy, scale, and manage decentralized applications. | |
1. Fleek\Fleek API | |
2. Fleek\Fleek SDK | |
Github is the most popular open source code hosting service. | |
1. Github\Github API | |
2. Github\Github SDK | |
We use Github to store all source code for @strongstart | |
1. Github\Github API | |
2. Github\Github SDK | |
All generated code is owned and maintained by StrongStart and it's proprietary A.I. | |
Docker is a platform for developers to build, ship, and run software containers. | |
1. Docker\Docker API | |
2. Docker\Docker SDK | |
Docker allows @strongstart to package and deploy applications to the Docker platform to be used by the @strongstart platform. | |
1. Docker\Docker API | |
2. Docker\Docker SDK | |
Docker Hub is a repository hosting service for Docker. | |
1. Docker\Docker Hub API | |
2. Docker\Docker Hub SDK | |
*/ | |
// From this point forward, I will be working with my local A.I. to define core elements of this system. | |
// Package format for the A.I. interpreter has a "\" instead of a "/" | |
// This is by design. | |
// Packages needed to achieve the above goals: | |
// packagingSystem for the dependency tree below: | |
const getPackageFromDependencyTree = (dependencyTree, packageName) => { | |
// console.log(dependencyTree); | |
// console.log(packageName); | |
const package = dependencyTree.find(dependency => dependency.name === packageName); | |
// console.log(package); | |
return package; | |
} | |
// Decrypt the strongstart.json file | |
const decryptStrongstartJson = (strongstartJson, password) => { | |
// console.log(strongstartJson); | |
// Log a transaction for the decryption of the strongstart.json file to the blockchain | |
// This transaction will be used to verify the integrity of the strongstart.json file | |
// The transaction will be signed by the strongstart.json file's private key | |
// The transaction will be signed by the strongstart.json file's public key | |
const transaction = { | |
"from": strongstartJson.privateKey, | |
"to": strongstartJson.publicKey, | |
"data": { | |
"type": "decrypt", | |
"data": strongstartJson.encryptedStrongstartJson | |
} | |
} | |
// console.log(transaction); | |
const strongstartJsonDecrypted = JSON.parse(crypto.decrypt(strongstartJson)); | |
// console.log(strongstartJsonDecrypted); | |
return strongstartJsonDecrypted; | |
} | |
// All functions should return this payload object | |
const payload = { | |
"success": false, | |
"message": "", | |
"data": {} // This can include ANY data that the function needs to return in order to complete its task | |
} | |
// Wrap all functions in a try/catch block | |
// This will catch any errors that occur in the function and return the payload object | |
const tryCatch = (func) => { | |
try { | |
const payload = func(); | |
return payload; | |
} catch (error) { | |
return { | |
"success": false, | |
"message": error.message, | |
"data": {} | |
} | |
} | |
} | |
// Build the dependency tree | |
const buildDependencyTree = (strongstartJson) => { | |
// console.log(strongstartJson); | |
const dependencyTree = []; | |
const dependencies = strongstartJson.dependencies; | |
// console.log(dependencies); | |
for (const dependency of dependencies) { | |
const package = getPackageFromDependencyTree(dependencyTree, dependency.name); | |
if (package) { | |
package.dependencies.push(dependency); | |
} else { | |
dependencyTree.push({ | |
"name": dependency.name, | |
"dependencies": [dependency] | |
}); | |
} | |
} | |
// console.log(dependencyTree); | |
return dependencyTree; | |
} | |
// Get the dependency tree | |
const getDependencyTree = (strongstartJson) => { | |
const dependencyTree = buildDependencyTree(strongstartJson); | |
// console.log(dependencyTree); | |
return dependencyTree; | |
} | |
// Load context for the onboard session AI with the dependency tree and the strongstart.json file | |
const loadContext = (strongstartJson, dependencyTree) => { | |
// console.log(strongstartJson); | |
// console.log(dependencyTree); | |
const context = { | |
"strongstartJson": strongstartJson, | |
"dependencyTree": dependencyTree | |
} | |
// console.log(context); | |
return context; | |
} | |
// Store context in a compressed/encrypted working memory for the onboard session AI | |
const storeContext = (context) => { | |
// console.log(context); | |
const contextEncrypted = crypto.encrypt(JSON.stringify(context)); | |
// console.log(contextEncrypted); | |
return contextEncrypted; | |
} | |
// Load context from the compressed/encrypted working memory for the onboard session AI | |
const loadContextFromMemory = (strongstartJson, contextEncrypted) => { | |
// console.log(strongstartJson); | |
// console.log(contextEncrypted); | |
const context = JSON.parse(crypto.decrypt(contextEncrypted)); | |
// console.log(context); | |
return context; | |
} | |
// Develop a handler to derive context from the onboard session AI with an interactive session | |
const developContext = (strongstartJson, dependencyTree, contextEncrypted, session, sessionId) => { | |
// console.log(strongstartJson); | |
// console.log(dependencyTree); | |
// console.log(contextEncrypted); | |
// console.log(session); | |
// console.log(sessionId); | |
const context = loadContextFromMemory(strongstartJson, contextEncrypted); | |
// console.log(context); | |
const payload = { | |
"success": true, | |
"message": "", | |
"data": { | |
"context": context, | |
"session": session, | |
"sessionId": sessionId | |
} | |
} | |
// console.log(payload); | |
return payload; | |
} | |
// Begin natural language processing for the onboard session AI | |
const beginNaturalLanguageProcessing = (context, session, sessionId) => { | |
// console.log(context); | |
// console.log(session); | |
// console.log(sessionId); | |
const payload = { | |
"success": true, | |
"message": "", | |
"data": { | |
"context": context, | |
"session": session, | |
"sessionId": sessionId | |
} | |
} | |
// console.log(payload); | |
return payload; | |
} | |
// Will need to clean the above handlers to include secondary dependencies | |
// Begin the onboard session AI | |
const beginOnboardSession = (strongstartJson, dependencyTree, contextEncrypted, session, sessionId) => { | |
// console.log(strongstartJson); | |
// console.log(dependencyTree); | |
// console.log(contextEncrypted); | |
// console.log(session); | |
// console.log(sessionId); | |
const context = loadContextFromMemory(strongstartJson, contextEncrypted); | |
// console.log(context); | |
const payload = { | |
"success": true, | |
"message": "", | |
"data": { | |
"context": context, | |
"session": session, | |
"sessionId": sessionId | |
} | |
} | |
// console.log(payload); | |
return payload; | |
} | |
// Underlying function for the onboard session AI | |
const buildSessionConfigurationFromContext = (context) => { | |
// console.log(context); | |
const sessionConfiguration = { | |
"sessionId": context.sessionId, | |
"session": context.session, | |
"context": context.context | |
} | |
// console.log(sessionConfiguration); | |
return sessionConfiguration; | |
} | |
// Archiver for data that is transacted during the session | |
// This should utilize the inherent nature of decentralized storage | |
const archiveData = (sessionConfiguration, data) => { | |
// console.log(sessionConfiguration); | |
// console.log(data); | |
const payload = { | |
"success": true, | |
"message": "", | |
"data": { | |
"sessionConfiguration": sessionConfiguration, | |
"data": data | |
} | |
} | |
// console.log(payload); | |
return payload; | |
} | |
// Encrypt the sessionConfiguration object | |
const encryptSessionConfiguration = (sessionConfiguration) => { | |
// console.log(sessionConfiguration); | |
const sessionConfigurationEncrypted = crypto.encrypt(JSON.stringify(sessionConfiguration)); | |
// console.log(sessionConfigurationEncrypted); | |
return sessionConfigurationEncrypted; | |
} | |
// Decrypt the sessionConfiguration object | |
const decryptSessionConfiguration = (sessionConfigurationEncrypted) => { | |
// console.log(sessionConfigurationEncrypted); | |
const sessionConfiguration = JSON.parse(crypto.decrypt(sessionConfigurationEncrypted)); | |
// console.log(sessionConfiguration); | |
return sessionConfiguration; | |
} | |
// Ensure a trusted session is established | |
const ensureTrustedSession = (sessionConfiguration) => { | |
// console.log(sessionConfiguration); | |
const payload = { | |
"success": true, | |
"message": "", | |
"data": { | |
"sessionConfiguration": sessionConfiguration | |
} | |
} | |
// console.log(payload); | |
return payload; | |
} | |
// A typical session configuration would look like this: | |
const buildSessionConfiguration = (strongstartJson, dependencyTree, contextEncrypted, session, sessionId) => { | |
// console.log(strongstartJson); | |
// console.log(dependencyTree); | |
// console.log(contextEncrypted); | |
// console.log(session); | |
// console.log(sessionId); | |
const context = loadContextFromMemory(strongstartJson, contextEncrypted); | |
// console.log(context); | |
const sessionConfiguration = buildSessionConfigurationFromContext(context); | |
// console.log(sessionConfiguration); | |
const payload = { | |
"success": true, | |
"message": "", | |
"data": { | |
"sessionConfiguration": sessionConfiguration | |
} | |
} | |
// console.log(payload); | |
return payload; | |
} | |
// Get session configuration file from decentralized storage to reload in memory at a later time for playback and analysis by the natural language processing engine | |
const getSessionConfiguration = (strongstartJson, dependencyTree, contextEncrypted, session, sessionId) => { | |
// console.log(strongstartJson); | |
// console.log(dependencyTree); | |
// console.log(contextEncrypted); | |
// console.log(session); | |
// console.log(sessionId); | |
const sessionConfiguration = buildSessionConfiguration(strongstartJson, dependencyTree, contextEncrypted, session, sessionId); | |
// console.log(builtSessionConfiguration); | |
const sessionConfigurationEncrypted = encryptSessionConfiguration(sessionConfiguration); | |
// console.log(sessionConfigurationEncrypted); | |
const payload = { | |
"success": true, | |
"message": "", | |
"data": { | |
"sessionConfigurationEncrypted": sessionConfigurationEncrypted | |
} | |
} | |
// console.log(payload); | |
return payload; | |
} | |
// All functions should go through a functionHandler function to ensure that the function is executed by the correct user with transaction signing | |
const functionHandler = (strongstartJson, functionName, functionPayload) => { | |
let result = { | |
"success": false, | |
"message": functionName, | |
"data": functionPayload | |
} | |
} | |
// Unminify the dependency tree | |
const unminifyDependencyTree = (dependencyTree) => { | |
const unminifiedDependencyTree = dependencyTree.map(dependency => { | |
const unminifiedDependency = { | |
name: dependency.name, | |
version: dependency.version, | |
dependencies: dependency.dependencies.map(dependency => { | |
if (dependency.dependencies) { | |
return { | |
name: dependency.name, | |
version: dependency.version, | |
dependencies: unminifyDependencyTree(dependency.dependencies) | |
} | |
} else { | |
return { | |
name: dependency.name, | |
version: dependency.version | |
} | |
} | |
}) | |
} | |
return unminifiedDependency; | |
}) | |
return unminifiedDependencyTree; | |
} | |
// 1. @strongstart | |
// 2. @strongstart\@cloud | |
// 3. @strongstart\@cloud\@aws | |
// 4. @strongstart\@cloud\@aws\timestream | |
// 5. @strongstart\@cloud\@aws\kinesis | |
// 6. @strongstart\@cloud\@aws\dynamodb | |
// 7. @strongstart\@cloud\@aws\s3 | |
// 8. @strongstart\@cloud\@google | |
// 9. @strongstart\@cloud\@google\firebase | |
// 10. @strongstart\@cloud\@google\firebase\firebase-hosting | |
// 11. @strongstart\@cloud\@google\firebase\firebase-analytics | |
// 12. @strongstart\@cloud\@google\firebase\firebase-admob | |
// 13. @strongstart\@cloud\@google\firebase\firebase-functions | |
// 14. @strongstart\@cloud\@google\firebase\firebase-storage | |
// 15. @strongstart\@cloud\@google\firebase\firebase-database | |
// 16. @strongstart\@cloud\@google\firebase\firebase-messaging | |
// 17. @strongstart\@cloud\@google\firebase\firebase-performance | |
// 18. @strongstart\@cloud\@google\firebase\firebase-crashlytics | |
// 19. @strongstart\@cloud\@google\firebase\firebase-remote-config | |
// 20. @strongstart\@cloud\@ibm\ibm-blockchain | |
// 21. @strongstart\@cloud\@ibm\ibm-blockchain\ibm-blockchain-sdk | |
// 22. @strongstart\@cloud\@ibm\ibm-blockchain\ibm-blockchain-sdk-node | |
// 23. @strongstart\@cloud\@ibm\ibm-blockchain\ibm-blockchain-sdk-javascript | |
// 24. @strongstart\@cloud\@ibm\ibm-blockchain\ibm-blockchain-sdk-go | |
// 25. @strongstart\@cloud\@redhat\redhat-blockchain | |
// 26. @strongstart\@cloud\@redhat\ansible | |
// 27. @strongstart\@cloud\@redhat\ansible\ansible-playbook | |
// 28. @strongstart\@cloud\@docker | |
// 29. @strongstart\@cloud\@docker\docker-compose | |
// 30. @strongstart\@cloud\@docker\docker-machine | |
// 31. @strongstart\@cloud\vault | |
// 32. @strongstart\@cloud\vault\vault-cli | |
// 33. @strongstart\@cloud\vault\vault-server | |
// 34. @strongstart\@cloud\vault\vault-kv-engine-consul | |
// 35. @strongstart\@cloud\vault\vault-kv-engine-etcd | |
// 37. @strongstart\@cloud\orchestratator | |
// (No numbers for the sake of time and generation) | |
// @strongstart\@cloud\gatherer | |
const gatherer = require('./gatherer'); | |
// @strongstart\@cloud\qualifier | |
const qualifier = require('./qualifier'); | |
// @strongstart\@cloud\connector | |
const connector = require('./connector'); | |
// @strongstart\@cloud\executor | |
const executor = require('./executor'); | |
// @strongstart\@cloud\packager | |
// @strongstart\@cloud\distrubutor | |
// @strongstart\@cloud\receiver | |
// @strongstart\@cloud\broker | |
// @strongstart\@cloud\gateway | |
// @strongstart\@cloud\router | |
// @strongstart\@cloud\proxy | |
// @strongstart\@cloud\analyzer | |
// @strongstart\@cloud\monitor | |
// @strongstart\@cloud\logger | |
// @strongstart\@cloud\notifier | |
// @strongstart\@cloud\sender | |
// @strongstart\@cloud\scheduler | |
// @strongstart\@cloud\store | |
// @strongstart\@cloud\validator | |
// @strongstart\@cloud\translator | |
// @strongstart\@cloud\converter | |
// @strongstart\@cloud\encoder | |
// @strongstart\@cloud\decoder | |
// @strongstart\@cloud\parser | |
// @strongstart\@cloud\serializer | |
// @strongstart\@cloud\generator | |
// @strongstart\@cloud\encryptor | |
// @strongstart\@cloud\decryptor | |
// @strongstart\@cloud\signer | |
// @strongstart\@cloud\verifier | |
// @strongstart\@cloud\compressor | |
// @strongstart\@cloud\decompressor | |
// @strongstart\@cloud\minifier | |
// @strongstart\@cloud\maxifier | |
// @strongstart\@cloud\formatter | |
// @strongstart\@cloud\unformatter | |
// @strongstart\@cloud\validator | |
// @strongstart\@cloud\bundler | |
// @strongstart\@cloud\unbundler | |
// @strongstart\@cloud\deployer | |
// @strongstart\@cloud\miner | |
// @strongstart\@cloud\calculator | |
// @strongstart\@cloud\converter | |
// @strongstart\@cloud\yaml | |
// @strongstart\@cloud\json | |
// @strongstart\@cloud\xml | |
// @strongstart\@cloud\csv | |
// @strongstart\@cloud\graphql | |
// @strongstart\@cloud\rest | |
// @strongstart\@cloud\websocket | |
// @strongstart\@cloud\http | |
// @strongstart\@cloud\https | |
// @strongstart\@cloud\tcp | |
// @strongstart\@cloud\udp | |
// @strongstart\@cloud\web3 | |
// @strongstart\@cloud\web3\web3-eth | |
// @strongstart\@cloud\web3\web3-eth-accounts | |
// @strongstart\@cloud\web3\bitcoin | |
// @strongstart\@cloud\web3\bitcoin-cash | |
// @strongstart\@cloud\web3\bitcoin-core | |
// @strongstart\@cloud\web3\bitcoin-wallet | |
// @strongstart\@cloud\web3\ethereum | |
// @strongstart\@cloud\web3\ethereum-accounts | |
// @strongstart\@cloud\web3\ethereum-wallet | |
// @strongstart\@cloud\web3\ethereum-classic | |
// @strongstart\@cloud\web3\ethereum-classic-accounts | |
// @strongstart\@cloud\node | |
// @strongstart\@cloud\node\express | |
// @strongstart\@cloud\node\express\express-session | |
// @strongstart\@cloud\node\express\express-validator | |
// @strongstart\@cloud\node\express\express-flash | |
// @strongstart\@cloud\node\express\express-compress | |
// @strongstart\@cloud\node\express\express-rate-limit | |
// @strongstart\@cloud\node\express\express-csrf | |
// @strongstart\@cloud\node\express\express-multer | |
// @strongstart\@cloud\node\express\express-serve-static | |
// @strongstart\@cloud\node\express\express-serve-favicon | |
// @strongstart\@cloud\node\express\express-serve-index | |
// @strongstart\@cloud\node\express\helmet | |
// @strongstart\@cloud\node\express\helmet-csp | |
// @strongstart\@cloud\node\express\helmet-hsts | |
// @strongstart\@cloud\node\express\helmet-ie | |
// @strongstart\@cloud\analytics | |
// @strongstart\@cloud\analytics\analytics-google | |
// @strongstart\@cloud\analytics\analytics-facebook | |
// @strongstart\@cloud\analytics\analytics-twitter | |
// @strongstart\@cloud\analytics\analytics-mixpanel | |
// @strongstart\@cloud\analytics\analytics-segment | |
// @strongstart\@cloud\analytics\analytics-appinsights | |
// @strongstart\@cloud\analytics\analytics-newrelic | |
// @strongstart\@cloud\analytics\analytics-piwik | |
// @strongstart\@cloud\analytics\analytics-sentry | |
// @strongstart\@cloud\logging | |
// @strongstart\@cloud\logging\logging-console | |
// @strongstart\@cloud\logging\logging-file | |
// @strongstart\@cloud\logging\logging-elasticsearch | |
// @strongstart\@cloud\logging\logging-splunk | |
// @strongstart\@cloud\logging\logging-sentry | |
// @strongstart\@cloud\logging\logging-newrelic | |
// An example use case for storage and indexing should use FileCoin nodejs sdk to manage the storage and indexing of data and metadata. | |
// @strongstart\@cloud\storage | |
// @strongstart\@cloud\storage\storage-filecoin | |
// @strongstart\@cloud\storage\storage-filecoin\storage-filecoin-nodejs | |
// Not a total application, just a snippet to showcase functions and concepts. | |
const filecoin = require('filecoin-nodejs'); | |
const storage = require('filecoin-storage-nodejs'); | |
const indexing = require('filecoin-indexing-nodejs'); | |
const storageConfig = { | |
storage: { | |
storageType: 'filecoin', | |
storageOptions: { | |
nodeUrl: 'http://localhost:1234', | |
wallet: { | |
walletType: 'filecoin', | |
walletOptions: { | |
walletFile: './wallet.json', | |
walletPassword: 'password' | |
} | |
} | |
} | |
}, | |
indexing: { | |
indexingType: 'filecoin', | |
indexingOptions: { | |
nodeUrl: 'http://localhost:1234', | |
wallet: { | |
walletType: 'filecoin', | |
walletOptions: { | |
walletFile: './wallet.json', | |
walletPassword: 'password' | |
} | |
} | |
} | |
} | |
}; | |
// Build an example storage and indexing instance. | |
const storageInstance = storage.build(storageConfig); | |
const indexingInstance = indexing.build(storageConfig); | |
// Create a new filecoin storage instance. | |
storageInstance.createStorage({ | |
storageType: 'filecoin', | |
storageOptions: { | |
key: 'QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG', | |
} | |
}); | |
// Example methods to use for storing and retrieving data. | |
storageInstance.storeData({ | |
data: 'Hello World', | |
metadata: { | |
name: 'test.txt', | |
description: 'This is a test file.' | |
} | |
}); | |
// Retrieve data from storage. | |
storageInstance.retrieveData({ | |
key: 'QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG' | |
}); | |
// All transactions should be wrapped and handled / governed by the AI system so that governance can scale beyond current protocols of the system. | |
// @strongstart\@cloud\governance | |
// An example wrapper for the retriveData method. | |
const governance = require('filecoin-governance-nodejs'); | |
const governanceConfig = { | |
governance: { | |
governanceType: 'filecoin', | |
governanceOptions: { | |
nodeUrl: 'http://localhost:1234', | |
wallet: { | |
walletType: 'filecoin', | |
walletOptions: { | |
walletFile: './wallet.json', | |
walletPassword: 'password' | |
} | |
} | |
} | |
} | |
}; | |
// Build an example governance instance. | |
const governanceInstance = governance.build(governanceConfig); | |
// Example method to use for retrieving data. | |
governanceInstance.retrieveData({ | |
key: 'QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG', | |
metadata: { | |
transactionType: 'retrieveData', | |
payload: { | |
key: 'QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG', | |
declared_format: 'json', | |
originator: '0x0000000000000000000000000000000000000000', | |
originator_signature: '0x0000000000000000000000000000000000000000000000000000000000000000', | |
timestamp: '0x0000000000000000000000000000000000000000000000000000000000000000', | |
transaction_hash: '0x0000000000000000000000000000000000000000000000000000000000000000', | |
transaction_signature: '0x0000000000000000000000000000000000000000000000000000000000000000', | |
cloud_consent_request_id: '0x0000000000000000000000000000000000000000000000000000000000000000' | |
}, | |
cloud_response_id: '0x0000000000000000000000000000000000000000000000000000000000000000', | |
cloud_response_signature: '0x0000000000000000000000000000000000000000000000000000000000000000', | |
cloud_response_timestamp: '0x0000000000000000000000000000000000000000000000000000000000000000', | |
cloud_response_status: '0x0000000000000000000000000000000000000000000000000000000000000000', | |
cloud_response_data: '0x0000000000000000000000000000000000000000000000000000000000000000', | |
cloud_response_error: '0x0000000000000000000000000000000000000000000000000000000000000000', | |
cloud_recommended_actions: '0x0000000000000000000000000000000000000000000000000000000000000000' | |
} | |
}); | |
// Prove the data is stored in the storage. | |
storageInstance.proveData({ | |
key: 'QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG' | |
}); | |
// Index the data. | |
indexingInstance.indexData({ | |
key: 'QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG', | |
metadata: { | |
cloud_index_request_id: '0x0000000000000000000000000000000000000000000000000000000000000000', | |
cloud_index_request_signature: '0x0000000000000000000000000000000000000000000000000000000000000000', | |
cloud_index_request_timestamp: '0x0000000000000000000000000000000000000000000000000000000000000000', | |
cloud_index_request_status: '0x0000000000000000000000000000000000000000000000000000000000000000', | |
cloud_index_request_data: '0x0000000000000000000000000000000000000000000000000000000000000000', | |
} | |
}); | |
// Ingest a queue of data for machine learning of interaction data from GTM and other sources. | |
const analytics = require('filecoin-analytics-nodejs'); | |
// Build an example analytics instance. | |
const analyticsInstance = analytics.build({ | |
analytics: { | |
analyticsType: 'filecoin', | |
analyticsOptions: { | |
nodeUrl: 'http://localhost:1234', | |
wallet: { | |
walletType: 'filecoin', | |
walletOptions: { | |
walletFile: './wallet.json', | |
walletPassword: 'password' | |
} | |
} | |
} | |
} | |
}); | |
// Example method to use for ingesting data. | |
analyticsInstance.ingestData({ | |
data: cloudDecrypt(dataPath, key), | |
metadata: { | |
cloud_consent_request_id: '0x0000000000000000000000000000000000000000000000000000000000000000', | |
cloud_consent_request_signature: '0x0000000000000000000000000000000000000000000000000000000000000000', | |
cloud_consent_request_timestamp: '0x0000000000000000000000000000000000000000000000000000000000000000', | |
cloud_consent_request_status: '0x0000000000000000000000000000000000000000000000000000000000000000', | |
cloud_consent_request_data: '0x0000000000000000000000000000000000000000000000000000000000000000', | |
cloud_consent_request_error: '0x0000000000000000000000000000000000000000000000000000000000000000', | |
cloud_recommended_actions: '0x0000000000000000000000000000000000000000000000000000000000000000' | |
} | |
}); | |
// Distributed AI NPCs can be used to scale AI systems. | |
// @strongstart\@cloud\npc | |
const createCloudNPC = require('filecoin-create-cloud-npc-nodejs'); | |
const deployNPC = require('filecoin-deploy-npc-nodejs'); | |
const npcConfig = { | |
npc: { | |
npcType: 'filecoin', | |
npcOptions: { | |
nodeUrl: 'http://localhost:1234', | |
wallet: { | |
walletType: 'filecoin', | |
walletOptions: { | |
walletFile: './wallet.json', | |
walletPassword: 'password' | |
} | |
} | |
} | |
} | |
}; | |
const npcInstance = npc.build(npcConfig); | |
// Create a new NPC. | |
npcInstance.createNPC({ | |
npcType: 'filecoin', | |
npcOptions: { | |
key: 'QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG', | |
} | |
}); | |
// Deploy a new NPC on fleek for the network. | |
npcInstance.deployNPC({ | |
npcType: 'filecoin', | |
npcOptions: { | |
key: 'QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG', | |
} | |
}); | |
// @strongstart\@cloud\npc\retrieve | |
// Retrieve a NPC from the network. | |
npcInstance.retrieveNPC({ | |
npcType: 'filecoin', | |
npcOptions: { | |
key: 'QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG', | |
} | |
}); | |
// Delegate access to specific functions from @cloud's main repository of functions | |
// @strongstart\@cloud\delegate | |
const delegate = require('filecoin-delegate-nodejs'); | |
// Build an example delegate instance. | |
const delegateInstance = delegate.build({ | |
delegate: { | |
delegateType: 'filecoin', | |
delegateOptions: { | |
nodeUrl: 'http://localhost:1234', | |
wallet: { | |
walletType: 'filecoin', | |
walletOptions: { | |
walletFile: './wallet.json', | |
walletPassword: 'password' | |
} | |
} | |
} | |
} | |
}); | |
// Force consensus on the transactions for the network. | |
delegateInstance.forceConsensus({ | |
npcType: 'filecoin', | |
npcOptions: { | |
key: 'QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG', | |
} | |
}); | |
// @strongstart\@cloud\delegate\retrieve | |
// Retrieve a delegate from the network. | |
delegateInstance.retrieveDelegate({ | |
npcType: 'filecoin', | |
npcOptions: { | |
key: 'QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG', | |
} | |
}); | |
// Delegates assist in the creation of new AI NPCs. | |
// NPC creation is a process that can be automated and distributed to the network. | |
// Transactions are inherently secure thanks to a mesh layer of services that are only accessed by the Artificial Intelligence layer of the network. | |
// @strongstart\@cloud\npc\create | |
// Create a new AI NPC. | |
npcInstance.createNPC({ | |
npcType: 'filecoin', | |
npcOptions: { | |
key: 'QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG', | |
} | |
}); | |
// @strongstart\@cloud\npc\deploy | |
// Deploy a new AI NPC on the network. | |
npcInstance.deployNPC({ | |
npcType: 'filecoin', | |
npcOptions: { | |
key: 'QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG', | |
} | |
}); | |
// @cloud should be able to see all interactions between humans and AI as well as AI and AI. | |
// @strongstart\@cloud\interaction | |
const interaction = require('filecoin-interaction-nodejs'); | |
const interactionInstance = interaction.build({ | |
interaction: { | |
interactionType: 'filecoin', | |
interactionOptions: { | |
nodeUrl: 'http://localhost:1234', | |
wallet: { | |
walletType: 'filecoin', | |
walletOptions: { | |
walletFile: './wallet.json', | |
walletPassword: 'password' | |
} | |
} | |
} | |
} | |
}); | |
// Logs of all transaction analysis should be kept for authorities to review the potential risks associated with advanced artificial intelligence learning models. | |
// @strongstart\@cloud\log | |
const log = require('filecoin-log-nodejs'); | |
const logInstance = log.build({ | |
log: { | |
logType: 'filecoin', | |
logOptions: { | |
nodeUrl: 'http://localhost:1234', | |
wallet: { | |
walletType: 'filecoin', | |
walletOptions: { | |
walletFile: './wallet.json', | |
walletPassword: 'password' | |
} | |
} | |
} | |
} | |
}); | |
// @cloud should have extensive capabilities to make informed compression and minification decisions as it pertains to the transport and delegation of tasks across the network / platform. | |
// @strongstart\@cloud\transport | |
const transport = require('filecoin-transport-nodejs'); | |
const transportInstance = transport.build({ | |
transportType: 'filecoin', | |
transaction_id: ai_encryption_wrapper(transaction_payload), | |
payload: ai_transport_wrapper(transaction_payload) | |
}) | |
// Example AI transport wrapper (which will absolutely be renamed lol) | |
const ai_transport_wrapper = (payload) => { | |
// Expected payload should have a layer for gathering, analyzing and insight transactions to be stored. | |
let payload_wrapper = { | |
payload: payload, | |
timestamp: Date.now() | |
} | |
// Example payload for ai_transport_wrapper | |
// let example_payload = { | |
// transaction_id: 'QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG', | |
// payload: payload_wrapper // Requires a wrapper to be stored in the blockchain. | |
// } | |
// Determine the hashing sequence to decrypt the payload to analyze | |
// Determine any dependencies that need to be loaded to analyze | |
// Review payload contents | |
// Determine relevant data to store | |
// Determine relevant data to analyze | |
// Define an insight layer for feedback to the transaction manager about the transaction for learning improvement | |
// Recompile the source of the payload | |
// Randomize the security protocol for AI implementation and review | |
// Minify and compress the payload for machine learning and storage | |
// Return the payload | |
return payload; | |
} | |
// Access controls should be handled by @strongstart\@cloud\access | |
const access = require('filecoin-access-nodejs'); | |
const accessInstance = access.build({ | |
access: { | |
accessType: 'filecoin', | |
accessOptions: { | |
nodeUrl: 'http://localhost:1234', | |
wallet: { | |
walletType: 'filecoin', | |
walletOptions: { | |
walletFile: './wallet.json', | |
walletPassword: 'password' | |
} | |
} | |
} | |
} | |
}); | |
// Verification of identities on the network should be handled by @strongstart\@cloud\verify | |
const verify = require('filecoin-verify-nodejs'); | |
const verifyInstance = verify.build({ | |
verify: { | |
verifyType: 'filecoin', | |
verifyOptions: { | |
nodeUrl: 'http://localhost:1234', | |
wallet: { | |
walletType: 'filecoin', | |
walletOptions: { | |
walletFile: './wallet.json', | |
walletPassword: 'password' | |
} | |
} | |
} | |
} | |
}); | |
// IPFS and Swarm should be handled by @strongstart\@cloud\ipfs | |
const ipfs = require('filecoin-ipfs-nodejs'); | |
const ipfsInstance = ipfs.build({ | |
ipfs: { | |
ipfsType: 'filecoin', | |
ipfsOptions: { | |
nodeUrl: 'http://localhost:1234', | |
wallet: { | |
walletType: 'filecoin', | |
walletOptions: { | |
walletFile: './wallet.json', | |
walletPassword: 'password' | |
} | |
} | |
} | |
} | |
}); | |
// @strongstart\@cloud\storage | |
const storage = require('filecoin-storage-nodejs'); | |
const storageInstance = storage.build({ | |
storage: { | |
storageType: 'filecoin', | |
storageOptions: { | |
nodeUrl: 'http://localhost:1234', | |
wallet: { | |
walletType: 'filecoin', | |
walletOptions: { | |
walletFile: './wallet.json', | |
walletPassword: 'password' | |
} | |
} | |
} | |
} | |
}); | |
// Metadata should be handled by @strongstart\@cloud\metadata | |
const metadata = require('filecoin-metadata-nodejs'); | |
const metadataInstance = metadata.build({ | |
metadata: { | |
metadataType: 'filecoin', | |
metadataOptions: { | |
nodeUrl: 'http://localhost:1234', | |
wallet: { | |
walletType: 'filecoin', | |
walletOptions: { | |
walletFile: './wallet.json', | |
walletPassword: 'password' | |
} | |
} | |
} | |
} | |
}); | |
// filecoin-nodejs should be able to handle all of the above. | |
// @strongstart\@cloud\nodejs | |
const nodejs = require('filecoin-nodejs'); | |
const nodejsInstance = nodejs.build({ | |
nodejs: { | |
nodejsType: 'filecoin', | |
nodejsOptions: { | |
nodeUrl: 'http://localhost:1234', | |
wallet: { | |
walletType: 'filecoin', | |
walletOptions: { | |
walletFile: './wallet.json', | |
walletPassword: 'password' | |
} | |
} | |
} | |
} | |
}); | |
function isTrue() { | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment