├── .circleci ├── config.yml ├── deploy.sh ├── docker-pull.sh ├── e2e-testnet.sh └── setup-rngd.sh ├── .dockerignore ├── .editorconfig ├── .eslintrc ├── .gitignore ├── .vscode ├── extensions.json └── launch.json ├── .yarnrc ├── Dockerfile.bot ├── Dockerfile.e2e ├── Dockerfile.sdk ├── Dockerfile.sdk.base ├── Dockerfile.server ├── Dockerfile.server.base ├── LICENSE ├── LICENSE-HEADER ├── NETWORK-TOU.md ├── README.md ├── build-bot.sh ├── build-e2e.sh ├── build-sdk.sh ├── build-server.sh ├── build.sh ├── build └── src │ ├── build-ts.js │ └── watch-ts.js ├── client ├── README.md ├── client-contract-test │ ├── .gitignore │ ├── build.gradle │ ├── build.sh │ ├── package.json │ ├── src │ │ ├── contract-adapter.ts │ │ ├── expected-results.ts │ │ ├── index.ts │ │ ├── orbs-api-interface.ts │ │ └── types │ │ │ └── elliptic.d.ts │ ├── test │ │ ├── client-sdk.spec.ts │ │ └── java-sdk-helper.ts │ ├── tsconfig.json │ ├── tsconfig.test.json │ ├── tslint.json │ └── yarn.lock ├── client-sdk-javascript │ ├── .clang-format │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── binding.gyp │ ├── build.sh │ ├── package.json │ ├── src │ │ ├── address.cpp │ │ ├── address.h │ │ ├── address.ts │ │ ├── crypto-sdk.cpp │ │ ├── ed25519key.cpp │ │ ├── ed25519key.h │ │ ├── ed25519key.ts │ │ ├── index.ts │ │ ├── orbs-api-interface.ts │ │ ├── orbs-client.ts │ │ ├── orbs-contract.ts │ │ ├── transaction-signer.ts │ │ └── types │ │ │ ├── elliptic.d.ts │ │ │ └── grpc-caller.d.ts │ ├── test.sh │ ├── test │ │ ├── address.spec.ts │ │ └── ed25519key.spec.ts │ ├── tsconfig.json │ ├── tsconfig.test.json │ ├── tslint.json │ └── yarn.lock ├── crypto-sdk-android │ ├── .clang-format │ ├── .gitignore │ ├── .settings │ │ └── org.eclipse.buildship.core.prefs │ ├── build.gradle │ ├── build.sh │ ├── clean.sh │ ├── crypto-sdk │ │ ├── .gitignore │ │ ├── CMakeLists.txt │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── cpp │ │ │ │ ├── Address.cpp │ │ │ │ ├── Address.h │ │ │ │ ├── CryptoSDK.cpp │ │ │ │ ├── CryptoSDK.h │ │ │ │ ├── ED25519Key.cpp │ │ │ │ ├── ED25519Key.h │ │ │ │ ├── Utilities.cpp │ │ │ │ └── Utilities.h │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── orbs │ │ │ │ │ ├── client │ │ │ │ │ ├── CallContractRequest.java │ │ │ │ │ ├── CallPayload.java │ │ │ │ │ ├── OrbsClient.java │ │ │ │ │ ├── OrbsContract.java │ │ │ │ │ ├── OrbsHashUtils.java │ │ │ │ │ ├── OrbsHost.java │ │ │ │ │ ├── OrbsStableTransactionRequestSerializer.java │ │ │ │ │ ├── SendTransactionHeader.java │ │ │ │ │ ├── SendTransactionPayload.java │ │ │ │ │ ├── SendTransactionRequest.java │ │ │ │ │ ├── SendTransactionResponse.java │ │ │ │ │ └── SendTransactionSignature.java │ │ │ │ │ └── cryptosdk │ │ │ │ │ ├── Address.java │ │ │ │ │ ├── CryptoSDK.java │ │ │ │ │ └── ED25519Key.java │ │ │ └── res │ │ │ │ └── values │ │ │ │ ├── colors.xml │ │ │ │ ├── strings.xml │ │ │ │ └── styles.xml │ │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── orbs │ │ │ ├── client │ │ │ ├── ContractUnitTests.java │ │ │ ├── OrbsClientTests.java │ │ │ └── OrbsHashTests.java │ │ │ └── cryptosdk │ │ │ ├── AddressUnitTest.java │ │ │ └── ED25519KeyUnitTest.java │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── macos_install.sh │ ├── readme.md │ ├── settings.gradle │ └── test.sh ├── crypto-sdk-ios │ └── build.sh ├── crypto-sdk-python │ ├── .clang-format │ ├── .gitignore │ ├── CMakeLists.txt │ ├── LICENSE │ ├── README.md │ ├── build.sh │ ├── clean.sh │ ├── lib │ │ ├── CMakeLists.txt │ │ ├── address.cpp │ │ ├── ed25519key.cpp │ │ └── main.cpp │ ├── orbs_client │ │ ├── __init__.py │ │ ├── contract.py │ │ └── http_client.py │ ├── rebuild.sh │ ├── requirements.txt │ ├── test.sh │ └── test │ │ ├── __init__.py │ │ ├── address.py │ │ ├── contract.py │ │ ├── ed25519.py │ │ └── http_client.py ├── crypto-sdk │ ├── .clang-format │ ├── .gitignore │ ├── CMakeLists.txt │ ├── build-deps.sh │ ├── build.sh │ ├── clean.sh │ ├── deps │ │ ├── libgcrypt │ │ │ ├── build.sh │ │ │ ├── download.sh │ │ │ └── libgcrypt.patch │ │ └── libgpg-error │ │ │ ├── build.sh │ │ │ ├── download.sh │ │ │ └── libgpg-error.patch │ ├── gtest.cmake │ ├── lib │ │ ├── CMakeLists.txt │ │ ├── address.cpp │ │ ├── address.h │ │ ├── base58.cpp │ │ ├── base58.h │ │ ├── crc32.cpp │ │ ├── crc32.h │ │ ├── crypto.cpp │ │ ├── crypto.h │ │ ├── ed25519key.cpp │ │ ├── ed25519key.h │ │ ├── exports.h │ │ ├── ripemd160.cpp │ │ ├── ripemd160.h │ │ ├── sha256.cpp │ │ ├── sha256.h │ │ ├── sha512.cpp │ │ ├── sha512.h │ │ ├── utils.cpp │ │ └── utils.h │ ├── rebuild.sh │ ├── test.sh │ ├── test │ │ ├── CMakeLists.txt │ │ ├── address-test.cpp │ │ ├── base58-test.cpp │ │ ├── crc32-test.cpp │ │ ├── crypto-tests.cpp │ │ ├── ed25519key-test.cpp │ │ ├── main.cpp │ │ ├── ripemd160-test.cpp │ │ ├── sha256-test.cpp │ │ ├── sha512-test.cpp │ │ └── utils-test.cpp │ └── toolchains │ │ └── ios.toolchain.cmake └── examples │ ├── android-sample-app │ ├── .gitignore │ ├── app │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── orbs │ │ │ │ └── sampleapp │ │ │ │ └── SampleApp.java │ │ │ └── res │ │ │ ├── drawable │ │ │ └── orbs.png │ │ │ ├── layout │ │ │ └── activity_sample_app.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── values-w820dp │ │ │ └── dimens.xml │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── dimens.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── build.sh │ ├── crypto-sdk │ │ └── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── keyforrelease │ └── settings.gradle │ ├── event-proxy-app │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── build.sh │ ├── package.json │ ├── src │ │ └── index.ts │ ├── tsconfig.json │ ├── tslint.json │ └── yarn.lock │ ├── ios-sample-app │ ├── .gitignore │ ├── ios-sample-app.xcodeproj │ │ ├── project.pbxproj │ │ └── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ └── ios-sample-app │ │ ├── AppDelegate.h │ │ ├── AppDelegate.mm │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── logo-1024.png │ │ │ ├── logo-20.png │ │ │ ├── logo-20@2x.png │ │ │ ├── logo-20@3x.png │ │ │ ├── logo-29.png │ │ │ ├── logo-29@2x.png │ │ │ ├── logo-29@3x.png │ │ │ ├── logo-40.png │ │ │ ├── logo-40@2x.png │ │ │ ├── logo-40@3x.png │ │ │ ├── logo-60@2x.png │ │ │ ├── logo-60@3x.png │ │ │ ├── logo-76.png │ │ │ ├── logo-76@2x.png │ │ │ └── logo-83.5@2x.png │ │ ├── Contents.json │ │ └── Logo.imageset │ │ │ ├── Contents.json │ │ │ └── logo.png │ │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ │ ├── Info.plist │ │ ├── ViewController.h │ │ ├── ViewController.mm │ │ └── main.m │ ├── python-example-app │ ├── build.sh │ ├── requirements.txt │ └── src │ │ └── bot.py │ └── slack-bot │ ├── .gitignore │ ├── LICENSE │ ├── build.sh │ ├── package.json │ ├── src │ ├── foobar-account.ts │ └── index.ts │ ├── tsconfig.json │ ├── tslint.json │ └── yarn.lock ├── config ├── projects.bot.json ├── projects.e2e.json ├── projects.sdk.json ├── projects.server.json └── topologies │ └── discovery │ └── node1 │ ├── consensus.js │ ├── gossip.js │ ├── public-api.js │ ├── sidechain-connector.js │ ├── storage.js │ └── virtual-machine.js ├── db └── .gitkeep ├── deploy ├── .gitignore ├── README.md ├── bootstrap │ ├── .env │ ├── .gitignore │ ├── README.md │ ├── bootstrap.sh │ ├── crontab │ └── docker-compose.yml ├── bot │ └── docker-compose.yml ├── cloudformation │ ├── basic-infrastructure.yaml │ ├── node.yaml │ ├── parameters.basic-infrastracture.json │ ├── parameters.node.json │ └── parameters.parity.json ├── deploy-staging.sh ├── examples │ └── event-counter-app │ │ ├── .gitignore │ │ └── docker-compose.yml ├── generate-staging-keys.sh ├── local │ ├── .gitignore │ ├── README.md │ ├── Vagrantfile │ └── bootstrap-local.sh ├── package.json ├── parity │ ├── bootstrap.sh │ └── docker-compose.yml ├── src │ ├── deploy.ts │ └── multi-account.ts ├── test │ └── parity-test.js ├── tsconfig.json └── tslint.json ├── docker-build.sh ├── docker-export.sh ├── docker-tag.sh ├── docker-test.sh ├── docker ├── bootstrap-e2e.sh ├── bootstrap-sdk.sh ├── bootstrap-server.sh ├── build-bot.sh ├── build-e2e.sh ├── build-sdk-base.sh ├── build-sdk.sh └── build-server-base.sh ├── e2e ├── .dockerignore ├── .gitignore ├── LICENSE ├── README.md ├── build.sh ├── config │ ├── docker │ │ ├── docker-compose.test.base.yml │ │ ├── docker-compose.test.ethereum.yml │ │ ├── docker-compose.test.networks.yml │ │ ├── docker-compose.test.services.yml │ │ ├── docker-compose.test.volumes.local.yml │ │ └── docker-compose.test.volumes.yml │ └── env │ │ ├── default.env │ │ └── stub-consensus.env ├── docker-containers-health-check.sh ├── package.json ├── src │ ├── chai-bars-plugin.ts │ ├── docker-health-checks.ts │ ├── foobar-contract.ts │ ├── simple-smart-contracts.spec.ts │ ├── stress-test.ts │ ├── test-config.ts │ ├── test-environment │ │ ├── ethereum-simulation-node.ts │ │ ├── index.ts │ │ ├── orbs-nodes.ts │ │ ├── test-component.ts │ │ ├── test-environment.ts │ │ ├── test-stack.ts │ │ └── test-subnet.ts │ ├── text-message-contract.ts │ └── types │ │ ├── chai-bar-plugin.d.ts │ │ ├── ganache-core.d.ts │ │ ├── grpc-caller.d.ts │ │ └── solc.d.ts ├── test-from-docker.sh ├── test-from-host.sh ├── tsconfig.json ├── tslint.json └── yarn.lock ├── logo.jpg ├── logs └── .gitignore ├── orbs-team-member-bootstrap.sh ├── package.json ├── projects ├── architecture │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── TODO.md │ ├── build.sh │ ├── build │ │ ├── src │ │ │ └── ts-index.js │ │ └── typescript.sh │ ├── flows │ │ ├── close-block │ │ ├── execute-block │ │ └── send-transaction │ ├── interfaces │ │ ├── block-storage.proto │ │ ├── call-contract.proto │ │ ├── consensus-service.proto │ │ ├── consensus.proto │ │ ├── gossip.proto │ │ ├── primitives │ │ │ ├── blocks.proto │ │ │ ├── gossip-listener.proto │ │ │ ├── transactions.proto │ │ │ └── wrappers.proto │ │ ├── sidechain-connector.proto │ │ ├── state-storage.proto │ │ ├── storage-service.proto │ │ ├── subscription-manager.proto │ │ ├── transaction-pool.proto │ │ └── virtual-machine.proto │ ├── package.json │ ├── rebuild.sh │ ├── system │ │ └── topology │ │ │ ├── node.png │ │ │ ├── topology.md │ │ │ └── topology.png │ ├── tsconfig.json │ └── yarn.lock ├── libs │ └── core-library-typescript │ │ ├── .gitignore │ │ ├── LICENSE │ │ ├── build.sh │ │ ├── package.json │ │ ├── src │ │ ├── base-service │ │ │ ├── index.ts │ │ │ ├── service-runner.ts │ │ │ └── service.ts │ │ ├── block-storage │ │ │ ├── README.md │ │ │ ├── block-storage-sync.ts │ │ │ ├── block-storage.ts │ │ │ ├── index.ts │ │ │ └── leveldb-driver.ts │ │ ├── common-library │ │ │ ├── README.md │ │ │ ├── address.ts │ │ │ ├── block-utils.ts │ │ │ ├── error-handler.ts │ │ │ ├── grpc-server.ts │ │ │ ├── grpc.ts │ │ │ ├── index.ts │ │ │ ├── json-buffer.ts │ │ │ ├── key-manager.ts │ │ │ ├── logger.ts │ │ │ ├── startup-check-runner-default.ts │ │ │ ├── startup-check-runner.ts │ │ │ ├── startup-check.ts │ │ │ ├── startup-status.ts │ │ │ ├── topology.ts │ │ │ ├── topologyPeers.ts │ │ │ ├── transaction-helper.ts │ │ │ └── types.ts │ │ ├── consensus │ │ │ ├── README.md │ │ │ ├── base-consensus.ts │ │ │ ├── benchmark-consensus.ts │ │ │ ├── block-builder.ts │ │ │ ├── consensus.ts │ │ │ ├── index.ts │ │ │ └── stub-consensus.ts │ │ ├── gossip │ │ │ ├── README.md │ │ │ ├── Uuid.ts │ │ │ ├── gossip.ts │ │ │ └── index.ts │ │ ├── index.ts │ │ ├── public-api │ │ │ ├── README.md │ │ │ ├── index.ts │ │ │ ├── public-api.ts │ │ │ └── transaction-handler.ts │ │ ├── sidechain-connector │ │ │ ├── README.md │ │ │ ├── ethereum-connector.ts │ │ │ ├── index.ts │ │ │ └── sidechain-connector.ts │ │ ├── state-storage │ │ │ ├── README.md │ │ │ ├── index.ts │ │ │ ├── kvstore.ts │ │ │ └── state-storage.ts │ │ ├── subscription-manager │ │ │ ├── README.md │ │ │ ├── erc-billing-contract-proxy.ts │ │ │ ├── index.ts │ │ │ └── subscription-manager.ts │ │ ├── test-kit │ │ │ ├── fake-gossip-client.ts │ │ │ ├── generate-key-pairs.ts │ │ │ ├── index.ts │ │ │ ├── service-in-process-client.ts │ │ │ ├── startup-check-tester.ts │ │ │ └── transaction-builders.ts │ │ ├── transaction-pool │ │ │ ├── README.md │ │ │ ├── base-transaction-pool.ts │ │ │ ├── committed-transaction-pool.ts │ │ │ ├── index.ts │ │ │ ├── pending-transaction-pool.ts │ │ │ └── transaction-validator.ts │ │ ├── types │ │ │ ├── bs58.d.ts │ │ │ ├── elliptic.d.ts │ │ │ ├── gaggle.d.ts │ │ │ ├── ganache-core.d.ts │ │ │ ├── grpc-caller.d.ts │ │ │ ├── levelup.d.ts │ │ │ ├── mali.d.ts │ │ │ ├── solc.d.ts │ │ │ ├── uncaught-exception.d.ts │ │ │ └── winston-logzio.d.ts │ │ └── virtual-machine │ │ │ ├── README.md │ │ │ ├── contract-state-accessor.ts │ │ │ ├── hard-coded-contracts │ │ │ ├── base-smart-contact.ts │ │ │ ├── hard-coded-smart-contract-registry.ts │ │ │ ├── processor.ts │ │ │ └── registry │ │ │ │ ├── event-counter-smart-contract.ts │ │ │ │ ├── foobar-smart-contract.ts │ │ │ │ ├── kinatn-smart-contract.ts │ │ │ │ └── text-message-smart-contract.ts │ │ │ ├── index.ts │ │ │ ├── state-cache.ts │ │ │ └── virtual-machine.ts │ │ ├── test │ │ ├── block-storage │ │ │ ├── block-storage-sync.spec.ts │ │ │ └── block-storage.spec.ts │ │ ├── common-library │ │ │ ├── .gitignore │ │ │ ├── address.spec.ts │ │ │ ├── block-utils.spec.ts │ │ │ ├── grpc-server.spec.ts │ │ │ ├── key-manager.spec.ts │ │ │ ├── startup-check-runner-default.spec.ts │ │ │ └── startup-check-runner.spec.ts │ │ ├── consensus │ │ │ └── block-builder.spec.ts │ │ ├── gossip │ │ │ ├── .gitignore │ │ │ └── gossip.spec.ts │ │ ├── public-api │ │ │ └── transaction-handler.spec.ts │ │ ├── sidechain-connector │ │ │ └── ethereum-connector.spec.ts │ │ ├── state-storage │ │ │ └── state-storage.spec.ts │ │ ├── subscription-manager │ │ │ └── subscription-manager.spec.ts │ │ ├── transaction-pool │ │ │ ├── committed-transaction-pool.spec.ts │ │ │ ├── pending-transaction-pool.spec.ts │ │ │ └── transaction-validator.spec.ts │ │ └── virtual-machine │ │ │ ├── bar-smart-contract.spec.ts │ │ │ ├── contract-state-accessor.spec.ts │ │ │ ├── event-counter-smart-contract.spec.ts │ │ │ ├── hard-coded-smart-contract-registry.spec.ts │ │ │ ├── kin-atn-smart-contract.spec.ts │ │ │ ├── state-cache.spec.ts │ │ │ ├── stub-contract.ts │ │ │ ├── text-message-smart-contract.spec.ts │ │ │ └── virtual-machine.spec.ts │ │ ├── tsconfig.json │ │ ├── tsconfig.test.json │ │ ├── tslint.json │ │ ├── watch.sh │ │ └── yarn.lock └── services │ ├── consensus-service-typescript │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── build.sh │ ├── package.json │ ├── src │ │ ├── consensus-server.ts │ │ ├── consensus-service.ts │ │ ├── index.ts │ │ ├── subscription-manager-service.ts │ │ └── transaction-pool-service.ts │ ├── test │ │ ├── consensus-service.spec.ts │ │ ├── stub-consensus-service.spec.ts │ │ ├── subscription-manager-service.spec.ts │ │ └── transaction-pool-service.spec.ts │ ├── tsconfig.json │ ├── tsconfig.test.json │ ├── tslint.json │ ├── watch.sh │ └── yarn.lock │ ├── gossip-service-typescript │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── build.sh │ ├── package.json │ ├── src │ │ ├── index.ts │ │ ├── server.ts │ │ └── service.ts │ ├── test │ │ └── gossip-service.spec.ts │ ├── tsconfig.json │ ├── tsconfig.test.json │ ├── tslint.json │ ├── watch.sh │ └── yarn.lock │ ├── public-api-service-typescript │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── build.sh │ ├── package.json │ ├── src │ │ ├── index.ts │ │ ├── server.ts │ │ ├── service.ts │ │ └── types │ │ │ └── get-port.d.ts │ ├── test │ │ ├── json-diff.d.ts │ │ ├── mock-server.ts │ │ ├── public-api-service.spec.ts │ │ └── run-mock-server.ts │ ├── tsconfig.json │ ├── tsconfig.test.json │ ├── tslint.json │ ├── watch.sh │ └── yarn.lock │ ├── sidechain-connector-service-typescript │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── build.sh │ ├── package.json │ ├── src │ │ ├── index.ts │ │ ├── server.ts │ │ └── service.ts │ ├── test │ │ ├── ethereum-driver.ts │ │ ├── sidechain-connector-service.spec.ts │ │ └── types │ │ │ ├── ganache-core.d.ts │ │ │ └── solc.d.ts │ ├── tsconfig.json │ ├── tsconfig.test.json │ ├── tslint.json │ ├── watch.sh │ └── yarn.lock │ ├── storage-service-typescript │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── build.sh │ ├── package.json │ ├── src │ │ ├── block-storage-service.ts │ │ ├── index.ts │ │ ├── server.ts │ │ └── state-storage-service.ts │ ├── test │ │ ├── node-loader.ts │ │ ├── storage-service-sync.spec.ts │ │ └── storage-service.spec.ts │ ├── tsconfig.json │ ├── tsconfig.test.json │ ├── tslint.json │ ├── watch.sh │ └── yarn.lock │ └── virtual-machine-service-typescript │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── build.sh │ ├── package.json │ ├── src │ ├── index.ts │ ├── server.ts │ └── service.ts │ ├── test │ └── virtual-machine-service.spec.ts │ ├── tsconfig.json │ ├── tsconfig.test.json │ ├── tslint.json │ ├── watch.sh │ └── yarn.lock ├── watch.sh └── yarn.lock /.circleci/deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -xe 2 | 3 | export DOCKER_TAG=$(./docker-tag.sh) 4 | 5 | cd deploy 6 | npm install 7 | 8 | aws s3 sync s3://orbs-network-config-staging/dummy-keys/public-keys/ bootstrap/public-keys/ 9 | aws s3 sync s3://orbs-network-config-staging/dummy-keys/private-keys/ temp-keys/private-keys/ 10 | ./deploy-staging.sh 11 | -------------------------------------------------------------------------------- /.circleci/docker-pull.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -xe 2 | 3 | export DOCKER_TAG=$(./docker-tag.sh) 4 | 5 | docker pull $DOCKER_IMAGE:$DOCKER_TAG 6 | docker tag $DOCKER_IMAGE:$DOCKER_TAG orbs:$DOCKER_TAG 7 | -------------------------------------------------------------------------------- /.circleci/e2e-testnet.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -xe 2 | 3 | docker run --rm -ti \ 4 | -e E2E_NO_DEPLOY=true \ 5 | -e E2E_PUBLIC_API_ENDPOINT=$E2E_PUBLIC_API_ENDPOINT \ 6 | -e NETWORK_ID=T \ 7 | orbs:e2e \ 8 | ./test-from-host.sh 9 | -------------------------------------------------------------------------------- /.circleci/setup-rngd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -xe 2 | 3 | sudo apt-get update && sudo apt-get install rng-tools 4 | sudo rngd -o /dev/random -r /dev/urandom 5 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | **/node_modules 2 | **/distTest 3 | 4 | lib-cov 5 | *.seed 6 | *.log 7 | *.csv 8 | *.dat 9 | *.out 10 | *.pid 11 | *.gz 12 | *.swp 13 | 14 | pids 15 | logs 16 | results 17 | tmp 18 | 19 | # API keys and secrets 20 | .env 21 | 22 | # Dependency directory 23 | node_modules 24 | bower_components 25 | 26 | # Editors 27 | .idea 28 | *.iml 29 | .vscode 30 | 31 | # OS metadata 32 | .DS_Store 33 | Thumbs.db 34 | 35 | # Local configuration file (sdk path, etc) 36 | local.properties 37 | 38 | # Client binaries 39 | .gradle 40 | client/crypto-sdk/build 41 | client/crypto-sdk/deps/libgpg-error/libgpg-error-* 42 | client/crypto-sdk/deps/libgcrypt/libgcrypt-* 43 | client/crypto-sdk-android/crypto-sdk/.externalNativeBuild 44 | client/crypto-sdk-android/crypto-sdk/build 45 | client/crypto-sdk-javascript/build 46 | client/crypto-sdk-javascript/deps 47 | examples/android-sample-app/build 48 | 49 | # Deploy & config 50 | deploy 51 | .circleci 52 | .vscode 53 | 54 | # build artifacts 55 | artifacts 56 | 57 | # Docker images 58 | docker/images 59 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | 2 | root = true 3 | 4 | [*] 5 | trim_trailing_whitespace = true 6 | insert_final_newline = true 7 | end_of_line = lf 8 | charset = utf-8 9 | max_line_length = 180 10 | 11 | [*.ts] 12 | indent_style = space 13 | indent_size = 2 14 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "airbnb" 3 | } 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | lib-cov 2 | *.seed 3 | *.log 4 | *.csv 5 | *.dat 6 | *.out 7 | *.pid 8 | *.gz 9 | *.swp 10 | 11 | pids 12 | logs 13 | results 14 | tmp 15 | 16 | # API keys and secrets 17 | .env 18 | 19 | # Dependency 20 | node_modules 21 | bower_components 22 | package-lock.json 23 | distTest 24 | # yarn.lock 25 | 26 | # Editors 27 | .idea 28 | .history 29 | .vscode/* 30 | !.vscode/extensions.json 31 | !.vscode/launch.json 32 | *.iml 33 | 34 | # OS metadata 35 | .DS_Store 36 | Thumbs.db 37 | 38 | # Databases 39 | db 40 | .ldb_history 41 | 42 | # keys 43 | private-keys 44 | public-keys 45 | 46 | # build artifacts 47 | artifacts 48 | 49 | # docker 50 | docker/images 51 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | "DavidAnson.vscode-markdownlint", 6 | "EditorConfig.EditorConfig", 7 | "JuanBlanco.solidity", 8 | "PeterJausovec.vscode-docker", 9 | "christian-kohler.npm-intellisense", 10 | "christian-kohler.path-intellisense", 11 | "dbaeumer.vscode-eslint", 12 | "eg2.tslint", 13 | "eg2.vscode-npm-script", 14 | "felipe.nasc-touchbar", 15 | "ms-vscode.cpptools", 16 | "wayou.vscode-todo-highlight", 17 | "yzhang.markdown-all-in-one", 18 | "zxh404.vscode-proto3", 19 | "vadimcn.vscode-lldb" 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /.yarnrc: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | #--verbose true 6 | --pure-lockfile true 7 | --frozen-lockfile true 8 | --link-duplicates true 9 | cache-folder "/usr/local/share/.cache/yarn/v1" 10 | -------------------------------------------------------------------------------- /Dockerfile.bot: -------------------------------------------------------------------------------- 1 | FROM orbs:base-sdk 2 | 3 | ADD . /opt/orbs 4 | 5 | RUN ./build-bot.sh && yarn cache clean 6 | -------------------------------------------------------------------------------- /Dockerfile.e2e: -------------------------------------------------------------------------------- 1 | FROM orbs:base-sdk 2 | 3 | ENV PROJECT_TYPE=e2e 4 | 5 | ADD docker/bootstrap-e2e.sh /opt/orbs/ 6 | 7 | RUN ./bootstrap-e2e.sh 8 | 9 | ADD . /opt/orbs 10 | 11 | RUN ./build-e2e.sh 12 | 13 | WORKDIR /opt/orbs/e2e 14 | -------------------------------------------------------------------------------- /Dockerfile.sdk: -------------------------------------------------------------------------------- 1 | FROM orbs:base-sdk 2 | 3 | ADD . /opt/orbs 4 | 5 | RUN ./build-sdk.sh && yarn cache clean 6 | -------------------------------------------------------------------------------- /Dockerfile.sdk.base: -------------------------------------------------------------------------------- 1 | FROM node:9-stretch 2 | 3 | ARG CI 4 | ENV CI=$CI 5 | 6 | ARG NO_ANDROID 7 | ENV NO_ANDROID=$NO_ANDROID 8 | 9 | ADD package.json yarn.lock .yarnrc docker/bootstrap-sdk.sh /opt/orbs/ 10 | 11 | WORKDIR /opt/orbs 12 | 13 | ENV PROJECT_TYPE="sdk" 14 | ENV SDK_HOME="/opt" 15 | ENV GRADLE_VERSION="4.6" 16 | ENV ANDROID_TARGET_SDK="android-27" 17 | ENV ANDROID_SDK_TOOLS="3859397" 18 | ENV ANDROID_BUILD_TOOLS="build-tools-27.0.3" 19 | ENV ANDROID_NDK_VERSION="r16b" 20 | 21 | ENV GRADLE_HOME="${SDK_HOME}/gradle-${GRADLE_VERSION}" 22 | ENV ANDROID_HOME="${SDK_HOME}/Android/sdk" 23 | ENV ANDROID_NDK_HOME="${ANDROID_HOME}/ndk-bundle" 24 | 25 | RUN ./bootstrap-sdk.sh 26 | 27 | ENV PATH="${GRADLE_HOME}/bin:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/cmake/bin:${ANDROID_NDK_HOME}:${PATH}" 28 | 29 | RUN yarn config list && \ 30 | yarn global add typescript@2.7.1 tslint@5.9.1 && \ 31 | yarn install && yarn cache clean 32 | -------------------------------------------------------------------------------- /Dockerfile.server: -------------------------------------------------------------------------------- 1 | FROM orbs:base-server 2 | 3 | ADD . /opt/orbs 4 | 5 | RUN ./build-server.sh && yarn cache clean 6 | 7 | HEALTHCHECK --interval=10s --timeout=10s --retries=3 \ 8 | CMD curl -q http://localhost:8081/admin/startupCheck || exit 1 9 | 10 | -------------------------------------------------------------------------------- /Dockerfile.server.base: -------------------------------------------------------------------------------- 1 | FROM node:9-stretch 2 | 3 | ARG CI 4 | ENV CI=$CI 5 | ENV PROJECT_TYPE="server" 6 | 7 | VOLUME [ "/opt/orbs/logs", "/opt/orbs/db" ] 8 | 9 | ADD package.json yarn.lock .yarnrc docker/bootstrap-server.sh /opt/orbs/ 10 | 11 | WORKDIR /opt/orbs 12 | 13 | RUN ./bootstrap-server.sh 14 | 15 | RUN yarn config list && \ 16 | yarn global add typescript@2.7.1 tslint@5.9.1 && \ 17 | yarn install && yarn cache clean 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Orbs 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 NON-INFRINGEMENT. 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 | -------------------------------------------------------------------------------- /LICENSE-HEADER: -------------------------------------------------------------------------------- 1 | Copyright 2018 the orbs-network-typescript authors 2 | This file is part of the orbs-network-typescript library in the Orbs project. 3 | 4 | This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 5 | The above notice should be included in all copies or substantial portions of the software. 6 | -------------------------------------------------------------------------------- /build-bot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export PROJECT_TYPE=bot 4 | ./build.sh 5 | -------------------------------------------------------------------------------- /build-e2e.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export PROJECT_TYPE=e2e 4 | ./build.sh 5 | -------------------------------------------------------------------------------- /build-sdk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export PROJECT_TYPE=sdk 4 | ./build.sh 5 | -------------------------------------------------------------------------------- /build-server.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export PROJECT_TYPE=server 4 | ./build.sh 5 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | export PROJECT_TYPE=${PROJECT_TYPE-server} 4 | 5 | yarn install 6 | 7 | yarn run build 8 | -------------------------------------------------------------------------------- /build/src/watch-ts.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | /* eslint-disable no-console */ 10 | 11 | const path = require('path'); 12 | const shell = require('shelljs'); 13 | const projects = require('../../config/projects.json'); 14 | require('colors'); 15 | 16 | async function main() { 17 | projects.order.forEach((projectName) => { 18 | const project = projects[projectName]; 19 | 20 | if (project.runtime !== 'typescript') { 21 | return; 22 | } 23 | 24 | const projectPath = path.resolve(__dirname, '../../', project.path); 25 | 26 | console.log(` * Watching ${projectName}\n`.green); 27 | shell.cd(projectPath); 28 | shell.exec('./watch.sh', { async: true }); 29 | }); 30 | } 31 | 32 | main().catch((e) => { 33 | console.error(e); 34 | 35 | process.exit(1); 36 | }); 37 | 38 | -------------------------------------------------------------------------------- /client/client-contract-test/.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | 34 | # CMake 35 | CMakeCache.txt 36 | CMakeFiles 37 | CMakeScripts 38 | Testing 39 | Makefile 40 | cmake_install.cmake 41 | install_manifest.txt 42 | compile_commands.json 43 | CTestTestfile.cmake 44 | 45 | build/ 46 | deps/ 47 | .gradle 48 | 49 | # Ignore built ts files 50 | dist/**/* 51 | -------------------------------------------------------------------------------- /client/client-contract-test/build.gradle: -------------------------------------------------------------------------------- 1 | repositories { 2 | jcenter() 3 | } 4 | configurations { 5 | libs 6 | } 7 | dependencies { 8 | libs "com.google.code.gson:gson:2.8.4" 9 | libs "com.squareup.okhttp3:okhttp:3.10.0" 10 | } 11 | task acquireLibs(type: Copy) { 12 | from configurations.libs 13 | into "$buildDir/javaLibs" 14 | } -------------------------------------------------------------------------------- /client/client-contract-test/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | yarn link orbs-client-sdk 4 | 5 | yarn install 6 | 7 | gradle acquireLibs 8 | 9 | yarn run build 10 | 11 | yarn test 12 | 13 | yarn link 14 | -------------------------------------------------------------------------------- /client/client-contract-test/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | export { testContract, OrbsContractAdapter } from "./contract-adapter"; 10 | 11 | -------------------------------------------------------------------------------- /client/client-contract-test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "noImplicitAny": true, 6 | "skipLibCheck": true, 7 | "moduleResolution": "node", 8 | "sourceMap": true, 9 | "declaration": true, 10 | "inlineSources": true, 11 | "experimentalDecorators": true, 12 | "outDir": "dist", 13 | "baseUrl": ".", 14 | "paths": { 15 | "*": [ 16 | "node_modules/*", 17 | "src/types/*" 18 | ] 19 | } 20 | }, 21 | "include": [ 22 | "src/**/*" 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /client/client-contract-test/tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "types": [ 6 | "mocha", 7 | "node" 8 | ], 9 | "noImplicitAny": true, 10 | "skipLibCheck": true, 11 | "moduleResolution": "node", 12 | "sourceMap": true, 13 | "inlineSources": true, 14 | "experimentalDecorators": true, 15 | "outDir": "distTest", 16 | "baseUrl": ".", 17 | "paths": { 18 | "*": [ 19 | "node_modules/*", 20 | "src/types/*" 21 | ] 22 | } 23 | }, 24 | "include": [ 25 | "test/**/*" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /client/client-sdk-javascript/.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | BasedOnStyle: None 3 | IndentWidth: 4 4 | UseTab: Never 5 | --- 6 | Language: Cpp 7 | ColumnLimit: 120 8 | NamespaceIndentation: None 9 | AccessModifierOffset: -4 10 | AlignAfterOpenBracket: false 11 | BinPackParameters: false 12 | ContinuationIndentWidth: 0 13 | --- 14 | -------------------------------------------------------------------------------- /client/client-sdk-javascript/.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | 34 | # CMake 35 | CMakeCache.txt 36 | CMakeFiles 37 | CMakeScripts 38 | Testing 39 | Makefile 40 | cmake_install.cmake 41 | install_manifest.txt 42 | compile_commands.json 43 | CTestTestfile.cmake 44 | 45 | build/ 46 | deps/ 47 | 48 | # Ignore built ts files 49 | dist/**/* 50 | -------------------------------------------------------------------------------- /client/client-sdk-javascript/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Orbs Network 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 NON-INFRINGEMENT. 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 | -------------------------------------------------------------------------------- /client/client-sdk-javascript/README.md: -------------------------------------------------------------------------------- 1 | # Client SDK (WIP) 2 | -------------------------------------------------------------------------------- /client/client-sdk-javascript/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | rm -rf deps && mkdir -p deps 4 | ln -s "$(pwd)/../crypto-sdk" deps/crypto-sdk 5 | 6 | yarn install 7 | 8 | yarn run build 9 | 10 | yarn test 11 | 12 | yarn link 13 | -------------------------------------------------------------------------------- /client/client-sdk-javascript/src/address.ts: -------------------------------------------------------------------------------- 1 | const CryptoSDK = require("bindings")("cryptosdk"); 2 | 3 | export interface Address { 4 | publicKey: string; 5 | networkId: number; 6 | version: number; 7 | virtualChainId: string; 8 | accountId: string; 9 | checksum: string; 10 | 11 | toString(): string; 12 | } 13 | 14 | export const Address: { 15 | readonly MAIN_NETWORK_ID: string; 16 | readonly TEST_NETWORK_ID: string; 17 | 18 | new(publicKey: string, virtualChainId: string, networkId: string): Address; 19 | } = CryptoSDK.Address; 20 | -------------------------------------------------------------------------------- /client/client-sdk-javascript/src/crypto-sdk.cpp: -------------------------------------------------------------------------------- 1 | #include "address.h" 2 | #include "ed25519key.h" 3 | 4 | #include "crypto-sdk/lib/crypto.h" 5 | 6 | napi_value Init(napi_env env, napi_value exports) { 7 | Orbs::CryptoSDK::Init(); 8 | 9 | exports = Address::Init(env, exports); 10 | exports = ED25519Key::Init(env, exports); 11 | 12 | return exports; 13 | } 14 | 15 | NAPI_MODULE(NODE_GYP_MODULE_NAME, Init) 16 | -------------------------------------------------------------------------------- /client/client-sdk-javascript/src/ed25519key.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | #include "crypto-sdk/lib/ed25519key.h" 8 | 9 | class ED25519Key { 10 | public: 11 | static napi_value Init(napi_env env, napi_value exports); 12 | static void Destructor(napi_env env, void *nativeObject, void *finalizeHint); 13 | 14 | private: 15 | explicit ED25519Key(const std::string &publicKey); 16 | explicit ED25519Key(const std::string &publicKey, const std::string &privateKey); 17 | explicit ED25519Key(); 18 | ~ED25519Key(); 19 | 20 | static napi_value New(napi_env env, napi_callback_info info); 21 | static napi_value GetPublicKey(napi_env env, napi_callback_info info); 22 | static napi_value GetPrivateKeyUnsafe(napi_env env, napi_callback_info info); 23 | static napi_value HasPrivateKey(napi_env env, napi_callback_info info); 24 | 25 | static napi_value Sign(napi_env env, napi_callback_info info); 26 | static napi_value Verify(napi_env env, napi_callback_info info); 27 | 28 | private: 29 | static napi_ref constructor; 30 | napi_env env_; 31 | napi_ref wrapper_; 32 | 33 | Orbs::ED25519Key key_; 34 | }; 35 | -------------------------------------------------------------------------------- /client/client-sdk-javascript/src/ed25519key.ts: -------------------------------------------------------------------------------- 1 | const CryptoSDK = require("bindings")("cryptosdk"); 2 | 3 | export interface ED25519Key { 4 | publicKey: string; 5 | hasPrivateKey: boolean; 6 | 7 | getPrivateKeyUnsafe(): string; 8 | sign(message: Buffer): Buffer; 9 | verify(message: Buffer, signature: Buffer): boolean; 10 | } 11 | 12 | export const ED25519Key: { 13 | new(publicKey?: string, privateKey?: string): ED25519Key; 14 | } = CryptoSDK.ED25519Key; 15 | -------------------------------------------------------------------------------- /client/client-sdk-javascript/src/index.ts: -------------------------------------------------------------------------------- 1 | export { OrbsClient } from "./orbs-client"; 2 | export { OrbsContract, OrbsContractMethodArgs } from "./orbs-contract"; 3 | export { Address } from "./address"; 4 | export { ED25519Key } from "./ed25519key"; 5 | -------------------------------------------------------------------------------- /client/client-sdk-javascript/src/orbs-api-interface.ts: -------------------------------------------------------------------------------- 1 | export interface OrbsAPISendTransactionRequest { 2 | header: { 3 | version: number, 4 | senderAddressBase58: string, 5 | timestamp: string, 6 | contractAddressBase58: string 7 | }; 8 | payload: string; 9 | signatureData: { 10 | publicKeyHex: string; 11 | signatureHex: string; 12 | }; 13 | } 14 | 15 | export interface OrbsAPICallContractRequest { 16 | senderAddressBase58: string; 17 | contractAddressBase58: string; 18 | payload: string; 19 | } 20 | 21 | export interface OrbsAPIGetTransactionStatusRequest { 22 | txid: string; 23 | } 24 | 25 | export interface OrbsAPITransactionReceipt { 26 | success: boolean; 27 | } 28 | 29 | export interface OrbsAPIGetTransactionStatusResponse { 30 | status: string; 31 | receipt?: OrbsAPITransactionReceipt; 32 | } 33 | -------------------------------------------------------------------------------- /client/client-sdk-javascript/src/transaction-signer.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbs-network/orbs-network-typescript/a878afb5e6f8de3a2042764f0cecd6f27d113c18/client/client-sdk-javascript/src/transaction-signer.ts -------------------------------------------------------------------------------- /client/client-sdk-javascript/src/types/grpc-caller.d.ts: -------------------------------------------------------------------------------- 1 | /** Declaration file generated by dts-gen */ 2 | 3 | export = grpc_caller; 4 | 5 | declare function grpc_caller(host: any, proto: any, name?: any, options?: any): any; 6 | 7 | declare namespace grpc_caller { 8 | const prototype: { 9 | }; 10 | 11 | function metadata(metadata: any, options: any): any; 12 | 13 | namespace metadata { 14 | const prototype: { 15 | }; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /client/client-sdk-javascript/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | yarn test 4 | -------------------------------------------------------------------------------- /client/client-sdk-javascript/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "noImplicitAny": true, 6 | "skipLibCheck": true, 7 | "moduleResolution": "node", 8 | "sourceMap": true, 9 | "declaration": true, 10 | "inlineSources": true, 11 | "experimentalDecorators": true, 12 | "outDir": "dist", 13 | "baseUrl": ".", 14 | "paths": { 15 | "*": [ 16 | "node_modules/*", 17 | "src/types/*" 18 | ] 19 | } 20 | }, 21 | "include": [ 22 | "src/**/*" 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /client/client-sdk-javascript/tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "types": [ 6 | "mocha", 7 | "node" 8 | ], 9 | "noImplicitAny": true, 10 | "skipLibCheck": true, 11 | "moduleResolution": "node", 12 | "sourceMap": true, 13 | "inlineSources": true, 14 | "experimentalDecorators": true, 15 | "outDir": "distTest", 16 | "baseUrl": ".", 17 | "paths": { 18 | "*": [ 19 | "node_modules/*", 20 | "src/types/*" 21 | ] 22 | } 23 | }, 24 | "include": [ 25 | "test/**/*" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /client/crypto-sdk-android/.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | BasedOnStyle: None 3 | IndentWidth: 4 4 | UseTab: Never 5 | --- 6 | Language: Cpp 7 | ColumnLimit: 120 8 | NamespaceIndentation: None 9 | AccessModifierOffset: -4 10 | AlignAfterOpenBracket: false 11 | BinPackParameters: false 12 | ContinuationIndentWidth: 0 13 | --- 14 | -------------------------------------------------------------------------------- /client/crypto-sdk-android/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | #Tue Apr 17 09:01:43 IDT 2018 2 | connection.project.dir= 3 | -------------------------------------------------------------------------------- /client/crypto-sdk-android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.1.2' 9 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0' 10 | classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | } 19 | } 20 | 21 | task clean(type: Delete) { 22 | delete rootProject.buildDir 23 | } 24 | -------------------------------------------------------------------------------- /client/crypto-sdk-android/clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | rm -rf build 4 | rm -rf crypto-sdk/build 5 | -------------------------------------------------------------------------------- /client/crypto-sdk-android/crypto-sdk/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /client/crypto-sdk-android/crypto-sdk/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.6) 2 | 3 | set(CMAKE_CXX_STANDARD 11) 4 | 5 | file(GLOB CRYPTO_SDK_ANDROID_SRC 6 | "src/main/cpp/*.h" 7 | "src/main/cpp/*.cpp" 8 | ) 9 | 10 | if(ANDROID_ABI) 11 | set(CRYPTO_SDK_LIBRARY ${CMAKE_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI}/libcryptosdk.so) 12 | else() 13 | # Ensure jni.h is found for local builds. 14 | find_package(JNI REQUIRED) 15 | include_directories(${JNI_INCLUDE_DIRS}) 16 | 17 | if(APPLE) 18 | set(CRYPTO_SDK_LIBRARY ${CMAKE_SOURCE_DIR}/src/main/jniLibs/mac/libcryptosdk.dylib) 19 | else() 20 | set(CRYPTO_SDK_LIBRARY ${CMAKE_SOURCE_DIR}/src/main/jniLibs/linux/libcryptosdk.so) 21 | endif() 22 | endif() 23 | 24 | add_library(cryptosdk-android SHARED ${CRYPTO_SDK_ANDROID_SRC}) 25 | target_link_libraries(cryptosdk-android ${CRYPTO_SDK_LIBRARY}) 26 | -------------------------------------------------------------------------------- /client/crypto-sdk-android/crypto-sdk/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | 23 | -keepclassmembers class com.orbs.cryptosdk.** { 24 | *; 25 | } -------------------------------------------------------------------------------- /client/crypto-sdk-android/crypto-sdk/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /client/crypto-sdk-android/crypto-sdk/src/main/cpp/CryptoSDK.cpp: -------------------------------------------------------------------------------- 1 | #include "CryptoSDK.h" 2 | 3 | #include 4 | 5 | #include "../../../../../crypto-sdk/lib/crypto.h" 6 | 7 | #include "Utilities.h" 8 | 9 | using namespace std; 10 | using namespace Orbs; 11 | 12 | JNIEXPORT void JNICALL Java_com_orbs_cryptosdk_CryptoSDK_init(JNIEnv *env, jclass thisClass) { 13 | try { 14 | CryptoSDK::Init(); 15 | } catch (const exception &e) { 16 | Utilities::ThrowException(env, e.what()); 17 | 18 | return; 19 | } catch (...) { 20 | Utilities::ThrowUnknownException(env); 21 | 22 | return; 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /client/crypto-sdk-android/crypto-sdk/src/main/cpp/CryptoSDK.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class com_orbs_cryptosdk_CryptoSDK */ 4 | 5 | #ifndef _Included_com_orbs_cryptosdk_CryptoSDK 6 | #define _Included_com_orbs_cryptosdk_CryptoSDK 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: com_orbs_cryptosdk_CryptoSDK 12 | * Method: init 13 | * Signature: ()V 14 | */ 15 | JNIEXPORT void JNICALL Java_com_orbs_cryptosdk_CryptoSDK_init 16 | (JNIEnv *, jclass); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | #endif 22 | -------------------------------------------------------------------------------- /client/crypto-sdk-android/crypto-sdk/src/main/cpp/Utilities.cpp: -------------------------------------------------------------------------------- 1 | #include "Utilities.h" 2 | 3 | void Utilities::ThrowException(JNIEnv *env, const char *error) { 4 | jclass jcls = env->FindClass("java/lang/Exception"); 5 | env->ThrowNew(jcls, error); 6 | } 7 | 8 | void Utilities::ThrowUnknownException(JNIEnv *env) { 9 | ThrowException(env, "Unknown exception!"); 10 | } -------------------------------------------------------------------------------- /client/crypto-sdk-android/crypto-sdk/src/main/cpp/Utilities.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class Utilities { 6 | public: 7 | static void ThrowException(JNIEnv *env, const char *error); 8 | static void ThrowUnknownException(JNIEnv *env); 9 | }; -------------------------------------------------------------------------------- /client/crypto-sdk-android/crypto-sdk/src/main/java/com/orbs/client/CallContractRequest.java: -------------------------------------------------------------------------------- 1 | package com.orbs.client; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | public class CallContractRequest { 6 | @SerializedName("senderAddressBase58") 7 | public String senderAddressBase58; 8 | @SerializedName("contractAddressBase58") 9 | public String contractAddressBase58; 10 | @SerializedName("payload") 11 | public String payload; 12 | } 13 | -------------------------------------------------------------------------------- /client/crypto-sdk-android/crypto-sdk/src/main/java/com/orbs/client/CallPayload.java: -------------------------------------------------------------------------------- 1 | package com.orbs.client; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | public class CallPayload { 6 | @SerializedName("method") 7 | public String method; 8 | @SerializedName("args") 9 | public Object[] args; 10 | 11 | public CallPayload(Builder builder) { 12 | this.method = builder.method; 13 | this.args = builder.args; 14 | } 15 | 16 | public static final class Builder { 17 | public String method; 18 | public Object[] args; 19 | 20 | public Builder withMethod(String name) { 21 | this.method = name; 22 | return this; 23 | } 24 | 25 | public Builder withArgs(Object[] args) { 26 | if (args == null) { 27 | this.args = new Object[0]; 28 | } 29 | else { 30 | this.args = args; 31 | } 32 | return this; 33 | } 34 | 35 | public CallPayload build() throws Exception { 36 | if (this.method == null || this.args == null) { 37 | throw new Exception("Payload must have both args and method name"); 38 | } 39 | return new CallPayload(this); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /client/crypto-sdk-android/crypto-sdk/src/main/java/com/orbs/client/OrbsHashUtils.java: -------------------------------------------------------------------------------- 1 | package com.orbs.client; 2 | 3 | import java.security.MessageDigest; 4 | import java.security.NoSuchAlgorithmException; 5 | 6 | class OrbsHashUtils { 7 | public static byte[] hash256(String data) throws NoSuchAlgorithmException { 8 | MessageDigest md = MessageDigest.getInstance("SHA-256"); 9 | md.update(data.getBytes()); 10 | return md.digest(); 11 | } 12 | 13 | public static String bytesToHex(byte[] bytes) { 14 | StringBuffer result = new StringBuffer(); 15 | for (byte byt : bytes) result.append(Integer.toString((byt & 0xff) + 0x100, 16).substring(1)); 16 | return result.toString(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /client/crypto-sdk-android/crypto-sdk/src/main/java/com/orbs/client/OrbsHost.java: -------------------------------------------------------------------------------- 1 | package com.orbs.client; 2 | 3 | public class OrbsHost { 4 | private String scheme; 5 | private String host; 6 | private int port; 7 | 8 | public OrbsHost(boolean isHttps, String host, int port) { 9 | this.scheme = isHttps ? "https" : "http"; 10 | this.host = host; 11 | this.port = port; 12 | } 13 | 14 | public String getScheme() { 15 | return scheme; 16 | } 17 | 18 | public String getHost() { 19 | return host; 20 | } 21 | 22 | public int getPort() { 23 | return port; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /client/crypto-sdk-android/crypto-sdk/src/main/java/com/orbs/client/OrbsStableTransactionRequestSerializer.java: -------------------------------------------------------------------------------- 1 | package com.orbs.client; 2 | 3 | import com.google.gson.JsonElement; 4 | import com.google.gson.JsonObject; 5 | import com.google.gson.JsonSerializationContext; 6 | import com.google.gson.JsonSerializer; 7 | 8 | import java.lang.reflect.Type; 9 | 10 | public class OrbsStableTransactionRequestSerializer implements JsonSerializer { 11 | @Override 12 | public JsonElement serialize(SendTransactionRequest src, Type typeOfSrc, JsonSerializationContext context) { 13 | JsonObject headerObject = new JsonObject(); 14 | headerObject.add("contractAddressBase58", context.serialize(src.header.contractAddressBase58)); 15 | headerObject.add("senderAddressBase58", context.serialize(src.header.senderAddressBase58)); 16 | headerObject.add("timestamp", context.serialize(src.header.timestamp)); 17 | headerObject.add("version", context.serialize(src.header.version)); 18 | JsonObject object = new JsonObject(); 19 | object.add("header",headerObject); 20 | object.add("payload",context.serialize(src.payload)); 21 | return object; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /client/crypto-sdk-android/crypto-sdk/src/main/java/com/orbs/client/SendTransactionHeader.java: -------------------------------------------------------------------------------- 1 | package com.orbs.client; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | public class SendTransactionHeader { 6 | @SerializedName("version") 7 | public int version; 8 | @SerializedName("senderAddressBase58") 9 | public String senderAddressBase58; 10 | @SerializedName("timestamp") 11 | public String timestamp; 12 | @SerializedName("contractAddressBase58") 13 | public String contractAddressBase58; 14 | } 15 | -------------------------------------------------------------------------------- /client/crypto-sdk-android/crypto-sdk/src/main/java/com/orbs/client/SendTransactionRequest.java: -------------------------------------------------------------------------------- 1 | package com.orbs.client; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | public class SendTransactionRequest { 6 | @SerializedName("header") 7 | public SendTransactionHeader header; 8 | @SerializedName("payload") 9 | public String payload; 10 | @SerializedName("signatureData") 11 | public SendTransactionSignature signatureData; 12 | } 13 | -------------------------------------------------------------------------------- /client/crypto-sdk-android/crypto-sdk/src/main/java/com/orbs/client/SendTransactionResponse.java: -------------------------------------------------------------------------------- 1 | package com.orbs.client; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | public class SendTransactionResponse { 6 | @SerializedName("transactionId") 7 | public String transactionId; 8 | } 9 | -------------------------------------------------------------------------------- /client/crypto-sdk-android/crypto-sdk/src/main/java/com/orbs/client/SendTransactionSignature.java: -------------------------------------------------------------------------------- 1 | package com.orbs.client; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | public class SendTransactionSignature { 6 | @SerializedName("publicKeyHex") 7 | public String publicKeyHex; 8 | @SerializedName("signatureHex") 9 | public String signatureHex; 10 | } 11 | -------------------------------------------------------------------------------- /client/crypto-sdk-android/crypto-sdk/src/main/java/com/orbs/cryptosdk/Address.java: -------------------------------------------------------------------------------- 1 | package com.orbs.cryptosdk; 2 | 3 | public class Address implements AutoCloseable { 4 | // This is the "handle" to the underlying native instance. 5 | private long selfPtr; 6 | public final String virtualChainId; 7 | public final String networkId; 8 | public static final String TEST_NETWORK_ID = "T"; 9 | public static final String MAIN_NETWORK_ID = "M"; 10 | 11 | public Address(String publicKey, String virtualChainId, String networkId) { 12 | this.virtualChainId = virtualChainId; 13 | this.networkId = networkId; 14 | 15 | init(publicKey, virtualChainId, networkId); 16 | } 17 | 18 | static { 19 | System.loadLibrary("cryptosdk-android"); 20 | } 21 | 22 | public void close() { 23 | disposeNative(); 24 | } 25 | 26 | private native void init(String publicKey, String virtualChainId, String networkId); 27 | private native void disposeNative(); 28 | 29 | public native String getPublicKey(); 30 | public native String toString(); 31 | } 32 | -------------------------------------------------------------------------------- /client/crypto-sdk-android/crypto-sdk/src/main/java/com/orbs/cryptosdk/CryptoSDK.java: -------------------------------------------------------------------------------- 1 | package com.orbs.cryptosdk; 2 | 3 | public class CryptoSDK { 4 | public CryptoSDK() { 5 | } 6 | 7 | static public void initialize() { 8 | init(); 9 | } 10 | 11 | static { 12 | System.loadLibrary("cryptosdk-android"); 13 | } 14 | 15 | private static native void init(); 16 | } 17 | -------------------------------------------------------------------------------- /client/crypto-sdk-android/crypto-sdk/src/main/java/com/orbs/cryptosdk/ED25519Key.java: -------------------------------------------------------------------------------- 1 | package com.orbs.cryptosdk; 2 | 3 | public class ED25519Key implements AutoCloseable { 4 | // This is the "handle" to the underlying native instance. 5 | private long selfPtr; 6 | 7 | public ED25519Key(String publicKey) { 8 | init(publicKey); 9 | } 10 | 11 | public ED25519Key(String publicKey, String privateKey) { 12 | init(publicKey, privateKey); 13 | } 14 | 15 | public ED25519Key() { 16 | init(); 17 | } 18 | 19 | static { 20 | System.loadLibrary("cryptosdk-android"); 21 | } 22 | 23 | public void close() { 24 | disposeNative(); 25 | } 26 | 27 | private native void init(String publicKey); 28 | private native void init(String publicKey, String privateKey); 29 | private native void init(); 30 | private native void disposeNative(); 31 | 32 | 33 | public native String getPublicKey(); 34 | public native String getPrivateKeyUnsafe(); 35 | public native boolean hasPrivateKey(); 36 | 37 | public native byte[] sign(byte[] message); 38 | public native boolean verify(byte[] message, byte[] signature); 39 | } 40 | -------------------------------------------------------------------------------- /client/crypto-sdk-android/crypto-sdk/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /client/crypto-sdk-android/crypto-sdk/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /client/crypto-sdk-android/crypto-sdk/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /client/crypto-sdk-android/crypto-sdk/src/test/java/com/orbs/client/ContractUnitTests.java: -------------------------------------------------------------------------------- 1 | package com.orbs.client; 2 | 3 | 4 | import com.orbs.cryptosdk.Address; 5 | import com.orbs.cryptosdk.CryptoSDK; 6 | import com.orbs.cryptosdk.ED25519Key; 7 | 8 | import org.junit.Test; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | 13 | public class ContractUnitTests { 14 | static { 15 | CryptoSDK.initialize(); 16 | } 17 | 18 | final String PRIVATE_KEY = "3f81e53116ee3f860c154d03b9cabf8af71d8beec210c535ed300c0aee5fcbe7"; 19 | final String PUBLIC_KEY = "b9a91acbf23c22123a8253cfc4325d7b4b7a620465c57f932c7943f60887308b"; 20 | 21 | @Test 22 | public void test_response_parsing() { 23 | Address address = new Address(PUBLIC_KEY,"640ed3", "T"); 24 | OrbsHost endpoint = new OrbsHost(false, "dont_care", 80); 25 | OrbsClient client = new OrbsClient(endpoint, address , new ED25519Key(PUBLIC_KEY, PRIVATE_KEY)); 26 | final String response = "{\"transactionId\": \"some_id\"}"; 27 | SendTransactionResponse res = client.parseSendTransactionResponse(response); 28 | assertEquals(res.transactionId, "some_id"); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /client/crypto-sdk-android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | -------------------------------------------------------------------------------- /client/crypto-sdk-android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /client/crypto-sdk-android/macos_install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | brew tap caskroom/cask 3 | brew cask install android-sdk 4 | brew install gradle 5 | brew install cmake 6 | yes | sdkmanager --licenses 7 | sdkmanager "lldb;3.1" 8 | sdkmanager "cmake;3.6.4111459" 9 | sdkmanager "build-tools;27.0.3" 10 | sdkmanager "ndk-bundle" 11 | echo "sdk.dir=/usr/local/share/android-sdk" >> ./local.properties 12 | -------------------------------------------------------------------------------- /client/crypto-sdk-android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':crypto-sdk' 2 | -------------------------------------------------------------------------------- /client/crypto-sdk-android/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | if [ -n "${DEBUG}" ] ; then 4 | BUILD_TYPE=Debug 5 | else 6 | BUILD_TYPE=Release 7 | fi 8 | 9 | gradle test${BUILD_TYPE}UnitTest 10 | -------------------------------------------------------------------------------- /client/crypto-sdk-ios/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | pushd ../crypto-sdk 4 | PLATFORM=ios ./build.sh 5 | popd 6 | -------------------------------------------------------------------------------- /client/crypto-sdk-python/.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | BasedOnStyle: None 3 | IndentWidth: 4 4 | UseTab: Never 5 | --- 6 | Language: Cpp 7 | ColumnLimit: 120 8 | NamespaceIndentation: None 9 | AccessModifierOffset: -4 10 | AlignAfterOpenBracket: false 11 | BinPackParameters: false 12 | ContinuationIndentWidth: 0 13 | --- 14 | -------------------------------------------------------------------------------- /client/crypto-sdk-python/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.6) 2 | 3 | find_package(PythonInterp REQUIRED) 4 | find_package(PythonLibs REQUIRED) 5 | if(${PYTHON_VERSION_MAJOR} EQUAL 3) 6 | find_package(Boost COMPONENTS python3 REQUIRED) 7 | else() 8 | if(APPLE) 9 | find_package(Boost COMPONENTS python27 REQUIRED) 10 | else() 11 | find_package(Boost COMPONENTS python REQUIRED) 12 | endif() 13 | endif() 14 | 15 | if(NOT CMAKE_BUILD_TYPE) 16 | set(CMAKE_BUILD_TYPE Release) 17 | endif(NOT CMAKE_BUILD_TYPE) 18 | message("CMAKE_BUILD_TYPE is ${CMAKE_BUILD_TYPE}") 19 | 20 | set(CMAKE_CXX_STANDARD 11) 21 | set(CMAKE_POSITION_INDEPENDENT_CODE ON) 22 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") 23 | set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Set debug library postfix" FORCE) 24 | 25 | set(BUILD_DIR ${PLATFORM}) 26 | 27 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${BUILD_DIR}/lib) 28 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${BUILD_DIR}/lib) 29 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${BUILD_DIR}/bin) 30 | 31 | add_subdirectory(lib) 32 | -------------------------------------------------------------------------------- /client/crypto-sdk-python/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Orbs Network 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 NON-INFRINGEMENT. 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 | -------------------------------------------------------------------------------- /client/crypto-sdk-python/README.md: -------------------------------------------------------------------------------- 1 | # Build requirements 2 | 3 | ## Mac requirements 4 | 5 | ```bash 6 | brew install boost boost-python python@2 7 | ``` 8 | -------------------------------------------------------------------------------- /client/crypto-sdk-python/clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | if [ -n "${CMAKE_ONLY}" ] ; then 4 | find "build/" -type d -name "CMakeFiles" -exec rm -r {} + 5 | find "build/" -type f -name "*.cmake" -exec rm -r {} + 6 | find "build/" -type f -name "CMakeCache.txt" -exec rm -r {} + 7 | find "build/" -type f -name "Makefile" -exec rm -r {} + 8 | else 9 | rm -rf build 10 | fi 11 | -------------------------------------------------------------------------------- /client/crypto-sdk-python/lib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.6) 2 | 3 | file(GLOB CRYPTO_SDK_SRC 4 | "*.h" 5 | "*.cpp" 6 | ) 7 | 8 | PYTHON_ADD_MODULE(pycrypto ${CRYPTO_SDK_SRC}) 9 | 10 | if(APPLE) 11 | set(CRYPTO_SDK_LIBRARY ${CMAKE_SOURCE_DIR}/build/${PLATFORM}/libcryptosdk.dylib) 12 | else() 13 | set(CRYPTO_SDK_LIBRARY ${CMAKE_SOURCE_DIR}/build/${PLATFORM}/libcryptosdk.so) 14 | endif() 15 | 16 | target_include_directories(pycrypto PUBLIC 17 | ${Boost_INCLUDE_DIRS} 18 | ${PYTHON_INCLUDE_DIRS} 19 | ) 20 | target_link_libraries(pycrypto LINK_PUBLIC 21 | ${CRYPTO_SDK_LIBRARY} 22 | ${Boost_LIBRARIES} 23 | ${PYTHON_LIBRARIES} 24 | ) 25 | -------------------------------------------------------------------------------- /client/crypto-sdk-python/lib/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "../../crypto-sdk/lib/crypto.h" 4 | 5 | using namespace boost::python; 6 | using namespace Orbs; 7 | 8 | void ExportAddress(); 9 | void ExportED25519(); 10 | 11 | BOOST_PYTHON_MODULE(pycrypto) { 12 | CryptoSDK::Init(); 13 | 14 | ExportAddress(); 15 | ExportED25519(); 16 | } 17 | -------------------------------------------------------------------------------- /client/crypto-sdk-python/orbs_client/__init__.py: -------------------------------------------------------------------------------- 1 | from http_client import HttpClient 2 | from contract import Contract 3 | -------------------------------------------------------------------------------- /client/crypto-sdk-python/rebuild.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | ./clean.sh 4 | ./build.sh 5 | -------------------------------------------------------------------------------- /client/crypto-sdk-python/requirements.txt: -------------------------------------------------------------------------------- 1 | requests 2 | -------------------------------------------------------------------------------- /client/crypto-sdk-python/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | LD_LIBRARY_PATH=build/${LOCAL_PLATFORM}/ find test -name '*.py' -exec python '{}' \; 4 | -------------------------------------------------------------------------------- /client/crypto-sdk-python/test/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbs-network/orbs-network-typescript/a878afb5e6f8de3a2042764f0cecd6f27d113c18/client/crypto-sdk-python/test/__init__.py -------------------------------------------------------------------------------- /client/crypto-sdk-python/test/address.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import unittest 4 | 5 | from os import sys, path 6 | sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) 7 | 8 | from orbs_client.pycrypto import Address 9 | 10 | 11 | class TestAddress(unittest.TestCase): 12 | def test_initialized_by_a_public_key(self): 13 | public_key = "8d41d055d00459be37f749da2caf87bd4ced6fafa335b1f2142e0f44501b2c65" 14 | virtual_chain_id = "640ed3" 15 | network_id = Address.MAIN_NETWORK_ID 16 | 17 | address = Address(public_key, virtual_chain_id, network_id) 18 | self.assertEqual(address.public_key, public_key) 19 | self.assertEqual(address.network_id, Address.MAIN_NETWORK_ID) 20 | self.assertEqual(address.version, "\x00") 21 | self.assertEqual(address.virtual_chain_id, "640ed3") 22 | self.assertEqual(address.account_id, "c13052d8208230a58ab363708c08e78f1125f488") 23 | self.assertEqual(address.checksum, "0b4af4d2") 24 | self.assertEqual(address.to_string(), "M00EXMPnnaWFqRyVxWdhYCgGzpnaL4qBy4N3Qqa1") 25 | 26 | 27 | if __name__ == '__main__': 28 | unittest.main() 29 | -------------------------------------------------------------------------------- /client/crypto-sdk/.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | BasedOnStyle: None 3 | IndentWidth: 4 4 | UseTab: Never 5 | --- 6 | Language: Cpp 7 | ColumnLimit: 120 8 | NamespaceIndentation: None 9 | AccessModifierOffset: -4 10 | AlignAfterOpenBracket: false 11 | BinPackParameters: false 12 | ContinuationIndentWidth: 0 13 | --- 14 | -------------------------------------------------------------------------------- /client/crypto-sdk/.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | 34 | # CMake 35 | CMakeCache.txt 36 | CMakeFiles 37 | CMakeScripts 38 | Testing 39 | Makefile 40 | cmake_install.cmake 41 | install_manifest.txt 42 | compile_commands.json 43 | CTestTestfile.cmake 44 | 45 | build/ 46 | deps/libgpg-error/libgpg-error-* 47 | deps/libgcrypt/libgcrypt-* 48 | -------------------------------------------------------------------------------- /client/crypto-sdk/build-deps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | mkdir -p build 4 | 5 | if [ -z "${PLATFORM}" ]; then 6 | echo "You should set PLATFORM to the name of the target build!" 7 | exit 1 8 | fi 9 | 10 | if [ ! -d "build/${PLATFORM}/libgpg-error" ] ; then 11 | pushd deps/libgpg-error 12 | ./download.sh 13 | ./build.sh 14 | popd 15 | fi 16 | 17 | if [ ! -d "build/${PLATFORM}/libgcrypt/" ] ; then 18 | pushd deps/libgcrypt 19 | ./download.sh 20 | ./build.sh 21 | popd 22 | fi 23 | -------------------------------------------------------------------------------- /client/crypto-sdk/clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | if [ -n "${CMAKE_ONLY}" ] ; then 4 | find "build/" -type d -name "CMakeFiles" -exec rm -r {} + 5 | find "build/" -type f -name "*.cmake" -exec rm -r {} + 6 | find "build/" -type f -name "CMakeCache.txt" -exec rm -r {} + 7 | find "build/" -type f -name "Makefile" -exec rm -r {} + 8 | else 9 | rm -rf build 10 | fi 11 | -------------------------------------------------------------------------------- /client/crypto-sdk/deps/libgcrypt/download.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | LIBGCRYPT_VERSION=1.8.2 4 | LIBGCRYPT_PACKAGE="libgcrypt-${LIBGCRYPT_VERSION}" 5 | LIBGCRYPT_PACKAGE_FILENAME="${LIBGCRYPT_PACKAGE}.tar.bz2" 6 | LIBGCRYPT_SHA256="c8064cae7558144b13ef0eb87093412380efa16c4ee30ad12ecb54886a524c07" 7 | 8 | # Download the package. 9 | if [ ! -e ${LIBGCRYPT_PACKAGE_FILENAME} ] ; then 10 | echo "Downloading ${LIBGCRYPT_PACKAGE_FILENAME}" 11 | curl -O https://www.gnupg.org/ftp/gcrypt/libgcrypt/${LIBGCRYPT_PACKAGE_FILENAME} 12 | else 13 | echo "Using ${LIBGCRYPT_PACKAGE_FILENAME}" 14 | fi 15 | 16 | # Verify the SHA256 of the package. 17 | echo "${LIBGCRYPT_SHA256} ${LIBGCRYPT_PACKAGE_FILENAME}" | shasum -a256 -c 18 | if [ $? != 0 ] ; then 19 | echo "${LIBGCRYPT_PACKAGE_FILENAME} verification has failed!" 20 | exit 1 21 | else 22 | echo "${LIBGCRYPT_PACKAGE_FILENAME} has been verified successfully" 23 | fi 24 | 25 | # Extract the package 26 | tar -jxvf ${LIBGCRYPT_PACKAGE_FILENAME} 27 | -------------------------------------------------------------------------------- /client/crypto-sdk/deps/libgcrypt/libgcrypt.patch: -------------------------------------------------------------------------------- 1 | --- tests/random.c 2018-03-28 13:46:08.000000000 +0300 2 | +++ tests/random.c.patched 2017-11-23 20:16:58.000000000 +0200 3 | @@ -553,8 +553,8 @@ 4 | strcat (cmdline, " --progress"); 5 | strcat (cmdline, " "); 6 | strcat (cmdline, options[idx]); 7 | - if (system (cmdline)) 8 | - die ("running '%s' failed\n", cmdline); 9 | + // if (system (cmdline)) 10 | + // die ("running '%s' failed\n", cmdline); 11 | } 12 | 13 | free (cmdline); 14 | 15 | --- src/sexp.c 2017-11-24 18:38:42.000000000 +0900 16 | +++ src/sexp.1.c 2018-04-06 13:59:29.000000000 +0900 17 | @@ -2447,3 +2447,17 @@ 18 | va_end (arg_ptr); 19 | return rc; 20 | } 21 | + 22 | +#ifdef IMPLEMENT_STPCPY 23 | +// This implementation is missing when building for x86. 24 | +char *stpcpy(char *dest, char const *src) { 25 | + char *d = dest; 26 | + const char *s = src; 27 | + 28 | + do { 29 | + *d++ = *s; 30 | + } while (*s++ != '\0'); 31 | + 32 | + return d - 1; 33 | +} 34 | +#endif 35 | -------------------------------------------------------------------------------- /client/crypto-sdk/deps/libgpg-error/download.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | LIBGPG_ERROR_VERSION=1.28 4 | LIBGPG_ERROR_PACKAGE="libgpg-error-${LIBGPG_ERROR_VERSION}" 5 | LIBGPG_ERROR_PACKAGE_FILENAME="${LIBGPG_ERROR_PACKAGE}.tar.bz2" 6 | LIBGPG_ERROR_SHA256="3edb957744905412f30de3e25da18682cbe509541e18cd3b8f9df695a075da49" 7 | 8 | # Download the package. 9 | if [ ! -e ${LIBGPG_ERROR_PACKAGE_FILENAME} ] ; then 10 | echo "Downloading ${LIBGPG_ERROR_PACKAGE_FILENAME}" 11 | curl -O https://www.gnupg.org/ftp/gcrypt/libgpg-error/${LIBGPG_ERROR_PACKAGE_FILENAME} 12 | else 13 | echo "Using ${LIBGPG_ERROR_PACKAGE_FILENAME}" 14 | fi 15 | 16 | # Verify the SHA256 of the package. 17 | echo "${LIBGPG_ERROR_SHA256} ${LIBGPG_ERROR_PACKAGE_FILENAME}" | shasum -a256 -c 18 | if [ $? != 0 ] ; then 19 | echo "${LIBGPG_ERROR_PACKAGE_FILENAME} verification has failed!" 20 | exit 1 21 | else 22 | echo "${LIBGPG_ERROR_PACKAGE_FILENAME} has been verified successfully" 23 | fi 24 | 25 | # Extract the package 26 | tar -jxvf ${LIBGPG_ERROR_PACKAGE_FILENAME} 27 | -------------------------------------------------------------------------------- /client/crypto-sdk/deps/libgpg-error/libgpg-error.patch: -------------------------------------------------------------------------------- 1 | --- src/logging.c 2018-04-05 15:52:06.000000000 +0900 2 | +++ src/logging.c.patched 2018-04-05 15:53:09.000000000 +0900 3 | @@ -1142,15 +1142,9 @@ 4 | const char *fmt, ...) 5 | { 6 | va_list arg_ptr; 7 | - 8 | - if (fmt) 9 | - { 10 | - va_start (arg_ptr, fmt); 11 | - _gpgrt_logv_printhex (buffer, length, fmt, arg_ptr); 12 | - va_end (arg_ptr); 13 | - } 14 | - else 15 | - _gpgrt_logv_printhex (buffer, length, NULL, NULL); 16 | + va_start (arg_ptr, fmt); 17 | + _gpgrt_logv_printhex (buffer, length, fmt, arg_ptr); 18 | + va_end (arg_ptr); 19 | } 20 | -------------------------------------------------------------------------------- /client/crypto-sdk/lib/base58.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include "exports.h" 8 | 9 | namespace Orbs { 10 | 11 | class CRYPTO_EXPORT Base58 { 12 | public: 13 | // Encode a byte vector to a base58 encoded string. 14 | static const std::string Encode(const std::vector &data); 15 | 16 | // Decode a a base58 encoded strin to a byte vector. 17 | static const std::vector Decode(const std::string &data); 18 | }; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /client/crypto-sdk/lib/crc32.cpp: -------------------------------------------------------------------------------- 1 | #include "crc32.h" 2 | 3 | #include 4 | 5 | #include "utils.h" 6 | 7 | using namespace std; 8 | using namespace Orbs; 9 | 10 | void CRC32::Hash(const vector &data, vector &res) { 11 | size_t digestLength = gcry_md_get_algo_dlen(GCRY_MD_CRC32); 12 | res.resize(digestLength); 13 | 14 | gcry_md_hash_buffer(GCRY_MD_CRC32, &res[0], &data[0], data.size()); 15 | } 16 | 17 | void CRC32::Hash(const vector &data, string &res) { 18 | vector binRes; 19 | 20 | CRC32::Hash(data, binRes); 21 | 22 | res = Utils::Vec2Hex(binRes); 23 | } 24 | 25 | void CRC32::Hash(const string &str, vector &res) { 26 | vector data(str.begin(), str.end()); 27 | 28 | CRC32::Hash(data, res); 29 | } 30 | 31 | void CRC32::Hash(const string &str, string &res) { 32 | vector binRes; 33 | 34 | CRC32::Hash(str, binRes); 35 | 36 | res = Utils::Vec2Hex(binRes); 37 | } 38 | -------------------------------------------------------------------------------- /client/crypto-sdk/lib/crc32.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include "exports.h" 8 | 9 | namespace Orbs { 10 | 11 | class CRYPTO_EXPORT CRC32 { 12 | public: 13 | static void Hash(const std::vector &data, std::vector &res); 14 | static void Hash(const std::vector &data, std::string &res); 15 | static void Hash(const std::string &str, std::vector &res); 16 | static void Hash(const std::string &str, std::string &res); 17 | }; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /client/crypto-sdk/lib/crypto.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "exports.h" 4 | 5 | namespace Orbs { 6 | 7 | class CRYPTO_EXPORT CryptoSDK { 8 | public: 9 | // Initializes the Crypto SDK. This method have to be called before using any of the underlying functions. 10 | static void Init(); 11 | 12 | static bool IsInitialized(); 13 | }; 14 | 15 | } 16 | -------------------------------------------------------------------------------- /client/crypto-sdk/lib/exports.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef CRYPTO_EXPORT 4 | #define CRYPTO_EXPORT __attribute__((visibility("default"))) 5 | #endif 6 | 7 | #ifndef CRYPTO_NO_EXPORT 8 | #define CRYPTO_NO_EXPORT __attribute__((visibility("hidden"))) 9 | #endif 10 | -------------------------------------------------------------------------------- /client/crypto-sdk/lib/ripemd160.cpp: -------------------------------------------------------------------------------- 1 | #include "ripemd160.h" 2 | 3 | #include 4 | 5 | #include "utils.h" 6 | 7 | using namespace std; 8 | using namespace Orbs; 9 | 10 | void RIPEMD160::Hash(const vector &data, vector &res) { 11 | size_t digestLength = gcry_md_get_algo_dlen(GCRY_MD_RMD160); 12 | res.resize(digestLength); 13 | 14 | gcry_md_hash_buffer(GCRY_MD_RMD160, &res[0], &data[0], data.size()); 15 | } 16 | 17 | void RIPEMD160::Hash(const vector &data, string &res) { 18 | vector binRes; 19 | 20 | RIPEMD160::Hash(data, binRes); 21 | 22 | res = Utils::Vec2Hex(binRes); 23 | } 24 | 25 | void RIPEMD160::Hash(const string &str, vector &res) { 26 | vector data(str.begin(), str.end()); 27 | 28 | RIPEMD160::Hash(data, res); 29 | } 30 | 31 | void RIPEMD160::Hash(const string &str, string &res) { 32 | vector binRes; 33 | 34 | RIPEMD160::Hash(str, binRes); 35 | 36 | res = Utils::Vec2Hex(binRes); 37 | } 38 | -------------------------------------------------------------------------------- /client/crypto-sdk/lib/ripemd160.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include "exports.h" 8 | 9 | namespace Orbs { 10 | 11 | class CRYPTO_EXPORT RIPEMD160 { 12 | public: 13 | static void Hash(const std::vector &data, std::vector &res); 14 | static void Hash(const std::vector &data, std::string &res); 15 | static void Hash(const std::string &str, std::vector &res); 16 | static void Hash(const std::string &str, std::string &res); 17 | }; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /client/crypto-sdk/lib/sha256.cpp: -------------------------------------------------------------------------------- 1 | #include "sha256.h" 2 | 3 | #include 4 | 5 | #include "utils.h" 6 | 7 | using namespace std; 8 | using namespace Orbs; 9 | 10 | void SHA256::Hash(const vector &data, vector &res) { 11 | size_t digestLength = gcry_md_get_algo_dlen(GCRY_MD_SHA256); 12 | res.resize(digestLength); 13 | 14 | gcry_md_hash_buffer(GCRY_MD_SHA256, &res[0], &data[0], data.size()); 15 | } 16 | 17 | void SHA256::Hash(const vector &data, string &res) { 18 | vector binRes; 19 | 20 | SHA256::Hash(data, binRes); 21 | 22 | res = Utils::Vec2Hex(binRes); 23 | } 24 | 25 | void SHA256::Hash(const string &str, vector &res) { 26 | vector data(str.begin(), str.end()); 27 | 28 | SHA256::Hash(data, res); 29 | } 30 | 31 | void SHA256::Hash(const string &str, string &res) { 32 | vector binRes; 33 | 34 | SHA256::Hash(str, binRes); 35 | 36 | res = Utils::Vec2Hex(binRes); 37 | } 38 | -------------------------------------------------------------------------------- /client/crypto-sdk/lib/sha256.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include "exports.h" 8 | 9 | namespace Orbs { 10 | 11 | class CRYPTO_EXPORT SHA256 { 12 | public: 13 | static void Hash(const std::vector &data, std::vector &res); 14 | static void Hash(const std::vector &data, std::string &res); 15 | static void Hash(const std::string &str, std::vector &res); 16 | static void Hash(const std::string &str, std::string &res); 17 | }; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /client/crypto-sdk/lib/sha512.cpp: -------------------------------------------------------------------------------- 1 | #include "sha512.h" 2 | 3 | #include 4 | 5 | #include "utils.h" 6 | 7 | using namespace std; 8 | using namespace Orbs; 9 | 10 | void SHA512::Hash(const vector &data, vector &res) { 11 | size_t digestLength = gcry_md_get_algo_dlen(GCRY_MD_SHA512); 12 | res.resize(digestLength); 13 | 14 | gcry_md_hash_buffer(GCRY_MD_SHA512, &res[0], &data[0], data.size()); 15 | } 16 | 17 | void SHA512::Hash(const vector &data, string &res) { 18 | vector binRes; 19 | 20 | SHA512::Hash(data, binRes); 21 | 22 | res = Utils::Vec2Hex(binRes); 23 | } 24 | 25 | void SHA512::Hash(const string &str, vector &res) { 26 | vector data(str.begin(), str.end()); 27 | 28 | SHA512::Hash(data, res); 29 | } 30 | 31 | void SHA512::Hash(const string &str, string &res) { 32 | vector binRes; 33 | 34 | SHA512::Hash(str, binRes); 35 | 36 | res = Utils::Vec2Hex(binRes); 37 | } 38 | -------------------------------------------------------------------------------- /client/crypto-sdk/lib/sha512.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include "exports.h" 8 | 9 | namespace Orbs { 10 | 11 | class CRYPTO_EXPORT SHA512 { 12 | public: 13 | static void Hash(const std::vector &data, std::vector &res); 14 | static void Hash(const std::vector &data, std::string &res); 15 | static void Hash(const std::string &str, std::vector &res); 16 | static void Hash(const std::string &str, std::string &res); 17 | }; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /client/crypto-sdk/lib/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | using namespace std; 8 | using namespace Orbs; 9 | 10 | const string Utils::Vec2Hex(const vector &data) { 11 | stringstream ss; 12 | ss << hex << setfill('0'); 13 | for (uint8_t i : data) { 14 | ss << setw(2) << static_cast(i); 15 | } 16 | 17 | return ss.str(); 18 | } 19 | 20 | static const string HEX_ALPHABET("0123456789abcdefABCDEF"); 21 | 22 | const vector Utils::Hex2Vec(const string &data) { 23 | if (data.length() % 2 != 0) { 24 | throw invalid_argument("Invalid data length!"); 25 | } 26 | 27 | if (data.find_first_not_of(HEX_ALPHABET) != string::npos) { 28 | throw invalid_argument("Invalid hex data!"); 29 | } 30 | 31 | vector res; 32 | res.reserve(data.length() / 2); 33 | for (string::size_type i = 0; i < data.length(); i += 2) { 34 | unsigned byte; 35 | istringstream strm(data.substr(i, 2)); 36 | strm >> hex >> byte; 37 | res.push_back(static_cast(byte)); 38 | } 39 | 40 | return res; 41 | } 42 | -------------------------------------------------------------------------------- /client/crypto-sdk/lib/utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include "exports.h" 9 | 10 | namespace Orbs { 11 | 12 | class CRYPTO_EXPORT Utils { 13 | public: 14 | static const std::string Vec2Hex(const std::vector &data); 15 | static const std::vector Hex2Vec(const std::string &data); 16 | 17 | template 18 | static const std::string ToString(T value) { 19 | std::ostringstream os; 20 | os << value; 21 | 22 | return os.str() ; 23 | } 24 | 25 | template 26 | static const T FromString(const std::string &str) { 27 | std::stringstream s(str); 28 | 29 | T value; 30 | s >> value; 31 | 32 | return value; 33 | } 34 | }; 35 | 36 | } 37 | -------------------------------------------------------------------------------- /client/crypto-sdk/rebuild.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | ./clean.sh 4 | ./build.sh 5 | -------------------------------------------------------------------------------- /client/crypto-sdk/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | cd build 4 | 5 | case ${PLATFORM} in 6 | ios) 7 | ;; 8 | android) 9 | ;; 10 | *) 11 | CTEST_OUTPUT_ON_FAILURE=1 GTEST_COLOR=1 ctest 12 | 13 | ;; 14 | esac 15 | -------------------------------------------------------------------------------- /client/crypto-sdk/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(../gtest.cmake) 2 | 3 | file(GLOB CRYPTO_SDK_TEST_SRC 4 | "*.h" 5 | "*.cpp" 6 | ) 7 | 8 | if(PLATFORM STREQUAL "mac") 9 | set(LIBGPG_ERROR_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../build/mac/libgpg-error) 10 | set(LIBGCRYPT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../build/mac/libgcrypt) 11 | elseif(PLATFORM STREQUAL "linux") 12 | set(LIBGPG_ERROR_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../build/linux/libgpg-error) 13 | set(LIBGCRYPT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../build/linux/libgcrypt) 14 | endif() 15 | 16 | set(LIBGPG_ERROR_LIBRARY ${LIBGPG_ERROR_DIR}/lib/libgpg-error.a) 17 | set(LIBGCRYPT_LIBRARY ${LIBGCRYPT_DIR}/lib/libgcrypt.a) 18 | 19 | add_executable(crypto-test ${CRYPTO_SDK_TEST_SRC}) 20 | 21 | target_link_libraries(crypto-test LINK_PUBLIC 22 | cryptosdk 23 | ${GTEST_LIBRARY} 24 | ${GMOCK_LIBRARY} 25 | ${LIBGCRYPT_LIBRARY} 26 | ${LIBGPG_ERROR_LIBRARY} 27 | ) 28 | 29 | # Tell ctest about my tests. 30 | include(GoogleTest) 31 | gtest_add_tests(TARGET crypto-test TEST_LIST crypto-test-targets) 32 | 33 | # Set each target to timeout if not finished within 10 sec. 34 | set_tests_properties(${crypto-test-targets} PROPERTIES TIMEOUT 10) 35 | -------------------------------------------------------------------------------- /client/crypto-sdk/test/crypto-tests.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "../lib/crypto.h" 5 | 6 | using namespace std; 7 | using namespace testing; 8 | using namespace Orbs; 9 | 10 | TEST(CryptoSDK, can_be_called_more_than_once) { 11 | EXPECT_TRUE(CryptoSDK::IsInitialized()); 12 | EXPECT_NO_THROW(CryptoSDK::Init()); 13 | } 14 | -------------------------------------------------------------------------------- /client/crypto-sdk/test/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "../lib/crypto.h" 7 | 8 | using namespace std; 9 | using namespace testing; 10 | using namespace Orbs; 11 | 12 | int main(int argc, char **argv) { 13 | cerr << "Initializing CryptoSDK in regular mode..." << endl; 14 | CryptoSDK::Init(); 15 | 16 | InitGoogleTest(&argc, argv); 17 | InitGoogleMock(&argc, argv); 18 | 19 | return RUN_ALL_TESTS(); 20 | } 21 | -------------------------------------------------------------------------------- /client/examples/android-sample-app/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/gfan/dev/sdk_current/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | 20 | ## OkHttp 21 | -dontwarn okhttp3.** 22 | -dontwarn okio.** 23 | -dontwarn javax.annotation.** 24 | -------------------------------------------------------------------------------- /client/examples/android-sample-app/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /client/examples/android-sample-app/app/src/main/res/drawable/orbs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbs-network/orbs-network-typescript/a878afb5e6f8de3a2042764f0cecd6f27d113c18/client/examples/android-sample-app/app/src/main/res/drawable/orbs.png -------------------------------------------------------------------------------- /client/examples/android-sample-app/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbs-network/orbs-network-typescript/a878afb5e6f8de3a2042764f0cecd6f27d113c18/client/examples/android-sample-app/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /client/examples/android-sample-app/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbs-network/orbs-network-typescript/a878afb5e6f8de3a2042764f0cecd6f27d113c18/client/examples/android-sample-app/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /client/examples/android-sample-app/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbs-network/orbs-network-typescript/a878afb5e6f8de3a2042764f0cecd6f27d113c18/client/examples/android-sample-app/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /client/examples/android-sample-app/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbs-network/orbs-network-typescript/a878afb5e6f8de3a2042764f0cecd6f27d113c18/client/examples/android-sample-app/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /client/examples/android-sample-app/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbs-network/orbs-network-typescript/a878afb5e6f8de3a2042764f0cecd6f27d113c18/client/examples/android-sample-app/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /client/examples/android-sample-app/app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /client/examples/android-sample-app/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /client/examples/android-sample-app/app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /client/examples/android-sample-app/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Orbs Android Sample App 3 | N/A 4 | Logo 5 | Orbs Address 6 | Testnet 7 | Mainnet 8 | Generate New Address 9 | 10 | -------------------------------------------------------------------------------- /client/examples/android-sample-app/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /client/examples/android-sample-app/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.1.2' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | google() 15 | jcenter() 16 | } 17 | } 18 | 19 | task clean(type: Delete) { 20 | delete rootProject.buildDir 21 | } 22 | -------------------------------------------------------------------------------- /client/examples/android-sample-app/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | gradle build 4 | -------------------------------------------------------------------------------- /client/examples/android-sample-app/crypto-sdk/build.gradle: -------------------------------------------------------------------------------- 1 | configurations.maybeCreate("default") 2 | artifacts.add("default", file('../../../crypto-sdk-android/crypto-sdk/build/outputs/aar/crypto-sdk-release.aar')) -------------------------------------------------------------------------------- /client/examples/android-sample-app/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /client/examples/android-sample-app/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sun Apr 01 08:28:44 IDT 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip 7 | -------------------------------------------------------------------------------- /client/examples/android-sample-app/keyforrelease: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbs-network/orbs-network-typescript/a878afb5e6f8de3a2042764f0cecd6f27d113c18/client/examples/android-sample-app/keyforrelease -------------------------------------------------------------------------------- /client/examples/android-sample-app/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':crypto-sdk' 2 | -------------------------------------------------------------------------------- /client/examples/event-proxy-app/.gitignore: -------------------------------------------------------------------------------- 1 | lib-cov 2 | *.seed 3 | *.log 4 | *.csv 5 | *.dat 6 | *.out 7 | *.pid 8 | *.gz 9 | *.swp 10 | 11 | pids 12 | logs 13 | results 14 | tmp 15 | 16 | #Build 17 | public/css/main.css 18 | 19 | # API keys and secrets 20 | .env 21 | 22 | # Dependency directory 23 | node_modules 24 | bower_components 25 | 26 | # Editors 27 | .idea 28 | *.iml 29 | 30 | # OS metadata 31 | .DS_Store 32 | Thumbs.db 33 | 34 | # Ignore built ts files 35 | dist/**/* 36 | -------------------------------------------------------------------------------- /client/examples/event-proxy-app/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Orbs Network 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 NON-INFRINGEMENT. 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 | -------------------------------------------------------------------------------- /client/examples/event-proxy-app/README.md: -------------------------------------------------------------------------------- 1 | # Event proxy app 2 | 3 | Calls `event-counter` smart contract. 4 | 5 | ## How to build 6 | 7 | ```bash 8 | ./build.sh 9 | ``` 10 | 11 | ## How to run 12 | 13 | ```bash 14 | export ORBS_API_ENDPOINT= 15 | export REDIS_URL= 16 | export NETWORK_ID= 17 | export VIRTUAL_CHAIN= 18 | yarn run server 19 | ``` 20 | 21 | Note, that `NETWORK_ID=T` on staging and `M` in production. 22 | -------------------------------------------------------------------------------- /client/examples/event-proxy-app/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | yarn link orbs-client-sdk 3 | 4 | yarn install --production=false 5 | 6 | yarn run build 7 | -------------------------------------------------------------------------------- /client/examples/event-proxy-app/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "types": [ 6 | "node" 7 | ], 8 | "noImplicitAny": true, 9 | "skipLibCheck": true, 10 | "moduleResolution": "node", 11 | "sourceMap": true, 12 | "inlineSources": true, 13 | "experimentalDecorators": true, 14 | "outDir": "dist", 15 | "baseUrl": ".", 16 | "paths": { 17 | "*": [ 18 | "node_modules/*", 19 | "src/types/*" 20 | ] 21 | } 22 | }, 23 | "include": [ 24 | "src/**/*", 25 | "test/**/*" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /client/examples/ios-sample-app/.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | IDEWorkspaceChecks.plist 8 | 9 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 10 | *.xcscmblueprint 11 | *.xccheckout 12 | 13 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 14 | build/ 15 | DerivedData/ 16 | *.moved-aside 17 | *.pbxuser 18 | !default.pbxuser 19 | *.mode1v3 20 | !default.mode1v3 21 | *.mode2v3 22 | !default.mode2v3 23 | *.perspectivev3 24 | !default.perspectivev3 25 | 26 | _CodeSignature 27 | -------------------------------------------------------------------------------- /client/examples/ios-sample-app/ios-sample-app.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /client/examples/ios-sample-app/ios-sample-app/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface AppDelegate : UIResponder 4 | 5 | @property (strong, nonatomic) UIWindow *window; 6 | 7 | 8 | @end 9 | 10 | -------------------------------------------------------------------------------- /client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/AppIcon.appiconset/logo-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbs-network/orbs-network-typescript/a878afb5e6f8de3a2042764f0cecd6f27d113c18/client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/AppIcon.appiconset/logo-1024.png -------------------------------------------------------------------------------- /client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/AppIcon.appiconset/logo-20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbs-network/orbs-network-typescript/a878afb5e6f8de3a2042764f0cecd6f27d113c18/client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/AppIcon.appiconset/logo-20.png -------------------------------------------------------------------------------- /client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/AppIcon.appiconset/logo-20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbs-network/orbs-network-typescript/a878afb5e6f8de3a2042764f0cecd6f27d113c18/client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/AppIcon.appiconset/logo-20@2x.png -------------------------------------------------------------------------------- /client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/AppIcon.appiconset/logo-20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbs-network/orbs-network-typescript/a878afb5e6f8de3a2042764f0cecd6f27d113c18/client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/AppIcon.appiconset/logo-20@3x.png -------------------------------------------------------------------------------- /client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/AppIcon.appiconset/logo-29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbs-network/orbs-network-typescript/a878afb5e6f8de3a2042764f0cecd6f27d113c18/client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/AppIcon.appiconset/logo-29.png -------------------------------------------------------------------------------- /client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/AppIcon.appiconset/logo-29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbs-network/orbs-network-typescript/a878afb5e6f8de3a2042764f0cecd6f27d113c18/client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/AppIcon.appiconset/logo-29@2x.png -------------------------------------------------------------------------------- /client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/AppIcon.appiconset/logo-29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbs-network/orbs-network-typescript/a878afb5e6f8de3a2042764f0cecd6f27d113c18/client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/AppIcon.appiconset/logo-29@3x.png -------------------------------------------------------------------------------- /client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/AppIcon.appiconset/logo-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbs-network/orbs-network-typescript/a878afb5e6f8de3a2042764f0cecd6f27d113c18/client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/AppIcon.appiconset/logo-40.png -------------------------------------------------------------------------------- /client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/AppIcon.appiconset/logo-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbs-network/orbs-network-typescript/a878afb5e6f8de3a2042764f0cecd6f27d113c18/client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/AppIcon.appiconset/logo-40@2x.png -------------------------------------------------------------------------------- /client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/AppIcon.appiconset/logo-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbs-network/orbs-network-typescript/a878afb5e6f8de3a2042764f0cecd6f27d113c18/client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/AppIcon.appiconset/logo-40@3x.png -------------------------------------------------------------------------------- /client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/AppIcon.appiconset/logo-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbs-network/orbs-network-typescript/a878afb5e6f8de3a2042764f0cecd6f27d113c18/client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/AppIcon.appiconset/logo-60@2x.png -------------------------------------------------------------------------------- /client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/AppIcon.appiconset/logo-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbs-network/orbs-network-typescript/a878afb5e6f8de3a2042764f0cecd6f27d113c18/client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/AppIcon.appiconset/logo-60@3x.png -------------------------------------------------------------------------------- /client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/AppIcon.appiconset/logo-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbs-network/orbs-network-typescript/a878afb5e6f8de3a2042764f0cecd6f27d113c18/client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/AppIcon.appiconset/logo-76.png -------------------------------------------------------------------------------- /client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/AppIcon.appiconset/logo-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbs-network/orbs-network-typescript/a878afb5e6f8de3a2042764f0cecd6f27d113c18/client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/AppIcon.appiconset/logo-76@2x.png -------------------------------------------------------------------------------- /client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/AppIcon.appiconset/logo-83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbs-network/orbs-network-typescript/a878afb5e6f8de3a2042764f0cecd6f27d113c18/client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/AppIcon.appiconset/logo-83.5@2x.png -------------------------------------------------------------------------------- /client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/Logo.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "universal", 5 | "filename": "logo.png", 6 | "scale": "1x" 7 | }, 8 | { 9 | "idiom": "universal", 10 | "filename": "logo.png", 11 | "scale": "2x" 12 | }, 13 | { 14 | "idiom": "universal", 15 | "filename": "logo.png", 16 | "scale": "3x" 17 | } 18 | ], 19 | "info": { 20 | "version": 1, 21 | "author": "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/Logo.imageset/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbs-network/orbs-network-typescript/a878afb5e6f8de3a2042764f0cecd6f27d113c18/client/examples/ios-sample-app/ios-sample-app/Assets.xcassets/Logo.imageset/logo.png -------------------------------------------------------------------------------- /client/examples/ios-sample-app/ios-sample-app/ViewController.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface ViewController : UIViewController 4 | 5 | @property (strong, nonatomic) IBOutlet UITextField *addressTextField; 6 | @property (strong, nonatomic) IBOutlet UIButton *generateAddressButton; 7 | @property (strong, nonatomic) IBOutlet UISegmentedControl *networkIdControl; 8 | 9 | @end 10 | 11 | -------------------------------------------------------------------------------- /client/examples/ios-sample-app/ios-sample-app/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char * argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /client/examples/python-example-app/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | pip install -r requirements.txt 4 | -------------------------------------------------------------------------------- /client/examples/python-example-app/requirements.txt: -------------------------------------------------------------------------------- 1 | requests 2 | redis 3 | slackclient 4 | -------------------------------------------------------------------------------- /client/examples/slack-bot/.gitignore: -------------------------------------------------------------------------------- 1 | lib-cov 2 | *.seed 3 | *.log 4 | *.csv 5 | *.dat 6 | *.out 7 | *.pid 8 | *.gz 9 | *.swp 10 | 11 | pids 12 | logs 13 | results 14 | tmp 15 | 16 | #Build 17 | public/css/main.css 18 | 19 | # API keys and secrets 20 | .env 21 | 22 | # Dependency directory 23 | node_modules 24 | bower_components 25 | 26 | # Editors 27 | .idea 28 | *.iml 29 | 30 | # OS metadata 31 | .DS_Store 32 | Thumbs.db 33 | 34 | # Ignore built ts files 35 | dist/**/* 36 | -------------------------------------------------------------------------------- /client/examples/slack-bot/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Orbs Network 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 NON-INFRINGEMENT. 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 | -------------------------------------------------------------------------------- /client/examples/slack-bot/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | yarn link orbs-client-sdk 3 | 4 | yarn install --production=false 5 | 6 | yarn run build 7 | -------------------------------------------------------------------------------- /client/examples/slack-bot/src/foobar-account.ts: -------------------------------------------------------------------------------- 1 | import { OrbsContract } from "orbs-client-sdk"; 2 | 3 | export interface Message { 4 | recipient: string; 5 | sender: string; 6 | timestamp: number; 7 | processedAtTimestamp: number; 8 | message: string; 9 | } 10 | 11 | export class FooBarAccount { 12 | contract: OrbsContract; 13 | address: string; 14 | username: string; 15 | 16 | public constructor(username: string, address: string, contract: OrbsContract) { 17 | this.username = username; 18 | this.contract = contract; 19 | this.address = address; 20 | } 21 | 22 | public async transfer(to: string, amount: number) { 23 | return await this.contract.sendTransaction("transfer", [to, amount]); 24 | } 25 | 26 | public async initBalance(account: string, balance: number) { 27 | return await this.contract.sendTransaction("initBalance", [account, balance]); 28 | } 29 | 30 | public async getMyBalance() { 31 | return this.contract.call("getMyBalance", []); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /client/examples/slack-bot/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "types": [ 6 | "node" 7 | ], 8 | "noImplicitAny": true, 9 | "skipLibCheck": true, 10 | "moduleResolution": "node", 11 | "sourceMap": true, 12 | "inlineSources": true, 13 | "experimentalDecorators": true, 14 | "outDir": "dist", 15 | "baseUrl": ".", 16 | "paths": { 17 | "*": [ 18 | "node_modules/*", 19 | "src/types/*" 20 | ] 21 | } 22 | }, 23 | "include": [ 24 | "src/**/*", 25 | "test/**/*" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /config/projects.bot.json: -------------------------------------------------------------------------------- 1 | { 2 | "architecture": { 3 | "runtime": "protobuf", 4 | "type": "static", 5 | "path": "projects/architecture" 6 | }, 7 | "crypto-sdk": { 8 | "runtime": "c++", 9 | "type": "library", 10 | "path": "client/crypto-sdk" 11 | }, 12 | "client-sdk-javascript": { 13 | "runtime": "typescript", 14 | "type": "library", 15 | "path": "client/client-sdk-javascript" 16 | }, 17 | "crypto-sdk-python": { 18 | "runtime": "c++", 19 | "type": "library", 20 | "path": "client/crypto-sdk-python" 21 | }, 22 | "example-slack-bot": { 23 | "runtime": "typescript", 24 | "type": "library", 25 | "path": "client/examples/slack-bot" 26 | }, 27 | "example-python-app": { 28 | "runtime": "typescript", 29 | "type": "library", 30 | "path": "client/examples/python-example-app" 31 | }, 32 | "event-proxy-app": { 33 | "runtime": "typescript", 34 | "type": "library", 35 | "path": "client/examples/event-proxy-app" 36 | }, 37 | "order": [ 38 | "architecture", 39 | "crypto-sdk", 40 | "client-sdk-javascript", 41 | "event-proxy-app", 42 | "example-slack-bot", 43 | "crypto-sdk-python", 44 | "example-python-app" 45 | ] 46 | } 47 | -------------------------------------------------------------------------------- /config/projects.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "architecture": { 3 | "runtime": "protobuf", 4 | "type": "static", 5 | "path": "projects/architecture" 6 | }, 7 | "crypto-sdk": { 8 | "runtime": "c++", 9 | "type": "library", 10 | "path": "client/crypto-sdk" 11 | }, 12 | "client-sdk-javascript": { 13 | "runtime": "typescript", 14 | "type": "library", 15 | "path": "client/client-sdk-javascript" 16 | }, 17 | "e2e": { 18 | "runtime": "typescript", 19 | "type": "library", 20 | "path": "e2e" 21 | }, 22 | "order": [ 23 | "architecture", 24 | "crypto-sdk", 25 | "client-sdk-javascript", 26 | "e2e" 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /config/topologies/discovery/node1/consensus.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | module.exports = { 10 | name: 'consensus', 11 | version: '1.0.0', 12 | endpoint: '0.0.0.0:51151', 13 | project: 'consensus-service-typescript', 14 | peers: [ 15 | { 16 | service: 'gossip', 17 | endpoint: 'gossip:51151', 18 | }, 19 | { 20 | service: 'storage', 21 | endpoint: 'storage:51151', 22 | }, 23 | { 24 | service: 'sidechain-connector', 25 | endpoint: 'sidechain-connector:51151', 26 | }, 27 | { 28 | service: 'consensus', 29 | endpoint: 'consensus:51151', 30 | }, 31 | { 32 | service: 'virtual-machine', 33 | endpoint: 'virtual-machine:51151', 34 | }, 35 | ], 36 | }; 37 | -------------------------------------------------------------------------------- /config/topologies/discovery/node1/gossip.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | const GOSSIP_PEERS = process.env.GOSSIP_PEERS ? process.env.GOSSIP_PEERS.split(',') : undefined; 10 | 11 | module.exports = { 12 | name: 'gossip', 13 | version: '1.0.0', 14 | endpoint: '0.0.0.0:51151', 15 | project: 'gossip-service-typescript', 16 | peers: [ 17 | { 18 | service: 'consensus', 19 | endpoint: 'consensus:51151', 20 | }, 21 | { 22 | service: 'storage', 23 | endpoint: 'storage:51151', 24 | }, 25 | ], 26 | gossipPort: 60001, 27 | gossipPeers: GOSSIP_PEERS || [ 28 | 'ws://172.1.1.2:60001', 29 | 'ws://172.1.1.3:60001', 30 | 'ws://172.1.1.4:60001', 31 | 'ws://172.1.1.5:60001', 32 | 'ws://172.1.1.6:60001', 33 | 'ws://172.1.1.7:60001', 34 | ], 35 | }; 36 | -------------------------------------------------------------------------------- /config/topologies/discovery/node1/public-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | module.exports = { 10 | name: 'public-api', 11 | version: '1.0.0', 12 | endpoint: '0.0.0.0:51151', 13 | project: 'public-api-service-typescript', 14 | peers: [ 15 | { 16 | service: 'gossip', 17 | endpoint: 'gossip:51151', 18 | }, 19 | { 20 | service: 'consensus', 21 | endpoint: 'consensus:51151', 22 | }, 23 | { 24 | service: 'virtual-machine', 25 | endpoint: 'virtual-machine:51151', 26 | }, 27 | ], 28 | }; 29 | -------------------------------------------------------------------------------- /config/topologies/discovery/node1/sidechain-connector.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | module.exports = { 10 | name: 'sidechain-connector', 11 | version: '1.0.0', 12 | endpoint: '0.0.0.0:51151', 13 | project: 'sidechain-connector-service-typescript', 14 | peers: [], 15 | }; 16 | -------------------------------------------------------------------------------- /config/topologies/discovery/node1/storage.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | module.exports = { 10 | name: 'storage', 11 | version: '1.0.0', 12 | endpoint: '0.0.0.0:51151', 13 | project: 'storage-service-typescript', 14 | peers: [ 15 | { 16 | service: 'storage', 17 | endpoint: 'storage:51151', 18 | }, 19 | { 20 | service: 'gossip', 21 | endpoint: 'gossip:51151', 22 | }, 23 | { 24 | service: 'consensus', 25 | endpoint: 'consensus:51151', 26 | }, 27 | ], 28 | }; 29 | -------------------------------------------------------------------------------- /config/topologies/discovery/node1/virtual-machine.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | module.exports = { 10 | name: 'virtual-machine', 11 | version: '1.0.0', 12 | endpoint: '0.0.0.0:51151', 13 | project: 'virtual-machine-service-typescript', 14 | peers: [ 15 | { 16 | service: 'storage', 17 | endpoint: 'storage:51151', 18 | }, 19 | ], 20 | }; 21 | -------------------------------------------------------------------------------- /db/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbs-network/orbs-network-typescript/a878afb5e6f8de3a2042764f0cecd6f27d113c18/db/.gitkeep -------------------------------------------------------------------------------- /deploy/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | temp-keys 3 | 4 | deploy-multi.sh 5 | -------------------------------------------------------------------------------- /deploy/bootstrap/.env: -------------------------------------------------------------------------------- 1 | # THIS FILE IS FOR STAGING ENV **ONLY** AND SHOULD BE CHANGED IN PRODUCTION 2 | LOG_LEVEL=debug 3 | GOSSIP_PEERS=ws://us-east-1.global.nodes.staging.orbs-test.com:60001,ws://eu-central-1.global.nodes.staging.orbs-test.com:60001,ws://ap-northeast-1.global.nodes.staging.orbs-test.com:60001,ws://ap-northeast-2.global.nodes.staging.orbs-test.com:60001,ws://ap-southeast-2.global.nodes.staging.orbs-test.com:60001,ws://ca-central-1.global.nodes.staging.orbs-test.com:60001 4 | NUM_OF_NODES=6 5 | # Should NOT be enabled in production 6 | # CHANGE NETWORK ID FOR PRODUCTION TO "M" 7 | SMART_CONTRACTS_TO_LOAD=[{"vchainId": "640ed3", "name": "foobar", "filename": "foobar-smart-contract", "networkId": "T"},{"vchainId": "640ed3", "name": "text-message", "filename": "text-message-smart-contract", "networkId": "T"},{"vchainId": "6b696e", "name": "kinatn", "filename": "kinatn-smart-contract", "networkId": "T"},{"vchainId": "640ed3", "name": "event-counter", "filename": "event-counter-smart-contract", "networkId": "T"}] 8 | -------------------------------------------------------------------------------- /deploy/bootstrap/.gitignore: -------------------------------------------------------------------------------- 1 | .env-secrets 2 | public-keys 3 | -------------------------------------------------------------------------------- /deploy/bootstrap/bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -xe 2 | 3 | export CURRENT_NODE_IP=$(curl http://169.254.169.254/latest/meta-data/public-ipv4) 4 | export INSTANCE_ID=$(curl http://169.254.169.254/latest/meta-data/instance-id) 5 | 6 | if [ $CURRENT_NODE_IP != $NODE_IP ]; then 7 | aws ec2 associate-address --region $REGION --instance-id $INSTANCE_ID --allocation-id $EIP 8 | fi 9 | 10 | $(aws ecr get-login --no-include-email --region $REGION) 11 | pip install docker-compose 12 | 13 | export ENV_FILE=/opt/orbs/.env 14 | 15 | echo NODE_IP=$NODE_IP >> $ENV_FILE 16 | echo NODE_NAME=$NODE_NAME >> $ENV_FILE 17 | echo NODE_ENV=$NODE_ENV >> $ENV_FILE 18 | echo INSTANCE_ID=$INSTANCE_ID >> $ENV_FILE 19 | echo ETHEREUM_NODE_HTTP_ADDRESS=$ETHEREUM_NODE_HTTP_ADDRESS >> $ENV_FILE 20 | 21 | export DOCKER_TAG=${DOCKER_TAG-master} 22 | # TODO: remove default image 23 | export DOCKER_IMAGE=${DOCKER_IMAGE-506367651493.dkr.ecr.us-west-2.amazonaws.com/orbs-network} 24 | 25 | crontab /opt/orbs/crontab 26 | 27 | /usr/local/bin/docker-compose -f /opt/orbs/docker-compose.yml up -d 28 | -------------------------------------------------------------------------------- /deploy/bootstrap/crontab: -------------------------------------------------------------------------------- 1 | */5 * * * * flock /var/lock/update-bootstrap bash /opt/scripts/update.sh 2 | -------------------------------------------------------------------------------- /deploy/bot/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | services: 4 | bot: 5 | image: ${DOCKER_IMAGE}:${DOCKER_TAG} 6 | working_dir: /opt/orbs/client/examples/slack-bot 7 | command: yarn run bot 8 | restart: always 9 | environment: 10 | SLACK_TOKEN: ${SLACK_TOKEN} 11 | ORBS_API_ENDPOINT: http://us-east-1.global.nodes.staging.orbs-test.com 12 | REDIS_URL: redis://redis:6379 13 | links: 14 | - redis:redis 15 | 16 | logger: 17 | image: ${DOCKER_IMAGE}:${DOCKER_TAG} 18 | working_dir: /opt/orbs/client/examples/python-example-app 19 | command: python src/bot.py 20 | restart: always 21 | environment: 22 | SLACK_TOKEN: ${SLACK_TOKEN} 23 | ORBS_API_ENDPOINT: http://eu-central-1.global.nodes.staging.orbs-test.com 24 | REDIS_URL: redis://redis:6379 25 | links: 26 | - redis:redis 27 | redis: 28 | image: redis 29 | volumes: 30 | - ./data:/data 31 | -------------------------------------------------------------------------------- /deploy/cloudformation/parameters.basic-infrastracture.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ParameterKey": "NodeEnv", 4 | "ParameterValue": "staging" 5 | }, 6 | { 7 | "ParameterKey": "DNSZone", 8 | "ParameterValue": "orbs-test.com" 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /deploy/deploy-staging.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -xe 2 | 3 | export NETWORK=testnet 4 | export AWS_ACCOUNT_ID=506367651493 5 | export DNS_ZONE=orbs-test.com 6 | export S3_BUCKET_NAME=orbs-network-config 7 | export REGIONS=${REGIONS-us-east-1,eu-central-1,ap-northeast-1,ap-northeast-2,ap-southeast-2,ca-central-1} 8 | export DOCKER_TAG=${DOCKER_TAG-master} 9 | export DEPLOY_STEP=${DEPLOY_STEP-2} 10 | export ETHEREUM_NODE_IP=34.212.214.57 11 | 12 | npm run build-ts 13 | 14 | node dist/multi-account.js \ 15 | --region $REGIONS \ 16 | --dns-zone $DNS_ZONE \ 17 | --account-id $AWS_ACCOUNT_ID \ 18 | --network $NETWORK \ 19 | --s3-bucket-name $S3_BUCKET_NAME \ 20 | --docker-tag ${DOCKER_TAG} \ 21 | --step $DEPLOY_STEP \ 22 | --ethereum-node-ip $ETHEREUM_NODE_IP \ 23 | --tag-docker-image \ 24 | --push-docker-image \ 25 | --remove-node \ 26 | --deploy-node 27 | -------------------------------------------------------------------------------- /deploy/examples/event-counter-app/.gitignore: -------------------------------------------------------------------------------- 1 | data 2 | -------------------------------------------------------------------------------- /deploy/examples/event-counter-app/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | services: 4 | app: 5 | image: ${DOCKER_IMAGE}:${DOCKER_TAG} 6 | working_dir: /opt/orbs/client/examples/event-proxy-app 7 | command: yarn run server 8 | restart: always 9 | ports: 10 | - 80:8080 11 | environment: 12 | ORBS_API_ENDPOINT: http://us-east-1.global.nodes.staging.orbs-test.com 13 | REDIS_URL: redis://redis:6379 14 | links: 15 | - redis:redis 16 | 17 | redis: 18 | image: redis 19 | restart: always 20 | volumes: 21 | - ./data:/data 22 | -------------------------------------------------------------------------------- /deploy/generate-staging-keys.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -xe 2 | 3 | export AWS_ACCOUNT_ID=${AWS_ACCOUNT_ID-506367651493} 4 | export REGIONS=${REGIONS-us-east-1,eu-central-1,ap-northeast-1,ap-northeast-2,ap-southeast-2,ca-central-1} 5 | export KEY_TYPE=${KEY_TYPE-message} 6 | export NODE_ENV=${NODE_ENV-staging} 7 | 8 | mkdir -p \ 9 | temp-keys/private-keys/$KEY_TYPE \ 10 | temp-keys/public-keys/$KEY_TYPE 11 | 12 | for REGION in $(echo $REGIONS | sed -e 's/,/ /g'); do 13 | export KEY_NAME=orbs-global-$AWS_ACCOUNT_ID-$NODE_ENV-$REGION 14 | 15 | ssh-keygen -t rsa -b 4096 -N "" -f temp-keys/$KEY_NAME-$KEY_TYPE 16 | ssh-keygen -f temp-keys/$KEY_NAME-$KEY_TYPE.pub -e -m pem > temp-keys/public-keys/$KEY_TYPE/$KEY_NAME 17 | cp temp-keys/$KEY_NAME-$KEY_TYPE temp-keys/private-keys/$KEY_TYPE/$KEY_NAME 18 | 19 | rm -rf temp-keys/$KEY_NAME* 20 | done 21 | 22 | mkdir -p bootstrap/public-keys/$KEY_TYPE 23 | 24 | cp -rf temp-keys/public-keys/$KEY_TYPE/* bootstrap/public-keys/$KEY_TYPE 25 | -------------------------------------------------------------------------------- /deploy/local/.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | -------------------------------------------------------------------------------- /deploy/local/Vagrantfile: -------------------------------------------------------------------------------- 1 | 2 | Vagrant.configure("2") do |config| 3 | config.vm.provider "virtualbox" do |v| 4 | v.memory = 1024 5 | v.cpus = 2 6 | end 7 | 8 | config.vm.synced_folder "../../docker/images/", "/opt/docker/" 9 | config.vm.synced_folder "../bootstrap", "/opt/orbs" 10 | config.vm.synced_folder "../temp-keys/private-keys", "/opt/orbs/private-keys" 11 | 12 | config.vm.box = "generic/debian9" 13 | config.vm.provision "shell", path: "bootstrap-local.sh" 14 | end 15 | -------------------------------------------------------------------------------- /deploy/local/bootstrap-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | apt-get install -y python-pip curl && pip install docker-compose && (curl -fsSL get.docker.com | bash) 4 | 5 | export $(cat /opt/docker/.env) 6 | 7 | docker image load -i /opt/docker/orbs-network.tar 8 | docker-compose -f /opt/orbs/docker-compose.yml up -d 9 | -------------------------------------------------------------------------------- /deploy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cloudformation", 3 | "version": "0.1.0", 4 | "description": "## Template and parameters", 5 | "main": "src/deploy.js", 6 | "scripts": { 7 | "test": "ssh -t -o StrictHostKeyChecking=no ec2-user@pelmeni.nodes.orbs-test.com \"sudo docker exec -ti orbs_public-api_1 /bin/bash -c 'cd /opt/orbs/e2e && yarn test'\"", 8 | "build": "yarn run build-ts && yarn run tslint", 9 | "watch": "concurrently -k -p \"[{name}]\" -n \"TypeScript,Node\" -c \"yellow.bold,cyan.bold,green.bold\" \"yarn run watch-ts\" \"yarn run serve\"", 10 | "build-ts": "tsc", 11 | "watch-ts": "tsc -w", 12 | "tslint": "tslint -c tslint.json -p tsconfig.json", 13 | "deploy": "node dist/deploy.js" 14 | }, 15 | "author": "", 16 | "license": "MIT", 17 | "dependencies": { 18 | "@types/nconf": "^0.0.37", 19 | "aws-sdk": "^2.192.0", 20 | "csv-parse": "^2.0.4", 21 | "lodash": "^4.17.5", 22 | "nconf": "^0.10.0", 23 | "shelljs": "^0.8.1", 24 | "web3": "^1.0.0-beta.29" 25 | }, 26 | "devDependencies": { 27 | "@types/lodash": "^4.14.99", 28 | "@types/node": "^9.4.4", 29 | "tslint": "^5.9.1", 30 | "typescript": "^2.7.1" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /deploy/parity/bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | export INSTANCE_ID=$(curl http://169.254.169.254/latest/meta-data/instance-id) 4 | aws ec2 associate-address --region ${REGION} --instance-id $INSTANCE_ID --allocation-id $EIP 5 | 6 | export ETHEREUM_CHAIN=${ETHEREUM_CHAIN-ropsten} 7 | 8 | pip install docker-compose 9 | 10 | /usr/local/bin/docker-compose -f /opt/parity/docker-compose.yml up -d 11 | -------------------------------------------------------------------------------- /deploy/parity/docker-compose.yml: -------------------------------------------------------------------------------- 1 | parity: 2 | image: parity/parity:v1.8.9 3 | volumes: 4 | - /mnt/data:/root/.local/share/io.parity.ethereum/ 5 | ports: 6 | - 8545:8545 7 | command: --no-secretstore --jsonrpc-interface all --no-ui --no-ipc --no-ws --no-ancient-blocks --chain ${ETHEREUM_CHAIN} --pruning archive 8 | -------------------------------------------------------------------------------- /deploy/test/parity-test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | const Web3 = require('web3'); 10 | const web3 = new Web3(new Web3.providers.HttpProvider("http://ethereum.services.orbs-test.com:8545")); 11 | 12 | Promise.all([web3.eth.isSyncing(), web3.eth.net.getPeerCount()]).then(([syncStatus, peerCount]) => { 13 | const isSyncing = syncStatus.currentBlock !== syncStatus.highestBlock; 14 | console.log(`Node ${isSyncing ? "is" : "is not"} syncing and has ${peerCount} peers`); 15 | }).catch(console.error); -------------------------------------------------------------------------------- /deploy/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "types": [ 6 | "node" 7 | ], 8 | "noImplicitAny": true, 9 | "skipLibCheck": true, 10 | "moduleResolution": "node", 11 | "sourceMap": true, 12 | "inlineSources": true, 13 | "experimentalDecorators": true, 14 | "outDir": "dist", 15 | "baseUrl": ".", 16 | "paths": { 17 | "*": [ 18 | "node_modules/*", 19 | "src/types/*" 20 | ] 21 | } 22 | }, 23 | "include": [ 24 | "src/**/*", 25 | "test/**/*" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /docker-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | export DOCKER_IMAGE=${DOCKER_IMAGE-orbs} 4 | export DOCKER_TAG=${DOCKER_TAG-$(./docker-tag.sh)} 5 | export DOCKER_BUILD_OPTIONS=${DOCKER_BUILD_OPTIONS-""} 6 | # --squash to produce a single layer image 7 | 8 | docker build $DOCKER_BUILD_OPTIONS -f Dockerfile.server -t ${DOCKER_IMAGE}:${DOCKER_TAG} --build-arg CI=${CI} . 9 | -------------------------------------------------------------------------------- /docker-export.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export DOCKER_IMAGE=${DOCKER_IMAGE-orbs} 4 | export DOCKER_TAG=${DOCKER_TAG-$(./docker-tag.sh)} 5 | 6 | mkdir -p docker/images 7 | 8 | docker image save $DOCKER_IMAGE:$DOCKER_TAG -o docker/images/orbs-network.tar 9 | echo DOCKER_IMAGE=$DOCKER_IMAGE DOCKER_TAG=$DOCKER_TAG > docker/images/.env 10 | -------------------------------------------------------------------------------- /docker-tag.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | git rev-parse --abbrev-ref HEAD | sed -e 's/\//-/g' 4 | -------------------------------------------------------------------------------- /docker-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -xe 2 | 3 | export DOCKER_IMAGE=${DOCKER_IMAGE-orbs} 4 | export DOCKER_TAG=${DOCKER_TAG-$(./docker-tag.sh)} 5 | 6 | ./e2e/test-from-docker.sh 7 | 8 | exit $EXIT_CODE 9 | -------------------------------------------------------------------------------- /docker/bootstrap-e2e.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | apt-get install -y python-pip && pip install docker-compose && (curl -fsSL get.docker.com | bash) 4 | -------------------------------------------------------------------------------- /docker/bootstrap-server.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | apt-get update 4 | apt-get install -y git-core build-essential python 5 | apt-get clean 6 | -------------------------------------------------------------------------------- /docker/build-bot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | docker build -t orbs:bot -f Dockerfile.bot . 4 | -------------------------------------------------------------------------------- /docker/build-e2e.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | docker build -t orbs:e2e -f Dockerfile.e2e . 4 | -------------------------------------------------------------------------------- /docker/build-sdk-base.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | docker build --build-arg NO_ANDROID=$NO_ANDROID -t orbs:base-sdk -f Dockerfile.sdk.base . 4 | -------------------------------------------------------------------------------- /docker/build-sdk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | docker build -t orbs:sdk -f Dockerfile.sdk . 4 | -------------------------------------------------------------------------------- /docker/build-server-base.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | docker build -t orbs:base-server -f Dockerfile.server.base . 4 | -------------------------------------------------------------------------------- /e2e/.dockerignore: -------------------------------------------------------------------------------- 1 | dist 2 | node_modules 3 | -------------------------------------------------------------------------------- /e2e/.gitignore: -------------------------------------------------------------------------------- 1 | lib-cov 2 | *.seed 3 | *.log 4 | *.csv 5 | *.dat 6 | *.out 7 | *.pid 8 | *.gz 9 | *.swp 10 | 11 | pids 12 | logs 13 | results 14 | tmp 15 | 16 | #Build 17 | public/css/main.css 18 | 19 | # API keys and secrets 20 | .env 21 | 22 | # Dependency directory 23 | node_modules 24 | bower_components 25 | 26 | # Editors 27 | .idea 28 | *.iml 29 | 30 | # OS metadata 31 | .DS_Store 32 | Thumbs.db 33 | 34 | # Ignore built ts files 35 | dist/**/* 36 | -------------------------------------------------------------------------------- /e2e/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Orbs Network 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 NON-INFRINGEMENT. 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 | -------------------------------------------------------------------------------- /e2e/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | yarn link orbs-interfaces 4 | yarn link orbs-client-sdk 5 | 6 | yarn install --production=false 7 | 8 | yarn run build 9 | -------------------------------------------------------------------------------- /e2e/config/docker/docker-compose.test.base.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | services: 4 | base-service: 5 | image: ${DOCKER_IMAGE}:${DOCKER_TAG} 6 | command: node dist/index.js ${NODE_CONFIG_PATH} 7 | volumes: 8 | - ../../../logs:/opt/orbs/logs 9 | environment: 10 | NODE_NAME: ${NODE_NAME} 11 | NODE_ENV: test 12 | LOG_LEVEL: debug 13 | GOSSIP_PEERS: ${GOSSIP_PEERS} 14 | -------------------------------------------------------------------------------- /e2e/config/docker/docker-compose.test.ethereum.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | services: 4 | ganache-server: 5 | image: ganache-cli:v6.0.3 6 | build: https://github.com/trufflesuite/ganache-cli.git#v6.0.3 7 | ports: 8 | - 8545:8545 9 | networks: 10 | public-network: 11 | ipv4_address: ${PUBLIC_IP} 12 | command: ["--debug","-h", "0.0.0.0","--account","0xd39e45111943503f91ad22650915bda5cbba5538a689bdfa7228516a5441a8c1,300000000000000000000","-g","1"] 13 | -------------------------------------------------------------------------------- /e2e/config/docker/docker-compose.test.networks.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | networks: 4 | public-network: 5 | external: 6 | name: public-network 7 | orbs-network: 8 | external: 9 | name: orbs-network 10 | node-network: 11 | driver: bridge 12 | ipam: 13 | driver: default 14 | config: 15 | - subnet: ${PRIVATE_NETWORK}.0/24 16 | -------------------------------------------------------------------------------- /e2e/config/docker/docker-compose.test.volumes.local.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | services: 4 | shared_volumes: 5 | image: busybox 6 | volumes: 7 | - ../../../config/test.json:/opt/orbs/config/test.json 8 | - ../../../e2e/dist:/opt/orbs/e2e/dist 9 | - ../../../projects/services/public-api-service-typescript/dist:/opt/orbs/projects/services/public-api-service-typescript/dist 10 | - ../../../projects/services/sidechain-connector-service-typescript/dist:/opt/orbs/projects/services/sidechain-connector-service-typescript/dist 11 | - ../../../projects/services/storage-service-typescript/dist:/opt/orbs/projects/services/storage-service-typescript/dist 12 | - ../../../projects/services/gossip-service-typescript/dist:/opt/orbs/projects/services/gossip-service-typescript/dist 13 | - ../../../projects/services/consensus-service-typescript/dist:/opt/orbs/projects/services/consensus-service-typescript/dist 14 | - ../../../projects/services/virtual-machine-service-typescript/dist:/opt/orbs/projects/services/virtual-machine-service-typescript/dist 15 | -------------------------------------------------------------------------------- /e2e/config/docker/docker-compose.test.volumes.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | services: 4 | shared_volumes: 5 | image: busybox 6 | -------------------------------------------------------------------------------- /e2e/config/env/default.env: -------------------------------------------------------------------------------- 1 | TEST_ENV=1 2 | -------------------------------------------------------------------------------- /e2e/config/env/stub-consensus.env: -------------------------------------------------------------------------------- 1 | CONSENSUS_ALGORITHM=stub 2 | CONSENSUS_LEADER_NODE_NAME=node1 3 | -------------------------------------------------------------------------------- /e2e/src/chai-bars-plugin.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | import { FooBarAccount } from "./foobar-contract"; 10 | 11 | export default function chaiBarsPlugin(_chai: any, utils: any) { 12 | async function assertFooBarAccountBalance(n: number) { 13 | // make sure we are working with am Account model 14 | new _chai.Assertion(this._obj).to.be.instanceof(FooBarAccount); 15 | 16 | const account = this._obj; 17 | 18 | const actualBars = await account.getBalance(); 19 | 20 | this.assert( 21 | actualBars === n 22 | , "expected #{this} to have balance #{exp} but got #{act}" 23 | , "expected #{this} to not have balance #{act}" 24 | , n 25 | , actualBars 26 | ); 27 | } 28 | 29 | _chai.Assertion.addMethod("bars", assertFooBarAccountBalance); 30 | } 31 | -------------------------------------------------------------------------------- /e2e/src/test-environment/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | export { TestEnvironment } from "./test-environment"; 10 | -------------------------------------------------------------------------------- /e2e/src/test-environment/test-component.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | export default interface TestComponent { 10 | start(): Promise; 11 | stop(): Promise; 12 | } -------------------------------------------------------------------------------- /e2e/src/test-environment/test-stack.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | import TestComponent from "./test-component"; 10 | 11 | export default abstract class TestStack implements TestComponent { 12 | protected componentStack: TestComponent[] = []; 13 | 14 | protected async startComponent(component: TestComponent) { 15 | this.componentStack.push(component); 16 | await component.start(); 17 | } 18 | 19 | async start() { 20 | throw "not implemented"; 21 | } 22 | 23 | public async stop() { 24 | while (true) { 25 | const component = this.componentStack.pop(); 26 | if (!component) { 27 | break; 28 | } 29 | await component.stop(); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /e2e/src/text-message-contract.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | import { OrbsContract } from "orbs-client-sdk"; 10 | 11 | export interface Message { 12 | recipient: string; 13 | sender: string; 14 | timestamp: number; 15 | processedAtTimestamp: number; 16 | message: string; 17 | } 18 | 19 | export class TextMessageAccount { 20 | adapter: OrbsContract; 21 | address: string; 22 | 23 | public constructor(address: string, adapter: OrbsContract) { 24 | this.adapter = adapter; 25 | this.address = address; 26 | } 27 | 28 | public async sendMessage(recipient: string, message: string) { 29 | return await this.adapter.sendTransaction("sendMessage", [recipient, message, new Date().getTime()]); 30 | } 31 | 32 | public async getMyMessages() { 33 | return this.adapter.call("getMyMessages", []); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /e2e/src/types/chai-bar-plugin.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'chai' { 2 | global { 3 | export namespace Chai { 4 | interface Assertion { 5 | bars(n: number): Promise; 6 | } 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /e2e/src/types/ganache-core.d.ts: -------------------------------------------------------------------------------- 1 | /** Declaration file generated by dts-gen */ 2 | 3 | export function provider(options: any): any; 4 | 5 | export function server(options: any): any; 6 | 7 | export namespace provider { 8 | const prototype: { 9 | }; 10 | 11 | } 12 | 13 | export namespace server { 14 | const prototype: { 15 | }; 16 | 17 | } 18 | 19 | -------------------------------------------------------------------------------- /e2e/src/types/grpc-caller.d.ts: -------------------------------------------------------------------------------- 1 | /** Declaration file generated by dts-gen */ 2 | 3 | export = grpc_caller; 4 | 5 | declare function grpc_caller(host: any, proto: any, name?: any, options?: any): any; 6 | 7 | declare namespace grpc_caller { 8 | const prototype: { 9 | }; 10 | 11 | function metadata(metadata: any, options: any): any; 12 | 13 | namespace metadata { 14 | const prototype: { 15 | }; 16 | 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /e2e/test-from-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -xe 2 | 3 | export DOCKER_IMAGE=${DOCKER_IMAGE-orbs} 4 | export DOCKER_TAG=${DOCKER_TAG-$(git rev-parse --abbrev-ref HEAD | sed -e 's/\//-/g')} 5 | export TEST=${TEST-test} 6 | 7 | export ROOT_DIR=$(cd "$(dirname "$0")/.."; pwd) 8 | 9 | docker network create public-network --subnet 172.2.2.0/24 || true 10 | docker run -ti --rm --privileged \ 11 | --network=public-network --ip 172.2.2.15 \ 12 | -e PREEXISTING_PUBLIC_SUBNET=172.2.2 -e CONNECT_FROM_HOST=false \ 13 | -e DOCKER_IMAGE -e DOCKER_TAG \ 14 | -e TEST \ 15 | -v /var/run/docker.sock:/var/run/docker.sock \ 16 | -v $ROOT_DIR/logs:/opt/orbs/logs \ 17 | orbs:e2e \ 18 | yarn test 19 | -------------------------------------------------------------------------------- /e2e/test-from-host.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -xe 2 | 3 | export DOCKER_IMAGE=${DOCKER_IMAGE-orbs} 4 | export DOCKER_TAG=${DOCKER_TAG-$(git rev-parse --abbrev-ref HEAD | sed -e 's/\//-/g')} 5 | export TEST=${TEST-test} 6 | 7 | yarn run build 8 | CONNECT_FROM_HOST=true yarn run $TEST 9 | -------------------------------------------------------------------------------- /e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "types": [ 6 | "mocha", 7 | "node" 8 | ], 9 | "noImplicitAny": true, 10 | "skipLibCheck": true, 11 | "moduleResolution": "node", 12 | "sourceMap": true, 13 | "inlineSources": true, 14 | "experimentalDecorators": true, 15 | "outDir": "dist", 16 | "baseUrl": ".", 17 | "paths": { 18 | "*": [ 19 | "node_modules/*", 20 | "src/types/*" 21 | ] 22 | } 23 | }, 24 | "include": [ 25 | "src/**/*", 26 | "test/**/*" 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbs-network/orbs-network-typescript/a878afb5e6f8de3a2042764f0cecd6f27d113c18/logo.jpg -------------------------------------------------------------------------------- /logs/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbs-network/orbs-network-typescript/a878afb5e6f8de3a2042764f0cecd6f27d113c18/logs/.gitignore -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "orbs-network-build", 3 | "version": "0.1.0", 4 | "description": "orbs-network-build", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/orbs-network/orbs-network.git" 8 | }, 9 | "author": "Orbs Team", 10 | "license": "MIT", 11 | "scripts": { 12 | "build": "node build/src/build-ts.js", 13 | "watch": "node build/src/watch-ts.js" 14 | }, 15 | "dependencies": { 16 | "colors": "^1.1.2", 17 | "shelljs": "^0.7.7" 18 | }, 19 | "devDependencies": { 20 | "@types/supertest": "^2.0.4", 21 | "eslint": "^4.11.0", 22 | "eslint-config-airbnb": "^16.1.0", 23 | "eslint-plugin-import": "^2.8.0", 24 | "eslint-plugin-jsx-a11y": "^6.0.2", 25 | "eslint-plugin-react": "^7.5.1" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /projects/architecture/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist/ 3 | intermediate/ 4 | 5 | lib-cov 6 | *.seed 7 | *.log 8 | *.csv 9 | *.dat 10 | *.out 11 | *.pid 12 | *.gz 13 | *.swp 14 | 15 | pids 16 | logs 17 | results 18 | tmp 19 | 20 | # API keys and secrets 21 | .env 22 | 23 | # Dependency directory 24 | node_modules 25 | bower_components 26 | 27 | # Editors 28 | .idea 29 | *.iml 30 | 31 | # OS metadata 32 | .DS_Store 33 | Thumbs.db 34 | -------------------------------------------------------------------------------- /projects/architecture/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Orbs Network 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 NON-INFRINGEMENT. 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 | -------------------------------------------------------------------------------- /projects/architecture/TODO.md: -------------------------------------------------------------------------------- 1 | # Todo 2 | 3 | ## Structure 4 | 5 | * How do we manage service redundancy? 6 | * How do we manage service orchestration? 7 | -------------------------------------------------------------------------------- /projects/architecture/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | yarn install 4 | 5 | ./build/typescript.sh 6 | 7 | yarn link 8 | -------------------------------------------------------------------------------- /projects/architecture/build/typescript.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | mkdir -p ./dist 4 | mkdir -p ./intermediate 5 | rm -rf ./dist/** 6 | 7 | ./node_modules/protobufjs/bin/pbjs \ 8 | -p ./node_modules/protobufjs \ 9 | -t json \ 10 | ./interfaces/*.proto > \ 11 | ./dist/protos.json 12 | 13 | node ./build/src/ts-index.js > ./intermediate/index.ts 14 | tsc -d 15 | 16 | echo 17 | echo "Done generating TypeScript types from *.proto" 18 | echo 19 | -------------------------------------------------------------------------------- /projects/architecture/flows/close-block: -------------------------------------------------------------------------------- 1 | // leader node 2 | Consensus: TransactionPool.GetNextPendingTransactionBatch 3 | Consensus: Gossip.AnnounceNextBlock 4 | Consensus: VirtualMachine.ExecuteBlock // see flows/execute-block 5 | 6 | ... (gossip protocol) 7 | 8 | // all other nodes as validators 9 | Gossip: Gossip.NextBlockAnnounced 10 | Gossip: Consensus.ValidateBlock 11 | Consensus: VirtualMachine.ExecuteBlock // see flows/execute-block 12 | Consensus: Gossip.AnnounceBlockValidation 13 | 14 | ... (gossip protocol) 15 | 16 | // leader node 17 | Gossip: Gossip.BlockValidationAnnounced 18 | Gossip: Consensus.BlockValidationReceived 19 | 20 | // leader node after enough validations 21 | Consensus: Gossip.AnnounceClosedBlock 22 | Consensus: StateStorage.ClosedBlockReceived 23 | Consensus: JournalStorage.ClosedBlockReceived 24 | 25 | ... (gossip protocol) 26 | 27 | // all other nodes 28 | Gossip: Gossip.ClosedBlockAnnounced 29 | Gossip: StateStorage.ClosedBlockReceived 30 | Gossip: JournalStorage.ClosedBlockReceived 31 | -------------------------------------------------------------------------------- /projects/architecture/flows/execute-block: -------------------------------------------------------------------------------- 1 | // repeat per transaction 2 | VirtualMachine: TransactionPool.IsTransactionAlreadyConfirmed 3 | VirtualMachine: StateStorage.GetImmutableStateBlob 4 | VirtualMachine: Processor.ExecuteContractMethod 5 | 6 | // optional per instruction 7 | Processor: VirtualMachine.ReadStateBlob 8 | VirtualMachine: StateStorage.GetMutableStateBlob 9 | 10 | // optional per instruction 11 | Processor: VirtualMachine.WriteStateBlob 12 | 13 | // repeat per transaction continued 14 | VirtualMachine.ContractMethodExecutionFinished 15 | -------------------------------------------------------------------------------- /projects/architecture/flows/send-transaction: -------------------------------------------------------------------------------- 1 | // end-user client 2 | App: Client.CreateTransaction 3 | App: Client.SendTransaction 4 | 5 | ... (public protocol) 6 | 7 | // node receiving transaction from client 8 | PublicApi: PublicApi.TransactionReceived 9 | PublicApi: TransactionPool.AddNewPendingTransaction 10 | TransactionPool: Gossip.AnnounceTransaction 11 | 12 | ... (gossip protocol) 13 | 14 | // all other nodes 15 | Gossip: Gossip.TransactionAnnounced 16 | Gossip: TransactionPool.AddExistingPendingTransaction 17 | -------------------------------------------------------------------------------- /projects/architecture/interfaces/call-contract.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the orbs-network-typescript authors 2 | // This file is part of the orbs-network-typescript library in the Orbs project. 3 | // 4 | // This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 5 | // The above notice should be included in all copies or substantial portions of the software. 6 | 7 | syntax = "proto3"; 8 | 9 | message CallContractInput { 10 | bytes sender = 1; 11 | bytes contractAddress = 2; 12 | string payload = 3; 13 | } 14 | 15 | message CallContractOutput { 16 | string resultJson = 1; 17 | } 18 | -------------------------------------------------------------------------------- /projects/architecture/interfaces/consensus-service.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the orbs-network-typescript authors 2 | // This file is part of the orbs-network-typescript library in the Orbs project. 3 | // 4 | // This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 5 | // The above notice should be included in all copies or substantial portions of the software. 6 | 7 | syntax = "proto3"; 8 | 9 | import "consensus.proto"; 10 | import "subscription-manager.proto"; 11 | import "transaction-pool.proto"; 12 | -------------------------------------------------------------------------------- /projects/architecture/interfaces/consensus.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the orbs-network-typescript authors 2 | // This file is part of the orbs-network-typescript library in the Orbs project. 3 | // 4 | // This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 5 | // The above notice should be included in all copies or substantial portions of the software. 6 | 7 | syntax = "proto3"; 8 | 9 | import "primitives/blocks.proto"; 10 | import "primitives/gossip-listener.proto"; 11 | 12 | service Consensus { 13 | rpc GossipMessageReceived (GossipListenerInput) returns (GossipListenerOutput); 14 | } 15 | 16 | message ConsensusMessage { 17 | Block block = 1; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /projects/architecture/interfaces/gossip.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the orbs-network-typescript authors 2 | // This file is part of the orbs-network-typescript library in the Orbs project. 3 | // 4 | // This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 5 | // The above notice should be included in all copies or substantial portions of the software. 6 | 7 | syntax = "proto3"; 8 | 9 | import "primitives/transactions.proto"; 10 | 11 | service Gossip { 12 | rpc BroadcastMessage (BroadcastMessageInput) returns (BroadcastMessageOutput); 13 | rpc UnicastMessage (UnicastMessageInput) returns (UnicastMessageOutput); 14 | } 15 | 16 | message BroadcastMessageInput { 17 | string broadcastGroup = 1; 18 | string messageType = 2; 19 | bytes buffer = 3; 20 | bool immediate = 4; 21 | } 22 | 23 | message BroadcastMessageOutput { 24 | // empty 25 | } 26 | 27 | message UnicastMessageInput { 28 | string recipient = 1; 29 | string broadcastGroup = 2; 30 | string messageType = 3; 31 | bytes buffer = 4; 32 | bool immediate = 5; 33 | } 34 | message UnicastMessageOutput { 35 | // empty 36 | } 37 | -------------------------------------------------------------------------------- /projects/architecture/interfaces/primitives/blocks.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the orbs-network-typescript authors 2 | // This file is part of the orbs-network-typescript library in the Orbs project. 3 | // 4 | // This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 5 | // The above notice should be included in all copies or substantial portions of the software. 6 | 7 | syntax = "proto3"; 8 | 9 | import "transactions.proto"; 10 | 11 | message BlockHeader { 12 | uint32 version = 1; 13 | bytes prevBlockHash = 2; 14 | uint32 height = 3; 15 | } 16 | 17 | message BlockSignatureData { 18 | bytes signature = 1; 19 | string signatory = 2; 20 | } 21 | 22 | message BlockBody { 23 | repeated Transaction transactions = 1; 24 | repeated TransactionReceipt transactionReceipts = 2; 25 | repeated ModifiedStateKey stateDiff = 3; 26 | } 27 | 28 | message ModifiedStateKey { 29 | bytes contractAddress = 1; 30 | string key = 2; 31 | string value = 3; 32 | } 33 | 34 | message Block { 35 | BlockHeader header = 1; 36 | BlockBody body = 2; 37 | BlockSignatureData signatureData = 3; 38 | } 39 | -------------------------------------------------------------------------------- /projects/architecture/interfaces/primitives/gossip-listener.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the orbs-network-typescript authors 2 | // This file is part of the orbs-network-typescript library in the Orbs project. 3 | // 4 | // This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 5 | // The above notice should be included in all copies or substantial portions of the software. 6 | 7 | syntax = "proto3"; 8 | 9 | message GossipListenerInput { 10 | string fromAddress = 1; 11 | string broadcastGroup = 2; // null for unicast messages 12 | string messageType = 3; 13 | bytes buffer = 4; 14 | } 15 | 16 | message GossipListenerOutput { 17 | } 18 | -------------------------------------------------------------------------------- /projects/architecture/interfaces/primitives/wrappers.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the orbs-network-typescript authors 2 | // This file is part of the orbs-network-typescript library in the Orbs project. 3 | // 4 | // This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 5 | // The above notice should be included in all copies or substantial portions of the software. 6 | 7 | syntax = "proto3"; 8 | 9 | message UInt32Value { 10 | // The uint32 value. 11 | uint32 value = 1; 12 | } -------------------------------------------------------------------------------- /projects/architecture/interfaces/state-storage.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the orbs-network-typescript authors 2 | // This file is part of the orbs-network-typescript library in the Orbs project. 3 | // 4 | // This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 5 | // The above notice should be included in all copies or substantial portions of the software. 6 | 7 | syntax = "proto3"; 8 | 9 | service StateStorage { 10 | rpc ReadKeys (ReadKeysInput) returns (ReadKeysOutput); 11 | } 12 | 13 | message ReadKeysInput { 14 | bytes contractAddress = 1; 15 | repeated string keys = 2; 16 | } 17 | 18 | message ReadKeysOutput { 19 | map values = 1; 20 | } 21 | -------------------------------------------------------------------------------- /projects/architecture/interfaces/storage-service.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the orbs-network-typescript authors 2 | // This file is part of the orbs-network-typescript library in the Orbs project. 3 | // 4 | // This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 5 | // The above notice should be included in all copies or substantial portions of the software. 6 | 7 | syntax = "proto3"; 8 | 9 | import "block-storage.proto"; 10 | import "state-storage.proto"; 11 | -------------------------------------------------------------------------------- /projects/architecture/interfaces/subscription-manager.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the orbs-network-typescript authors 2 | // This file is part of the orbs-network-typescript library in the Orbs project. 3 | // 4 | // This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 5 | // The above notice should be included in all copies or substantial portions of the software. 6 | 7 | syntax = "proto3"; 8 | 9 | service SubscriptionManager { 10 | rpc IsSubscriptionValid (IsSubscriptionValidInput) returns (IsSubscriptionValidOutput); 11 | } 12 | 13 | message IsSubscriptionValidInput { 14 | string subscriptionKey = 1; 15 | } 16 | 17 | message IsSubscriptionValidOutput { 18 | bool isValid = 1; 19 | } 20 | -------------------------------------------------------------------------------- /projects/architecture/interfaces/virtual-machine.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the orbs-network-typescript authors 2 | // This file is part of the orbs-network-typescript library in the Orbs project. 3 | // 4 | // This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 5 | // The above notice should be included in all copies or substantial portions of the software. 6 | 7 | syntax = "proto3"; 8 | 9 | import "primitives/transactions.proto"; 10 | import "primitives/blocks.proto"; 11 | import "call-contract.proto"; 12 | 13 | service VirtualMachine { 14 | rpc CallContract (CallContractInput) returns (CallContractOutput); 15 | rpc ProcessTransactionSet(ProcessTransactionSetInput) returns (ProcessTransactionSetOutput); 16 | } 17 | 18 | message ProcessTransactionSetInput { 19 | repeated TransactionEntry orderedTransactions = 1; 20 | } 21 | 22 | message ProcessTransactionSetOutput { 23 | repeated TransactionReceipt transactionReceipts = 1; 24 | repeated ModifiedStateKey stateDiff = 2; 25 | } 26 | -------------------------------------------------------------------------------- /projects/architecture/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "orbs-interfaces", 3 | "version": "0.1.0", 4 | "description": "orbs-interfaces", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/orbs-network/orbs-network.git" 8 | }, 9 | "main": "dist/index.js", 10 | "types": "dist/index.d.ts", 11 | "author": "Orbs Team", 12 | "license": "MIT", 13 | "scripts": {}, 14 | "dependencies": {}, 15 | "devDependencies": { 16 | "@types/node": "^9.4.4", 17 | "eslint": "^4.16.0", 18 | "eslint-config-airbnb": "^16.1.0", 19 | "eslint-plugin-import": "^2.8.0", 20 | "eslint-plugin-jsx-a11y": "^6.0.3", 21 | "eslint-plugin-react": "^7.6.1", 22 | "protobufjs": "^6.8.4" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /projects/architecture/rebuild.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | ./build/typescript.sh 4 | -------------------------------------------------------------------------------- /projects/architecture/system/topology/node.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbs-network/orbs-network-typescript/a878afb5e6f8de3a2042764f0cecd6f27d113c18/projects/architecture/system/topology/node.png -------------------------------------------------------------------------------- /projects/architecture/system/topology/topology.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orbs-network/orbs-network-typescript/a878afb5e6f8de3a2042764f0cecd6f27d113c18/projects/architecture/system/topology/topology.png -------------------------------------------------------------------------------- /projects/architecture/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "noImplicitAny": false, 6 | "skipLibCheck": true, 7 | "moduleResolution": "node", 8 | "sourceMap": true, 9 | "inlineSources": true, 10 | "experimentalDecorators": true, 11 | "outDir": "dist", 12 | "baseUrl": ".", 13 | "paths": { 14 | "*": [ 15 | "node_modules/*", 16 | "src/types/*" 17 | ] 18 | } 19 | }, 20 | "include": [ 21 | "intermediate/**/*" 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore built ts files 2 | dist/**/* 3 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Orbs Network 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 NON-INFRINGEMENT. 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 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | yarn link orbs-interfaces 4 | 5 | yarn install --unsafe-perm grpc@1.9.0 # Needs unsafe permissions to install node grpc extensions 6 | yarn install 7 | 8 | yarn run build 9 | 10 | yarn test 11 | 12 | yarn link 13 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/base-service/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | export { Service, ServiceConfig } from "./service"; 10 | export { ServiceRunner } from "./service-runner"; 11 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/block-storage/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | export { BlockStorage } from "./block-storage"; 10 | export { BlockStorageSync } from "./block-storage-sync"; 11 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/common-library/README.md: -------------------------------------------------------------------------------- 1 | # Common Library (TypeScript) 2 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/common-library/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | export * from "./logger"; 10 | export * from "./error-handler"; 11 | export * from "./grpc"; 12 | export * from "./topology"; 13 | export * from "./topologyPeers"; 14 | export * from "./types"; 15 | export * from "./grpc-server"; 16 | export * from "./block-utils"; 17 | export * from "./json-buffer"; 18 | export * from "./transaction-helper"; 19 | export * from "./key-manager"; 20 | export * from "./address"; 21 | export * from "./startup-status"; 22 | export * from "./startup-check"; 23 | export * from "./startup-check-runner"; 24 | export * from "./startup-check-runner-default"; 25 | 26 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/common-library/json-buffer.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | export namespace JsonBuffer { 10 | export function parseJsonWithBuffers(json: any) { 11 | return JSON.parse(json, (k, v) => { 12 | // support parsing back to a Buffer object 13 | if (v !== null && typeof v === "object" && "type" in v && v.type === "Buffer" && "data" in v && Array.isArray(v.data)) { 14 | return new Buffer(v.data); 15 | } 16 | return v; 17 | }); 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/common-library/startup-check-runner-default.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | import { StartupCheckRunner } from "./startup-check-runner"; 10 | import { StartupCheck } from "./startup-check"; 11 | import { StartupStatus, STARTUP_STATUS } from "./startup-status"; 12 | import { logger } from "../common-library"; 13 | 14 | export class StartupCheckRunnerDefault extends StartupCheckRunner { 15 | 16 | constructor(name: string, startupChecks?: StartupCheck[]) { 17 | super(name, startupChecks); 18 | } 19 | 20 | run(): Promise { 21 | return Promise.resolve({ name: this.name, status: STARTUP_STATUS.OK, message: "Not implemented" }); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/common-library/startup-check.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | import { StartupStatus } from "./startup-status"; 10 | 11 | export interface StartupCheck { 12 | startupCheck(): Promise; 13 | } 14 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/common-library/startup-status.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | export interface StartupStatus { 10 | name: string; 11 | status: STARTUP_STATUS; 12 | services?: StartupStatus[]; 13 | message?: string; 14 | } 15 | 16 | export enum STARTUP_STATUS { OK = "OK", FAIL = "FAIL", PARTIALLY_OPERATIONAL = "PARTIALLY_OPERATIONAL" } 17 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/common-library/topology.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | import { logger } from "./logger"; 10 | import * as fs from "fs"; 11 | 12 | export const topology = () => { 13 | function showUsage() { 14 | logger.warn("Usage: node dist/index.js "); 15 | } 16 | 17 | if (!process.argv[2]) { 18 | logger.error("topology not provided, exiting"); 19 | showUsage(); 20 | process.exit(); 21 | } 22 | 23 | const filePath = process.argv[2]; 24 | if (!fs.existsSync(filePath)) { 25 | logger.error(`topology with path '${filePath}' not found, exiting`); 26 | showUsage(); 27 | process.exit(); 28 | } 29 | 30 | return require(filePath); 31 | }; 32 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/common-library/types.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | import * as types from "orbs-interfaces"; 10 | export { types }; 11 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/consensus/README.md: -------------------------------------------------------------------------------- 1 | # Consensus 2 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/consensus/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | export { Consensus } from "./consensus"; 10 | export { BaseConsensusConfig } from "./base-consensus"; 11 | export { ElectionTimeoutConfig } from "./base-consensus"; 12 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/gossip/README.md: -------------------------------------------------------------------------------- 1 | # Gossip 2 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/gossip/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | export { Gossip } from "./gossip"; 10 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/public-api/README.md: -------------------------------------------------------------------------------- 1 | # Public API 2 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/public-api/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | export { TransactionHandler } from "./transaction-handler"; 10 | export { PublicApi } from "./public-api"; 11 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/sidechain-connector/README.md: -------------------------------------------------------------------------------- 1 | # Sidechain Connector 2 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/sidechain-connector/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | export { SidechainConnector, SidechainConnectorOptions } from "./sidechain-connector"; 10 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/state-storage/README.md: -------------------------------------------------------------------------------- 1 | # State Storage 2 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/state-storage/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | export { StateStorage } from "./state-storage"; 10 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/subscription-manager/README.md: -------------------------------------------------------------------------------- 1 | # Subscription Manager 2 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/subscription-manager/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | export { SubscriptionManager, SubscriptionManagerConfiguration, SubscriptionProfiles } from "./subscription-manager"; 10 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/test-kit/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | export { FakeGossipClient } from "./fake-gossip-client"; 10 | export { generateServiceInProcessClient } from "./service-in-process-client"; 11 | export { testStartupCheckHappyPath } from "./startup-check-tester"; 12 | export * from "./generate-key-pairs"; 13 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/test-kit/service-in-process-client.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | export function generateServiceInProcessClient(service: any): T { 10 | const client = {}; 11 | 12 | for (const propertyName of Object.getOwnPropertyNames(Object.getPrototypeOf(service))) { 13 | Object.defineProperty(client, propertyName, { 14 | value: async function (req: any) { 15 | const ctx = { req, res: {} }; 16 | await service[propertyName](ctx); 17 | return ctx.res; 18 | }, 19 | enumerable: true 20 | }); 21 | } 22 | 23 | return client; 24 | } 25 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/test-kit/startup-check-tester.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | import { StartupStatus, STARTUP_STATUS } from "../common-library/startup-status"; 10 | import * as _ from "lodash"; 11 | import * as request from "supertest"; 12 | 13 | export function testStartupCheckHappyPath(serverIpAddress: string, port: number, componentName: string, childServiceNames?: string[], ) { 14 | const expected: StartupStatus = { 15 | name: componentName, 16 | status: STARTUP_STATUS.OK, 17 | }; 18 | if (childServiceNames && childServiceNames.length > 0) { 19 | expected.services = _.map(childServiceNames, name => { return { name, status: STARTUP_STATUS.OK }; }); 20 | } 21 | 22 | return request(`http://${serverIpAddress}:${port}`) 23 | .get("/admin/startupCheck") 24 | .expect(200, expected); 25 | } 26 | 27 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/transaction-pool/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | export { PendingTransactionPool } from "./pending-transaction-pool"; 10 | export { CommittedTransactionPool } from "./committed-transaction-pool"; 11 | export { TransactionValidator } from "./transaction-validator"; 12 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/types/bs58.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | /** Declaration file generated by dts-gen */ 10 | 11 | export function decode(string: string): Buffer; 12 | 13 | export function decodeUnsafe(string: string): Buffer; 14 | 15 | export function encode(source: Buffer): string; 16 | 17 | export namespace decode { 18 | const prototype: { 19 | }; 20 | } 21 | 22 | export namespace decodeUnsafe { 23 | const prototype: { 24 | }; 25 | } 26 | 27 | export namespace encode { 28 | const prototype: { 29 | }; 30 | } 31 | 32 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/types/gaggle.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | /** Declaration file generated by dts-gen */ 10 | 11 | export = gaggle; 12 | 13 | declare function gaggle(opts: any): any; 14 | 15 | declare namespace gaggle { 16 | const prototype: { 17 | }; 18 | 19 | function enhanceServerForSocketIOChannel(server: any): any; 20 | 21 | namespace enhanceServerForSocketIOChannel { 22 | const prototype: { 23 | }; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/types/ganache-core.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | /** Declaration file generated by dts-gen */ 10 | 11 | export function provider(options: any): any; 12 | 13 | export function server(options: any): any; 14 | 15 | export namespace provider { 16 | const prototype: { 17 | }; 18 | 19 | } 20 | 21 | export namespace server { 22 | const prototype: { 23 | }; 24 | 25 | } 26 | 27 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/types/grpc-caller.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | /** Declaration file generated by dts-gen */ 10 | 11 | export = grpc_caller; 12 | 13 | declare function grpc_caller(host: any, proto: any, name?: any, options?: any): any; 14 | 15 | declare namespace grpc_caller { 16 | const prototype: { 17 | }; 18 | 19 | function metadata(metadata: any, options: any): any; 20 | 21 | namespace metadata { 22 | const prototype: { 23 | }; 24 | 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/types/uncaught-exception.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | /** Declaration file generated by dts-gen */ 10 | 11 | export = uncaught_exception; 12 | 13 | declare function uncaught_exception(options: any): any; 14 | 15 | declare namespace uncaught_exception { 16 | const prototype: { 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/types/winston-logzio.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | import * as winston from 'winston'; 10 | import { TransportInstance } from 'winston'; 11 | 12 | export interface WinstonLogzioTransportOptions { 13 | apiKey: string; 14 | host: string; 15 | } 16 | 17 | export interface WinstonLogzioTransportInstance extends TransportInstance { 18 | new(options?: WinstonLogzioTransportOptions): WinstonLogzioTransportInstance; 19 | } 20 | 21 | export declare class Logzio extends winston.Transport implements WinstonLogzioTransportInstance { 22 | constructor(options?: WinstonLogzioTransportOptions); 23 | } 24 | 25 | declare module "winston" { 26 | interface Transports { 27 | Logzio: Logzio; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/virtual-machine/README.md: -------------------------------------------------------------------------------- 1 | # Virtual Machine 2 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/src/virtual-machine/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | export { VirtualMachine } from "./virtual-machine"; 10 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/test/common-library/.gitignore: -------------------------------------------------------------------------------- 1 | test-private-keys 2 | test-public-keys 3 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/test/gossip/.gitignore: -------------------------------------------------------------------------------- 1 | test-private-keys 2 | test-public-keys 3 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/test/virtual-machine/state-cache.spec.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | import { StateCache, StateCacheKey } from "../../src/virtual-machine/state-cache"; 10 | import { expect } from "chai"; 11 | import { Address } from "../../src/common-library/address"; 12 | 13 | describe("state cache", () => { 14 | let stateCache: StateCache; 15 | beforeEach(() => { 16 | stateCache = new StateCache(); 17 | }); 18 | it("loads a key that was stored with the correct value", () => { 19 | const key: StateCacheKey = { 20 | contractAddress: Address.createContractAddress("contractName").toBuffer(), 21 | key: "key" 22 | }; 23 | stateCache.set(key, "value"); 24 | expect(stateCache.get(key)).to.equal("value"); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/test/virtual-machine/stub-contract.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | // this class is empty on purpose - its only purpose is to have a default export for the registry's test to pass 10 | export default class StubContract {} 11 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "types": [ 6 | "node", 7 | "mocha", 8 | "chai" 9 | ], 10 | "noImplicitAny": true, 11 | "skipLibCheck": true, 12 | "moduleResolution": "node", 13 | "sourceMap": true, 14 | "declaration": true, 15 | "inlineSources": true, 16 | "experimentalDecorators": true, 17 | "outDir": "dist", 18 | "allowSyntheticDefaultImports": true, 19 | "baseUrl": ".", 20 | "paths": { 21 | "*": [ 22 | "node_modules/*", 23 | "src/types/*" 24 | ] 25 | } 26 | }, 27 | "include": [ 28 | "src/**/*" 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "types": [ 6 | "sinon", 7 | "chai", 8 | "mocha", 9 | "node" 10 | ], 11 | "noImplicitAny": true, 12 | "skipLibCheck": true, 13 | "moduleResolution": "node", 14 | "sourceMap": true, 15 | "inlineSources": true, 16 | "experimentalDecorators": true, 17 | "outDir": "distTest", 18 | "baseUrl": ".", 19 | "paths": { 20 | "*": [ 21 | "node_modules/*", 22 | "src/types/*", 23 | "test/types/*" 24 | ] 25 | } 26 | }, 27 | "include": [ 28 | "test/**/*" 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /projects/libs/core-library-typescript/watch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | yarn run watch-ts 4 | -------------------------------------------------------------------------------- /projects/services/consensus-service-typescript/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore built ts files 2 | dist/**/* 3 | -------------------------------------------------------------------------------- /projects/services/consensus-service-typescript/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Orbs Network 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 NON-INFRINGEMENT. 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 | -------------------------------------------------------------------------------- /projects/services/consensus-service-typescript/README.md: -------------------------------------------------------------------------------- 1 | # Storage Service 2 | -------------------------------------------------------------------------------- /projects/services/consensus-service-typescript/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | yarn link orbs-interfaces 4 | yarn link orbs-core-library 5 | 6 | yarn install 7 | 8 | yarn run build 9 | 10 | yarn test 11 | -------------------------------------------------------------------------------- /projects/services/consensus-service-typescript/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | import * as path from "path"; 10 | 11 | import { logger, ErrorHandler, topology, Service } from "orbs-core-library"; 12 | 13 | import consensusServer from "./consensus-server"; 14 | 15 | ErrorHandler.setup(); 16 | 17 | Service.initLogger(path.join(__dirname, "../../../../logs/consensus.log")); 18 | 19 | const nodeTopology = topology(); 20 | 21 | consensusServer(nodeTopology, process.env) 22 | .onEndpoint(nodeTopology.endpoint) 23 | .start(); 24 | -------------------------------------------------------------------------------- /projects/services/consensus-service-typescript/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "noImplicitAny": true, 6 | "skipLibCheck": true, 7 | "moduleResolution": "node", 8 | "sourceMap": true, 9 | "inlineSources": true, 10 | "experimentalDecorators": true, 11 | "outDir": "dist", 12 | "baseUrl": ".", 13 | "paths": { 14 | "*": [ 15 | "node_modules/*", 16 | "src/types/*" 17 | ] 18 | } 19 | }, 20 | "include": [ 21 | "src/**/*" 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /projects/services/consensus-service-typescript/tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "types": [ 6 | "mocha", 7 | "node" 8 | ], 9 | "noImplicitAny": true, 10 | "skipLibCheck": true, 11 | "moduleResolution": "node", 12 | "sourceMap": true, 13 | "inlineSources": true, 14 | "experimentalDecorators": true, 15 | "outDir": "distTest", 16 | "baseUrl": ".", 17 | "paths": { 18 | "*": [ 19 | "node_modules/*", 20 | "src/types/*" 21 | ] 22 | } 23 | }, 24 | "include": [ 25 | "test/**/*" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /projects/services/consensus-service-typescript/watch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | yarn run watch-ts 4 | -------------------------------------------------------------------------------- /projects/services/gossip-service-typescript/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore built ts files 2 | dist/**/* 3 | -------------------------------------------------------------------------------- /projects/services/gossip-service-typescript/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Orbs Network 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 NON-INFRINGEMENT. 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 | -------------------------------------------------------------------------------- /projects/services/gossip-service-typescript/README.md: -------------------------------------------------------------------------------- 1 | # Gossip Service 2 | -------------------------------------------------------------------------------- /projects/services/gossip-service-typescript/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | yarn link orbs-interfaces 4 | yarn link orbs-core-library 5 | 6 | yarn install 7 | 8 | yarn run build 9 | 10 | yarn test 11 | -------------------------------------------------------------------------------- /projects/services/gossip-service-typescript/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | import * as path from "path"; 10 | 11 | import { logger, ErrorHandler, Service, topology } from "orbs-core-library"; 12 | 13 | import gossipServer from "./server"; 14 | 15 | ErrorHandler.setup(); 16 | 17 | Service.initLogger(path.join(__dirname, "../../../../logs/gossip.log")); 18 | 19 | const nodeTopology = topology(); 20 | gossipServer(nodeTopology, process.env) 21 | .onEndpoint(nodeTopology.endpoint) 22 | .start(); -------------------------------------------------------------------------------- /projects/services/gossip-service-typescript/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "noImplicitAny": true, 6 | "skipLibCheck": true, 7 | "moduleResolution": "node", 8 | "sourceMap": true, 9 | "inlineSources": true, 10 | "experimentalDecorators": true, 11 | "outDir": "dist", 12 | "baseUrl": ".", 13 | "paths": { 14 | "*": [ 15 | "node_modules/*", 16 | "src/types/*" 17 | ] 18 | } 19 | }, 20 | "include": [ 21 | "src/**/*" 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /projects/services/gossip-service-typescript/tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "types": [ 6 | "mocha", 7 | "node" 8 | ], 9 | "noImplicitAny": true, 10 | "skipLibCheck": true, 11 | "moduleResolution": "node", 12 | "sourceMap": true, 13 | "inlineSources": true, 14 | "experimentalDecorators": true, 15 | "outDir": "distTest", 16 | "baseUrl": ".", 17 | "paths": { 18 | "*": [ 19 | "node_modules/*", 20 | "src/types/*" 21 | ] 22 | } 23 | }, 24 | "include": [ 25 | "test/**/*" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /projects/services/gossip-service-typescript/watch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | yarn run watch-ts 4 | -------------------------------------------------------------------------------- /projects/services/public-api-service-typescript/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore built ts files 2 | dist/**/* 3 | -------------------------------------------------------------------------------- /projects/services/public-api-service-typescript/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Orbs Network 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 NON-INFRINGEMENT. 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 | -------------------------------------------------------------------------------- /projects/services/public-api-service-typescript/README.md: -------------------------------------------------------------------------------- 1 | # Public API Service 2 | -------------------------------------------------------------------------------- /projects/services/public-api-service-typescript/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | yarn link orbs-interfaces 4 | yarn link orbs-core-library 5 | 6 | yarn install 7 | 8 | yarn run build 9 | 10 | yarn test 11 | -------------------------------------------------------------------------------- /projects/services/public-api-service-typescript/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | import * as path from "path"; 10 | 11 | import { ErrorHandler, Service, topology, logger } from "orbs-core-library"; 12 | import httpServer from "./server"; 13 | 14 | ErrorHandler.setup(); 15 | 16 | Service.initLogger(path.join(__dirname, "../../../../logs/public-api.log")); 17 | 18 | const nodeTopology = topology(); 19 | httpServer(nodeTopology, process.env).start(); 20 | -------------------------------------------------------------------------------- /projects/services/public-api-service-typescript/src/server.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | import PublicApiHTTPService from "./service"; 10 | import { topologyPeers } from "orbs-core-library"; 11 | 12 | export default function (nodeTopology: any, env: any): PublicApiHTTPService { 13 | const peers = topologyPeers(nodeTopology.peers); 14 | const { NODE_NAME, HTTP_PORT, HTTP_MANAGEMENT_PORT } = env; 15 | 16 | if (!NODE_NAME) { 17 | throw new Error("NODE_NAME can't be empty!"); 18 | } 19 | 20 | const httpNodeConfig = { 21 | nodeName: NODE_NAME, 22 | httpPort: HTTP_PORT || 80, 23 | httpManagementPort: HTTP_MANAGEMENT_PORT || 8081 24 | }; 25 | 26 | return new PublicApiHTTPService(peers.virtualMachine, peers.transactionPool, httpNodeConfig); 27 | } 28 | -------------------------------------------------------------------------------- /projects/services/public-api-service-typescript/src/types/get-port.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | /** Declaration file generated by dts-gen */ 10 | 11 | export = getPort; 12 | 13 | declare function getPort(options?: any): Promise; 14 | 15 | declare namespace getPort { 16 | const prototype: { 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /projects/services/public-api-service-typescript/test/json-diff.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | declare module 'json-diff'; 10 | -------------------------------------------------------------------------------- /projects/services/public-api-service-typescript/test/run-mock-server.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | import createMockServer from "./mock-server"; 10 | import * as args from "args"; 11 | 12 | args 13 | .option("port", "HTTP Port to listen on") 14 | .option("stubs", "JSON representing RequestStub[]"); 15 | 16 | const flags = args.parse(process.argv); 17 | 18 | if (flags.port && flags.stubs) { 19 | 20 | createMockServer(JSON.parse(flags.stubs)) 21 | .then(server => server.listen(flags.port, () => console.log(`started on port ${flags.port}`))) 22 | .catch(error => console.log(`server failed to start, got error: ${error}`)); 23 | 24 | } else { 25 | console.log(args.showHelp()); 26 | } 27 | 28 | -------------------------------------------------------------------------------- /projects/services/public-api-service-typescript/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "noImplicitAny": true, 6 | "skipLibCheck": true, 7 | "moduleResolution": "node", 8 | "sourceMap": true, 9 | "inlineSources": true, 10 | "experimentalDecorators": true, 11 | "outDir": "dist", 12 | "baseUrl": ".", 13 | "paths": { 14 | "*": [ 15 | "node_modules/*", 16 | "src/types/*" 17 | ] 18 | } 19 | }, 20 | "include": [ 21 | "src/**/*" 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /projects/services/public-api-service-typescript/tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "types": [ 6 | "mocha", 7 | "node" 8 | ], 9 | "noImplicitAny": true, 10 | "skipLibCheck": true, 11 | "moduleResolution": "node", 12 | "sourceMap": true, 13 | "inlineSources": true, 14 | "experimentalDecorators": true, 15 | "outDir": "distTest", 16 | "baseUrl": ".", 17 | "paths": { 18 | "*": [ 19 | "node_modules/*", 20 | "src/types/*" 21 | ] 22 | } 23 | }, 24 | "include": [ 25 | "test/**/*" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /projects/services/public-api-service-typescript/watch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | yarn run watch-ts 4 | -------------------------------------------------------------------------------- /projects/services/sidechain-connector-service-typescript/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore built ts files 2 | dist/**/* 3 | -------------------------------------------------------------------------------- /projects/services/sidechain-connector-service-typescript/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Orbs Network 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 NON-INFRINGEMENT. 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 | -------------------------------------------------------------------------------- /projects/services/sidechain-connector-service-typescript/README.md: -------------------------------------------------------------------------------- 1 | # Storage Service 2 | -------------------------------------------------------------------------------- /projects/services/sidechain-connector-service-typescript/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | yarn link orbs-interfaces 4 | yarn link orbs-core-library 5 | 6 | yarn install 7 | 8 | yarn run build 9 | 10 | yarn test 11 | -------------------------------------------------------------------------------- /projects/services/sidechain-connector-service-typescript/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | import * as path from "path"; 10 | 11 | import { logger, ErrorHandler, Service, topology } from "orbs-core-library"; 12 | import sidechainConnectorServer from "./server"; 13 | 14 | ErrorHandler.setup(); 15 | 16 | Service.initLogger(path.join(__dirname, "../../../../logs/sidechain-connector.log")); 17 | 18 | const nodeTopology = topology(); 19 | 20 | sidechainConnectorServer(nodeTopology, process.env) 21 | .onEndpoint(nodeTopology.endpoint) 22 | .start(); 23 | -------------------------------------------------------------------------------- /projects/services/sidechain-connector-service-typescript/test/types/ganache-core.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | /** Declaration file generated by dts-gen */ 10 | 11 | export function provider(options: any): any; 12 | 13 | export function server(options: any): any; 14 | 15 | export namespace provider { 16 | const prototype: { 17 | }; 18 | 19 | } 20 | 21 | export namespace server { 22 | const prototype: { 23 | }; 24 | 25 | } 26 | 27 | -------------------------------------------------------------------------------- /projects/services/sidechain-connector-service-typescript/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "noImplicitAny": true, 6 | "skipLibCheck": true, 7 | "moduleResolution": "node", 8 | "sourceMap": true, 9 | "inlineSources": true, 10 | "experimentalDecorators": true, 11 | "outDir": "dist", 12 | "baseUrl": ".", 13 | "paths": { 14 | "*": [ 15 | "node_modules/*", 16 | "src/types/*" 17 | ] 18 | } 19 | }, 20 | "include": [ 21 | "src/**/*" 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /projects/services/sidechain-connector-service-typescript/tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "types": [ 6 | "mocha", 7 | "node" 8 | ], 9 | "noImplicitAny": true, 10 | "skipLibCheck": true, 11 | "moduleResolution": "node", 12 | "sourceMap": true, 13 | "inlineSources": true, 14 | "experimentalDecorators": true, 15 | "outDir": "distTest", 16 | "baseUrl": ".", 17 | "paths": { 18 | "*": [ 19 | "node_modules/*", 20 | "test/types/*" 21 | ] 22 | } 23 | }, 24 | "include": [ 25 | "test/**/*" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /projects/services/sidechain-connector-service-typescript/watch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | yarn run watch-ts 4 | -------------------------------------------------------------------------------- /projects/services/storage-service-typescript/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore built ts files 2 | dist/**/* 3 | -------------------------------------------------------------------------------- /projects/services/storage-service-typescript/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Orbs Network 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 NON-INFRINGEMENT. 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 | -------------------------------------------------------------------------------- /projects/services/storage-service-typescript/README.md: -------------------------------------------------------------------------------- 1 | # Storage Service 2 | -------------------------------------------------------------------------------- /projects/services/storage-service-typescript/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | yarn link orbs-interfaces 4 | yarn link orbs-core-library 5 | 6 | yarn install 7 | 8 | yarn run build 9 | 10 | yarn test 11 | -------------------------------------------------------------------------------- /projects/services/storage-service-typescript/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | import * as path from "path"; 10 | 11 | import { logger, ErrorHandler, Service, topology } from "orbs-core-library"; 12 | import storageServer from "./server"; 13 | 14 | ErrorHandler.setup(); 15 | 16 | Service.initLogger(path.join(__dirname, "../../../../logs/storage.log")); 17 | 18 | const nodeTopology = topology(); 19 | 20 | storageServer(nodeTopology, process.env) 21 | .onEndpoint(nodeTopology.endpoint) 22 | .start(); -------------------------------------------------------------------------------- /projects/services/storage-service-typescript/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "noImplicitAny": true, 6 | "skipLibCheck": true, 7 | "moduleResolution": "node", 8 | "sourceMap": true, 9 | "inlineSources": true, 10 | "experimentalDecorators": true, 11 | "outDir": "dist", 12 | "baseUrl": ".", 13 | "paths": { 14 | "*": [ 15 | "node_modules/*" 16 | ] 17 | } 18 | }, 19 | "include": [ 20 | "src/**/*" 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /projects/services/storage-service-typescript/tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "types": [ 6 | "mocha", 7 | "node" 8 | ], 9 | "noImplicitAny": true, 10 | "skipLibCheck": true, 11 | "moduleResolution": "node", 12 | "sourceMap": true, 13 | "inlineSources": true, 14 | "experimentalDecorators": true, 15 | "outDir": "distTest", 16 | "baseUrl": ".", 17 | "paths": { 18 | "*": [ 19 | "node_modules/*", 20 | "src/types/*" 21 | ] 22 | } 23 | }, 24 | "include": [ 25 | "test/**/*" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /projects/services/storage-service-typescript/watch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | yarn run watch-ts 4 | -------------------------------------------------------------------------------- /projects/services/virtual-machine-service-typescript/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore built ts files 2 | dist/**/* 3 | -------------------------------------------------------------------------------- /projects/services/virtual-machine-service-typescript/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Orbs Network 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 NON-INFRINGEMENT. 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 | -------------------------------------------------------------------------------- /projects/services/virtual-machine-service-typescript/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | yarn link orbs-interfaces 4 | yarn link orbs-core-library 5 | 6 | yarn install 7 | 8 | yarn run build 9 | 10 | yarn test 11 | 12 | yarn link 13 | -------------------------------------------------------------------------------- /projects/services/virtual-machine-service-typescript/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 the orbs-network-typescript authors 3 | * This file is part of the orbs-network-typescript library in the Orbs project. 4 | * 5 | * This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. 6 | * The above notice should be included in all copies or substantial portions of the software. 7 | */ 8 | 9 | import * as path from "path"; 10 | 11 | import { ErrorHandler, Service, topology } from "orbs-core-library"; 12 | 13 | import virtualMachineServer from "./server"; 14 | 15 | ErrorHandler.setup(); 16 | 17 | Service.initLogger(path.join(__dirname, "../../../../logs/virtual-machine.log")); 18 | 19 | const nodeTopology = topology(); 20 | 21 | virtualMachineServer(nodeTopology, process.env) 22 | .onEndpoint(nodeTopology.endpoint) 23 | .start(); 24 | -------------------------------------------------------------------------------- /projects/services/virtual-machine-service-typescript/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "noImplicitAny": true, 6 | "skipLibCheck": true, 7 | "moduleResolution": "node", 8 | "sourceMap": true, 9 | "inlineSources": true, 10 | "experimentalDecorators": true, 11 | "outDir": "dist", 12 | "baseUrl": ".", 13 | "paths": { 14 | "*": [ 15 | "node_modules/*", 16 | "src/types/*" 17 | ] 18 | } 19 | }, 20 | "include": [ 21 | "src/**/*" 22 | ], 23 | "exclude": [ 24 | "src/**/*.spec.*" 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /projects/services/virtual-machine-service-typescript/tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "types": [ 6 | "mocha", 7 | "node" 8 | ], 9 | "noImplicitAny": true, 10 | "skipLibCheck": true, 11 | "moduleResolution": "node", 12 | "sourceMap": true, 13 | "inlineSources": true, 14 | "experimentalDecorators": true, 15 | "outDir": "distTest", 16 | "baseUrl": ".", 17 | "paths": { 18 | "*": [ 19 | "node_modules/*", 20 | "src/types/*" 21 | ] 22 | } 23 | }, 24 | "include": [ 25 | "test/**/*" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /projects/services/virtual-machine-service-typescript/watch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | yarn run watch-ts 4 | -------------------------------------------------------------------------------- /watch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | yarn run watch 4 | --------------------------------------------------------------------------------