├── .flake8 ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── config.yml ├── dependabot.yml ├── linters │ ├── .flake8 │ ├── .isort.cfg │ ├── .markdown-lint.yml │ ├── .python-black │ └── .python-lint └── workflows │ ├── build-linux-installer-deb.yml │ ├── build-linux-installer.yml │ ├── build-macos-installer.yml │ └── build-windows-installer.yml ├── .gitignore ├── .gitmodules ├── .isort.cfg ├── BUILD_TIMELORD.md ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── INSTALL.md ├── LICENSE ├── README.md ├── azure-pipelines.yml ├── build_scripts ├── build_linux.sh ├── build_linux_deb.sh ├── build_linux_rpm.sh ├── build_macos.sh ├── build_macos_m1.sh ├── build_windows.ps1 └── installer-version.py ├── install-gui.sh ├── install-timelord.sh ├── install.sh ├── mozilla-ca ├── .github │ └── workflows │ │ └── update-cert.yaml ├── .gitignore ├── LICENSE ├── __init__.py └── cacert.pem ├── mypy.ini ├── pyproject.toml ├── run-py-tests.sh ├── scam-blockchain-gui ├── .editorconfig ├── .env ├── .eslintignore ├── .eslintrc.js ├── .github │ ├── dependabot.yml │ └── workflows │ │ ├── audit-locales.yml │ │ └── super-linter.yml ├── .gitignore ├── .linguirc ├── .prettierrc.js ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── babel.config.js ├── crowdin.yml ├── entitlements.mac.plist ├── package-lock.json ├── package.json ├── public │ ├── favicon.ico │ └── index.html ├── remote.md ├── scamblockchain.provisionprofile ├── src │ ├── assets │ │ ├── fonts │ │ │ ├── Roboto-Light.ttf │ │ │ ├── Roboto-Medium.ttf │ │ │ ├── Roboto-Regular.ttf │ │ │ ├── ionicons.eot │ │ │ ├── ionicons.svg │ │ │ ├── ionicons.ttf │ │ │ ├── ionicons.woff │ │ │ └── ionicons.woff2 │ │ └── img │ │ │ ├── circle-cropped.png │ │ │ ├── farm_sidebar.svg │ │ │ ├── help_sidebar.svg │ │ │ ├── home_sidebar.svg │ │ │ ├── noun_Farm.svg │ │ │ ├── plot_sidebar.svg │ │ │ ├── pool_sidebar.svg │ │ │ ├── scam.icns │ │ │ ├── scam.ico │ │ │ ├── scam.png │ │ │ ├── scam_circle.png │ │ │ ├── scam_circle.svg │ │ │ ├── scam_logo.svg │ │ │ └── wallet_sidebar.svg │ ├── components │ │ ├── about │ │ │ └── About.tsx │ │ ├── app │ │ │ ├── App.tsx │ │ │ ├── AppLoading.tsx │ │ │ ├── AppModalDialogs.tsx │ │ │ ├── AppRouter.tsx │ │ │ ├── AppTimeBomb.tsx │ │ │ ├── AppTimeBombAlert.tsx │ │ │ └── fonts │ │ │ │ ├── Fonts.tsx │ │ │ │ ├── Roboto-Light.ttf │ │ │ │ ├── Roboto-Medium.ttf │ │ │ │ ├── Roboto-Regular.ttf │ │ │ │ ├── ionicons.eot │ │ │ │ ├── ionicons.svg │ │ │ │ ├── ionicons.ttf │ │ │ │ ├── ionicons.woff │ │ │ │ └── ionicons.woff2 │ │ ├── backup │ │ │ ├── BackupCreate.tsx │ │ │ └── BackupRestore.tsx │ │ ├── block │ │ │ ├── Block.jsx │ │ │ └── BlockTitle.tsx │ │ ├── core │ │ │ ├── components │ │ │ │ ├── Accordion │ │ │ │ │ ├── Accordion.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── Address │ │ │ │ │ ├── Address.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── AdvancedOptions │ │ │ │ │ ├── AdvancedOptions.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── AlertDialog │ │ │ │ │ ├── AlertDialog.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── Amount │ │ │ │ │ ├── Amount.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── AspectRatio │ │ │ │ │ ├── AspectRatio.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── Autocomplete │ │ │ │ │ ├── Autocomplete.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── Button │ │ │ │ │ ├── Button.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── ButtonLoading │ │ │ │ │ ├── ButtonLoading.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── ButtonSelected │ │ │ │ │ ├── ButtonSelected.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── Card │ │ │ │ │ ├── Card.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── CardHero │ │ │ │ │ ├── CardHero.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── CardKeyValue │ │ │ │ │ ├── CardKeyValue.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── CardStep │ │ │ │ │ ├── CardStep.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── Checkbox │ │ │ │ │ ├── Checkbox.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── ConfirmDialog │ │ │ │ │ ├── ConfirmDialog.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── CopyToClipboard │ │ │ │ │ ├── CopyToClipboard.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── DarkModeToggle │ │ │ │ │ ├── DarkModeToggle.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── DialogActions │ │ │ │ │ ├── DialogActions.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── Dropzone │ │ │ │ │ ├── Dropzone.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── Fee │ │ │ │ │ ├── Fee.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── Flex │ │ │ │ │ ├── Flex.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── Form │ │ │ │ │ ├── Form.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── FormBackButton │ │ │ │ │ ├── FormBackButton.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── FormatBytes │ │ │ │ │ ├── FormatBytes.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── FormatConnectionStatus │ │ │ │ │ ├── FormatConnectionStatus.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── FormatLargeNumber │ │ │ │ │ ├── FormatLargeNumber.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── GuestRoute │ │ │ │ │ ├── GuestRoute.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── IconButton │ │ │ │ │ ├── IconButton.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── Indicator │ │ │ │ │ ├── Indicator.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── InputBase │ │ │ │ │ ├── InputBase.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── Link │ │ │ │ │ ├── Link.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── Loading │ │ │ │ │ ├── Loading.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── LocaleToggle │ │ │ │ │ ├── LocaleToggle.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── Log │ │ │ │ │ ├── Log.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── Logo │ │ │ │ │ ├── Logo.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── ModalDialogs │ │ │ │ │ ├── ModalDialogs.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── More │ │ │ │ │ ├── More.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── PrivateRoute │ │ │ │ │ ├── PrivateRoute.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── RadioGroup │ │ │ │ │ ├── RadioGroup.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── Select │ │ │ │ │ ├── Select.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── SideBarItem │ │ │ │ │ ├── SideBarItem.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── Spinner │ │ │ │ │ ├── Spinner.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── StateIndicator │ │ │ │ │ ├── StateIndicator.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── StateTypography │ │ │ │ │ ├── StateTypography.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── Table │ │ │ │ │ ├── Table.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── TextField │ │ │ │ │ ├── TextField.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── ThemeProvider │ │ │ │ │ ├── ThemeProvider.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── ToolbarSpacing │ │ │ │ │ ├── ToolbarSpacing.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── Tooltip │ │ │ │ │ ├── Tooltip.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── TooltipIcon │ │ │ │ │ ├── TooltipIcon.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── TooltipTypography │ │ │ │ │ ├── TooltipTypography.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── UnitFormat │ │ │ │ │ ├── UnitFormat.tsx │ │ │ │ │ └── index.ts │ │ │ │ └── index.ts │ │ │ ├── constants │ │ │ │ ├── CurrencyCode.ts │ │ │ │ ├── State.ts │ │ │ │ ├── StateColor.ts │ │ │ │ ├── Unit.ts │ │ │ │ ├── constants.ts │ │ │ │ └── index.ts │ │ │ ├── index.ts │ │ │ └── utils │ │ │ │ ├── index.ts │ │ │ │ └── unitFormat.ts │ │ ├── dashboard │ │ │ ├── Dashboard.tsx │ │ │ ├── DashboardSideBar.tsx │ │ │ └── DashboardTitle.tsx │ │ ├── farm │ │ │ ├── Farm.tsx │ │ │ ├── FarmCloseConnection.tsx │ │ │ ├── FarmFullNodeConnections.tsx │ │ │ ├── FarmLastAttemptedProof.tsx │ │ │ ├── FarmLatestBlockChallenges.tsx │ │ │ ├── FarmManageFarmingRewards.tsx │ │ │ ├── FarmYourHarvesterNetwork.tsx │ │ │ ├── FarmerStatus.tsx │ │ │ ├── card │ │ │ │ ├── FarmCard.tsx │ │ │ │ ├── FarmCardBlockRewards.tsx │ │ │ │ ├── FarmCardExpectedTimeToWin.tsx │ │ │ │ ├── FarmCardLastHeightFarmed.tsx │ │ │ │ ├── FarmCardNotAvailable.tsx │ │ │ │ ├── FarmCardPlotCount.tsx │ │ │ │ ├── FarmCardStatus.tsx │ │ │ │ ├── FarmCardTotalNetworkSpace.tsx │ │ │ │ ├── FarmCardTotalScamFarmed.tsx │ │ │ │ ├── FarmCardTotalSizeOfPlots.tsx │ │ │ │ └── FarmCardUserFees.tsx │ │ │ └── overview │ │ │ │ ├── FarmOverview.tsx │ │ │ │ ├── FarmOverviewCards.tsx │ │ │ │ ├── FarmOverviewHero.tsx │ │ │ │ └── images │ │ │ │ └── hero.svg │ │ ├── fullNode │ │ │ ├── FullNode.jsx │ │ │ ├── FullNodeAddConnection.tsx │ │ │ ├── FullNodeBlockSearch.tsx │ │ │ ├── FullNodeCloseConnection.tsx │ │ │ ├── FullNodeConnections.tsx │ │ │ └── card │ │ │ │ ├── FullNodeCardConnectionStatus.tsx │ │ │ │ ├── FullNodeCardDifficulty.tsx │ │ │ │ ├── FullNodeCardNetworkName.tsx │ │ │ │ ├── FullNodeCardPeakHeight.tsx │ │ │ │ ├── FullNodeCardPeakTime.tsx │ │ │ │ ├── FullNodeCardStatus.tsx │ │ │ │ ├── FullNodeCardTotalIterations.tsx │ │ │ │ ├── FullNodeCardVDFSubSlotIterations.tsx │ │ │ │ ├── FullNodeCards.tsx │ │ │ │ └── FullNodeEstimatedNetworkSpace.tsx │ │ ├── icons │ │ │ ├── Farm.tsx │ │ │ ├── Home.tsx │ │ │ ├── Keys.tsx │ │ │ ├── Plot.tsx │ │ │ ├── PlotHero.tsx │ │ │ ├── Pool.tsx │ │ │ ├── Status.tsx │ │ │ ├── Trade.tsx │ │ │ ├── Wallet.tsx │ │ │ ├── images │ │ │ │ ├── PlotHero.svg │ │ │ │ ├── farm.svg │ │ │ │ ├── home.svg │ │ │ │ ├── keys.svg │ │ │ │ ├── plot.svg │ │ │ │ ├── pool.svg │ │ │ │ ├── scam.svg │ │ │ │ ├── trade.svg │ │ │ │ └── wallet.svg │ │ │ ├── index.ts │ │ │ └── scam.tsx │ │ ├── layout │ │ │ ├── LayoutHero.tsx │ │ │ ├── LayoutLoading.tsx │ │ │ ├── LayoutMain.tsx │ │ │ └── LayoutSidebar.tsx │ │ ├── plot │ │ │ ├── Plot.tsx │ │ │ ├── PlotAction.tsx │ │ │ ├── PlotAddDirectoryDialog.tsx │ │ │ ├── PlotHeader.tsx │ │ │ ├── PlotStatus.tsx │ │ │ ├── PlotsFailed.tsx │ │ │ ├── PlotsNotFound.tsx │ │ │ ├── add │ │ │ │ ├── PlotAdd.tsx │ │ │ │ ├── PlotAddChooseSize.tsx │ │ │ │ ├── PlotAddNFT.tsx │ │ │ │ ├── PlotAddNumberOfPlots.tsx │ │ │ │ ├── PlotAddSelectFinalDirectory.tsx │ │ │ │ └── PlotAddSelectTemporaryDirectory.tsx │ │ │ ├── overview │ │ │ │ ├── PlotOverview.tsx │ │ │ │ ├── PlotOverviewHero.tsx │ │ │ │ └── PlotOverviewPlots.tsx │ │ │ └── queue │ │ │ │ ├── PlotQueueActions.tsx │ │ │ │ ├── PlotQueueIndicator.tsx │ │ │ │ ├── PlotQueueLogDialog.tsx │ │ │ │ └── PlotQueueSize.tsx │ │ ├── plotNFT │ │ │ ├── PlotExternalNFTCard.tsx │ │ │ ├── PlotNFTAbsorbRewards.tsx │ │ │ ├── PlotNFTAdd.tsx │ │ │ ├── PlotNFTCard.tsx │ │ │ ├── PlotNFTChangePool.tsx │ │ │ ├── PlotNFTExternalState.tsx │ │ │ ├── PlotNFTGetPoolLoginLinkDialog.tsx │ │ │ ├── PlotNFTGraph.tsx │ │ │ ├── PlotNFTName.tsx │ │ │ ├── PlotNFTPayoutInstructionsDialog.tsx │ │ │ ├── PlotNFTState.tsx │ │ │ ├── PlotNFTUnconfirmedCard.tsx │ │ │ └── select │ │ │ │ ├── PlotNFTSelectBase.tsx │ │ │ │ ├── PlotNFTSelectFaucet.tsx │ │ │ │ └── PlotNFTSelectPool.tsx │ │ ├── pool │ │ │ ├── Pool.tsx │ │ │ ├── PoolAbsorbRewards.tsx │ │ │ ├── PoolHeader.tsx │ │ │ ├── PoolHero.tsx │ │ │ ├── PoolInfo.tsx │ │ │ ├── PoolJoin.tsx │ │ │ └── PoolOverview.tsx │ │ ├── selectKey │ │ │ └── SelectKey.tsx │ │ ├── trading │ │ │ ├── CreateOffer.jsx │ │ │ ├── TradeManager.tsx │ │ │ ├── TradesTable.tsx │ │ │ ├── TradingOverview.jsx │ │ │ └── ViewOffer.jsx │ │ └── wallet │ │ │ ├── WalletAdd.tsx │ │ │ ├── WalletGraph.tsx │ │ │ ├── WalletHistory.tsx │ │ │ ├── WalletImport.tsx │ │ │ ├── WalletStatus.tsx │ │ │ ├── WalletStatusCard.tsx │ │ │ ├── WalletStatusHeight.tsx │ │ │ ├── Wallets.tsx │ │ │ ├── card │ │ │ ├── WalletCardPendingBalance.tsx │ │ │ ├── WalletCardPendingChange.tsx │ │ │ ├── WalletCardPendingTotalBalance.tsx │ │ │ ├── WalletCardSpendableBalance.tsx │ │ │ └── WalletCardTotalBalance.tsx │ │ │ ├── coloured │ │ │ └── WalletColoured.tsx │ │ │ ├── create │ │ │ ├── WalletCreate.jsx │ │ │ ├── createDIDWallet.js │ │ │ ├── createExistingColouredCoin.jsx │ │ │ ├── createNewColouredCoin.jsx │ │ │ ├── createRLAdmin.jsx │ │ │ ├── createRLUser.jsx │ │ │ └── recoverDIDWallet.js │ │ │ ├── did │ │ │ └── DIDWallet.js │ │ │ ├── rateLimited │ │ │ └── WalletRateLimited.jsx │ │ │ └── standard │ │ │ ├── WalletCards.tsx │ │ │ └── WalletStandard.tsx │ ├── config │ │ ├── config.js │ │ ├── env.ts │ │ └── locales.ts │ ├── constants │ │ ├── FarmerStatus.ts │ │ ├── FullNodeState.ts │ │ ├── PlotNFTState.ts │ │ ├── PlotStatus.ts │ │ ├── SyncingStatus.ts │ │ ├── TransactionType.ts │ │ ├── WalletType.ts │ │ ├── plotSizes.ts │ │ └── style.ts │ ├── dev_config.js │ ├── electron │ │ ├── handleSquirrelEvent.ts │ │ ├── main.tsx │ │ └── preload.js │ ├── fonts.d.ts │ ├── hocs │ │ └── WebsocketConnection.js │ ├── hooks │ │ ├── useAbsorbRewards.tsx │ │ ├── useCurrencyCode.ts │ │ ├── useFarmerStatus.ts │ │ ├── useFullNodeState.ts │ │ ├── useIsMainnet.tsx │ │ ├── useJoinPool.tsx │ │ ├── useLocale.ts │ │ ├── useOpenDialog.ts │ │ ├── useOpenExternal.ts │ │ ├── usePeak.ts │ │ ├── usePlotNFTDetails.ts │ │ ├── usePlotNFTExternalDetails.ts │ │ ├── usePlotNFTName.ts │ │ ├── usePlotNFTs.ts │ │ ├── usePlots.ts │ │ ├── usePoolInfo.ts │ │ ├── useSelectDirectory.tsx │ │ ├── useSelectFile.tsx │ │ ├── useStandardWallet.ts │ │ ├── useThrottleSelector.ts │ │ ├── useTransaction.ts │ │ ├── useUnconfirmedPlotNFTs.ts │ │ └── useWallet.ts │ ├── index.html │ ├── index.tsx │ ├── locales │ │ ├── README.md │ │ ├── af-ZA │ │ │ └── messages.po │ │ ├── ak-GH │ │ │ └── messages.po │ │ ├── ar-SA │ │ │ └── messages.po │ │ ├── be-BY │ │ │ └── messages.po │ │ ├── bg-BG │ │ │ └── messages.po │ │ ├── bn-BD │ │ │ └── messages.po │ │ ├── bn-IN │ │ │ └── messages.po │ │ ├── bs-BA │ │ │ └── messages.po │ │ ├── ca-ES │ │ │ └── messages.po │ │ ├── cs-CZ │ │ │ └── messages.po │ │ ├── cy-GB │ │ │ └── messages.po │ │ ├── da-DK │ │ │ └── messages.po │ │ ├── de-DE │ │ │ └── messages.po │ │ ├── el-GR │ │ │ └── messages.po │ │ ├── en-AU │ │ │ └── messages.po │ │ ├── en-NZ │ │ │ └── messages.po │ │ ├── en-PT │ │ │ └── messages.po │ │ ├── en-US │ │ │ └── messages.po │ │ ├── eo-UY │ │ │ └── messages.po │ │ ├── es-AR │ │ │ └── messages.po │ │ ├── es-ES │ │ │ └── messages.po │ │ ├── es-MX │ │ │ └── messages.po │ │ ├── fa-IR │ │ │ └── messages.po │ │ ├── fi-FI │ │ │ └── messages.po │ │ ├── fr-FR │ │ │ └── messages.po │ │ ├── he-IL │ │ │ └── messages.po │ │ ├── hi-IN │ │ │ └── messages.po │ │ ├── hr-HR │ │ │ └── messages.po │ │ ├── hu-HU │ │ │ └── messages.po │ │ ├── id-ID │ │ │ └── messages.po │ │ ├── is-IS │ │ │ └── messages.po │ │ ├── it-IT │ │ │ └── messages.po │ │ ├── ja-JP │ │ │ └── messages.po │ │ ├── ko-KR │ │ │ └── messages.po │ │ ├── lol-US │ │ │ └── messages.po │ │ ├── lt-LT │ │ │ └── messages.po │ │ ├── lv-LV │ │ │ └── messages.po │ │ ├── mk-MK │ │ │ └── messages.po │ │ ├── mn-MN │ │ │ └── messages.po │ │ ├── nl-NL │ │ │ └── messages.po │ │ ├── no-NO │ │ │ └── messages.po │ │ ├── pa-IN │ │ │ └── messages.po │ │ ├── pl-PL │ │ │ └── messages.po │ │ ├── pt-BR │ │ │ └── messages.po │ │ ├── pt-PT │ │ │ └── messages.po │ │ ├── ro-RO │ │ │ └── messages.po │ │ ├── ru-RU │ │ │ └── messages.po │ │ ├── sk-SK │ │ │ └── messages.po │ │ ├── sl-SI │ │ │ └── messages.po │ │ ├── sq-AL │ │ │ └── messages.po │ │ ├── sr-SP │ │ │ └── messages.po │ │ ├── sv-SE │ │ │ └── messages.po │ │ ├── th-TH │ │ │ └── messages.po │ │ ├── tlh-AA │ │ │ └── messages.po │ │ ├── tr-TR │ │ │ └── messages.po │ │ ├── uk-UA │ │ │ └── messages.po │ │ ├── vi-VN │ │ │ └── messages.po │ │ ├── zh-CN │ │ │ └── messages.po │ │ └── zh-TW │ │ │ └── messages.po │ ├── logo.svg │ ├── middleware │ │ ├── middleware.js │ │ └── middleware_api.jsx │ ├── modules │ │ ├── backup.ts │ │ ├── createWallet.ts │ │ ├── daemon.ts │ │ ├── daemon_messages.js │ │ ├── dialog.tsx │ │ ├── entranceMenu.js │ │ ├── farmerMessages.js │ │ ├── farming.ts │ │ ├── fullNode.ts │ │ ├── fullnodeMessages.js │ │ ├── harvesterMessages.js │ │ ├── incoming.ts │ │ ├── localStorage.ts │ │ ├── message.js │ │ ├── mnemonic.ts │ │ ├── plotNFT.ts │ │ ├── plotQueue.ts │ │ ├── plotterControl.ts │ │ ├── plotter_messages.js │ │ ├── progress.ts │ │ ├── rootReducer.ts │ │ ├── store.js │ │ ├── trade.ts │ │ ├── trade_messages.js │ │ ├── walletMenu.ts │ │ └── websocket.ts │ ├── polyfill.ts │ ├── react-app-env.d.ts │ ├── readme.md │ ├── tests │ │ └── util │ │ │ ├── header.test.js │ │ │ ├── scam.test.js │ │ │ ├── units.test.js │ │ │ └── utils.test.js │ ├── theme │ │ ├── dark.ts │ │ ├── default.ts │ │ └── light.ts │ ├── types │ │ ├── Block.ts │ │ ├── Challenge.ts │ │ ├── Coin.ts │ │ ├── CoinSolution.ts │ │ ├── Connection.ts │ │ ├── FarmingInfo.ts │ │ ├── Fingerprint.ts │ │ ├── Foliage.ts │ │ ├── FoliageTransactionBlock.ts │ │ ├── G2Element.ts │ │ ├── Header.ts │ │ ├── InitialTargetState.ts │ │ ├── Peak.ts │ │ ├── Plot.ts │ │ ├── PlotAdd.ts │ │ ├── PlotNFT.ts │ │ ├── PlotNFTExternal.ts │ │ ├── PlotQueueItem.ts │ │ ├── Point.ts │ │ ├── PoolInfo.ts │ │ ├── PoolState.ts │ │ ├── PoolWalletStatus.ts │ │ ├── Program.ts │ │ ├── ProofsOfSpace.ts │ │ ├── SignagePoint.ts │ │ ├── SpendBundle.ts │ │ ├── SubBlock.ts │ │ ├── Transaction.ts │ │ ├── UnconfirmedPlotNFT.ts │ │ ├── Wallet.ts │ │ └── WalletBalance.ts │ └── util │ │ ├── blockHeightToTimestamp.ts │ │ ├── blockRewards.ts │ │ ├── computeStatistics.ts │ │ ├── config.js │ │ ├── createTransaction.ts │ │ ├── createWallet.ts │ │ ├── english.js │ │ ├── getDescriptiveError.ts │ │ ├── getPercentPointsSuccessfull.ts │ │ ├── getPoolInfo.ts │ │ ├── getWalletSyncingStatus.ts │ │ ├── header.js │ │ ├── isWindows.ts │ │ ├── mergeArrayItem.ts │ │ ├── mergeArrays.ts │ │ ├── normalizePoolState.ts │ │ ├── normalizeUrl.ts │ │ ├── plot_sizes.js │ │ ├── removeOldPoints.ts │ │ ├── scam.js │ │ ├── scamEnvironment.js │ │ ├── service_names.js │ │ ├── toBech32m.ts │ │ ├── transaction_result.js │ │ ├── trie.js │ │ ├── units.js │ │ ├── utils.js │ │ └── wallet_types.js ├── tsconfig.json ├── webpack.electron.babel.ts ├── webpack.react.babel.ts ├── windows.json └── winstaller.js ├── scam ├── __init__.py ├── clvm │ └── singleton.py ├── cmds │ ├── __init__.py │ ├── configure.py │ ├── farm.py │ ├── farm_funcs.py │ ├── init.py │ ├── init_funcs.py │ ├── keys.py │ ├── keys_funcs.py │ ├── netspace.py │ ├── netspace_funcs.py │ ├── plotnft.py │ ├── plotnft_funcs.py │ ├── plots.py │ ├── scam.py │ ├── show.py │ ├── start.py │ ├── start_funcs.py │ ├── stop.py │ ├── units.py │ ├── wallet.py │ └── wallet_funcs.py ├── consensus │ ├── __init__.py │ ├── block_body_validation.py │ ├── block_creation.py │ ├── block_header_validation.py │ ├── block_record.py │ ├── block_rewards.py │ ├── block_root_validation.py │ ├── blockchain.py │ ├── blockchain_interface.py │ ├── coinbase.py │ ├── condition_costs.py │ ├── constants.py │ ├── cost_calculator.py │ ├── default_constants.py │ ├── deficit.py │ ├── difficulty_adjustment.py │ ├── find_fork_point.py │ ├── full_block_to_block_record.py │ ├── get_block_challenge.py │ ├── make_sub_epoch_summary.py │ ├── multiprocess_validation.py │ ├── network_type.py │ ├── pos_quality.py │ ├── pot_iterations.py │ └── vdf_info_computation.py ├── daemon │ ├── __init__.py │ ├── client.py │ ├── server.py │ └── windows_signal.py ├── farmer │ ├── __init__.py │ ├── farmer.py │ └── farmer_api.py ├── full_node │ ├── __init__.py │ ├── block_store.py │ ├── bundle_tools.py │ ├── coin_store.py │ ├── full_node.py │ ├── full_node_api.py │ ├── full_node_store.py │ ├── generator.py │ ├── mempool.py │ ├── mempool_check_conditions.py │ ├── mempool_manager.py │ ├── signage_point.py │ ├── sync_store.py │ └── weight_proof.py ├── harvester │ ├── __init__.py │ ├── harvester.py │ └── harvester_api.py ├── introducer │ ├── __init__.py │ ├── introducer.py │ └── introducer_api.py ├── plotting │ ├── check_plots.py │ ├── create_plots.py │ └── plot_tools.py ├── pools │ ├── __init__.py │ ├── pool_config.py │ ├── pool_puzzles.py │ ├── pool_wallet.py │ └── pool_wallet_info.py ├── protocols │ ├── __init__.py │ ├── farmer_protocol.py │ ├── full_node_protocol.py │ ├── harvester_protocol.py │ ├── introducer_protocol.py │ ├── pool_protocol.py │ ├── protocol_message_types.py │ ├── shared_protocol.py │ ├── timelord_protocol.py │ └── wallet_protocol.py ├── pyinstaller.spec ├── rpc │ ├── __init__.py │ ├── farmer_rpc_api.py │ ├── farmer_rpc_client.py │ ├── full_node_rpc_api.py │ ├── full_node_rpc_client.py │ ├── harvester_rpc_api.py │ ├── harvester_rpc_client.py │ ├── rpc_client.py │ ├── rpc_server.py │ ├── wallet_rpc_api.py │ └── wallet_rpc_client.py ├── server │ ├── __init__.py │ ├── address_manager.py │ ├── address_manager_store.py │ ├── connection_utils.py │ ├── introducer_peers.py │ ├── node_discovery.py │ ├── outbound_message.py │ ├── rate_limits.py │ ├── reconnect_task.py │ ├── server.py │ ├── ssl_context.py │ ├── start_farmer.py │ ├── start_full_node.py │ ├── start_harvester.py │ ├── start_introducer.py │ ├── start_service.py │ ├── start_timelord.py │ ├── start_wallet.py │ ├── upnp.py │ └── ws_connection.py ├── simulator │ ├── __init__.py │ ├── full_node_simulator.py │ ├── simulator_constants.py │ ├── simulator_protocol.py │ └── start_simulator.py ├── ssl │ ├── create_ssl.py │ ├── dst_root_ca.pem │ ├── scam_ca.crt │ └── scam_ca.key ├── timelord │ ├── __init__.py │ ├── iters_from_block.py │ ├── timelord.py │ ├── timelord_api.py │ ├── timelord_launcher.py │ ├── timelord_state.py │ └── types.py ├── types │ ├── __init__.py │ ├── announcement.py │ ├── blockchain_format │ │ ├── __init__.py │ │ ├── classgroup.py │ │ ├── coin.py │ │ ├── foliage.py │ │ ├── pool_target.py │ │ ├── program.py │ │ ├── proof_of_space.py │ │ ├── reward_chain_block.py │ │ ├── sized_bytes.py │ │ ├── slots.py │ │ ├── sub_epoch_summary.py │ │ ├── tree_hash.py │ │ └── vdf.py │ ├── coin_record.py │ ├── coin_solution.py │ ├── condition_opcodes.py │ ├── condition_with_args.py │ ├── end_of_slot_bundle.py │ ├── full_block.py │ ├── generator_types.py │ ├── header_block.py │ ├── mempool_inclusion_status.py │ ├── mempool_item.py │ ├── name_puzzle_condition.py │ ├── peer_info.py │ ├── spend_bundle.py │ ├── unfinished_block.py │ ├── unfinished_header_block.py │ └── weight_proof.py ├── util │ ├── __init__.py │ ├── api_decorators.py │ ├── bech32m.py │ ├── block_cache.py │ ├── byte_types.py │ ├── chain_utils.py │ ├── clvm.py │ ├── condition_tools.py │ ├── config.py │ ├── create_alert_file.py │ ├── db_wrapper.py │ ├── default_root.py │ ├── english.txt │ ├── errors.py │ ├── generator_tools.py │ ├── hash.py │ ├── initial-config.yaml │ ├── ints.py │ ├── json_util.py │ ├── keychain.py │ ├── lru_cache.py │ ├── make_test_constants.py │ ├── merkle_set.py │ ├── misc.py │ ├── network.py │ ├── partial_func.py │ ├── path.py │ ├── pip_import.py │ ├── prev_transaction_block.py │ ├── profiler.py │ ├── recursive_replace.py │ ├── safe_cancel_task.py │ ├── scam_logging.py │ ├── service_groups.py │ ├── setproctitle.py │ ├── significant_bits.py │ ├── streamable.py │ ├── struct_stream.py │ ├── type_checking.py │ ├── validate_alert.py │ ├── vdf_prover.py │ └── ws_message.py └── wallet │ ├── __init__.py │ ├── block_record.py │ ├── cc_wallet │ ├── __init__.py │ ├── cc_info.py │ ├── cc_utils.py │ └── cc_wallet.py │ ├── chialisp.py │ ├── derivation_record.py │ ├── derive_keys.py │ ├── did_wallet │ ├── __init__.py │ ├── did_info.py │ ├── did_wallet.py │ └── did_wallet_puzzles.py │ ├── key_val_store.py │ ├── lineage_proof.py │ ├── puzzles │ ├── __init__.py │ ├── block_program_zero.clvm │ ├── block_program_zero.clvm.hex │ ├── block_program_zero.clvm.hex.sha256tree │ ├── calculate_synthetic_public_key.clvm │ ├── calculate_synthetic_public_key.clvm.hex │ ├── calculate_synthetic_public_key.clvm.hex.sha256tree │ ├── cc.clvm │ ├── cc.clvm.hex │ ├── cc.clvm.hex.sha256tree │ ├── cc_loader.py │ ├── condition_codes.clvm │ ├── create-lock-puzzlehash.clvm │ ├── create-lock-puzzlehash.clvm.hex.sha256tree │ ├── curry-and-treehash.clinc │ ├── decompress_coin_solution_entry.clvm │ ├── decompress_coin_solution_entry.clvm.hex │ ├── decompress_coin_solution_entry.clvm.hex.sha256tree │ ├── decompress_coin_solution_entry_with_prefix.clvm │ ├── decompress_coin_solution_entry_with_prefix.clvm.hex │ ├── decompress_coin_solution_entry_with_prefix.clvm.hex.sha256tree │ ├── decompress_puzzle.clvm │ ├── decompress_puzzle.clvm.hex │ ├── decompress_puzzle.clvm.hex.sha256tree │ ├── did_innerpuz.clvm │ ├── did_innerpuz.clvm.hex │ ├── did_innerpuz.clvm.hex.sha256tree │ ├── generator_for_single_coin.clvm │ ├── generator_for_single_coin.clvm.hex │ ├── generator_for_single_coin.clvm.hex.sha256tree │ ├── generator_loader.py │ ├── genesis-by-coin-id-with-0.clvm │ ├── genesis-by-coin-id-with-0.clvm.hex │ ├── genesis-by-coin-id-with-0.clvm.hex.sha256tree │ ├── genesis-by-puzzle-hash-with-0.clvm │ ├── genesis-by-puzzle-hash-with-0.clvm.hex │ ├── genesis-by-puzzle-hash-with-0.clvm.hex.sha256tree │ ├── genesis_by_coin_id_with_0.py │ ├── genesis_by_puzzle_hash_with_0.py │ ├── load_clvm.py │ ├── lock.inner.puzzle.clvm │ ├── lock.inner.puzzle.clvm.hex │ ├── lock.inner.puzzle.clvm.hex.sha256tree │ ├── p2_conditions.clvm │ ├── p2_conditions.clvm.hex │ ├── p2_conditions.clvm.hex.sha256tree │ ├── p2_conditions.py │ ├── p2_delegated_conditions.clvm │ ├── p2_delegated_conditions.clvm.hex │ ├── p2_delegated_conditions.clvm.hex.sha256tree │ ├── p2_delegated_conditions.py │ ├── p2_delegated_puzzle.clvm │ ├── p2_delegated_puzzle.clvm.hex │ ├── p2_delegated_puzzle.clvm.hex.sha256tree │ ├── p2_delegated_puzzle.py │ ├── p2_delegated_puzzle_or_hidden_puzzle.clvm │ ├── p2_delegated_puzzle_or_hidden_puzzle.clvm.hex │ ├── p2_delegated_puzzle_or_hidden_puzzle.clvm.hex.sha256tree │ ├── p2_delegated_puzzle_or_hidden_puzzle.py │ ├── p2_m_of_n_delegate_direct.clvm │ ├── p2_m_of_n_delegate_direct.clvm.hex │ ├── p2_m_of_n_delegate_direct.clvm.hex.sha256tree │ ├── p2_m_of_n_delegate_direct.py │ ├── p2_puzzle_hash.clvm │ ├── p2_puzzle_hash.clvm.hex │ ├── p2_puzzle_hash.clvm.hex.sha256tree │ ├── p2_puzzle_hash.py │ ├── p2_singleton.clvm │ ├── p2_singleton.clvm.hex │ ├── p2_singleton.clvm.hex.sha256tree │ ├── p2_singleton_or_delayed_puzhash.clvm │ ├── p2_singleton_or_delayed_puzhash.clvm.hex │ ├── p2_singleton_or_delayed_puzhash.clvm.hex.sha256tree │ ├── pool_member_innerpuz.clvm │ ├── pool_member_innerpuz.clvm.hex │ ├── pool_member_innerpuz.clvm.hex.sha256tree │ ├── pool_waitingroom_innerpuz.clvm │ ├── pool_waitingroom_innerpuz.clvm.hex │ ├── pool_waitingroom_innerpuz.clvm.hex.sha256tree │ ├── prefarm │ │ ├── make_prefarm_ph.py │ │ └── spend_prefarm.py │ ├── puzzle_utils.py │ ├── recompile-all.sh │ ├── rl.clvm │ ├── rl.clvm.hex │ ├── rl.clvm.hex.sha256tree │ ├── rl_aggregation.clvm │ ├── rl_aggregation.clvm.hex │ ├── rl_aggregation.clvm.hex.sha256tree │ ├── rom_bootstrap_generator.clvm │ ├── rom_bootstrap_generator.clvm.hex │ ├── rom_bootstrap_generator.clvm.hex.sha256tree │ ├── rom_bootstrap_generator.py │ ├── scamlisp_deserialisation.clvm │ ├── scamlisp_deserialisation.clvm.hex │ ├── scamlisp_deserialisation.clvm.hex.sha256tree │ ├── sha256tree_module.clvm │ ├── sha256tree_module.clvm.hex │ ├── sha256tree_module.clvm.hex.sha256tree │ ├── singleton_launcher.clvm │ ├── singleton_launcher.clvm.hex │ ├── singleton_launcher.clvm.hex.sha256tree │ ├── singleton_top_layer.clvm │ ├── singleton_top_layer.clvm.hex │ ├── singleton_top_layer.clvm.hex.sha256tree │ ├── singleton_top_layer.py │ ├── singleton_truths.clib │ ├── test_cc.py │ ├── test_generator_deserialize.clvm │ ├── test_generator_deserialize.clvm.hex │ ├── test_generator_deserialize.clvm.hex.sha256tree │ ├── test_multiple_generator_input_arguments.clvm │ ├── test_multiple_generator_input_arguments.clvm.hex │ └── test_multiple_generator_input_arguments.clvm.hex.sha256tree │ ├── rl_wallet │ ├── __init__.py │ ├── rl_wallet.py │ └── rl_wallet_puzzles.py │ ├── secret_key_store.py │ ├── settings │ ├── default_settings.py │ ├── settings_objects.py │ └── user_settings.py │ ├── sign_coin_solutions.py │ ├── trade_manager.py │ ├── trade_record.py │ ├── trading │ ├── __init__.py │ ├── trade_status.py │ └── trade_store.py │ ├── transaction_record.py │ ├── util │ ├── __init__.py │ ├── backup_utils.py │ ├── debug_spend_bundle.py │ ├── trade_utils.py │ ├── transaction_type.py │ └── wallet_types.py │ ├── wallet.py │ ├── wallet_action.py │ ├── wallet_action_store.py │ ├── wallet_block_store.py │ ├── wallet_blockchain.py │ ├── wallet_coin_record.py │ ├── wallet_coin_store.py │ ├── wallet_info.py │ ├── wallet_interested_store.py │ ├── wallet_node.py │ ├── wallet_node_api.py │ ├── wallet_pool_store.py │ ├── wallet_puzzle_store.py │ ├── wallet_state_manager.py │ ├── wallet_sync_store.py │ ├── wallet_transaction_store.py │ └── wallet_user_store.py ├── setup.py └── tests ├── README.md ├── __init__.py ├── block_tools.py ├── blockchain ├── __init__.py ├── config.py ├── test_blockchain.py └── test_blockchain_transactions.py ├── build-workflows.py ├── check_pytest_monitor_output.py ├── chia-start-sim ├── clvm ├── __init__.py ├── coin_store.py ├── config.py ├── test_clvm_compilation.py ├── test_puzzles.py ├── test_scamlisp_deserialization.py ├── test_serialized_program.py └── test_singletons.py ├── connection_utils.py ├── core ├── __init__.py ├── consensus │ ├── __init__.py │ └── test_pot_iterations.py ├── daemon │ └── test_daemon.py ├── fixtures.py ├── full_node │ ├── __init__.py │ ├── config.py │ ├── dos │ │ ├── __init__.py │ │ └── config.py │ ├── full_sync │ │ ├── __init__.py │ │ ├── config.py │ │ └── test_full_sync.py │ ├── ram_db.py │ ├── test_address_manager.py │ ├── test_block_store.py │ ├── test_coin_store.py │ ├── test_conditions.py │ ├── test_full_node.py │ ├── test_full_node_store.py │ ├── test_initial_freeze.py │ ├── test_mempool.py │ ├── test_mempool_performance.py │ ├── test_node_load.py │ ├── test_performance.py │ ├── test_sync_store.py │ └── test_transactions.py ├── make_block_generator.py ├── node_height.py ├── server │ ├── test_dos.py │ └── test_rate_limits.py ├── ssl │ └── test_ssl.py ├── test_cost_calculation.py ├── test_farmer_harvester_rpc.py ├── test_filter.py ├── test_full_node_rpc.py ├── test_merkle_set.py ├── test_setproctitle.py ├── types │ ├── __init__.py │ ├── test_coin.py │ └── test_proof_of_space.py └── util │ ├── __init__.py │ ├── test_keychain.py │ ├── test_lru_cache.py │ ├── test_significant_bits.py │ ├── test_streamable.py │ └── test_type_checking.py ├── generator ├── test_compression.py ├── test_generator_types.py ├── test_rom.py └── test_scan.py ├── pools ├── __init__.py ├── test_pool_config.py ├── test_pool_puzzles_lifecycle.py ├── test_pool_rpc.py ├── test_pool_wallet.py └── test_wallet_pool_store.py ├── pytest.ini ├── runner-templates ├── build-test-macos ├── build-test-ubuntu ├── checkout-test-plots.include.yml └── install-timelord.include.yml ├── setup_nodes.py ├── simulation ├── __init__.py ├── config.py └── test_simulation.py ├── testconfig.py ├── time_out_assert.py ├── util ├── __init__.py ├── alert_server.py ├── benchmark_cost.py ├── bip39_test_vectors.json ├── config.py ├── generator_tools_testing.py ├── key_tool.py ├── misc.py └── test_struct_stream.py ├── wallet ├── __init__.py ├── cc_wallet │ ├── __init__.py │ ├── test_cc_wallet.py │ └── test_trades.py ├── did_wallet │ └── test_did.py ├── rl_wallet │ ├── __init__.py │ ├── test_rl_rpc.py │ └── test_rl_wallet.py ├── rpc │ ├── __init__.py │ └── test_wallet_rpc.py ├── sync │ ├── __init__.py │ ├── config.py │ └── test_wallet_sync.py ├── test_backup.py ├── test_bech32m.py ├── test_puzzle_store.py ├── test_scamlisp.py ├── test_singleton.py ├── test_singleton_lifecycle.py ├── test_singleton_lifecycle_fast.py ├── test_taproot.py ├── test_wallet.py ├── test_wallet_interested_store.py └── test_wallet_store.py ├── wallet_tools.py └── weight_proof └── test_weight_proof.py /.flake8: -------------------------------------------------------------------------------- 1 | .github/linters/.flake8 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: "[BUG]" 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | 12 | 13 | **To Reproduce** 14 | 15 | Steps to reproduce the behavior: 16 | 17 | 1. Go to '...' 18 | 2. Click on '....' 19 | 3. Scroll down to '....' 20 | 4. See error 21 | 22 | **Expected behavior** 23 | 24 | 25 | **Screenshots** 26 | 27 | 28 | **Desktop** 29 | 30 | 31 | - OS: 32 | - OS Version/Flavor: 33 | - CPU: 34 | 35 | **Additional context** 36 | 37 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | contact_links: 2 | - about: Ask a question or request support here 3 | name: Ask for Support 4 | url: >- 5 | https://github.com/vrn00b/scam-blockchain/discussions/new?category=support 6 | - about: Request a new feature or idea here 7 | name: Make a Request 8 | url: >- 9 | https://github.com/vrn00b/scam-blockchain/discussions/new?category=ideas 10 | - about: Get support on the Scam Keybase chat channels. 11 | name: Join the Keybase.io support chat 12 | url: 'https://keybase.io/team/scam_network.public' 13 | -------------------------------------------------------------------------------- /.github/linters/.flake8: -------------------------------------------------------------------------------- 1 | [flake8] 2 | max-line-length = 120 3 | exclude = ./typings/**/* 4 | ignore = E203,W503 5 | -------------------------------------------------------------------------------- /.github/linters/.isort.cfg: -------------------------------------------------------------------------------- 1 | [settings] 2 | profile= 3 | 4 | ; vertical hanging indent mode also used in black configuration 5 | multi_line_output = 3 6 | 7 | ; necessary because black expect the trailing comma 8 | include_trailing_comma = true 9 | 10 | ; black compatibility 11 | force_grid_wrap = 0 12 | 13 | ; black compatibility 14 | use_parentheses = True 15 | 16 | ; black compatibility 17 | ensure_newline_before_comments = True 18 | 19 | ; we chose 120 as line length 20 | line_length = 120 21 | -------------------------------------------------------------------------------- /.github/linters/.python-black: -------------------------------------------------------------------------------- 1 | [tool.black] 2 | line_length = 120 3 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "scam-blockchain-gui"] 2 | path = scam-blockchain-gui 3 | url = https://github.com/vrn00b/scam-blockchain-gui.git 4 | branch = pools 5 | [submodule "mozilla-ca"] 6 | path = mozilla-ca 7 | url = https://github.com/Chia-Network/mozilla-ca.git 8 | branch = main 9 | -------------------------------------------------------------------------------- /.isort.cfg: -------------------------------------------------------------------------------- 1 | .github/linters/.isort.cfg -------------------------------------------------------------------------------- /INSTALL.md: -------------------------------------------------------------------------------- 1 | # Installation 2 | 3 | Install instructions have been moved to the [INSTALL](https://github.com/vrn00b/scam-blockchain/wiki/INSTALL) section of the repository [Wiki](https://github.com/vrn00b/scam-blockchain/wiki). 4 | 5 | After installing, follow the remaining instructions in the 6 | [Quick Start Guide](https://github.com/vrn00b/scam-blockchain/wiki/Quick-Start-Guide) 7 | to run the software. 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # scam-blockchain 2 | 3 | Full node mainnet started 08.08.2021 4 | 5 | **full node:** scamnetwork.net:9777 6 | 7 | **discord:** https://discord.gg/eabqvUawJ5 8 | 9 | **telegram:** https://t.me/scamblockchain 10 | 11 | **Scam** is a modern community-centric green cryptocurrency based on a proof-of-space-and-time consensus algorithm. 12 | 13 | For more information, see our website and downloads at https://scamnetwork.net. 14 | -------------------------------------------------------------------------------- /mozilla-ca/.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | -------------------------------------------------------------------------------- /mozilla-ca/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/mozilla-ca/__init__.py -------------------------------------------------------------------------------- /mypy.ini: -------------------------------------------------------------------------------- 1 | [mypy] 2 | ignore_missing_imports = True 3 | 4 | [mypy - lib] 5 | ignore_errors = True 6 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=4.1.2"] 3 | build-backend = "setuptools.build_meta" 4 | 5 | [tool.setuptools_scm] 6 | local_scheme = "no-local-version" 7 | 8 | [tool.black] 9 | line-length = 120 10 | -------------------------------------------------------------------------------- /run-py-tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | python3 -m venv venv 4 | # shellcheck disable=SC1091 5 | . ./activate 6 | pip3 install ".[dev]" 7 | 8 | py.test ./tests/blockchain -s -v 9 | py.test ./tests/core -s -v 10 | py.test ./tests/wallet -s -v 11 | -------------------------------------------------------------------------------- /scam-blockchain-gui/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | indent_size = 2 7 | indent_style = space 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | max_line_length = 80 -------------------------------------------------------------------------------- /scam-blockchain-gui/.env: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam-blockchain-gui/.env -------------------------------------------------------------------------------- /scam-blockchain-gui/.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | src/**/*.js 3 | src/**/*.jsx -------------------------------------------------------------------------------- /scam-blockchain-gui/.linguirc: -------------------------------------------------------------------------------- 1 | { 2 | "catalogs": [{ 3 | "path": "/src/locales/{locale}/messages", 4 | "include": ["/src"], 5 | "exclude": ["**/node_modules/**"] 6 | }], 7 | "locales": [ 8 | "ar-SA", 9 | "be-BY", 10 | "bg-BG", 11 | "ca-ES", 12 | "cs-CZ", 13 | "da-DK", 14 | "de-DE", 15 | "el-GR", 16 | "en-AU", 17 | "en-NZ", 18 | "en-PT", 19 | "en-US", 20 | "es-ES", 21 | "es-AR", 22 | "es-MX", 23 | "fa-IR", 24 | "fi-FI", 25 | "fr-FR", 26 | "hr-HR", 27 | "hu-HU", 28 | "id-ID", 29 | "it-IT", 30 | "ja-JP", 31 | "ko-KR", 32 | "nl-NL", 33 | "no-NO", 34 | "pl-PL", 35 | "pt-BR", 36 | "pt-PT", 37 | "ro-RO", 38 | "ru-RU", 39 | "sk-SK", 40 | "sq-AL", 41 | "sr-SP", 42 | "sv-SE", 43 | "tr-TR", 44 | "uk-UA", 45 | "zh-TW", 46 | "zh-CN" 47 | ], 48 | "format": "po", 49 | "sourceLocale": "en-US", 50 | "fallbackLocales": { 51 | default: "en-US" 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /scam-blockchain-gui/.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | singleQuote: true, 3 | trailingComma: 'all', 4 | printWidth: 80 5 | }; 6 | -------------------------------------------------------------------------------- /scam-blockchain-gui/README.md: -------------------------------------------------------------------------------- 1 | # scam-blockchain 2 | ![Alt text](https://www.scamnetwork.net/images/scam_logo.svg) 3 | 4 | ![GitHub contributors](https://img.shields.io/github/contributors/vrn00b/scam-blockchain?logo=GitHub) 5 | 6 | Please check out the [wiki](https://github.com/vrn00b/scam-blockchain/wiki) 7 | and [FAQ](https://github.com/vrn00b/scam-blockchain/wiki/FAQ) for 8 | information on this project. 9 | 10 | ## Installing 11 | 12 | This is the GUI for scam-blockchain. It is built into distribution packages in the scam-blockchain repository. 13 | 14 | Install instructions are available in the 15 | [INSTALL](https://github.com/vrn00b/scam-blockchain/wiki/INSTALL) 16 | section of the 17 | [scam-blockchain repository wiki](https://github.com/vrn00b/scam-blockchain/wiki). 18 | 19 | ## Running 20 | 21 | Once installed, a 22 | [Quick Start Guide](https://github.com/vrn00b/scam-blockchain/wiki/Quick-Start-Guide) 23 | is available from the repository 24 | [wiki](https://github.com/vrn00b/scam-blockchain/wiki). 25 | -------------------------------------------------------------------------------- /scam-blockchain-gui/babel.config.js: -------------------------------------------------------------------------------- 1 | const LOOSE = false; 2 | 3 | module.exports = function babel(api) { 4 | api.cache(true); 5 | 6 | return { 7 | presets: [ 8 | ['@babel/preset-env', { 9 | targets: { 10 | node: true, 11 | }, 12 | useBuiltIns: 'entry', 13 | corejs: 3, 14 | loose: LOOSE, 15 | }], 16 | '@babel/preset-typescript', 17 | '@babel/preset-react', 18 | ], 19 | plugins: [ 20 | 'macros', 21 | '@loadable/babel-plugin', 22 | ['babel-plugin-styled-components'], 23 | ['@babel/plugin-proposal-class-properties', { loose: LOOSE }], 24 | '@babel/plugin-proposal-export-default-from', 25 | ], 26 | }; 27 | }; 28 | -------------------------------------------------------------------------------- /scam-blockchain-gui/crowdin.yml: -------------------------------------------------------------------------------- 1 | files: 2 | - source: /src/locales/en-US/*.po 3 | translation: /src/locales/%locale%/messages.po 4 | -------------------------------------------------------------------------------- /scam-blockchain-gui/entitlements.mac.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.cs.allow-unsigned-executable-memory 6 | 7 | 8 | -------------------------------------------------------------------------------- /scam-blockchain-gui/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam-blockchain-gui/public/favicon.ico -------------------------------------------------------------------------------- /scam-blockchain-gui/remote.md: -------------------------------------------------------------------------------- 1 | # Connecting the UI to a Remote Daemon 2 | 3 | _This instructional how-to has been updated and [moved to the wiki](https://github.com/vrn00b/scam-blockchain/wiki/Connecting-the-UI-to-a-remote-daemon)._ 4 | -------------------------------------------------------------------------------- /scam-blockchain-gui/scamblockchain.provisionprofile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam-blockchain-gui/scamblockchain.provisionprofile -------------------------------------------------------------------------------- /scam-blockchain-gui/src/assets/fonts/Roboto-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam-blockchain-gui/src/assets/fonts/Roboto-Light.ttf -------------------------------------------------------------------------------- /scam-blockchain-gui/src/assets/fonts/Roboto-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam-blockchain-gui/src/assets/fonts/Roboto-Medium.ttf -------------------------------------------------------------------------------- /scam-blockchain-gui/src/assets/fonts/Roboto-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam-blockchain-gui/src/assets/fonts/Roboto-Regular.ttf -------------------------------------------------------------------------------- /scam-blockchain-gui/src/assets/fonts/ionicons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam-blockchain-gui/src/assets/fonts/ionicons.eot -------------------------------------------------------------------------------- /scam-blockchain-gui/src/assets/fonts/ionicons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam-blockchain-gui/src/assets/fonts/ionicons.ttf -------------------------------------------------------------------------------- /scam-blockchain-gui/src/assets/fonts/ionicons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam-blockchain-gui/src/assets/fonts/ionicons.woff -------------------------------------------------------------------------------- /scam-blockchain-gui/src/assets/fonts/ionicons.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam-blockchain-gui/src/assets/fonts/ionicons.woff2 -------------------------------------------------------------------------------- /scam-blockchain-gui/src/assets/img/circle-cropped.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam-blockchain-gui/src/assets/img/circle-cropped.png -------------------------------------------------------------------------------- /scam-blockchain-gui/src/assets/img/scam.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam-blockchain-gui/src/assets/img/scam.icns -------------------------------------------------------------------------------- /scam-blockchain-gui/src/assets/img/scam.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam-blockchain-gui/src/assets/img/scam.ico -------------------------------------------------------------------------------- /scam-blockchain-gui/src/assets/img/scam.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam-blockchain-gui/src/assets/img/scam.png -------------------------------------------------------------------------------- /scam-blockchain-gui/src/assets/img/scam_circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam-blockchain-gui/src/assets/img/scam_circle.png -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/app/AppLoading.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { useSelector } from 'react-redux'; 3 | import { Spinner } from '@scam/core'; 4 | import { RootState } from '../../modules/rootReducer'; 5 | 6 | export default function AppLoading() { 7 | const showProgressIndicator = useSelector( 8 | (state: RootState) => state.progress.progress_indicator, 9 | ); 10 | 11 | return ; 12 | } 13 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/app/AppModalDialogs.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { useSelector } from 'react-redux'; 3 | import { ModalDialogs } from '@scam/core'; 4 | import { RootState } from '../../modules/rootReducer'; 5 | 6 | export default function AppModalDialogs() { 7 | const dialogs = useSelector((state: RootState) => state.dialog_state.dialogs); 8 | 9 | return ; 10 | } 11 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/app/AppTimeBombAlert.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { useSelector } from 'react-redux'; 3 | import { Trans } from '@lingui/macro'; 4 | import { Alert } from '@material-ui/lab'; 5 | import { RootState } from '../../modules/rootReducer'; 6 | 7 | const CRITICAL_HEIGHT = 4608 * 42; // 6 weeks 8 | 9 | export default function AppTimeBomb() { 10 | const peakHeight = useSelector( 11 | (state: RootState) => 12 | state.full_node_state.blockchain_state?.peak?.height ?? 0, 13 | ); 14 | 15 | const isVisible = peakHeight >= CRITICAL_HEIGHT; 16 | if (isVisible) { 17 | return ( 18 | 19 | 20 | This version of Scam is no longer compatible with the blockchain and 21 | can not safely farm. 22 | 23 | 24 | ); 25 | } 26 | 27 | return null; 28 | } 29 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/app/fonts/Fonts.tsx: -------------------------------------------------------------------------------- 1 | import { createGlobalStyle } from 'styled-components'; 2 | import '@fontsource/roboto/700.css'; 3 | import '@fontsource/roboto/500.css'; 4 | import '@fontsource/roboto/400.css'; 5 | import '@fontsource/roboto/300.css'; 6 | 7 | export default createGlobalStyle` 8 | body { 9 | font-family: "Roboto"; 10 | } 11 | `; 12 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/app/fonts/Roboto-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam-blockchain-gui/src/components/app/fonts/Roboto-Light.ttf -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/app/fonts/Roboto-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam-blockchain-gui/src/components/app/fonts/Roboto-Medium.ttf -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/app/fonts/Roboto-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam-blockchain-gui/src/components/app/fonts/Roboto-Regular.ttf -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/app/fonts/ionicons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam-blockchain-gui/src/components/app/fonts/ionicons.eot -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/app/fonts/ionicons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam-blockchain-gui/src/components/app/fonts/ionicons.ttf -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/app/fonts/ionicons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam-blockchain-gui/src/components/app/fonts/ionicons.woff -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/app/fonts/ionicons.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam-blockchain-gui/src/components/app/fonts/ionicons.woff2 -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/block/BlockTitle.tsx: -------------------------------------------------------------------------------- 1 | import React, { ReactNode } from 'react'; 2 | import { Flex } from '@scam/core'; 3 | import { ArrowBackIos as ArrowBackIosIcon } from '@material-ui/icons'; 4 | import { useHistory } from 'react-router-dom'; 5 | import styled from 'styled-components'; 6 | 7 | const BackIcon = styled(ArrowBackIosIcon)` 8 | font-size: 1.25rem; 9 | cursor: pointer; 10 | `; 11 | 12 | type Props = { 13 | children?: ReactNode; 14 | }; 15 | 16 | export default function BlockTitle(props: Props) { 17 | const { children } = props; 18 | const history = useHistory(); 19 | 20 | function handleGoBack() { 21 | history.push('/dashboard'); 22 | } 23 | 24 | return ( 25 | 26 | 27 | {children} 28 | 29 | ); 30 | } 31 | 32 | BlockTitle.defaultProps = { 33 | children: undefined, 34 | }; 35 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/Accordion/Accordion.tsx: -------------------------------------------------------------------------------- 1 | import React, { ReactNode } from 'react'; 2 | import { Collapse } from '@material-ui/core'; 3 | 4 | type Props = { 5 | children?: ReactNode; 6 | expanded?: boolean; 7 | }; 8 | 9 | export default function Accordion(props: Props) { 10 | const { expanded, children } = props; 11 | 12 | return {children}; 13 | } 14 | 15 | Accordion.defaultProps = { 16 | children: undefined, 17 | expanded: false, 18 | }; 19 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/Accordion/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Accordion'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/Address/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Address'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/AdvancedOptions/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './AdvancedOptions'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/AlertDialog/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './AlertDialog'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/Amount/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Amount'; 2 | export type { AmountProps } from './Amount'; 3 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/AspectRatio/AspectRatio.tsx: -------------------------------------------------------------------------------- 1 | import React, { ReactNode } from 'react'; 2 | import styled from 'styled-components'; 3 | import { Box } from '@material-ui/core'; 4 | 5 | const OuterWrapper = styled(({ ration, ...rest }) => )` 6 | position: relative; 7 | width: 100%; 8 | height: 0; 9 | padding-bottom: ${(props) => (1 / props.ratio) * 100}%; 10 | overflow: hidden; 11 | `; 12 | 13 | export const InnerWrapper = styled(Box)` 14 | position: absolute; 15 | top: 0; 16 | right: 0; 17 | bottom: 0; 18 | left: 0; 19 | `; 20 | 21 | type Props = { 22 | ratio: number; 23 | children: ReactNode; 24 | }; 25 | 26 | export default function AspectRatio(props: Props) { 27 | const { children, ratio } = props; 28 | 29 | return ( 30 | 31 | {children} 32 | 33 | ); 34 | } 35 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/AspectRatio/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './AspectRatio'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/Autocomplete/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Autocomplete'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/Button/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Button'; 2 | export type { ButtonProps } from './Button'; 3 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/ButtonLoading/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './ButtonLoading'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/ButtonSelected/ButtonSelected.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Button, ButtonProps } from '@scam/core'; 3 | import { Check as CheckIcon } from '@material-ui/icons'; 4 | 5 | type Props = ButtonProps & { 6 | selected?: boolean; 7 | }; 8 | 9 | export default function ButtonSelected(props: Props) { 10 | const { selected, children, ...rest } = props; 11 | const color = selected ? 'primary' : 'default'; 12 | 13 | return ( 14 | 23 | ); 24 | } 25 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/ButtonSelected/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './ButtonSelected'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/Card/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Card'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/CardHero/CardHero.tsx: -------------------------------------------------------------------------------- 1 | import React, { ReactNode } from 'react'; 2 | import styled from 'styled-components'; 3 | import { Card, CardContent } from '@material-ui/core'; 4 | import { Flex } from '@scam/core'; 5 | 6 | const StyledContent = styled(CardContent)` 7 | padding: ${({ theme }) => 8 | `${theme.spacing(5)}px ${theme.spacing(4)}px !important`}; 9 | `; 10 | 11 | type Props = { 12 | children?: ReactNode; 13 | }; 14 | 15 | export default function CardHero(props: Props) { 16 | const { children } = props; 17 | 18 | return ( 19 | 20 | 21 | 22 | {children} 23 | 24 | 25 | 26 | ); 27 | } 28 | 29 | CardHero.defaultProps = { 30 | children: undefined, 31 | }; 32 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/CardHero/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './CardHero'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/CardKeyValue/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './CardKeyValue'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/CardStep/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './CardStep'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/Checkbox/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Checkbox'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/ConfirmDialog/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './ConfirmDialog'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/CopyToClipboard/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './CopyToClipboard'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/DarkModeToggle/DarkModeToggle.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import useDarkMode from 'use-dark-mode'; 3 | import { IconButton } from '@material-ui/core'; 4 | import { Brightness4, Brightness7 } from '@material-ui/icons'; 5 | 6 | export default function DarkModeToggle() { 7 | const { toggle, value: darkMode } = useDarkMode(); 8 | 9 | function handleClick() { 10 | toggle(); 11 | } 12 | 13 | return ( 14 | 15 | {darkMode ? : } 16 | 17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/DarkModeToggle/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './DarkModeToggle'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/DialogActions/DialogActions.tsx: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components'; 2 | import { DialogActions } from '@material-ui/core'; 3 | 4 | export default styled(DialogActions)` 5 | padding: ${({ theme }) => `${theme.spacing(2)}px ${theme.spacing(3)}px`}; 6 | `; 7 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/DialogActions/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './DialogActions'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/Dropzone/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Dropzone'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/Fee/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Fee'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/Flex/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Flex'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/Form/Form.tsx: -------------------------------------------------------------------------------- 1 | import React, { ReactNode } from 'react'; 2 | import { UseFormMethods, FormProvider, SubmitHandler } from 'react-hook-form'; 3 | 4 | export default function Form(props: { 5 | methods: UseFormMethods; 6 | onSubmit: SubmitHandler; 7 | children: ReactNode; 8 | }) { 9 | const { methods, onSubmit, ...rest } = props; 10 | const { handleSubmit } = methods; 11 | 12 | return ( 13 | 14 |
15 | 16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/Form/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Form'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/FormBackButton/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './FormBackButton'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/FormatBytes/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './FormatBytes'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/FormatConnectionStatus/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './FormatConnectionStatus'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/FormatLargeNumber/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './FormatLargeNumber'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/GuestRoute/GuestRoute.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { useSelector } from 'react-redux'; 3 | import { Route, Redirect, RouteProps } from 'react-router-dom'; 4 | import type { RootState } from '../../../../modules/rootReducer'; 5 | 6 | type Props = RouteProps; 7 | 8 | export default function GuestRoute(props: Props) { 9 | const loggedIn = useSelector( 10 | (state: RootState) => state.wallet_state.logged_in, 11 | ); 12 | 13 | if (loggedIn) { 14 | return ; 15 | } 16 | 17 | return ; 18 | } 19 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/GuestRoute/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './GuestRoute'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/IconButton/IconButton.tsx: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components'; 2 | import { IconButton } from '@material-ui/core'; 3 | 4 | const StyledIconButton = styled(IconButton)` 5 | padding: 0.2rem; 6 | `; 7 | 8 | export default StyledIconButton; 9 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/IconButton/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './IconButton'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/Indicator/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Indicator'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/InputBase/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './InputBase'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/Link/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Link'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/Loading/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Loading'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/LocaleToggle/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './LocaleToggle'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/Log/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Log'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/Logo/Logo.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import styled from 'styled-components'; 3 | import { Box, BoxProps } from '@material-ui/core'; 4 | import { Scam } from '@scam/icons'; 5 | 6 | const StyledScam = styled(Scam)` 7 | max-width: 100%; 8 | width: auto; 9 | height: auto; 10 | `; 11 | 12 | export default function Logo(props: BoxProps) { 13 | return ( 14 | 15 | 16 | 17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/Logo/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Logo'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/ModalDialogs/ModalDialogs.tsx: -------------------------------------------------------------------------------- 1 | import React, { cloneElement } from 'react'; 2 | import type { Dialog } from '../../../../modules/dialog'; 3 | 4 | type Props = { 5 | dialogs: Dialog[]; 6 | }; 7 | 8 | export default function ModalDialogs(props: Props) { 9 | const { dialogs } = props; 10 | 11 | function handleClose(value: any, dialog: Dialog) { 12 | const { resolve, reject } = dialog; 13 | 14 | if (value instanceof Error) { 15 | reject(value); 16 | return; 17 | } 18 | 19 | resolve(value); 20 | } 21 | 22 | return ( 23 | <> 24 | {dialogs.map((dialog) => 25 | cloneElement( 26 | // @ts-ignore 27 | dialog.element, 28 | { 29 | key: dialog.id, 30 | open: true, 31 | onClose: (value: any) => handleClose(value, dialog), 32 | }, 33 | ), 34 | )} 35 | 36 | ); 37 | } 38 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/ModalDialogs/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './ModalDialogs'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/More/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './More'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/PrivateRoute/PrivateRoute.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { useSelector } from 'react-redux'; 3 | import { Route, Redirect, RouteProps } from 'react-router-dom'; 4 | import type { RootState } from '../../../../modules/rootReducer'; 5 | 6 | type Props = RouteProps; 7 | 8 | export default function PrivateRoute(props: Props) { 9 | const loggedIn = useSelector( 10 | (state: RootState) => state.wallet_state.logged_in, 11 | ); 12 | if (!loggedIn) { 13 | return ; 14 | } 15 | 16 | return ; 17 | } 18 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/PrivateRoute/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './PrivateRoute'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/RadioGroup/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './RadioGroup'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/Select/Select.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { get } from 'lodash'; 3 | import { Controller, useFormContext } from 'react-hook-form'; 4 | import { Select as MaterialSelect, SelectProps } from '@material-ui/core'; 5 | 6 | type Props = SelectProps & { 7 | hideError?: boolean; 8 | name: string; 9 | }; 10 | 11 | export default function Select(props: Props) { 12 | const { name, onChange, ...rest } = props; 13 | const { control, errors } = useFormContext(); 14 | const errorMessage = get(errors, name); 15 | 16 | return ( 17 | // @ts-ignore 18 | 25 | ); 26 | } 27 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/Select/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Select'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/SideBarItem/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './SideBarItem'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/Spinner/Spinner.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Backdrop, CircularProgress } from '@material-ui/core'; 3 | import styled from 'styled-components'; 4 | 5 | const StyledBackdrop = styled(Backdrop)` 6 | z-index: 2000; 7 | `; 8 | 9 | type Props = { 10 | show: boolean; 11 | }; 12 | 13 | export default function Spinner(props: Props) { 14 | const { show } = props; 15 | 16 | return ( 17 | 18 | 19 | 20 | ); 21 | } 22 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/Spinner/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Spinner'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/StateIndicator/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './StateIndicator'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/StateTypography/StateTypography.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import styled from 'styled-components'; 3 | import { Typography } from '@material-ui/core'; 4 | import State from '../../constants/State'; 5 | import StateColor from '../../constants/StateColor'; 6 | 7 | const Color = { 8 | [State.SUCCESS]: StateColor.SUCCESS, 9 | [State.WARNING]: StateColor.WARNING, 10 | [State.ERROR]: StateColor.ERROR, 11 | }; 12 | 13 | export default styled(({ state, ...rest }) => )` 14 | ${({ state }) => (state ? `color: ${Color[state]};` : '')} 15 | `; 16 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/StateTypography/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './StateTypography'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/Table/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Table'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/TextField/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './TextField'; 2 | export type { TextFieldProps } from './TextField'; 3 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/ThemeProvider/ThemeProvider.tsx: -------------------------------------------------------------------------------- 1 | import React, { ReactNode } from 'react'; 2 | import { CssBaseline } from '@material-ui/core'; 3 | import { 4 | ThemeProvider as MaterialThemeProvider, 5 | StylesProvider, 6 | } from '@material-ui/core/styles'; 7 | import { ThemeProvider as StyledThemeProvider } from 'styled-components'; 8 | 9 | type Props = { 10 | children: ReactNode; 11 | theme: Object; 12 | }; 13 | 14 | export default function ThemeProvider(props: Props) { 15 | const { children, theme } = props; 16 | 17 | return ( 18 | 19 | 20 | 21 | <> 22 | 23 | {children} 24 | 25 | 26 | 27 | 28 | ); 29 | } 30 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/ThemeProvider/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './ThemeProvider'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/ToolbarSpacing/ToolbarSpacing.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { makeStyles, Theme, createStyles } from '@material-ui/core/styles'; 3 | 4 | const useStyles = makeStyles((theme: Theme) => 5 | createStyles({ 6 | toolbar: theme.mixins.toolbar, 7 | }), 8 | ); 9 | 10 | export default function ToolbarSpacing() { 11 | const classes = useStyles(); 12 | 13 | return
; 14 | } 15 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/ToolbarSpacing/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './ToolbarSpacing'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/Tooltip/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Tooltip'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/TooltipIcon/TooltipIcon.tsx: -------------------------------------------------------------------------------- 1 | import React, { ReactElement } from 'react'; 2 | import styled from 'styled-components'; 3 | import { Help as HelpIcon } from '@material-ui/icons'; 4 | import { Tooltip } from '@material-ui/core'; 5 | 6 | const StyledHelpIcon = styled(HelpIcon)` 7 | color: ${({ theme }) => 8 | theme.palette.type === 'dark' ? '#c8c8c8' : '#757575'}; 9 | font-size: 1rem; 10 | `; 11 | 12 | type Props = { 13 | children?: ReactElement; 14 | interactive?: boolean; 15 | }; 16 | 17 | export default function TooltipIcon(props: Props) { 18 | const { children, interactive } = props; 19 | if (!children) { 20 | return null; 21 | } 22 | 23 | return ( 24 | 25 | 26 | 27 | ); 28 | } 29 | 30 | TooltipIcon.defaultProps = { 31 | children: undefined, 32 | }; 33 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/TooltipIcon/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './TooltipIcon'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/TooltipTypography/TooltipTypography.tsx: -------------------------------------------------------------------------------- 1 | import React, { ReactElement } from 'react'; 2 | import { Typography, TypographyProps } from '@material-ui/core'; 3 | import Flex from '../Flex'; 4 | import TooltipIcon from '../TooltipIcon'; 5 | 6 | type Props = TypographyProps & { 7 | title: ReactElement; 8 | }; 9 | 10 | export default function TooltipTypography(props: Props) { 11 | const { title, ...rest } = props; 12 | 13 | return ( 14 | 15 | 16 | {title} 17 | 18 | ); 19 | } 20 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/TooltipTypography/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './TooltipTypography'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/UnitFormat/UnitFormat.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import useCurrencyCode from '../../../../hooks/useCurrencyCode'; 3 | import State from '../../constants/State'; 4 | import StateTypography from '../StateTypography'; 5 | 6 | type Props = { 7 | value: number; 8 | variant?: string; 9 | state?: State; 10 | }; 11 | 12 | export default function UnitFormat(props: Props) { 13 | const { value, variant, state, ...rest } = props; 14 | const currencyCode = useCurrencyCode(); 15 | 16 | return ( 17 | 18 | {`${value} ${currencyCode}`} 19 | 20 | ); 21 | } 22 | 23 | UnitFormat.defaultProps = { 24 | variant: 'body1', 25 | }; 26 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/components/UnitFormat/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './UnitFormat'; 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/constants/CurrencyCode.ts: -------------------------------------------------------------------------------- 1 | import Unit from './Unit'; 2 | import { IS_MAINNET } from './constants'; 3 | 4 | export default { 5 | [Unit.SCAM]: IS_MAINNET ? 'SCM' : 'TSCM', 6 | }; 7 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/constants/State.ts: -------------------------------------------------------------------------------- 1 | enum State { 2 | SUCCESS = 'SUCCESS', 3 | WARNING = 'WARNING', 4 | ERROR = 'ERROR', 5 | } 6 | 7 | export default State; 8 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/constants/StateColor.ts: -------------------------------------------------------------------------------- 1 | enum StateColor { 2 | SUCCESS = '#3AAC59', 3 | WARNING = '#F7CA3E', 4 | ERROR = '#F44336', 5 | } 6 | 7 | export default StateColor; 8 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/constants/Unit.ts: -------------------------------------------------------------------------------- 1 | enum Unit { 2 | SCAM = 'SCAM', 3 | MOJO = 'MOJO', 4 | COLOURED_COIN = 'COLOUREDCOIN', 5 | } 6 | 7 | export default Unit; 8 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/constants/constants.ts: -------------------------------------------------------------------------------- 1 | export const IS_MAINNET = process.env.REACT_APP_TESTNET !== 'true'; // eslint-disable-line 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/constants/index.ts: -------------------------------------------------------------------------------- 1 | export { default as State } from './State'; 2 | export { default as StateColor } from './StateColor'; 3 | export { default as Unit } from './Unit'; 4 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/index.ts: -------------------------------------------------------------------------------- 1 | export * from './components'; 2 | export * from './constants'; 3 | export * from './utils'; 4 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/utils/index.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam-blockchain-gui/src/components/core/utils/index.ts -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/core/utils/unitFormat.ts: -------------------------------------------------------------------------------- 1 | import Unit from '../constants/Unit'; 2 | import CurrencyCode from '../constants/CurrencyCode'; 3 | 4 | type Options = { 5 | from?: Unit; 6 | to?: Unit; 7 | currencyCode?: boolean; 8 | }; 9 | 10 | const defaultOptions = { 11 | to: Unit.SCAM, 12 | from: Unit.SCAM, 13 | }; 14 | 15 | export default function unitFormat(value: number, options: Options): string { 16 | const { to, currencyCode } = { 17 | ...defaultOptions, 18 | ...options, 19 | }; 20 | 21 | const updatedValue = value; 22 | 23 | if (currencyCode) { 24 | // @ts-ignore 25 | const code = CurrencyCode[to]; 26 | if (!code) { 27 | throw new Error(`Currency code is not defined for ${to}`); 28 | } 29 | 30 | return `${updatedValue} ${code}`; 31 | } 32 | 33 | return String(updatedValue); 34 | } 35 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/dashboard/DashboardTitle.tsx: -------------------------------------------------------------------------------- 1 | import React, { ReactNode } from 'react'; 2 | import { Typography } from '@material-ui/core'; 3 | import { Flex } from '@scam/core'; 4 | import { createTeleporter } from 'react-teleporter'; 5 | 6 | const DashboardTitleTeleporter = createTeleporter(); 7 | 8 | export function DashboardTitleTarget() { 9 | return ( 10 | 11 | 12 | 13 | ); 14 | } 15 | 16 | type Props = { 17 | children?: ReactNode; 18 | }; 19 | 20 | export default function DashboardTitle(props: Props) { 21 | const { children } = props; 22 | 23 | return ( 24 | 25 | {children} 26 | 27 | ); 28 | } 29 | 30 | DashboardTitle.defaultProps = { 31 | children: undefined, 32 | }; 33 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/farm/FarmCloseConnection.tsx: -------------------------------------------------------------------------------- 1 | import { useDispatch } from 'react-redux'; 2 | import { closeConnection } from '../../modules/farmerMessages'; 3 | 4 | type Props = { 5 | nodeId: string; 6 | children: (props: { onClose: () => void }) => JSX.Element; 7 | }; 8 | 9 | export default function FarmCloseConnection(props: Props): JSX.Element { 10 | const { nodeId, children } = props; 11 | const dispatch = useDispatch(); 12 | 13 | function handleClose() { 14 | dispatch(closeConnection(nodeId)); 15 | } 16 | 17 | return children({ 18 | onClose: handleClose, 19 | }); 20 | } 21 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/farm/card/FarmCardLastHeightFarmed.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Trans } from '@lingui/macro'; 3 | import { FormatLargeNumber } from '@scam/core'; 4 | import { useSelector } from 'react-redux'; 5 | import type { RootState } from '../../../modules/rootReducer'; 6 | import FarmCard from './FarmCard'; 7 | 8 | export default function FarmCardLastHeightFarmed() { 9 | const loading = useSelector( 10 | (state: RootState) => !state.wallet_state.farmed_amount, 11 | ); 12 | 13 | const lastHeightFarmed = useSelector( 14 | (state: RootState) => state.wallet_state.farmed_amount?.last_height_farmed, 15 | ); 16 | 17 | return ( 18 | Last Height Farmed} 20 | value={} 21 | description={!lastHeightFarmed && No blocks farmed yet} 22 | loading={loading} 23 | /> 24 | ); 25 | } 26 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/farm/card/FarmCardNotAvailable.tsx: -------------------------------------------------------------------------------- 1 | import React, { ReactNode } from 'react'; 2 | import { Trans } from '@lingui/macro'; 3 | import { State, StateIndicator } from '@scam/core'; 4 | import FarmCard from './FarmCard'; 5 | 6 | type Props = { 7 | title: ReactNode; 8 | state?: State; 9 | }; 10 | 11 | export default function FarmCardNotAvailable(props: Props) { 12 | const { title, state } = props; 13 | 14 | return ( 15 | 20 | Not Available 21 | 22 | ) : ( 23 | Not Available 24 | ) 25 | } 26 | description={Wait for synchronization} 27 | valueColor="initial" 28 | /> 29 | ); 30 | } 31 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/farm/card/FarmCardPlotCount.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Trans } from '@lingui/macro'; 3 | import { FormatLargeNumber } from '@scam/core'; 4 | import FarmCard from './FarmCard'; 5 | import usePlots from '../../../hooks/usePlots'; 6 | 7 | export default function FarmCardPlotCount() { 8 | const { uniquePlots } = usePlots(); 9 | 10 | return ( 11 | Plot Count} 13 | value={} 14 | loading={!uniquePlots} 15 | /> 16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/farm/card/FarmCardTotalNetworkSpace.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Trans } from '@lingui/macro'; 3 | import { useSelector } from 'react-redux'; 4 | import { FormatBytes } from '@scam/core'; 5 | import type { RootState } from '../../../modules/rootReducer'; 6 | import FarmCard from './FarmCard'; 7 | 8 | export default function FarmCardTotalNetworkSpace() { 9 | const totalNetworkSpace = useSelector( 10 | (state: RootState) => state.full_node_state.blockchain_state?.space ?? 0, 11 | ); 12 | 13 | return ( 14 | Total Network Space} 16 | value={} 17 | description={Best estimate over last 24 hours} 18 | /> 19 | ); 20 | } 21 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/farm/card/FarmCardTotalSizeOfPlots.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Trans } from '@lingui/macro'; 3 | import { FormatBytes } from '@scam/core'; 4 | import usePlots from '../../../hooks/usePlots'; 5 | import FarmCard from './FarmCard'; 6 | 7 | export default function FarmCardTotalSizeOfPlots() { 8 | const { size } = usePlots(); 9 | 10 | return ( 11 | Total Size of Plots} 13 | value={} 14 | /> 15 | ); 16 | } 17 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/fullNode/card/FullNodeCardConnectionStatus.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Trans } from '@lingui/macro'; 3 | import { useSelector } from 'react-redux'; 4 | import FarmCard from '../../farm/card/FarmCard'; 5 | import type { RootState } from '../../../modules/rootReducer'; 6 | 7 | export default function FullNodeCardConnectionStatus() { 8 | const connected = useSelector( 9 | (state: RootState) => state.daemon_state.full_node_connected, 10 | ); 11 | 12 | return ( 13 | Connection Status} 16 | value={ 17 | connected ? Connected : Not connected 18 | } 19 | /> 20 | ); 21 | } 22 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/fullNode/card/FullNodeCardDifficulty.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Trans } from '@lingui/macro'; 3 | import { useSelector } from 'react-redux'; 4 | import FarmCard from '../../farm/card/FarmCard'; 5 | import { FormatLargeNumber } from '@scam/core'; 6 | import type { RootState } from '../../../modules/rootReducer'; 7 | 8 | export default function FullNodeCardDifficulty() { 9 | const state = useSelector( 10 | (state: RootState) => state.full_node_state.blockchain_state, 11 | ); 12 | 13 | const loading = !state; 14 | const value = state?.difficulty; 15 | 16 | return ( 17 | Difficulty} 21 | value={} 22 | /> 23 | ); 24 | } 25 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/fullNode/card/FullNodeCardNetworkName.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Trans } from '@lingui/macro'; 3 | import { useSelector } from 'react-redux'; 4 | import FarmCard from '../../farm/card/FarmCard'; 5 | import type { RootState } from '../../../modules/rootReducer'; 6 | 7 | export default function FullNodeCardNetworkName() { 8 | const networkInfo = useSelector( 9 | (state: RootState) => state.wallet_state.network_info, 10 | ); 11 | 12 | const loading = !networkInfo; 13 | const networkName = networkInfo?.network_name; 14 | 15 | return ( 16 | Network Name} 20 | value={networkName} 21 | /> 22 | ); 23 | } 24 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/fullNode/card/FullNodeCardPeakHeight.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Trans } from '@lingui/macro'; 3 | import { useSelector } from 'react-redux'; 4 | import FarmCard from '../../farm/card/FarmCard'; 5 | import { FormatLargeNumber } from '@scam/core'; 6 | import { RootState } from '../../../modules/rootReducer'; 7 | 8 | export default function FullNodeCardPeakHeight() { 9 | const state = useSelector( 10 | (state: RootState) => state.full_node_state.blockchain_state, 11 | ); 12 | 13 | const loading = !state; 14 | const value = state?.peak?.height ?? 0; 15 | 16 | return ( 17 | Peak Height} 21 | value={} 22 | /> 23 | ); 24 | } 25 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/fullNode/card/FullNodeCardPeakTime.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Trans } from '@lingui/macro'; 3 | import { useSelector } from 'react-redux'; 4 | import FarmCard from '../../farm/card/FarmCard'; 5 | import { unix_to_short_date } from '../../../util/utils'; 6 | import type { RootState } from '../../../modules/rootReducer'; 7 | 8 | export default function FullNodeCardPeakTime() { 9 | const latestPeakTimestamp = useSelector( 10 | (state: RootState) => state.full_node_state?.latest_peak_timestamp, 11 | ); 12 | 13 | const value = latestPeakTimestamp 14 | ? unix_to_short_date(latestPeakTimestamp) 15 | : ''; 16 | 17 | const loading = latestPeakTimestamp === undefined; 18 | 19 | return ( 20 | Peak Time} 24 | tooltip={This is the time of the latest peak sub block.} 25 | value={value} 26 | /> 27 | ); 28 | } 29 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/fullNode/card/FullNodeCardTotalIterations.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Trans } from '@lingui/macro'; 3 | import { useSelector } from 'react-redux'; 4 | import FarmCard from '../../farm/card/FarmCard'; 5 | import { FormatLargeNumber } from '@scam/core'; 6 | import type { RootState } from '../../../modules/rootReducer'; 7 | 8 | export default function FullNodeCardTotalIterations() { 9 | const state = useSelector( 10 | (state: RootState) => state.full_node_state.blockchain_state, 11 | ); 12 | 13 | const loading = !state?.peak; 14 | const value = state?.peak?.total_iters ?? 0; 15 | 16 | return ( 17 | Total Iterations} 21 | tooltip={ 22 | Total iterations since the start of the blockchain 23 | } 24 | value={} 25 | /> 26 | ); 27 | } 28 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/fullNode/card/FullNodeCardVDFSubSlotIterations.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Trans } from '@lingui/macro'; 3 | import { useSelector } from 'react-redux'; 4 | import FarmCard from '../../farm/card/FarmCard'; 5 | import { FormatLargeNumber } from '@scam/core'; 6 | import { RootState } from '../../../modules/rootReducer'; 7 | 8 | export default function FullNodeCardVDFSubSlotIterations() { 9 | const state = useSelector( 10 | (state: RootState) => state.full_node_state.blockchain_state, 11 | ); 12 | 13 | const loading = !state; 14 | const value = state?.sub_slot_iters; 15 | 16 | return ( 17 | VDF Sub Slot Iterations} 21 | value={} 22 | /> 23 | ); 24 | } 25 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/fullNode/card/FullNodeEstimatedNetworkSpace.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Trans } from '@lingui/macro'; 3 | import { useSelector } from 'react-redux'; 4 | import FarmCard from '../../farm/card/FarmCard'; 5 | import { FormatBytes } from '@scam/core'; 6 | import { RootState } from '../../../modules/rootReducer'; 7 | 8 | export default function FullNodeEstimatedNetworkSpace() { 9 | const state = useSelector( 10 | (state: RootState) => state.full_node_state.blockchain_state, 11 | ); 12 | 13 | const loading = state?.space === undefined; 14 | const value = state?.space; 15 | 16 | return ( 17 | Estimated Network Space} 21 | tooltip={ 22 | 23 | Estimated sum of all the plotted disk space of all farmers in the 24 | network 25 | 26 | } 27 | value={value && } 28 | /> 29 | ); 30 | } 31 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/icons/Farm.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { SvgIcon, SvgIconProps } from '@material-ui/core'; 3 | import { ReactComponent as FarmIcon } from './images/farm.svg'; 4 | 5 | export default function Farm(props: SvgIconProps) { 6 | return ; 7 | } 8 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/icons/Home.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { SvgIcon, SvgIconProps } from '@material-ui/core'; 3 | import styled from 'styled-components'; 4 | import { ReactComponent as HomeIcon } from './images/home.svg'; 5 | 6 | function getColor({ theme, color }) { 7 | if (color !== 'inherit') { 8 | return color; 9 | } 10 | return theme.palette.type === 'dark' ? 'white' : '#757575'; 11 | } 12 | 13 | const StyledHomeIcon = styled(HomeIcon)` 14 | path { 15 | stroke: ${getColor}; 16 | stroke-width: 2; 17 | } 18 | `; 19 | 20 | export default function Home(props: SvgIconProps) { 21 | return ; 22 | } 23 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/icons/Keys.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { SvgIcon, SvgIconProps } from '@material-ui/core'; 3 | import { ReactComponent as KeysIcon } from './images/keys.svg'; 4 | 5 | export default function Keys(props: SvgIconProps) { 6 | return ; 7 | } 8 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/icons/Plot.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { SvgIcon, SvgIconProps } from '@material-ui/core'; 3 | import { ReactComponent as PlotIcon } from './images/plot.svg'; 4 | 5 | export default function Plot(props: SvgIconProps) { 6 | return ; 7 | } 8 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/icons/PlotHero.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { SvgIcon, SvgIconProps } from '@material-ui/core'; 3 | import { ReactComponent as PlotHeroIcon } from './images/PlotHero.svg'; 4 | 5 | export default function PlotHero(props: SvgIconProps) { 6 | return ; 7 | } 8 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/icons/Pool.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { SvgIcon, SvgIconProps } from '@material-ui/core'; 3 | import { ReactComponent as FarmIcon } from './images/pool.svg'; 4 | 5 | export default function Farm(props: SvgIconProps) { 6 | return ; 7 | } 8 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/icons/Status.tsx: -------------------------------------------------------------------------------- 1 | import React, { forwardRef } from 'react'; 2 | import styled from 'styled-components'; 3 | import { StateColor } from '@scam/core'; 4 | import { FiberManualRecord as FiberManualRecordIcon } from '@material-ui/icons'; 5 | 6 | const StyledFiberManualRecordIcon = styled(({ color, ...rest }) => ( 7 | 8 | ))` 9 | font-size: 1rem; 10 | color: ${({ color }) => color}; 11 | `; 12 | 13 | type Props = { 14 | color: StateColor; 15 | }; 16 | 17 | // @ts-ignore 18 | function Status(props: Props, ref) { 19 | const { color } = props; 20 | 21 | return ( 22 |
23 | 24 |
25 | ); 26 | } 27 | 28 | export default forwardRef(Status); 29 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/icons/Trade.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { SvgIcon, SvgIconProps } from '@material-ui/core'; 3 | import { ReactComponent as TradeIcon } from './images/trade.svg'; 4 | 5 | export default function Trade(props: SvgIconProps) { 6 | return ; 7 | } 8 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/icons/Wallet.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { SvgIcon, SvgIconProps } from '@material-ui/core'; 3 | import { ReactComponent as WalletIcon } from './images/wallet.svg'; 4 | 5 | export default function Wallet(props: SvgIconProps) { 6 | return ; 7 | } 8 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/icons/images/home.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/icons/index.ts: -------------------------------------------------------------------------------- 1 | export { default as Scam } from './scam'; 2 | export { default as Farm } from './Farm'; 3 | export { default as Home } from './Home'; 4 | export { default as Keys } from './Keys'; 5 | export { default as Plot } from './Plot'; 6 | export { default as Pool } from './Pool'; 7 | export { default as PlotHero } from './PlotHero'; 8 | export { default as Status } from './Status'; 9 | export { default as Trade } from './Trade'; 10 | export { default as Wallet } from './Wallet'; 11 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/icons/scam.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { SvgIcon, SvgIconProps } from '@material-ui/core'; 3 | import { ReactComponent as ScamIcon } from './images/scam.svg'; 4 | 5 | export default function Keys(props: SvgIconProps) { 6 | return ; 7 | } 8 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/layout/LayoutLoading.tsx: -------------------------------------------------------------------------------- 1 | import React, { ReactNode } from 'react'; 2 | import { Typography } from '@material-ui/core'; 3 | import { Loading } from '@scam/core'; 4 | import LayoutHero from './LayoutHero'; 5 | 6 | type Props = { 7 | children?: ReactNode; 8 | }; 9 | 10 | export default function LayoutLoading(props: Props) { 11 | const { children } = props; 12 | 13 | return ( 14 | 15 | {children} 16 | 17 | 18 | ); 19 | } 20 | 21 | LayoutLoading.defaultProps = { 22 | children: undefined, 23 | }; 24 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/plot/queue/PlotQueueSize.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import plotSizes from '../../../constants/plotSizes'; 3 | import type PlotQueueItem from '../../../types/PlotQueueItem'; 4 | 5 | type Props = { 6 | queueItem: PlotQueueItem; 7 | }; 8 | 9 | export default function PlotQueueSize(props: Props) { 10 | const { 11 | queueItem: { size }, 12 | } = props; 13 | const item = plotSizes.find((item) => item.value === size); 14 | if (!item) { 15 | return null; 16 | } 17 | 18 | return <>{`K-${size}, ${item.label}`}; 19 | } 20 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/plotNFT/PlotNFTExternalState.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Trans } from '@lingui/macro'; 3 | import { Typography } from '@material-ui/core'; 4 | import type PlotNFTExternal from '../../types/PlotNFTExternal'; 5 | 6 | type Props = { 7 | nft: PlotNFTExternal; 8 | }; 9 | 10 | export default function PlotNFTExternalState(props: Props) { 11 | const { 12 | nft: { 13 | pool_state: { 14 | pool_config: { pool_url }, 15 | }, 16 | }, 17 | } = props; 18 | 19 | const isSelfPooling = !pool_url; 20 | 21 | return ( 22 | 23 | {isSelfPooling && Self Pooling} 24 | {!isSelfPooling && Pooling} 25 | 26 | ); 27 | } 28 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/pool/PoolAbsorbRewards.tsx: -------------------------------------------------------------------------------- 1 | import { useHistory } from 'react-router'; 2 | import type PlotNFT from '../../types/PlotNFT'; 3 | import usePlotNFTDetails from '../../hooks/usePlotNFTDetails'; 4 | 5 | type Props = { 6 | nft: PlotNFT; 7 | children: (data: { 8 | absorb: () => Promise; 9 | disabled: boolean; 10 | }) => JSX.Element; 11 | }; 12 | 13 | export default function PoolAbsorbRewards(props: Props) { 14 | const { 15 | children, 16 | nft, 17 | nft: { 18 | pool_state: { p2_singleton_puzzle_hash }, 19 | }, 20 | } = props; 21 | const { canEdit } = usePlotNFTDetails(nft); 22 | const history = useHistory(); 23 | 24 | async function handleAbsorbRewards() { 25 | if (!canEdit) { 26 | return; 27 | } 28 | 29 | history.push(`/dashboard/pool/${p2_singleton_puzzle_hash}/absorb-rewards`); 30 | } 31 | 32 | return children({ 33 | absorb: handleAbsorbRewards, 34 | disabled: !canEdit, 35 | }); 36 | } 37 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/pool/PoolHeader.tsx: -------------------------------------------------------------------------------- 1 | import { createTeleporter } from 'react-teleporter'; 2 | 3 | const PoolHeaderTeleporter = createTeleporter(); 4 | 5 | export const PoolHeaderSource = PoolHeaderTeleporter.Source; 6 | 7 | export const PoolHeaderTarget = PoolHeaderTeleporter.Target; 8 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/components/wallet/WalletStatusHeight.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { useSelector } from 'react-redux'; 3 | import { FormatLargeNumber } from '@scam/core'; 4 | import type { RootState } from '../../modules/rootReducer'; 5 | 6 | export default function WalletStatusHeight() { 7 | const walletState = useSelector((state: RootState) => state.wallet_state); 8 | 9 | const currentHeight = walletState?.status?.height; 10 | 11 | if (currentHeight === undefined || currentHeight === null) { 12 | return null; 13 | } 14 | 15 | return ( 16 | <> 17 | {'('} 18 | 19 | {')'} 20 | 21 | ); 22 | } 23 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/config/config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | local_test: process.env.LOCAL_TEST === 'true', 3 | backup_host: 'https://backup.scamnetwork.net', 4 | }; 5 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/config/env.ts: -------------------------------------------------------------------------------- 1 | import dotenv from 'dotenv'; 2 | 3 | dotenv.config(); 4 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/constants/FarmerStatus.ts: -------------------------------------------------------------------------------- 1 | enum FarmerStatus { 2 | FARMING = 'FARMING', 3 | SYNCHING = 'SYNCHING', 4 | NOT_AVAILABLE = 'NOT_AVAILABLE', 5 | NOT_CONNECTED = 'NOT_CONNECTED', 6 | NOT_RUNNING = 'NOT_RUNNING', 7 | } 8 | 9 | export default FarmerStatus; 10 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/constants/FullNodeState.ts: -------------------------------------------------------------------------------- 1 | enum FullNodeState { 2 | SYNCHING = 'SYNCHING', 3 | ERROR = 'ERROR', 4 | SYNCED = 'SYNCED', 5 | } 6 | 7 | export default FullNodeState; 8 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/constants/PlotNFTState.ts: -------------------------------------------------------------------------------- 1 | // PoolSingletonState 2 | 3 | enum PlotNFTState { 4 | SELF_POOLING = 1, 5 | LEAVING_POOL = 2, 6 | FARMING_TO_POOL = 3, 7 | } 8 | 9 | export default PlotNFTState; 10 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/constants/PlotStatus.ts: -------------------------------------------------------------------------------- 1 | enum PlotStatus { 2 | SUBMITTED = 'SUBMITTED', 3 | RUNNING = 'RUNNING', 4 | REMOVING = 'REMOVING', 5 | FINISHED = 'FINISHED', 6 | } 7 | 8 | export default PlotStatus; 9 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/constants/SyncingStatus.ts: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line 2 | enum SyncingStatus { 3 | SYNCING = 'SYNCING', 4 | SYNCED = 'SYNCED', 5 | NOT_SYNCED = 'NOT_SYNCED', 6 | } 7 | 8 | export default SyncingStatus; 9 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/constants/TransactionType.ts: -------------------------------------------------------------------------------- 1 | enum TransactionType { 2 | INCOMING = 0, 3 | OUTGOING = 1, 4 | COINBASE_REWARD = 2, 5 | FEE_REWARD = 3, 6 | INCOMING_TRADE = 4, 7 | OUTGOING_TRADE = 5, 8 | } 9 | 10 | export default TransactionType; 11 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/constants/WalletType.ts: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line 2 | enum WalletType { 3 | STANDARD_WALLET = 0, 4 | RATE_LIMITED = 1, 5 | ATOMIC_SWAP = 2, 6 | AUTHORIZED_PAYEE = 3, 7 | MULTI_SIG = 4, 8 | CUSTODY = 5, 9 | COLOURED_COIN = 6, 10 | RECOVERABLE = 7, 11 | DISTRIBUTED_ID = 8, 12 | POOLING_WALLET = 9, 13 | } 14 | 15 | export default WalletType; 16 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/constants/plotSizes.ts: -------------------------------------------------------------------------------- 1 | type PlotSize = { 2 | label: string; 3 | value: number; 4 | workspace: string; 5 | defaultRam: number; 6 | }; 7 | 8 | export const defaultPlotSize: PlotSize = { 9 | label: '101.4GiB', 10 | value: 32, 11 | workspace: '239GiB', 12 | defaultRam: 3390, 13 | }; 14 | 15 | const plotSizes: PlotSize[] = [ 16 | { label: '600MiB', value: 25, workspace: '1.8GiB', defaultRam: 512 }, 17 | defaultPlotSize, 18 | { label: '208.8GiB', value: 33, workspace: '521GiB', defaultRam: 7400 }, 19 | // workspace are guesses using 55.35% - rounded up - past here 20 | { label: '429.8GiB', value: 34, workspace: '1041GiB', defaultRam: 14800 }, 21 | { label: '884.1GiB', value: 35, workspace: '2175GiB', defaultRam: 29600 }, 22 | ]; 23 | 24 | export const plotSizeOptions = plotSizes.map((item) => ({ 25 | value: item.value, 26 | label: `${item.label} (k=${item.value}, temporary space: ${item.workspace})`, 27 | })); 28 | 29 | export default plotSizes; 30 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/dev_config.js: -------------------------------------------------------------------------------- 1 | const dev_config = { 2 | redux_tool: null, 3 | react_tool: null, 4 | }; 5 | 6 | module.exports = dev_config; 7 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/electron/preload.js: -------------------------------------------------------------------------------- 1 | const electron = require('electron'); 2 | 3 | window.remote = electron.remote; 4 | window.ipcRenderer = electron.ipcRenderer; 5 | window.shell = electron.shell; 6 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/fonts.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.woff'; 2 | declare module '*.woff2'; 3 | declare module '*.ttf'; 4 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/hocs/WebsocketConnection.js: -------------------------------------------------------------------------------- 1 | import { useDispatch, useSelector } from 'react-redux'; 2 | import { wsConnect, wsConnecting } from '../modules/websocket'; 3 | 4 | const WebSocketConnection = (props) => { 5 | const dispatch = useDispatch(); 6 | const connected = useSelector((state) => state.websocket.connected); 7 | const connecting = useSelector((state) => state.websocket.connecting); 8 | 9 | if (!connected && !connecting) { 10 | dispatch(wsConnecting()); 11 | const { host } = props; 12 | dispatch(wsConnect(host)); 13 | } 14 | 15 | return props.children; 16 | }; 17 | 18 | export default WebSocketConnection; 19 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/hooks/useCurrencyCode.ts: -------------------------------------------------------------------------------- 1 | import { useSelector } from 'react-redux'; 2 | import type { RootState } from '../modules/rootReducer'; 3 | 4 | export default function useCurrencyCode(): string | undefined { 5 | const networkPrefix = useSelector( 6 | (state: RootState) => state.wallet_state.network_info?.network_prefix, 7 | ); 8 | 9 | return networkPrefix && networkPrefix.toUpperCase(); 10 | } 11 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/hooks/useFullNodeState.ts: -------------------------------------------------------------------------------- 1 | import { useSelector } from 'react-redux'; 2 | import type { RootState } from '../modules/rootReducer'; 3 | import FullNodeState from '../constants/FullNodeState'; 4 | 5 | export default function useFullNodeState(): FullNodeState { 6 | const blockchainSynced = useSelector( 7 | (state: RootState) => 8 | !!state.full_node_state.blockchain_state?.sync?.synced, 9 | ); 10 | const blockchainSynching = useSelector( 11 | (state: RootState) => 12 | !!state.full_node_state.blockchain_state?.sync?.sync_mode, 13 | ); 14 | 15 | if (blockchainSynching) { 16 | return FullNodeState.SYNCHING; 17 | } 18 | 19 | if (!blockchainSynced) { 20 | return FullNodeState.ERROR; 21 | } 22 | 23 | return FullNodeState.SYNCED; 24 | } 25 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/hooks/useIsMainnet.tsx: -------------------------------------------------------------------------------- 1 | import { useSelector } from 'react-redux'; 2 | import type { RootState } from '../modules/rootReducer'; 3 | 4 | export default function useIsMainnet(): boolean | undefined { 5 | const networkPrefix = useSelector( 6 | (state: RootState) => state.wallet_state.network_info?.network_prefix, 7 | ); 8 | 9 | if (!networkPrefix) { 10 | return undefined; 11 | } 12 | 13 | return networkPrefix.toLowerCase() === 'scm'; 14 | } 15 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/hooks/useLocale.ts: -------------------------------------------------------------------------------- 1 | import { useLocalStorage, writeStorage } from '@rehooks/local-storage'; 2 | 3 | export default function useLocale( 4 | defaultLocale: string, 5 | ): [string, (locale: string) => void] { 6 | let [locale] = useLocalStorage('locale', defaultLocale); 7 | 8 | if (locale && locale.length === 2) { 9 | locale = defaultLocale; 10 | } 11 | 12 | function handleSetLocale(locale: string) { 13 | writeStorage('locale', locale); 14 | } 15 | 16 | return [locale, handleSetLocale]; 17 | } 18 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/hooks/useOpenDialog.ts: -------------------------------------------------------------------------------- 1 | import { ReactNode } from 'react'; 2 | import { useDispatch } from 'react-redux'; 3 | import { openDialog } from '../modules/dialog'; 4 | 5 | export default function useOpenDialog() { 6 | const dispatch = useDispatch(); 7 | 8 | function handleOpen(dialog: ReactNode): Promise { 9 | return dispatch(openDialog(dialog)); 10 | } 11 | 12 | return handleOpen; 13 | } 14 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/hooks/useOpenExternal.ts: -------------------------------------------------------------------------------- 1 | import isElectron from 'is-electron'; 2 | 3 | export default function useOpenExternal(): (url: string) => void { 4 | function handleOpen(url: string) { 5 | if (isElectron()) { 6 | // @ts-ignore 7 | window.shell.openExternal(url); 8 | return; 9 | } 10 | 11 | window.open(url, '_blank'); 12 | } 13 | 14 | return handleOpen; 15 | } 16 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/hooks/usePeak.ts: -------------------------------------------------------------------------------- 1 | import { useSelector } from 'react-redux'; 2 | import { RootState } from '../modules/rootReducer'; 3 | import type Peak from '../types/Peak'; 4 | 5 | export default function usePeak(): { 6 | peak?: Peak; 7 | loading: boolean; 8 | } { 9 | const height = useSelector( 10 | (state: RootState) => state.full_node_state.blockchain_state?.peak?.height, 11 | ); 12 | 13 | const timestamp = useSelector( 14 | (state: RootState) => state.full_node_state.latest_peak_timestamp, 15 | ); 16 | 17 | const loading = height === undefined || timestamp === undefined; 18 | 19 | return { 20 | peak: loading 21 | ? undefined 22 | : { 23 | height, 24 | timestamp, 25 | }, 26 | loading, 27 | }; 28 | } 29 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/hooks/usePlotNFTName.ts: -------------------------------------------------------------------------------- 1 | import { useMemo } from 'react'; 2 | import seedrandom from 'seedrandom'; 3 | import { 4 | uniqueNamesGenerator, 5 | adjectives, 6 | colors, 7 | animals, 8 | } from 'unique-names-generator'; 9 | import type PlotNFTExternal from '../types/PlotNFTExternal'; 10 | import type PlotNFT from '../types/PlotNFT'; 11 | 12 | export default function usePlotNFTName(nft: PlotNFT | PlotNFTExternal): string { 13 | const name = useMemo(() => { 14 | const { 15 | pool_state: { p2_singleton_puzzle_hash }, 16 | } = nft; 17 | 18 | const generator = seedrandom(p2_singleton_puzzle_hash); 19 | const seed = generator.int32(); 20 | 21 | return uniqueNamesGenerator({ 22 | dictionaries: [colors, animals, adjectives], // colors can be omitted here as not used 23 | length: 2, 24 | seed, 25 | separator: ' ', 26 | style: 'capital', 27 | }); 28 | }, [nft]); 29 | 30 | return name; 31 | } 32 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/hooks/usePlotNFTs.ts: -------------------------------------------------------------------------------- 1 | import { useEffect } from 'react'; 2 | import { useSelector, useDispatch } from 'react-redux'; 3 | import { useInterval } from 'react-use'; 4 | import type { RootState } from '../modules/rootReducer'; 5 | import type PlotNFT from '../types/PlotNFT'; 6 | import { getPlotNFTs } from '../modules/plotNFT'; 7 | import PlotNFTExternal from 'types/PlotNFTExternal'; 8 | 9 | export default function usePlotNFTs(): { 10 | loading: boolean; 11 | nfts?: PlotNFT[]; 12 | external?: PlotNFTExternal[]; 13 | } { 14 | const dispatch = useDispatch(); 15 | const nfts = useSelector((state: RootState) => state.plot_nft.items); 16 | const external = useSelector((state: RootState) => state.plot_nft.external); 17 | const loading = !nfts || !external; 18 | 19 | useInterval(() => { 20 | dispatch(getPlotNFTs()); 21 | }, 10000); 22 | 23 | useEffect(() => { 24 | dispatch(getPlotNFTs()); 25 | }, []); 26 | 27 | return { 28 | loading, 29 | nfts, 30 | external, 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/hooks/useSelectFile.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import isElectron from 'is-electron'; 3 | import { Trans } from '@lingui/macro'; 4 | import { AlertDialog } from '@scam/core'; 5 | import useOpenDialog from './useOpenDialog'; 6 | 7 | export default function useSelectFile(): () => Promise { 8 | const openDialog = useOpenDialog(); 9 | 10 | async function handleSelect(): Promise { 11 | if (isElectron()) { 12 | // @ts-ignore 13 | const result = await window.remote.dialog.showSaveDialog({}); 14 | const { filePath } = result; 15 | 16 | return filePath; 17 | } 18 | 19 | openDialog( 20 | 21 | This feature is available only from the GUI. 22 | , 23 | ); 24 | } 25 | 26 | return handleSelect; 27 | } 28 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/hooks/useStandardWallet.ts: -------------------------------------------------------------------------------- 1 | import { useSelector } from 'react-redux'; 2 | import Wallet from '../types/Wallet'; 3 | import type { RootState } from '../modules/rootReducer'; 4 | import WalletType from '../constants/WalletType'; 5 | 6 | export default function useStandardWallet(): { 7 | loading: boolean; 8 | wallet?: Wallet; 9 | balance?: number; 10 | } { 11 | const wallets = useSelector((state: RootState) => state.wallet_state.wallets); 12 | 13 | const wallet = wallets?.find( 14 | (wallet) => wallet?.type === WalletType.STANDARD_WALLET, 15 | ); 16 | 17 | const balance = wallet?.wallet_balance?.confirmed_wallet_balance; 18 | 19 | return { 20 | loading: !wallets, 21 | wallet, 22 | balance, 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/hooks/useUnconfirmedPlotNFTs.ts: -------------------------------------------------------------------------------- 1 | import { useLocalStorage, writeStorage } from '@rehooks/local-storage'; 2 | import UnconfirmedPlotNFT from '../types/UnconfirmedPlotNFT'; 3 | 4 | const LOCAL_STORAGE_KEY = 'unconfirmedPlotNFTs'; 5 | 6 | export default function useUnconfirmedPlotNFTs(): { 7 | unconfirmed: UnconfirmedPlotNFT[]; 8 | add: (item: UnconfirmedPlotNFT) => void; 9 | remove: (transactionId: string) => void; 10 | } { 11 | let [unconfirmed] = useLocalStorage( 12 | LOCAL_STORAGE_KEY, 13 | [], 14 | ); 15 | 16 | function handleAdd(item: UnconfirmedPlotNFT) { 17 | writeStorage(LOCAL_STORAGE_KEY, [...unconfirmed, item]); 18 | } 19 | 20 | function handleRemove(transactionId: string) { 21 | const newList = unconfirmed.filter( 22 | (item) => item.transactionId !== transactionId, 23 | ); 24 | writeStorage(LOCAL_STORAGE_KEY, newList); 25 | } 26 | 27 | return { 28 | add: handleAdd, 29 | remove: handleRemove, 30 | unconfirmed, 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Scam Blockchain 10 | 11 | 12 | 13 |
14 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/index.tsx: -------------------------------------------------------------------------------- 1 | import './polyfill'; 2 | import React from 'react'; 3 | import ReactDOM from 'react-dom'; 4 | import './config/env'; 5 | import App from './components/app/App'; 6 | 7 | ReactDOM.render(, document.querySelector('#root')); 8 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/locales/README.md: -------------------------------------------------------------------------------- 1 | # Localization 2 | 3 | Thanks for helping to translate the GUI for Scam Blockchain. 4 | 5 | Please head over to our [Crowdin project](https://crowdin.com/project/scam-blockchain/) and add/edit translations there. 6 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/modules/entranceMenu.js: -------------------------------------------------------------------------------- 1 | export const presentNewWallet = 'NEW_WALLET'; 2 | export const presentOldWallet = 'OLD_WALLET'; 3 | export const presentDashboard = 'DASHBOARD'; 4 | export const presentSelectKeys = 'SELECT_KEYS'; 5 | export const presentRestoreBackup = 'RESTORE_BACKUP'; 6 | 7 | export const changeEntranceMenu = (item) => ({ 8 | type: 'ENTRANCE_MENU', 9 | item, 10 | }); 11 | 12 | const initial_state = { 13 | view: presentSelectKeys, 14 | }; 15 | 16 | export const entranceReducer = (state = { ...initial_state }, action) => { 17 | switch (action.type) { 18 | case 'LOG_OUT': 19 | return { ...initial_state }; 20 | case 'ENTRANCE_MENU': 21 | var { item } = action; 22 | return { ...state, view: item }; 23 | default: 24 | return state; 25 | } 26 | }; 27 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/modules/progress.ts: -------------------------------------------------------------------------------- 1 | const progressControl = () => ({ type: 'PROGRESS_CONTROL' }); 2 | 3 | export const openProgress = () => ({ 4 | ...progressControl(), 5 | open: true, 6 | }); 7 | 8 | export const closeProgress = () => ({ 9 | ...progressControl(), 10 | open: false, 11 | }); 12 | 13 | type ProgressState = { 14 | progress_indicator: boolean; 15 | }; 16 | 17 | const initialState: ProgressState = { 18 | progress_indicator: false, 19 | }; 20 | 21 | export default function progressReducer( 22 | state: ProgressState = { ...initialState }, 23 | action: any, 24 | ): ProgressState { 25 | switch (action.type) { 26 | case 'PROGRESS_CONTROL': 27 | return { ...state, progress_indicator: action.open }; 28 | default: 29 | return state; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/polyfill.ts: -------------------------------------------------------------------------------- 1 | import 'core-js/stable'; 2 | import 'regenerator-runtime/runtime'; 3 | import { polyfill } from 'es6-promise'; 4 | import 'isomorphic-fetch'; 5 | 6 | polyfill(); 7 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/react-app-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/readme.md: -------------------------------------------------------------------------------- 1 | # Information for developers 2 | 3 | ## How to use local test and farm locally 4 | 5 | If you want to use local farming and not to connect to the network you need to set 6 | variable LOCAL_TEST in your .env file. This file is located in the root directory of your scam-blockchain-gui directory. 7 | 8 | ```env 9 | LOCAL_TEST=true 10 | ``` 11 | 12 | ## Best practices 13 | 14 | - using TypeScript and CSS-in-JS because material-ui is using CSS-in-JS 15 | - Only one exported component per file 16 | - Same file name like exported function / component / class 17 | - CSS, gprahql file next to the component file with different extension 18 | - turn on eslint in your IDE 19 | - create unit tests for all components 20 | - all styled components use prefix Styled. For example const StyledMyComponent = styled.... 21 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/theme/dark.ts: -------------------------------------------------------------------------------- 1 | import { createMuiTheme } from '@material-ui/core/styles'; 2 | import theme from './default'; 3 | 4 | export default (locale: object) => 5 | createMuiTheme( 6 | { 7 | ...theme, 8 | palette: { 9 | ...theme.palette, 10 | secondary: { 11 | main: '#ffffff', 12 | }, 13 | type: 'dark', 14 | }, 15 | }, 16 | locale, 17 | ); 18 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/theme/default.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | palette: { 3 | primary: { 4 | main: '#3AAC59', 5 | contrastText: '#ffffff', 6 | }, 7 | secondary: { 8 | main: '#000000', 9 | contrastText: '#ffffff', 10 | }, 11 | danger: { 12 | main: '#dc3545', 13 | contrastText: '#ffffff', 14 | }, 15 | }, 16 | drawer: { 17 | width: '100px', 18 | }, 19 | }; 20 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/theme/light.ts: -------------------------------------------------------------------------------- 1 | import { createMuiTheme } from '@material-ui/core/styles'; 2 | import theme from './default'; 3 | 4 | export default (locale: object) => 5 | createMuiTheme( 6 | { 7 | ...theme, 8 | palette: { 9 | ...theme.palette, 10 | }, 11 | }, 12 | locale, 13 | ); 14 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/types/Block.ts: -------------------------------------------------------------------------------- 1 | import type FoliageTransactionBlock from './FoliageTransactionBlock'; 2 | import type Foliage from './Foliage'; 3 | 4 | type Block = { 5 | foliage_transaction_block: FoliageTransactionBlock; 6 | foliage: Foliage; 7 | }; 8 | 9 | export default Block; 10 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/types/Challenge.ts: -------------------------------------------------------------------------------- 1 | type Challenge = { 2 | challenge: string; 3 | difficulty: number; 4 | height: number; 5 | estimates: number[]; 6 | weight: number; 7 | timestamp?: number; 8 | }; 9 | 10 | export default Challenge; 11 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/types/Coin.ts: -------------------------------------------------------------------------------- 1 | import type WalletType from '../constants/WalletType'; 2 | 3 | type Coin = { 4 | confirmed_block_index: number; 5 | spent_block_index: number; 6 | spent: boolean; 7 | coinbase: boolean; 8 | wallet_type: WalletType; 9 | wallet_id: number; 10 | parent_coin_info: string; 11 | }; 12 | 13 | export default Coin; 14 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/types/CoinSolution.ts: -------------------------------------------------------------------------------- 1 | import type Coin from './Coin'; 2 | import type Program from './Program'; 3 | 4 | type CoinSolution = { 5 | coin: Coin; 6 | solution: Program; 7 | }; 8 | 9 | export default CoinSolution; 10 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/types/Connection.ts: -------------------------------------------------------------------------------- 1 | type Connection = { 2 | bytes_read: number; 3 | bytes_written: number; 4 | creation_time: number; 5 | last_message_time: number; 6 | local_host: string; 7 | local_port: number; 8 | node_id: string; 9 | peer_host: string; 10 | peer_port: number; 11 | peer_server_port: number; 12 | type: number; 13 | }; 14 | 15 | export default Connection; 16 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/types/FarmingInfo.ts: -------------------------------------------------------------------------------- 1 | type FarmingInfo = { 2 | challenge_hash: string; 3 | signage_point: string; 4 | timestamp: number; 5 | passed_filter: number; 6 | proofs: number; 7 | total_plots: number; 8 | }; 9 | 10 | export default FarmingInfo; 11 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/types/Fingerprint.ts: -------------------------------------------------------------------------------- 1 | type Fingerprint = number; 2 | 3 | export default Fingerprint; 4 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/types/Foliage.ts: -------------------------------------------------------------------------------- 1 | type Foliage = { 2 | foliage_transaction_block_hash: string; 3 | foliage_block_data_signature: string; 4 | foliage_block_data: { 5 | extension_data: string; 6 | farmer_reward_puzzle_hash: string; 7 | pool_signature: string; 8 | pool_target: { 9 | max_height: number; 10 | puzzle_hash: string; 11 | }; 12 | unfinished_reward_block_hash: string; 13 | }; 14 | prev_block_hash: string; 15 | reward_block_hash: string; 16 | }; 17 | 18 | export default Foliage; 19 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/types/FoliageTransactionBlock.ts: -------------------------------------------------------------------------------- 1 | type FoliageTransactionBlock = { 2 | additions_root: string; 3 | filter_hash: string; 4 | height: number; 5 | prev_block_hash: string; 6 | removals_root: string; 7 | timestamp: string; 8 | transactions_info_hash: string; 9 | }; 10 | 11 | export default FoliageTransactionBlock; 12 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/types/G2Element.ts: -------------------------------------------------------------------------------- 1 | type G2Element = string; 2 | 3 | export default G2Element; 4 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/types/Header.ts: -------------------------------------------------------------------------------- 1 | type Header = { 2 | data: { 3 | additions_root: string; 4 | aggregated_signature: string; 5 | cost: string; 6 | extension_data: string; 7 | farmer_rewards_puzzle_hash: string; 8 | filter_hash: string; 9 | finish_time: number; 10 | finished: boolean; 11 | generator_hash: string; 12 | header_hash: string; 13 | height: number; 14 | pool_target: { 15 | max_height: 0; 16 | puzzle_hash: string; 17 | }; 18 | prev_header_hash: string; 19 | proof_of_space_hash: string; 20 | removals_root: string; 21 | timestamp: string; 22 | total_iters: string; 23 | total_transaction_fees: string; 24 | weight: string; 25 | }; 26 | plot_signature: string; 27 | }; 28 | 29 | export default Header; 30 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/types/InitialTargetState.ts: -------------------------------------------------------------------------------- 1 | type InitialTargetState = 2 | | { 3 | state: 'SELF_POOLING'; 4 | } 5 | | { 6 | state: 'FARMING_TO_POOL'; 7 | pool_url: string; 8 | relative_lock_height: number; 9 | target_puzzle_hash: string; 10 | }; 11 | 12 | export default InitialTargetState; 13 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/types/Peak.ts: -------------------------------------------------------------------------------- 1 | type Peak = { 2 | height: number; 3 | timestamp: number; 4 | }; 5 | 6 | export default Peak; 7 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/types/Plot.ts: -------------------------------------------------------------------------------- 1 | type Plot = { 2 | plot_id: string; 3 | filename: string; 4 | file_size: number; 5 | size: number; 6 | local_sk: string; 7 | farmer_public_key: string; 8 | plot_public_key: string; 9 | pool_public_key: string; 10 | pool_contract_puzzle_hash: string; 11 | duplicates?: Plot[]; 12 | }; 13 | 14 | export default Plot; 15 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/types/PlotAdd.ts: -------------------------------------------------------------------------------- 1 | import Fingerprint from './Fingerprint'; 2 | 3 | type PlotAdd = { 4 | plotSize: number; 5 | plotCount: number; 6 | maxRam: number; 7 | numThreads: number; 8 | numBuckets: number; 9 | queue: string; 10 | finalLocation: string; 11 | workspaceLocation: string; 12 | workspaceLocation2: string; 13 | parallel: boolean; 14 | delay: number; 15 | fingerprint?: Fingerprint; 16 | disableBitfieldPlotting?: boolean; 17 | excludeFinalDir?: boolean; 18 | overrideK?: boolean; 19 | farmerPublicKey?: string; 20 | poolPublicKey?: string; 21 | c: string; 22 | }; 23 | 24 | export default PlotAdd; 25 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/types/PlotNFT.ts: -------------------------------------------------------------------------------- 1 | import type PoolState from './PoolState'; 2 | import type PoolWalletStatus from './PoolWalletStatus'; 3 | import type WalletBalance from './WalletBalance'; 4 | 5 | type PlotNFT = { 6 | pool_state: PoolState; 7 | wallet_balance: WalletBalance; 8 | pool_wallet_status: PoolWalletStatus; 9 | }; 10 | 11 | export default PlotNFT; 12 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/types/PlotNFTExternal.ts: -------------------------------------------------------------------------------- 1 | import type PoolState from './PoolState'; 2 | 3 | type PlotNFTExternal = { 4 | pool_state: PoolState; 5 | }; 6 | 7 | export default PlotNFTExternal; 8 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/types/PlotQueueItem.ts: -------------------------------------------------------------------------------- 1 | import PlotStatus from '../constants/PlotStatus'; 2 | 3 | type PlotQueueItem = { 4 | id: string; 5 | queue: string; 6 | size: number; 7 | parallel: boolean; 8 | delay: number; 9 | state: PlotStatus; 10 | error?: string; 11 | log?: string; 12 | progress?: number; 13 | }; 14 | 15 | export default PlotQueueItem; 16 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/types/Point.ts: -------------------------------------------------------------------------------- 1 | type Point = [number, number]; 2 | 3 | export default Point; 4 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/types/PoolInfo.ts: -------------------------------------------------------------------------------- 1 | type PoolInfo = { 2 | name: string; 3 | description: string; 4 | pool_url: string; 5 | fee: string; 6 | logo_url: string; 7 | minimum_difficulty: number; 8 | protocol_version: string; 9 | relative_lock_height: number; 10 | target_puzzle_hash: string; 11 | }; 12 | 13 | export default PoolInfo; 14 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/types/PoolState.ts: -------------------------------------------------------------------------------- 1 | import type PoolInfo from './PoolInfo'; 2 | 3 | type PoolState = { 4 | p2_singleton_puzzle_hash: string; 5 | points_found_since_start: number; 6 | points_found_24h: [number, number][]; 7 | points_acknowledged_since_start: number; 8 | points_acknowledged_24h: [number, number][]; 9 | current_points: number; 10 | current_difficulty: number; 11 | pool_errors_24h: { 12 | current_difficulty: number; 13 | error_code: number; 14 | error_message: string; 15 | }[]; 16 | pool_info: PoolInfo; 17 | pool_config: { 18 | authentication_key_info_signature: string; 19 | authentication_public_key: string; 20 | authentication_public_key_timestamp: number; 21 | owner_public_key: string; 22 | pool_puzzle_hash: string; 23 | pool_url: string; 24 | launcher_id: string; 25 | target: string; 26 | target_signature: string; 27 | pool_payout_instructions: string; 28 | target_puzzle_hash: string; 29 | }; 30 | }; 31 | 32 | export default PoolState; 33 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/types/PoolWalletStatus.ts: -------------------------------------------------------------------------------- 1 | import PlotNFTState from '../constants/PlotNFTState'; 2 | 3 | type PoolWalletStatus = { 4 | current: { 5 | owner_pubkey: string; 6 | pool_url: string; 7 | relative_lock_height: number; 8 | state: PlotNFTState; 9 | target_puzzle_hash: string; 10 | version: number; 11 | }; 12 | current_inner: string; 13 | launcher_coin: { 14 | amount: number; 15 | parent_coin_info: string; 16 | puzzle_hash: string; 17 | }; 18 | launcher_id: string; 19 | p2_singleton_puzzle_hash: string; 20 | tip_singleton_coin_id: string; 21 | wallet_id: number; 22 | target: null | { 23 | owner_pubkey: string; 24 | pool_url: string; 25 | relative_lock_height: number; 26 | state: PlotNFTState; 27 | target_puzzle_hash: string; 28 | version: number; 29 | }; 30 | }; 31 | 32 | export default PoolWalletStatus; 33 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/types/Program.ts: -------------------------------------------------------------------------------- 1 | type Program = {}; 2 | 3 | export default Program; 4 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/types/ProofsOfSpace.ts: -------------------------------------------------------------------------------- 1 | type ProofsOfSpace = { 2 | [key: string]: [string, ProofsOfSpace][]; 3 | }; 4 | 5 | export default ProofsOfSpace; 6 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/types/SignagePoint.ts: -------------------------------------------------------------------------------- 1 | type SignagePoint = { 2 | challenge_hash: string; 3 | challenge_chain_sp: string; 4 | reward_chain_sp: string; 5 | difficulty: number; 6 | sub_slot_iters: number; 7 | signage_point_index: number; 8 | }; 9 | 10 | export default SignagePoint; 11 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/types/SpendBundle.ts: -------------------------------------------------------------------------------- 1 | import type CoinSolution from './CoinSolution'; 2 | import type G2Element from './G2Element'; 3 | 4 | type SpendBundle = { 5 | coin_solutions: CoinSolution[]; 6 | aggregated_signature: G2Element; 7 | }; 8 | 9 | export default SpendBundle; 10 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/types/SubBlock.ts: -------------------------------------------------------------------------------- 1 | type SubBlock = { 2 | challenge_block_info_hash: string; 3 | challenge_vdf_output: { 4 | a: string; 5 | }; 6 | deficit: number; 7 | farmer_puzzle_hash: string; 8 | fees: null | string; 9 | finished_challenge_slot_hashes: string | null; 10 | finished_infused_challenge_slot_hashes: string[] | null; 11 | finished_reward_slot_hashes: string[] | null; 12 | header_hash: string; 13 | height: number; 14 | infused_challenge_vdf_output: { 15 | a: string; 16 | }; 17 | overflow: boolean; 18 | pool_puzzle_hash: string; 19 | prev_block_hash: string | null; 20 | prev_hash: string | null; 21 | required_iters: string; 22 | reward_claims_incorporated: unknown; 23 | reward_infusion_new_challenge: string; 24 | signage_point_index: number; 25 | sub_epoch_summary_included: unknown; 26 | sub_slot_iters: string; 27 | timestamp: number | null; 28 | total_iters: string; 29 | weight: string; 30 | foliage_transaction_block?: { 31 | timestamp: string; 32 | }; 33 | }; 34 | 35 | export default SubBlock; 36 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/types/Transaction.ts: -------------------------------------------------------------------------------- 1 | import type Coin from './Coin'; 2 | import type SpendBundle from './SpendBundle'; 3 | import type TransactionType from '../constants/TransactionType'; 4 | 5 | type Transaction = { 6 | confirmed_at_height: number; 7 | created_at_time: number; 8 | to_address: string; 9 | to_puzzle_hash?: string; 10 | amount: number; 11 | sent: number; 12 | fee_amount: number; 13 | incoming: boolean; 14 | confirmed: boolean; 15 | spend_bundle?: SpendBundle; 16 | additions: Coin[]; 17 | removals: Coin[]; 18 | wallet_id: number; 19 | trade_id?: number; 20 | name?: string; 21 | sent_to?: string[]; 22 | type: TransactionType; 23 | }; 24 | 25 | export default Transaction; 26 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/types/UnconfirmedPlotNFT.ts: -------------------------------------------------------------------------------- 1 | import PlotNFTState from '../constants/PlotNFTState'; 2 | 3 | type UnconfirmedPlotNFT = { 4 | transactionId: string; 5 | state: PlotNFTState; 6 | poolUrl?: string; 7 | }; 8 | 9 | export default UnconfirmedPlotNFT; 10 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/types/Wallet.ts: -------------------------------------------------------------------------------- 1 | import type Transaction from './Transaction'; 2 | import type WalletType from '../constants/WalletType'; 3 | import WalletBalance from './WalletBalance'; 4 | 5 | interface Wallet { 6 | id: number; 7 | name: string; 8 | type: WalletType; 9 | data: Object; 10 | transactions: Transaction[]; 11 | address: string; 12 | colour: string; 13 | mydid: string; 14 | didcoin: string; 15 | backup_dids: string[]; 16 | dids_num_req: number; 17 | did_attest: string; 18 | sending_transaction: boolean; 19 | send_transaction_result?: string | null; 20 | wallet_balance?: WalletBalance; 21 | } 22 | 23 | export default Wallet; 24 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/types/WalletBalance.ts: -------------------------------------------------------------------------------- 1 | type WalletBalance = { 2 | wallet_id: number; 3 | confirmed_wallet_balance: number; 4 | max_send_amount: number; 5 | pending_change: number; 6 | pending_coin_removal_count: number; 7 | spendable_balance: number; 8 | unconfirmed_wallet_balance: number; 9 | unspent_coin_count: number; 10 | pending_balance: number; 11 | }; 12 | 13 | export default WalletBalance; 14 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/util/blockHeightToTimestamp.ts: -------------------------------------------------------------------------------- 1 | import type Peak from '../types/Peak'; 2 | 3 | const BLOCK_DURATION_SECONDS = (24 * 60 * 60) / 4608; 4 | 5 | export default function blockHeightToTimestamp( 6 | height: number, 7 | peak: Peak, 8 | ): number { 9 | const diff = peak.height - height; 10 | const seconds = diff * BLOCK_DURATION_SECONDS; 11 | 12 | return peak.timestamp - seconds; 13 | } 14 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/util/createTransaction.ts: -------------------------------------------------------------------------------- 1 | import type SpendBundle from '../types/SpendBundle'; 2 | import type Coin from '../types/Coin'; 3 | import type Transaction from '../types/Transaction'; 4 | import type TransactionType from '../constants/TransactionType'; 5 | 6 | export default function createTransaction( 7 | confirmed_at_height: number, 8 | created_at_time: number, 9 | to_address: string, 10 | amount: string, 11 | fee_amount: string, 12 | incoming: boolean, 13 | confirmed: boolean, 14 | sent: number, 15 | spend_bundle: SpendBundle, 16 | additions: Coin[], 17 | removals: Coin[], 18 | wallet_id: number, 19 | type: TransactionType, 20 | ): Transaction { 21 | return { 22 | confirmed_at_height, 23 | created_at_time, 24 | to_address, 25 | amount, 26 | fee_amount, 27 | incoming, 28 | confirmed, 29 | sent, 30 | spend_bundle, 31 | additions, 32 | removals, 33 | wallet_id, 34 | type, 35 | }; 36 | } 37 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/util/createWallet.ts: -------------------------------------------------------------------------------- 1 | import type WalletType from '../constants/WalletType'; 2 | import type Wallet from '../types/Wallet'; 3 | 4 | // deprecated 5 | export default function createWallet( 6 | id: number, 7 | name: string, 8 | type: WalletType, 9 | data: Object, 10 | details?: Object, 11 | ): Wallet { 12 | return { 13 | id, 14 | name, 15 | type, 16 | data, 17 | balance_total: 0, 18 | balance_pending: 0, 19 | balance_spendable: 0, 20 | balance_frozen: 0, 21 | balance_change: 0, 22 | transactions: [], 23 | address: '', 24 | colour: '', 25 | mydid: '', 26 | didcoin: '', 27 | backup_dids: [], 28 | dids_num_req: 0, 29 | did_attest: '', 30 | sending_transaction: false, 31 | send_transaction_result: '', 32 | ...details, 33 | }; 34 | } 35 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/util/getDescriptiveError.ts: -------------------------------------------------------------------------------- 1 | import { t } from '@lingui/macro'; 2 | 3 | export default function getDescriptiveError(error: string): string { 4 | if (error == '13') { 5 | return t`[Error 13] Permission denied. You are trying to access a file/directory without having the necessary permissions. Most likely one of the plot folders in your config.yaml has an issue.`; 6 | } 7 | if (error == '22') { 8 | return t`[Error 22] File not found. Most likely one of the plot folders in your config.yaml has an issue.`; 9 | } 10 | 11 | return error; 12 | } 13 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/util/getPercentPointsSuccessfull.ts: -------------------------------------------------------------------------------- 1 | import { sumBy } from 'lodash'; 2 | import type Point from '../types/Point'; 3 | 4 | function sumPoints(points: Point[]): number { 5 | return sumBy(points, (point) => point[1]) ?? 0; 6 | } 7 | 8 | export default function getPercentPointsSuccessfull( 9 | pointsAcknowledged: Point[], 10 | pointsFound: Point[], 11 | ): number { 12 | const acknowledged = sumPoints(pointsAcknowledged); 13 | const found = sumPoints(pointsFound); 14 | 15 | if (!acknowledged || !found) { 16 | return 0; 17 | } 18 | 19 | return acknowledged / found; 20 | } 21 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/util/getPoolInfo.ts: -------------------------------------------------------------------------------- 1 | import type PoolInfo from '../types/PoolInfo'; 2 | 3 | export default async function getPoolInfo(poolUrl: string): PoolInfo { 4 | const url = `${poolUrl}/pool_info`; 5 | const response = await fetch(url); 6 | return response.json(); 7 | } 8 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/util/getWalletSyncingStatus.ts: -------------------------------------------------------------------------------- 1 | import type { IncomingState } from '../modules/incoming'; 2 | import SyncingStatus from '../constants/SyncingStatus'; 3 | 4 | export default function getWalletSyncingStatus(walletState: IncomingState) { 5 | const { 6 | status: { syncing, synced }, 7 | } = walletState; 8 | 9 | if (syncing) { 10 | return SyncingStatus.SYNCING; 11 | } else if (synced) { 12 | return SyncingStatus.SYNCED; 13 | } 14 | 15 | return SyncingStatus.NOT_SYNCED; 16 | } 17 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/util/isWindows.ts: -------------------------------------------------------------------------------- 1 | import os from 'os'; 2 | 3 | const platform = os.platform(); 4 | 5 | export default platform && platform.startsWith('win'); 6 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/util/mergeArrayItem.ts: -------------------------------------------------------------------------------- 1 | export default function mergeArrayItem( 2 | array: T[], 3 | identity: (item: T) => boolean, 4 | object: Partial, 5 | ): T[] { 6 | return array?.map((item) => { 7 | if (identity(item)) { 8 | return { 9 | ...item, 10 | ...object, 11 | }; 12 | } 13 | 14 | return item; 15 | }); 16 | } 17 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/util/mergeArrays.ts: -------------------------------------------------------------------------------- 1 | import mergeArrayItem from './mergeArrayItem'; 2 | 3 | export default function mergeArrays( 4 | base: T[] = [], 5 | identity: (a: T) => any, 6 | ...sources: T[][] 7 | ): T[] | undefined { 8 | let result = [...base]; 9 | 10 | sources.forEach((sourceArray) => { 11 | sourceArray.forEach((item) => { 12 | const id = identity(item); 13 | const index = result.findIndex( 14 | (resultItem) => identity(resultItem) === id, 15 | ); 16 | if (index === -1) { 17 | result.push(item); 18 | } else { 19 | result = mergeArrayItem( 20 | result, 21 | (resultItem) => identity(resultItem) === id, 22 | item, 23 | ); 24 | } 25 | }); 26 | }); 27 | 28 | return result; 29 | } 30 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/util/normalizePoolState.ts: -------------------------------------------------------------------------------- 1 | import PoolState from '../types/PoolState'; 2 | import removeOldPoints from './removeOldPoints'; 3 | 4 | export default function normalizePoolState(poolState: PoolState): PoolState { 5 | return { 6 | ...poolState, 7 | points_acknowledged_24h: removeOldPoints(poolState.points_acknowledged_24h), 8 | points_found_24h: removeOldPoints(poolState.points_found_24h), 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/util/normalizeUrl.ts: -------------------------------------------------------------------------------- 1 | import normalize from 'normalize-url'; 2 | 3 | export default function normalizeUrl(url: string): string { 4 | return normalize(url, { 5 | defaultProtocol: 'https:', 6 | stripAuthentication: false, 7 | stripTextFragment: false, 8 | stripWWW: false, 9 | removeQueryParameters: false, 10 | removeTrailingSlash: false, 11 | removeSingleSlash: false, 12 | sortQueryParameters: false, 13 | }); 14 | } 15 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/util/plot_sizes.js: -------------------------------------------------------------------------------- 1 | export function calculateSizeFromK(k) { 2 | return Math.floor(780 * k * Math.pow(2, k - 10)); 3 | } 4 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/util/removeOldPoints.ts: -------------------------------------------------------------------------------- 1 | import type Point from '../types/Point'; 2 | 3 | const DAY_SECONDS = 60 * 60 * 24; 4 | 5 | export default function removeOldPoints( 6 | points: Point[], 7 | second: number = DAY_SECONDS, 8 | ): Point[] { 9 | const current = Date.now() / 1000; 10 | const dayBefore = current - second; 11 | 12 | return points?.filter((point) => { 13 | const [timestamp] = point; 14 | 15 | return timestamp >= dayBefore; 16 | }); 17 | } 18 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/util/service_names.js: -------------------------------------------------------------------------------- 1 | export const service_wallet = 'scam_wallet'; 2 | export const service_full_node = 'scam_full_node'; 3 | export const service_farmer = 'scam_farmer'; 4 | export const service_harvester = 'scam_harvester'; 5 | export const service_simulator = 'scam_full_node_simulator'; 6 | export const service_daemon = 'daemon'; 7 | export const service_plotter = 'scam plots create'; 8 | 9 | // Corresponds with outbound_message.py NodeTypes 10 | export const service_connection_types = { 11 | 1: 'Full Node', 12 | 2: 'Harvester', 13 | 3: 'Farmer', 14 | 4: 'Timelord', 15 | 5: 'Introducer', 16 | 6: 'Wallet', 17 | 7: 'Plotter', 18 | }; 19 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/util/toBech32m.ts: -------------------------------------------------------------------------------- 1 | import { bech32m } from 'bech32'; 2 | 3 | function removePrefix(value: string, prefix: string): string { 4 | if (value.startsWith(prefix)) { 5 | return value.slice(prefix.length); 6 | } 7 | 8 | return value; 9 | } 10 | 11 | export default function encode(value: string, prefix: string): string { 12 | const pureHash = removePrefix(value, '0x'); 13 | const words = bech32m.toWords(Buffer.from(pureHash, 'hex')); 14 | return bech32m.encode(prefix, words); 15 | } 16 | -------------------------------------------------------------------------------- /scam-blockchain-gui/src/util/wallet_types.js: -------------------------------------------------------------------------------- 1 | export const STANDARD_WALLET = 0; 2 | export const RATE_LIMITED = 1; 3 | export const ATOMIC_SWAP = 2; 4 | export const AUTHORIZED_PAYEE = 3; 5 | export const MULTI_SIG = 4; 6 | export const CUSTODY = 5; 7 | export const COLOURED_COIN = 6; 8 | export const RECOVERABLE = 7; 9 | export const DISTRIBUTED_ID = 8; 10 | -------------------------------------------------------------------------------- /scam-blockchain-gui/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": "src", 4 | "target": "es5", 5 | "lib": [ 6 | "dom", 7 | "dom.iterable", 8 | "esnext" 9 | ], 10 | "paths": { 11 | "@scam/*": ["./components/*"] 12 | }, 13 | "allowJs": true, 14 | "skipLibCheck": true, 15 | "esModuleInterop": true, 16 | "allowSyntheticDefaultImports": true, 17 | "strict": true, 18 | "forceConsistentCasingInFileNames": true, 19 | "noFallthroughCasesInSwitch": true, 20 | "module": "esnext", 21 | "moduleResolution": "node", 22 | "resolveJsonModule": true, 23 | "isolatedModules": true, 24 | "noEmit": true, 25 | "jsx": "react" 26 | }, 27 | "include": [ 28 | "src/**/*" 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /scam-blockchain-gui/windows.json: -------------------------------------------------------------------------------- 1 | { 2 | "dest": "dist/installers/", 3 | "icon": "src/assets/img/scam.ico", 4 | "tags": ["Blockchain"] 5 | } 6 | -------------------------------------------------------------------------------- /scam/__init__.py: -------------------------------------------------------------------------------- 1 | from pkg_resources import DistributionNotFound, get_distribution, resource_filename 2 | 3 | try: 4 | __version__ = get_distribution("scam-blockchain").version 5 | except DistributionNotFound: 6 | # package is not installed 7 | __version__ = "unknown" 8 | 9 | PYINSTALLER_SPEC_PATH = resource_filename("scam", "pyinstaller.spec") 10 | -------------------------------------------------------------------------------- /scam/clvm/singleton.py: -------------------------------------------------------------------------------- 1 | from scam.wallet.puzzles.load_clvm import load_clvm 2 | 3 | P2_SINGLETON_MOD = load_clvm("p2_singleton.clvm") 4 | SINGLETON_TOP_LAYER_MOD = load_clvm("singleton_top_layer.clvm") 5 | SINGLETON_LAUNCHER = load_clvm("singleton_launcher.clvm") 6 | -------------------------------------------------------------------------------- /scam/cmds/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam/cmds/__init__.py -------------------------------------------------------------------------------- /scam/cmds/start.py: -------------------------------------------------------------------------------- 1 | import click 2 | 3 | from scam.util.service_groups import all_groups 4 | 5 | 6 | @click.command("start", short_help="Start service groups") 7 | @click.option("-r", "--restart", is_flag=True, type=bool, help="Restart running services") 8 | @click.argument("group", type=click.Choice(all_groups()), nargs=-1, required=True) 9 | @click.pass_context 10 | def start_cmd(ctx: click.Context, restart: bool, group: str) -> None: 11 | import asyncio 12 | from .start_funcs import async_start 13 | 14 | asyncio.get_event_loop().run_until_complete(async_start(ctx.obj["root_path"], group, restart)) 15 | -------------------------------------------------------------------------------- /scam/cmds/units.py: -------------------------------------------------------------------------------- 1 | from typing import Dict 2 | 3 | # The rest of the codebase uses mojos everywhere. 4 | # Only use these units for user facing interfaces. 5 | units: Dict[str, int] = { 6 | "scam": 10 ** 12, # 1 scam (SCM) is 1,000,000,000,000 mojo (1 trillion) 7 | "mojo:": 1, 8 | "colouredcoin": 10 ** 3, # 1 coloured coin is 1000 colouredcoin mojos 9 | } 10 | -------------------------------------------------------------------------------- /scam/consensus/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam/consensus/__init__.py -------------------------------------------------------------------------------- /scam/consensus/condition_costs.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | 3 | 4 | class ConditionCost(Enum): 5 | # Condition Costs 6 | AGG_SIG = 1200000 # the cost of one G1 subgroup check + aggregated signature validation 7 | CREATE_COIN = 1800000 8 | ASSERT_MY_COIN_ID = 0 9 | ASSERT_MY_PARENT_ID = 0 10 | ASSERT_MY_PUZZLEHASH = 0 11 | ASSERT_MY_AMOUNT = 0 12 | ASSERT_SECONDS_RELATIVE = 0 13 | ASSERT_SECONDS_ABSOLUTE = 0 14 | ASSERT_HEIGHT_RELATIVE = 0 15 | ASSERT_HEIGHT_ABSOLUTE = 0 16 | RESERVE_FEE = 0 17 | CREATE_COIN_ANNOUNCEMENT = 0 18 | ASSERT_COIN_ANNOUNCEMENT = 0 19 | CREATE_PUZZLE_ANNOUNCEMENT = 0 20 | ASSERT_PUZZLE_ANNOUNCEMENT = 0 21 | -------------------------------------------------------------------------------- /scam/consensus/network_type.py: -------------------------------------------------------------------------------- 1 | from enum import IntEnum 2 | 3 | 4 | class NetworkType(IntEnum): 5 | MAINNET = 0 6 | TESTNET = 1 7 | -------------------------------------------------------------------------------- /scam/consensus/pos_quality.py: -------------------------------------------------------------------------------- 1 | from scam.util.ints import uint64 2 | 3 | # The actual space in bytes of a plot, is _expected_plot_size(k) * UI_ACTUAL_SPACE_CONSTANT_FACTO 4 | # This is not used in consensus, only for display purposes 5 | UI_ACTUAL_SPACE_CONSTANT_FACTOR = 0.762 6 | 7 | 8 | def _expected_plot_size(k: int) -> uint64: 9 | """ 10 | Given the plot size parameter k (which is between 32 and 59), computes the 11 | expected size of the plot in bytes (times a constant factor). This is based on efficient encoding 12 | of the plot, and aims to be scale agnostic, so larger plots don't 13 | necessarily get more rewards per byte. The +1 is added to give half a bit more space per entry, which 14 | is necessary to store the entries in the plot. 15 | """ 16 | 17 | return ((2 * k) + 1) * (2 ** (k - 1)) 18 | -------------------------------------------------------------------------------- /scam/daemon/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam/daemon/__init__.py -------------------------------------------------------------------------------- /scam/farmer/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam/farmer/__init__.py -------------------------------------------------------------------------------- /scam/full_node/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam/full_node/__init__.py -------------------------------------------------------------------------------- /scam/full_node/signage_point.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | from typing import Optional 3 | 4 | from scam.types.blockchain_format.vdf import VDFInfo, VDFProof 5 | from scam.util.streamable import Streamable, streamable 6 | 7 | 8 | @dataclass(frozen=True) 9 | @streamable 10 | class SignagePoint(Streamable): 11 | cc_vdf: Optional[VDFInfo] 12 | cc_proof: Optional[VDFProof] 13 | rc_vdf: Optional[VDFInfo] 14 | rc_proof: Optional[VDFProof] 15 | -------------------------------------------------------------------------------- /scam/harvester/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam/harvester/__init__.py -------------------------------------------------------------------------------- /scam/introducer/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam/introducer/__init__.py -------------------------------------------------------------------------------- /scam/pools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam/pools/__init__.py -------------------------------------------------------------------------------- /scam/protocols/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam/protocols/__init__.py -------------------------------------------------------------------------------- /scam/protocols/introducer_protocol.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | from typing import List 3 | 4 | from scam.types.peer_info import TimestampedPeerInfo 5 | from scam.util.streamable import Streamable, streamable 6 | 7 | """ 8 | Protocol to introducer 9 | Note: When changing this file, also change protocol_message_types.py, and the protocol version in shared_protocol.py 10 | """ 11 | 12 | 13 | @dataclass(frozen=True) 14 | @streamable 15 | class RequestPeersIntroducer(Streamable): 16 | """ 17 | Return full list of peers 18 | """ 19 | 20 | 21 | @dataclass(frozen=True) 22 | @streamable 23 | class RespondPeersIntroducer(Streamable): 24 | peer_list: List[TimestampedPeerInfo] 25 | -------------------------------------------------------------------------------- /scam/protocols/shared_protocol.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | from enum import IntEnum 3 | from typing import List, Tuple 4 | 5 | from scam.util.ints import uint8, uint16 6 | from scam.util.streamable import Streamable, streamable 7 | 8 | protocol_version = "0.0.32" 9 | 10 | """ 11 | Handshake when establishing a connection between two servers. 12 | Note: When changing this file, also change protocol_message_types.py 13 | """ 14 | 15 | 16 | # Capabilities can be added here when new features are added to the protocol 17 | # These are passed in as uint16 into the Handshake 18 | class Capability(IntEnum): 19 | BASE = 1 # Base capability just means it supports the scam protocol at mainnet 20 | 21 | 22 | @dataclass(frozen=True) 23 | @streamable 24 | class Handshake(Streamable): 25 | network_id: str 26 | protocol_version: str 27 | software_version: str 28 | server_port: uint16 29 | node_type: uint8 30 | capabilities: List[Tuple[uint16, str]] 31 | -------------------------------------------------------------------------------- /scam/rpc/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam/rpc/__init__.py -------------------------------------------------------------------------------- /scam/server/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam/server/__init__.py -------------------------------------------------------------------------------- /scam/server/ssl_context.py: -------------------------------------------------------------------------------- 1 | from pathlib import Path 2 | from typing import Dict 3 | 4 | 5 | def public_ssl_paths(path: Path, config: Dict): 6 | return ( 7 | path / config["ssl"]["public_crt"], 8 | path / config["ssl"]["public_key"], 9 | ) 10 | 11 | 12 | def private_ssl_paths(path: Path, config: Dict): 13 | return ( 14 | path / config["ssl"]["private_crt"], 15 | path / config["ssl"]["private_key"], 16 | ) 17 | 18 | 19 | def private_ssl_ca_paths(path: Path, config: Dict): 20 | return ( 21 | path / config["private_ssl_ca"]["crt"], 22 | path / config["private_ssl_ca"]["key"], 23 | ) 24 | 25 | 26 | def scam_ssl_ca_paths(path: Path, config: Dict): 27 | return ( 28 | path / config["scam_ssl_ca"]["crt"], 29 | path / config["scam_ssl_ca"]["key"], 30 | ) 31 | -------------------------------------------------------------------------------- /scam/simulator/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam/simulator/__init__.py -------------------------------------------------------------------------------- /scam/simulator/simulator_constants.py: -------------------------------------------------------------------------------- 1 | if __name__ == "__main__": 2 | from tests.block_tools import BlockTools, test_constants 3 | from scam.util.default_root import DEFAULT_ROOT_PATH 4 | 5 | # TODO: mariano: fix this with new consensus 6 | bt = BlockTools(root_path=DEFAULT_ROOT_PATH) 7 | new_genesis_block = bt.create_genesis_block(test_constants, b"0") 8 | 9 | print(bytes(new_genesis_block)) 10 | -------------------------------------------------------------------------------- /scam/simulator/simulator_protocol.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | 3 | from scam.types.blockchain_format.sized_bytes import bytes32 4 | from scam.util.ints import uint32 5 | from scam.util.streamable import Streamable, streamable 6 | 7 | 8 | @dataclass(frozen=True) 9 | @streamable 10 | class FarmNewBlockProtocol(Streamable): 11 | puzzle_hash: bytes32 12 | 13 | 14 | @dataclass(frozen=True) 15 | @streamable 16 | class ReorgProtocol(Streamable): 17 | old_index: uint32 18 | new_index: uint32 19 | puzzle_hash: bytes32 20 | -------------------------------------------------------------------------------- /scam/timelord/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam/timelord/__init__.py -------------------------------------------------------------------------------- /scam/timelord/types.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | 3 | 4 | class Chain(Enum): 5 | CHALLENGE_CHAIN = 1 6 | REWARD_CHAIN = 2 7 | INFUSED_CHALLENGE_CHAIN = 3 8 | BLUEBOX = 4 9 | 10 | 11 | class IterationType(Enum): 12 | SIGNAGE_POINT = 1 13 | INFUSION_POINT = 2 14 | END_OF_SUBSLOT = 3 15 | 16 | 17 | class StateType(Enum): 18 | PEAK = 1 19 | END_OF_SUB_SLOT = 2 20 | FIRST_SUB_SLOT = 3 21 | -------------------------------------------------------------------------------- /scam/types/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam/types/__init__.py -------------------------------------------------------------------------------- /scam/types/announcement.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | 3 | from scam.types.blockchain_format.sized_bytes import bytes32 4 | from scam.util.hash import std_hash 5 | 6 | 7 | @dataclass(frozen=True) 8 | class Announcement: 9 | origin_info: bytes32 10 | message: bytes 11 | 12 | def name(self) -> bytes32: 13 | return std_hash(bytes(self.origin_info + self.message)) 14 | -------------------------------------------------------------------------------- /scam/types/blockchain_format/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam/types/blockchain_format/__init__.py -------------------------------------------------------------------------------- /scam/types/blockchain_format/pool_target.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | 3 | from scam.types.blockchain_format.sized_bytes import bytes32 4 | from scam.util.ints import uint32 5 | from scam.util.streamable import Streamable, streamable 6 | 7 | 8 | @dataclass(frozen=True) 9 | @streamable 10 | class PoolTarget(Streamable): 11 | puzzle_hash: bytes32 12 | max_height: uint32 # A max height of 0 means it is valid forever 13 | -------------------------------------------------------------------------------- /scam/types/blockchain_format/sized_bytes.py: -------------------------------------------------------------------------------- 1 | from scam.util.byte_types import make_sized_bytes 2 | 3 | bytes4 = make_sized_bytes(4) 4 | bytes8 = make_sized_bytes(8) 5 | bytes32 = make_sized_bytes(32) 6 | bytes48 = make_sized_bytes(48) 7 | bytes96 = make_sized_bytes(96) 8 | bytes100 = make_sized_bytes(100) 9 | bytes480 = make_sized_bytes(480) 10 | -------------------------------------------------------------------------------- /scam/types/blockchain_format/sub_epoch_summary.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | from typing import Optional 3 | 4 | from scam.types.blockchain_format.sized_bytes import bytes32 5 | from scam.util.ints import uint8, uint64 6 | from scam.util.streamable import Streamable, streamable 7 | 8 | 9 | @dataclass(frozen=True) 10 | @streamable 11 | class SubEpochSummary(Streamable): 12 | prev_subepoch_summary_hash: bytes32 13 | reward_chain_hash: bytes32 # hash of reward chain at end of last segment 14 | num_blocks_overflow: uint8 # How many more blocks than 384*(N-1) 15 | new_difficulty: Optional[uint64] # Only once per epoch (diff adjustment) 16 | new_sub_slot_iters: Optional[uint64] # Only once per epoch (diff adjustment) 17 | -------------------------------------------------------------------------------- /scam/types/coin_record.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | 3 | from scam.types.blockchain_format.coin import Coin 4 | from scam.types.blockchain_format.sized_bytes import bytes32 5 | from scam.util.ints import uint32, uint64 6 | from scam.util.streamable import Streamable, streamable 7 | 8 | 9 | @dataclass(frozen=True) 10 | @streamable 11 | class CoinRecord(Streamable): 12 | """ 13 | These are values that correspond to a CoinName that are used 14 | in keeping track of the unspent database. 15 | """ 16 | 17 | coin: Coin 18 | confirmed_block_index: uint32 19 | spent_block_index: uint32 20 | spent: bool 21 | coinbase: bool 22 | timestamp: uint64 # Timestamp of the block at height confirmed_block_index 23 | 24 | @property 25 | def name(self) -> bytes32: 26 | return self.coin.name() 27 | -------------------------------------------------------------------------------- /scam/types/coin_solution.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | from typing import List 3 | 4 | from scam.types.blockchain_format.coin import Coin 5 | from scam.types.blockchain_format.program import SerializedProgram, INFINITE_COST 6 | from scam.util.chain_utils import additions_for_solution 7 | from scam.util.streamable import Streamable, streamable 8 | 9 | 10 | @dataclass(frozen=True) 11 | @streamable 12 | class CoinSolution(Streamable): 13 | """ 14 | This is a rather disparate data structure that validates coin transfers. It's generally populated 15 | with data from different sources, since burned coins are identified by name, so it is built up 16 | more often that it is streamed. 17 | """ 18 | 19 | coin: Coin 20 | puzzle_reveal: SerializedProgram 21 | solution: SerializedProgram 22 | 23 | def additions(self) -> List[Coin]: 24 | return additions_for_solution(self.coin.name(), self.puzzle_reveal, self.solution, INFINITE_COST) 25 | -------------------------------------------------------------------------------- /scam/types/condition_with_args.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | from typing import List 3 | 4 | from scam.types.condition_opcodes import ConditionOpcode 5 | from scam.util.streamable import Streamable, streamable 6 | 7 | 8 | @dataclass(frozen=True) 9 | @streamable 10 | class ConditionWithArgs(Streamable): 11 | """ 12 | This structure is used to store parsed CLVM conditions 13 | Conditions in CLVM have either format of (opcode, var1) or (opcode, var1, var2) 14 | """ 15 | 16 | opcode: ConditionOpcode 17 | vars: List[bytes] 18 | -------------------------------------------------------------------------------- /scam/types/end_of_slot_bundle.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | from typing import Optional 3 | 4 | from scam.types.blockchain_format.slots import ( 5 | ChallengeChainSubSlot, 6 | InfusedChallengeChainSubSlot, 7 | RewardChainSubSlot, 8 | SubSlotProofs, 9 | ) 10 | from scam.util.streamable import Streamable, streamable 11 | 12 | 13 | @dataclass(frozen=True) 14 | @streamable 15 | class EndOfSubSlotBundle(Streamable): 16 | challenge_chain: ChallengeChainSubSlot 17 | infused_challenge_chain: Optional[InfusedChallengeChainSubSlot] 18 | reward_chain: RewardChainSubSlot 19 | proofs: SubSlotProofs 20 | -------------------------------------------------------------------------------- /scam/types/mempool_inclusion_status.py: -------------------------------------------------------------------------------- 1 | from enum import IntEnum 2 | 3 | 4 | class MempoolInclusionStatus(IntEnum): 5 | SUCCESS = 1 # Transaction added to mempool 6 | PENDING = 2 # Transaction not yet added to mempool 7 | FAILED = 3 # Transaction was invalid and dropped 8 | -------------------------------------------------------------------------------- /scam/types/name_puzzle_condition.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | from typing import Dict, List, Tuple 3 | 4 | from scam.types.blockchain_format.sized_bytes import bytes32 5 | from scam.types.condition_with_args import ConditionWithArgs 6 | from scam.util.condition_tools import ConditionOpcode 7 | from scam.util.streamable import Streamable, streamable 8 | 9 | 10 | @dataclass(frozen=True) 11 | @streamable 12 | class NPC(Streamable): 13 | coin_name: bytes32 14 | puzzle_hash: bytes32 15 | conditions: List[Tuple[ConditionOpcode, List[ConditionWithArgs]]] 16 | 17 | @property 18 | def condition_dict(self): 19 | d: Dict[ConditionOpcode, List[ConditionWithArgs]] = {} 20 | for opcode, l in self.conditions: 21 | d[opcode] = l 22 | return d 23 | -------------------------------------------------------------------------------- /scam/util/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam/util/__init__.py -------------------------------------------------------------------------------- /scam/util/chain_utils.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | 3 | from scam.types.blockchain_format.coin import Coin 4 | from scam.types.blockchain_format.program import SerializedProgram 5 | from scam.types.blockchain_format.sized_bytes import bytes32 6 | from scam.util.condition_tools import ( 7 | conditions_dict_for_solution, 8 | created_outputs_for_conditions_dict, 9 | ) 10 | 11 | 12 | def additions_for_solution( 13 | coin_name: bytes32, puzzle_reveal: SerializedProgram, solution: SerializedProgram, max_cost: int 14 | ) -> List[Coin]: 15 | """ 16 | Checks the conditions created by CoinSolution and returns the list of all coins created 17 | """ 18 | err, dic, cost = conditions_dict_for_solution(puzzle_reveal, solution, max_cost) 19 | if err or dic is None: 20 | return [] 21 | return created_outputs_for_conditions_dict(dic, coin_name) 22 | -------------------------------------------------------------------------------- /scam/util/clvm.py: -------------------------------------------------------------------------------- 1 | from clvm.casts import int_from_bytes, int_to_bytes # noqa 2 | -------------------------------------------------------------------------------- /scam/util/db_wrapper.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | import aiosqlite 4 | 5 | 6 | class DBWrapper: 7 | """ 8 | This object handles HeaderBlocks and Blocks stored in DB used by wallet. 9 | """ 10 | 11 | db: aiosqlite.Connection 12 | lock: asyncio.Lock 13 | 14 | def __init__(self, connection: aiosqlite.Connection): 15 | self.db = connection 16 | self.lock = asyncio.Lock() 17 | 18 | async def begin_transaction(self): 19 | cursor = await self.db.execute("BEGIN TRANSACTION") 20 | await cursor.close() 21 | 22 | async def rollback_transaction(self): 23 | # Also rolls back the coin store, since both stores must be updated at once 24 | if self.db.in_transaction: 25 | cursor = await self.db.execute("ROLLBACK") 26 | await cursor.close() 27 | 28 | async def commit_transaction(self): 29 | await self.db.commit() 30 | -------------------------------------------------------------------------------- /scam/util/default_root.py: -------------------------------------------------------------------------------- 1 | import os 2 | from pathlib import Path 3 | 4 | DEFAULT_ROOT_PATH = Path(os.path.expanduser(os.getenv("SCAM_ROOT", "~/.scam/mainnet"))).resolve() 5 | -------------------------------------------------------------------------------- /scam/util/hash.py: -------------------------------------------------------------------------------- 1 | import blspy 2 | 3 | from scam.types.blockchain_format.sized_bytes import bytes32 4 | 5 | 6 | def std_hash(b) -> bytes32: 7 | """ 8 | The standard hash used in many places. 9 | """ 10 | return bytes32(blspy.Util.hash256(bytes(b))) 11 | -------------------------------------------------------------------------------- /scam/util/lru_cache.py: -------------------------------------------------------------------------------- 1 | from collections import OrderedDict 2 | from typing import Any, Optional 3 | 4 | 5 | class LRUCache: 6 | def __init__(self, capacity: int): 7 | self.cache: OrderedDict = OrderedDict() 8 | self.capacity = capacity 9 | 10 | def get(self, key: Any) -> Optional[Any]: 11 | if key not in self.cache: 12 | return None 13 | else: 14 | self.cache.move_to_end(key) 15 | return self.cache[key] 16 | 17 | def put(self, key: Any, value: Any) -> None: 18 | self.cache[key] = value 19 | self.cache.move_to_end(key) 20 | if len(self.cache) > self.capacity: 21 | self.cache.popitem(last=False) 22 | 23 | def remove(self, key: Any) -> None: 24 | self.cache.pop(key) 25 | -------------------------------------------------------------------------------- /scam/util/make_test_constants.py: -------------------------------------------------------------------------------- 1 | from typing import Dict 2 | 3 | from scam.consensus.default_constants import DEFAULT_CONSTANTS, ConsensusConstants 4 | 5 | 6 | def make_test_constants(test_constants_overrides: Dict) -> ConsensusConstants: 7 | return DEFAULT_CONSTANTS.replace(**test_constants_overrides) 8 | -------------------------------------------------------------------------------- /scam/util/partial_func.py: -------------------------------------------------------------------------------- 1 | def partial_async_gen(f, *args): 2 | """ 3 | Returns an async generator function which is equalivalent to the passed in function, 4 | but only takes in one parameter (the first one). 5 | """ 6 | 7 | async def inner(first_param): 8 | async for x in f(first_param, *args): 9 | yield x 10 | 11 | return inner 12 | 13 | 14 | def partial_async(f, *args): 15 | """ 16 | Returns an async function which is equalivalent to the passed in function, 17 | but only takes in one parameter (the first one). 18 | """ 19 | 20 | async def inner(first_param): 21 | return await f(first_param, *args) 22 | 23 | return inner 24 | -------------------------------------------------------------------------------- /scam/util/path.py: -------------------------------------------------------------------------------- 1 | import os 2 | from pathlib import Path 3 | from typing import Union 4 | 5 | 6 | def path_from_root(root: Path, path_str: Union[str, Path]) -> Path: 7 | """ 8 | If path is relative, prepend root 9 | If path is absolute, return it directly. 10 | """ 11 | root = Path(os.path.expanduser(str(root))) 12 | path = Path(path_str) 13 | if not path.is_absolute(): 14 | path = root / path 15 | return path.resolve() 16 | 17 | 18 | def mkdir(path_str: Union[str, Path]) -> None: 19 | """ 20 | Create the existing directory (and its parents) if necessary. 21 | """ 22 | path = Path(path_str) 23 | path.mkdir(parents=True, exist_ok=True) 24 | 25 | 26 | def make_path_relative(path_str: Union[str, Path], root: Path) -> Path: 27 | """ 28 | Try to make the given path relative, given the default root. 29 | """ 30 | path = Path(path_str) 31 | try: 32 | path = path.relative_to(root) 33 | except ValueError: 34 | pass 35 | return path 36 | -------------------------------------------------------------------------------- /scam/util/pip_import.py: -------------------------------------------------------------------------------- 1 | "Import a package and install it with PIP if it doesn't exist." 2 | 3 | import subprocess 4 | import sys 5 | 6 | 7 | def pip_import(module, pypi_name=None): 8 | """ 9 | Return None if we can't import or install it. 10 | """ 11 | try: 12 | return __import__(module) 13 | except ImportError: 14 | pass 15 | 16 | subprocess.call([sys.executable, "-m", "pip", "install", pypi_name or module]) 17 | return __import__(module) 18 | -------------------------------------------------------------------------------- /scam/util/prev_transaction_block.py: -------------------------------------------------------------------------------- 1 | from typing import Tuple 2 | 3 | from scam.consensus.block_record import BlockRecord 4 | from scam.consensus.blockchain_interface import BlockchainInterface 5 | from scam.util.ints import uint128 6 | 7 | 8 | def get_prev_transaction_block( 9 | curr: BlockRecord, 10 | blocks: BlockchainInterface, 11 | total_iters_sp: uint128, 12 | ) -> Tuple[bool, BlockRecord]: 13 | prev_transaction_block = curr 14 | while not curr.is_transaction_block: 15 | curr = blocks.block_record(curr.prev_hash) 16 | if total_iters_sp > curr.total_iters: 17 | prev_transaction_block = curr 18 | is_transaction_block = True 19 | else: 20 | is_transaction_block = False 21 | return is_transaction_block, prev_transaction_block 22 | -------------------------------------------------------------------------------- /scam/util/recursive_replace.py: -------------------------------------------------------------------------------- 1 | from dataclasses import replace 2 | from typing import Any 3 | 4 | 5 | def recursive_replace(root_obj: Any, replace_str: str, replace_with: Any) -> Any: 6 | split_str = replace_str.split(".") 7 | if len(split_str) == 1: 8 | return replace(root_obj, **{split_str[0]: replace_with}) 9 | sub_obj = recursive_replace(getattr(root_obj, split_str[0]), ".".join(split_str[1:]), replace_with) 10 | return replace(root_obj, **{split_str[0]: sub_obj}) 11 | -------------------------------------------------------------------------------- /scam/util/safe_cancel_task.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import logging 3 | from typing import Optional 4 | 5 | 6 | def cancel_task_safe(task: Optional[asyncio.Task], log: Optional[logging.Logger] = None): 7 | if task is not None: 8 | try: 9 | task.cancel() 10 | except Exception as e: 11 | if log is not None: 12 | log.error(f"Error while canceling task.{e} {task}") 13 | -------------------------------------------------------------------------------- /scam/util/setproctitle.py: -------------------------------------------------------------------------------- 1 | try: 2 | import setproctitle as pysetproctitle 3 | 4 | no_setproctitle = False 5 | except Exception: 6 | no_setproctitle = True 7 | 8 | 9 | def setproctitle(ps_name: str) -> None: 10 | if no_setproctitle is False: 11 | pysetproctitle.setproctitle(ps_name) 12 | -------------------------------------------------------------------------------- /scam/util/significant_bits.py: -------------------------------------------------------------------------------- 1 | def truncate_to_significant_bits(input_x: int, num_significant_bits: int) -> int: 2 | """ 3 | Truncates the number such that only the top num_significant_bits contain 1s. 4 | and the rest of the number is 0s (in binary). Ignores decimals and leading 5 | zeroes. For example, -0b011110101 and 2, returns -0b11000000. 6 | """ 7 | x = abs(input_x) 8 | if num_significant_bits > x.bit_length(): 9 | return x 10 | lower = x.bit_length() - num_significant_bits 11 | mask = (1 << (x.bit_length())) - 1 - ((1 << lower) - 1) 12 | if input_x < 0: 13 | return -(x & mask) 14 | else: 15 | return x & mask 16 | 17 | 18 | def count_significant_bits(input_x: int) -> int: 19 | """ 20 | Counts the number of significant bits of an integer, ignoring negative signs 21 | and leading zeroes. For example, for -0b000110010000, returns 5. 22 | """ 23 | x = input_x 24 | for i in range(x.bit_length()): 25 | if x & (1 << i) > 0: 26 | return x.bit_length() - i 27 | return 0 28 | -------------------------------------------------------------------------------- /scam/wallet/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam/wallet/__init__.py -------------------------------------------------------------------------------- /scam/wallet/cc_wallet/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam/wallet/cc_wallet/__init__.py -------------------------------------------------------------------------------- /scam/wallet/cc_wallet/cc_info.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | from typing import List, Optional, Tuple 3 | 4 | from scam.types.blockchain_format.program import Program 5 | from scam.types.blockchain_format.sized_bytes import bytes32 6 | from scam.util.streamable import Streamable, streamable 7 | 8 | 9 | @dataclass(frozen=True) 10 | @streamable 11 | class CCInfo(Streamable): 12 | my_genesis_checker: Optional[Program] # this is the program 13 | lineage_proofs: List[Tuple[bytes32, Optional[Program]]] # {coin.name(): lineage_proof} 14 | -------------------------------------------------------------------------------- /scam/wallet/derivation_record.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | 3 | from blspy import G1Element 4 | 5 | from scam.types.blockchain_format.sized_bytes import bytes32 6 | from scam.util.ints import uint32 7 | from scam.wallet.util.wallet_types import WalletType 8 | 9 | 10 | @dataclass(frozen=True) 11 | class DerivationRecord: 12 | """ 13 | These are records representing a puzzle hash, which is generated from a 14 | public key, derivation index, and wallet type. Stored in the puzzle_store. 15 | """ 16 | 17 | index: uint32 18 | puzzle_hash: bytes32 19 | pubkey: G1Element 20 | wallet_type: WalletType 21 | wallet_id: uint32 22 | -------------------------------------------------------------------------------- /scam/wallet/did_wallet/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam/wallet/did_wallet/__init__.py -------------------------------------------------------------------------------- /scam/wallet/did_wallet/did_info.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | from typing import List, Optional, Tuple 3 | 4 | from scam.types.blockchain_format.sized_bytes import bytes32 5 | from scam.util.ints import uint64 6 | from scam.util.streamable import streamable, Streamable 7 | from scam.wallet.lineage_proof import LineageProof 8 | from scam.types.blockchain_format.program import Program 9 | from scam.types.blockchain_format.coin import Coin 10 | 11 | 12 | @dataclass(frozen=True) 13 | @streamable 14 | class DIDInfo(Streamable): 15 | origin_coin: Optional[Coin] # puzzlehash of this coin is our DID 16 | backup_ids: List[bytes] 17 | num_of_backup_ids_needed: uint64 18 | parent_info: List[Tuple[bytes32, Optional[LineageProof]]] # {coin.name(): LineageProof} 19 | current_inner: Optional[Program] # represents a Program as bytes 20 | temp_coin: Optional[Coin] # partially recovered wallet uses these to hold info 21 | temp_puzhash: Optional[bytes32] 22 | temp_pubkey: Optional[bytes] 23 | -------------------------------------------------------------------------------- /scam/wallet/lineage_proof.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | from typing import Optional 3 | 4 | from scam.types.blockchain_format.sized_bytes import bytes32 5 | from scam.util.ints import uint64 6 | from scam.util.streamable import Streamable, streamable 7 | 8 | 9 | @dataclass(frozen=True) 10 | @streamable 11 | class LineageProof(Streamable): 12 | parent_name: bytes32 13 | inner_puzzle_hash: Optional[bytes32] 14 | amount: uint64 15 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam/wallet/puzzles/__init__.py -------------------------------------------------------------------------------- /scam/wallet/puzzles/block_program_zero.clvm: -------------------------------------------------------------------------------- 1 | 2 | ; TODO convert generators arg to list of generators 3 | 4 | (mod (decompress_puzzle decompress_coin_solution_entry start end compressed_cses deserialize gen_list reserved_arg) 5 | 6 | (defun decompress_cses (decompress_puzzle decompress_coin_solution_entry cses deserialize puzzle_prefix) 7 | (if cses 8 | (c (a decompress_coin_solution_entry (list deserialize decompress_puzzle puzzle_prefix (f cses))) 9 | (decompress_cses decompress_puzzle decompress_coin_solution_entry (r cses) deserialize puzzle_prefix )) 10 | ()) ) 11 | 12 | (list (decompress_cses decompress_puzzle decompress_coin_solution_entry compressed_cses deserialize (substr (f gen_list) start end))) 13 | 14 | ) 15 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/block_program_zero.clvm.hex: -------------------------------------------------------------------------------- 1 | ff02ffff01ff04ffff02ff02ffff04ff02ffff04ff05ffff04ff0bffff04ff5fffff04ff81bfffff04ffff0cff82027fff17ff2f80ff8080808080808080ff8080ffff04ffff01ff02ffff03ff17ffff01ff04ffff02ff0bffff04ff2fffff04ff05ffff04ff5fffff04ff27ff808080808080ffff02ff02ffff04ff02ffff04ff05ffff04ff0bffff04ff37ffff04ff2fffff04ff5fff808080808080808080ff8080ff0180ff018080 -------------------------------------------------------------------------------- /scam/wallet/puzzles/block_program_zero.clvm.hex.sha256tree: -------------------------------------------------------------------------------- 1 | f0a38c8efe58895ae527c65c37f700a4238504691b83990e5dd91bd8b3c30eae 2 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/calculate_synthetic_public_key.clvm: -------------------------------------------------------------------------------- 1 | (mod 2 | (public_key hidden_puzzle_hash) 3 | 4 | (point_add public_key (pubkey_for_exp (sha256 public_key hidden_puzzle_hash))) 5 | ) 6 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/calculate_synthetic_public_key.clvm.hex: -------------------------------------------------------------------------------- 1 | ff1dff02ffff1effff0bff02ff05808080 -------------------------------------------------------------------------------- /scam/wallet/puzzles/calculate_synthetic_public_key.clvm.hex.sha256tree: -------------------------------------------------------------------------------- 1 | 624c5d5704d0decadfc0503e71bbffb6cdfe45025bce7cf3e6864d1eafe8f65e 2 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/cc.clvm.hex.sha256tree: -------------------------------------------------------------------------------- 1 | d4596fa7aa6eaa267ebce8d527546827de083d58fb4e14f4137c2448f7252e5c 2 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/cc_loader.py: -------------------------------------------------------------------------------- 1 | from scam.wallet.puzzles.load_clvm import load_clvm 2 | 3 | CC_MOD = load_clvm("cc.clvm", package_or_requirement=__name__) 4 | LOCK_INNER_PUZZLE = load_clvm("lock.inner.puzzle.clvm", package_or_requirement=__name__) 5 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/create-lock-puzzlehash.clvm: -------------------------------------------------------------------------------- 1 | ; This puzzle evaluates to an empty list , which means no conditions need to be satisfied; 2 | ; The puzzle can never evaluate to my-id. 3 | ; my-id is there on a discarded branch of the tree as a signal to another piece of code 4 | ; that will be checking if a coin whose puzzle is of this form, was created or spent. 5 | ( 6 | (defun-inline create-lock-puzzlehash (my-id) 7 | (sha256tree (list r 8 | (list c 9 | (list q 10 | my-id) 11 | (q (q ())))))) 12 | ) -------------------------------------------------------------------------------- /scam/wallet/puzzles/create-lock-puzzlehash.clvm.hex.sha256tree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam/wallet/puzzles/create-lock-puzzlehash.clvm.hex.sha256tree -------------------------------------------------------------------------------- /scam/wallet/puzzles/decompress_coin_solution_entry.clvm: -------------------------------------------------------------------------------- 1 | (mod (deserialize decompress_puzzle puzzle_prefix suffix cse) 2 | 3 | ; decompress a single compressed standard transaction 4 | (c (f cse) (c (a decompress_puzzle (list deserialize puzzle_prefix (f (f (r cse))) suffix)) (c (f (r (f cse))) (r (f (r cse)))))) 5 | ) 6 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/decompress_coin_solution_entry.clvm.hex: -------------------------------------------------------------------------------- 1 | ff04ff4fffff04ffff02ff05ffff04ff02ffff04ff0bffff04ff82012fffff04ff17ff808080808080ffff04ff82014fff8201af808080 -------------------------------------------------------------------------------- /scam/wallet/puzzles/decompress_coin_solution_entry.clvm.hex.sha256tree: -------------------------------------------------------------------------------- 1 | 9d98ed08770d31be4bd1bde4705dab388db5e7e9c349f5a76fc3c347aa3a0b79 2 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/decompress_coin_solution_entry_with_prefix.clvm: -------------------------------------------------------------------------------- 1 | (mod (deserialize decompress_puzzle puzzle_prefix cse) 2 | 3 | ; decompress a single compressed standard transaction 4 | 5 | (c (f (f cse)) (c (a decompress_puzzle (list deserialize puzzle_prefix (f (f (r cse))) (q . 0xff018080))) (c (f (r (f cse))) (r (f (r cse)))))) 6 | 7 | ) 8 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/decompress_coin_solution_entry_with_prefix.clvm.hex: -------------------------------------------------------------------------------- 1 | ff04ff47ffff04ffff02ff05ffff04ff02ffff04ff0bffff04ff8197ffff01ff84ff0180808080808080ffff04ff81a7ff81d7808080 -------------------------------------------------------------------------------- /scam/wallet/puzzles/decompress_coin_solution_entry_with_prefix.clvm.hex.sha256tree: -------------------------------------------------------------------------------- 1 | 92aa4bc8060a8836355a1884075141b4791ce1b67ae6092bb166b2845954bc89 2 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/decompress_puzzle.clvm: -------------------------------------------------------------------------------- 1 | (mod (deserialize puzzle_prefix pubkey suffix) 2 | 3 | (a deserialize (list (concat puzzle_prefix pubkey suffix))) 4 | 5 | ) 6 | 7 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/decompress_puzzle.clvm.hex: -------------------------------------------------------------------------------- 1 | ff02ff02ffff04ffff0eff05ff0bff1780ff808080 -------------------------------------------------------------------------------- /scam/wallet/puzzles/decompress_puzzle.clvm.hex.sha256tree: -------------------------------------------------------------------------------- 1 | fe94c58f1117afe315e0450daca1c62460ec1a1c439cd4018d79967a5d7d1370 2 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/did_innerpuz.clvm.hex.sha256tree: -------------------------------------------------------------------------------- 1 | f2356bc00a27abf46c72b809ba7d1d53bde533d94a7a3da8954155afe54304c4 2 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/generator_for_single_coin.clvm.hex.sha256tree: -------------------------------------------------------------------------------- 1 | 303e2eeba68fd2d490a4af51dc9d175fcb33ae97a0ed242f9f08abc92c21898e 2 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/generator_loader.py: -------------------------------------------------------------------------------- 1 | from scam.wallet.puzzles.load_clvm import load_serialized_clvm 2 | 3 | GENERATOR_FOR_SINGLE_COIN_MOD = load_serialized_clvm("generator_for_single_coin.clvm", package_or_requirement=__name__) 4 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/genesis-by-coin-id-with-0.clvm: -------------------------------------------------------------------------------- 1 | ; This is a "genesis checker" for use with cc.clvm. 2 | ; 3 | ; This checker allows new ccs to be created if they have a particular 4 | ; coin id as parent; or created by anyone if their value is 0. 5 | 6 | (mod ( 7 | genesis-id 8 | lineage-proof-parameters 9 | my-coin-info 10 | (parent-coin zero-parent-inner-puzzle-hash) 11 | ) 12 | 13 | ;; boolean or macro 14 | ;; This lets you write something like (if (or COND1 COND2 COND3) (do-something) (do-something-else)) 15 | (defmacro or ARGS 16 | (if ARGS 17 | (qq (if (unquote (f ARGS)) 18 | 1 19 | (unquote (c or (r ARGS))) 20 | )) 21 | 0) 22 | ) 23 | 24 | (defun-inline main ( 25 | genesis-id 26 | my-coin-info 27 | ) 28 | 29 | (or 30 | (= (f (r (r my-coin-info))) 0) 31 | (= (f my-coin-info) genesis-id) 32 | ) 33 | ) 34 | 35 | (main 36 | genesis-id 37 | my-coin-info 38 | ) 39 | ) -------------------------------------------------------------------------------- /scam/wallet/puzzles/genesis-by-coin-id-with-0.clvm.hex: -------------------------------------------------------------------------------- 1 | ff02ffff03ffff09ff5bff8080ffff01ff0101ffff01ff02ffff03ffff09ff13ff0280ffff01ff0101ff8080ff018080ff0180 -------------------------------------------------------------------------------- /scam/wallet/puzzles/genesis-by-coin-id-with-0.clvm.hex.sha256tree: -------------------------------------------------------------------------------- 1 | 258008f81f21c270f4b58488b108a46a35e5df43ca5b0313ac83e900a5e44a5f 2 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/genesis-by-puzzle-hash-with-0.clvm.hex: -------------------------------------------------------------------------------- 1 | ff02ffff03ffff09ff5bff8080ffff01ff0101ffff01ff02ffff03ffff02ffff03ffff09ffff0bff47ff81a7ff82016780ff1380ffff01ff02ffff03ffff09ff81a7ff0280ffff01ff0101ff8080ff0180ff8080ff0180ffff01ff0101ff8080ff018080ff0180 -------------------------------------------------------------------------------- /scam/wallet/puzzles/genesis-by-puzzle-hash-with-0.clvm.hex.sha256tree: -------------------------------------------------------------------------------- 1 | 795964e0324fbc08e8383d67659194a70455956ad1ebd2329ccf20008da00936 2 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/lock.inner.puzzle.clvm: -------------------------------------------------------------------------------- 1 | ; a trivial puzzle used as the core of a lock puzzle 2 | (mod args (q ())) 3 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/lock.inner.puzzle.clvm.hex: -------------------------------------------------------------------------------- 1 | ff01ff8080 -------------------------------------------------------------------------------- /scam/wallet/puzzles/lock.inner.puzzle.clvm.hex.sha256tree: -------------------------------------------------------------------------------- 1 | f3a579254623f8094e07af862df2e45c9db5592b4105d34a256dd6c498416288 2 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/p2_conditions.clvm: -------------------------------------------------------------------------------- 1 | (mod (conditions) 2 | (qq (q . (unquote conditions))) 3 | ) 4 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/p2_conditions.clvm.hex: -------------------------------------------------------------------------------- 1 | ff04ffff0101ff0280 -------------------------------------------------------------------------------- /scam/wallet/puzzles/p2_conditions.clvm.hex.sha256tree: -------------------------------------------------------------------------------- 1 | 1c77d7d5efde60a7a1d2d27db6d746bc8e568aea1ef8586ca967a0d60b83cc36 2 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/p2_conditions.py: -------------------------------------------------------------------------------- 1 | """ 2 | Pay to conditions 3 | 4 | In this puzzle program, the solution is ignored. The reveal of the puzzle 5 | returns a fixed list of conditions. This roughly corresponds to OP_SECURETHEBAG 6 | in bitcoin. 7 | 8 | This is a pretty useless most of the time. But some (most?) solutions 9 | require a delegated puzzle program, so in those cases, this is just what 10 | the doctor ordered. 11 | """ 12 | 13 | from scam.types.blockchain_format.program import Program 14 | 15 | from .load_clvm import load_clvm 16 | 17 | MOD = load_clvm("p2_conditions.clvm") 18 | 19 | 20 | def puzzle_for_conditions(conditions) -> Program: 21 | return MOD.run([conditions]) 22 | 23 | 24 | def solution_for_conditions(conditions) -> Program: 25 | return Program.to([puzzle_for_conditions(conditions), 0]) 26 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/p2_delegated_conditions.clvm: -------------------------------------------------------------------------------- 1 | (mod 2 | (public_key conditions) 3 | 4 | (include condition_codes.clvm) 5 | 6 | ;; hash a tree 7 | ;; This is used to calculate a puzzle hash given a puzzle program. 8 | (defun sha256tree1 9 | (TREE) 10 | (if (l TREE) 11 | (sha256 2 (sha256tree1 (f TREE)) (sha256tree1 (r TREE))) 12 | (sha256 1 TREE) 13 | ) 14 | ) 15 | 16 | (c (list AGG_SIG_ME public_key (sha256tree1 conditions)) conditions) 17 | 18 | ) 19 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/p2_delegated_conditions.clvm.hex: -------------------------------------------------------------------------------- 1 | ff02ffff01ff04ffff04ff04ffff04ff05ffff04ffff02ff06ffff04ff02ffff04ff0bff80808080ff80808080ff0b80ffff04ffff01ff32ff02ffff03ffff07ff0580ffff01ff0bffff0102ffff02ff06ffff04ff02ffff04ff09ff80808080ffff02ff06ffff04ff02ffff04ff0dff8080808080ffff01ff0bffff0101ff058080ff0180ff018080 2 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/p2_delegated_conditions.clvm.hex.sha256tree: -------------------------------------------------------------------------------- 1 | 0ff94726f1a8dea5c3f70d3121945190778d3b2b3fcda3735a1f290977e98341 2 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/p2_delegated_conditions.py: -------------------------------------------------------------------------------- 1 | """ 2 | Pay to delegated conditions 3 | 4 | In this puzzle program, the solution must be a signed list of conditions, which 5 | is returned literally. 6 | """ 7 | 8 | 9 | from scam.types.blockchain_format.program import Program 10 | 11 | from .load_clvm import load_clvm 12 | 13 | MOD = load_clvm("p2_delegated_conditions.clvm") 14 | 15 | 16 | def puzzle_for_pk(public_key: Program) -> Program: 17 | return MOD.curry(public_key) 18 | 19 | 20 | def solution_for_conditions(conditions: Program) -> Program: 21 | return conditions.to([conditions]) 22 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/p2_delegated_puzzle.clvm: -------------------------------------------------------------------------------- 1 | (mod 2 | 3 | (public_key delegated_puzzle delegated_puzzle_solution) 4 | 5 | (include condition_codes.clvm) 6 | 7 | ;; hash a tree 8 | ;; This is used to calculate a puzzle hash given a puzzle program. 9 | (defun sha256tree1 10 | (TREE) 11 | (if (l TREE) 12 | (sha256 2 (sha256tree1 (f TREE)) (sha256tree1 (r TREE))) 13 | (sha256 1 TREE) 14 | ) 15 | ) 16 | 17 | (c (list AGG_SIG_ME public_key (sha256tree1 delegated_puzzle)) 18 | (a delegated_puzzle delegated_puzzle_solution)) 19 | ) 20 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/p2_delegated_puzzle.clvm.hex: -------------------------------------------------------------------------------- 1 | ff02ffff01ff04ffff04ff04ffff04ff05ffff04ffff02ff06ffff04ff02ffff04ff0bff80808080ff80808080ffff02ff0bff178080ffff04ffff01ff32ff02ffff03ffff07ff0580ffff01ff0bffff0102ffff02ff06ffff04ff02ffff04ff09ff80808080ffff02ff06ffff04ff02ffff04ff0dff8080808080ffff01ff0bffff0101ff058080ff0180ff018080 -------------------------------------------------------------------------------- /scam/wallet/puzzles/p2_delegated_puzzle.clvm.hex.sha256tree: -------------------------------------------------------------------------------- 1 | 542cde70d1102cd1b763220990873efc8ab15625ded7eae22cc11e21ef2e2f7c 2 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clvm.hex: -------------------------------------------------------------------------------- 1 | ff02ffff01ff02ffff03ff0bffff01ff02ffff03ffff09ff05ffff1dff0bffff1effff0bff0bffff02ff06ffff04ff02ffff04ff17ff8080808080808080ffff01ff02ff17ff2f80ffff01ff088080ff0180ffff01ff04ffff04ff04ffff04ff05ffff04ffff02ff06ffff04ff02ffff04ff17ff80808080ff80808080ffff02ff17ff2f808080ff0180ffff04ffff01ff32ff02ffff03ffff07ff0580ffff01ff0bffff0102ffff02ff06ffff04ff02ffff04ff09ff80808080ffff02ff06ffff04ff02ffff04ff0dff8080808080ffff01ff0bffff0101ff058080ff0180ff018080 -------------------------------------------------------------------------------- /scam/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clvm.hex.sha256tree: -------------------------------------------------------------------------------- 1 | e9aaa49f45bad5c889b86ee3341550c155cfdd10c3a6757de618d20612fffd52 2 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/p2_m_of_n_delegate_direct.clvm.hex: -------------------------------------------------------------------------------- 1 | ff02ffff01ff02ffff03ffff09ff05ffff02ff16ffff04ff02ffff04ff17ff8080808080ffff01ff02ff0cffff04ff02ffff04ffff02ff0affff04ff02ffff04ff17ffff04ff0bff8080808080ffff04ffff02ff1effff04ff02ffff04ff2fff80808080ffff04ff2fffff04ff5fff80808080808080ffff01ff088080ff0180ffff04ffff01ffff31ff02ffff03ff05ffff01ff04ffff04ff08ffff04ff09ffff04ff0bff80808080ffff02ff0cffff04ff02ffff04ff0dffff04ff0bffff04ff17ffff04ff2fff8080808080808080ffff01ff02ff17ff2f8080ff0180ffff02ffff03ff05ffff01ff02ffff03ff09ffff01ff04ff13ffff02ff0affff04ff02ffff04ff0dffff04ff1bff808080808080ffff01ff02ff0affff04ff02ffff04ff0dffff04ff1bff808080808080ff0180ff8080ff0180ffff02ffff03ff05ffff01ff10ffff02ff16ffff04ff02ffff04ff0dff80808080ffff02ffff03ff09ffff01ff0101ff8080ff018080ff8080ff0180ff02ffff03ffff07ff0580ffff01ff0bffff0102ffff02ff1effff04ff02ffff04ff09ff80808080ffff02ff1effff04ff02ffff04ff0dff8080808080ffff01ff0bffff0101ff058080ff0180ff018080 -------------------------------------------------------------------------------- /scam/wallet/puzzles/p2_m_of_n_delegate_direct.clvm.hex.sha256tree: -------------------------------------------------------------------------------- 1 | 0f199d5263ac1a62b077c159404a71abd3f9691cc57520bf1d4c5cb501504457 2 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/p2_m_of_n_delegate_direct.py: -------------------------------------------------------------------------------- 1 | """ 2 | Pay to m of n direct 3 | 4 | This puzzle program is like p2_delegated_puzzle except instead of one public key, 5 | it includes N public keys, any M of which needs to sign the delegated puzzle. 6 | """ 7 | 8 | from scam.types.blockchain_format.program import Program 9 | 10 | from .load_clvm import load_clvm 11 | 12 | MOD = load_clvm("p2_m_of_n_delegate_direct.clvm") 13 | 14 | 15 | def puzzle_for_m_of_public_key_list(m, public_key_list) -> Program: 16 | return MOD.curry(m, public_key_list) 17 | 18 | 19 | def solution_for_delegated_puzzle(m, selectors, puzzle, solution) -> Program: 20 | return Program.to([selectors, puzzle, solution]) 21 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/p2_puzzle_hash.clvm: -------------------------------------------------------------------------------- 1 | (mod 2 | (inner_puzzle_hash inner_puzzle inner_puzzle_solution) 3 | 4 | ;; hash a tree 5 | ;; This is used to calculate a puzzle hash given a puzzle program. 6 | (defun sha256tree1 7 | (TREE) 8 | (if (l TREE) 9 | (sha256 2 (sha256tree1 (f TREE)) (sha256tree1 (r TREE))) 10 | (sha256 1 TREE) 11 | ) 12 | ) 13 | 14 | (if (= inner_puzzle_hash (sha256tree1 inner_puzzle)) 15 | (a inner_puzzle inner_puzzle_solution) 16 | (x) 17 | ) 18 | ) -------------------------------------------------------------------------------- /scam/wallet/puzzles/p2_puzzle_hash.clvm.hex: -------------------------------------------------------------------------------- 1 | ff02ffff01ff02ffff03ffff09ff05ffff02ff02ffff04ff02ffff04ff0bff8080808080ffff01ff02ff0bff1780ffff01ff088080ff0180ffff04ffff01ff02ffff03ffff07ff0580ffff01ff0bffff0102ffff02ff02ffff04ff02ffff04ff09ff80808080ffff02ff02ffff04ff02ffff04ff0dff8080808080ffff01ff0bffff0101ff058080ff0180ff018080 -------------------------------------------------------------------------------- /scam/wallet/puzzles/p2_puzzle_hash.clvm.hex.sha256tree: -------------------------------------------------------------------------------- 1 | 13e29a62b42cd2ef72a79e4bacdc59733ca6310d65af83d349360d36ec622363 2 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/p2_puzzle_hash.py: -------------------------------------------------------------------------------- 1 | """ 2 | Pay to puzzle hash 3 | 4 | In this puzzle program, the solution must be a reveal of the puzzle with the given 5 | hash along with its solution. 6 | """ 7 | 8 | from scam.types.blockchain_format.program import Program 9 | from scam.types.blockchain_format.sized_bytes import bytes32 10 | 11 | from .load_clvm import load_clvm 12 | 13 | MOD = load_clvm("p2_puzzle_hash.clvm") 14 | 15 | 16 | def puzzle_for_inner_puzzle_hash(inner_puzzle_hash: bytes32) -> Program: 17 | program = MOD.curry(inner_puzzle_hash) 18 | return program 19 | 20 | 21 | def puzzle_for_inner_puzzle(inner_puzzle: Program) -> Program: 22 | return puzzle_for_inner_puzzle_hash(inner_puzzle.get_tree_hash()) 23 | 24 | 25 | def solution_for_inner_puzzle_and_inner_solution(inner_puzzle: Program, inner_puzzle_solution: Program) -> Program: 26 | return Program.to([inner_puzzle, inner_puzzle_solution]) 27 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/p2_singleton.clvm.hex: -------------------------------------------------------------------------------- 1 | ff02ffff01ff04ffff04ff18ffff04ffff0bffff02ff2effff04ff02ffff04ff05ffff04ff2fffff04ffff02ff3effff04ff02ffff04ffff04ff05ffff04ff0bff178080ff80808080ff808080808080ff5f80ff808080ffff04ffff04ff2cffff01ff248080ffff04ffff04ff10ffff04ff5fff808080ff80808080ffff04ffff01ffffff463fff02ff3c04ffff01ff0102ffff02ffff03ff05ffff01ff02ff16ffff04ff02ffff04ff0dffff04ffff0bff3affff0bff12ff3c80ffff0bff3affff0bff3affff0bff12ff2a80ff0980ffff0bff3aff0bffff0bff12ff8080808080ff8080808080ffff010b80ff0180ffff0bff3affff0bff12ff1480ffff0bff3affff0bff3affff0bff12ff2a80ff0580ffff0bff3affff02ff16ffff04ff02ffff04ff07ffff04ffff0bff12ff1280ff8080808080ffff0bff12ff8080808080ff02ffff03ffff07ff0580ffff01ff0bffff0102ffff02ff3effff04ff02ffff04ff09ff80808080ffff02ff3effff04ff02ffff04ff0dff8080808080ffff01ff0bffff0101ff058080ff0180ff018080 -------------------------------------------------------------------------------- /scam/wallet/puzzles/p2_singleton.clvm.hex.sha256tree: -------------------------------------------------------------------------------- 1 | 40f828d8dd55603f4ff9fbf6b73271e904e69406982f4fbefae2c8dcceaf9834 2 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/p2_singleton_or_delayed_puzhash.clvm.hex: -------------------------------------------------------------------------------- 1 | ff02ffff01ff02ffff03ff82017fffff01ff04ffff04ff38ffff04ffff0bffff02ff2effff04ff02ffff04ff05ffff04ff81bfffff04ffff02ff3effff04ff02ffff04ffff04ff05ffff04ff0bff178080ff80808080ff808080808080ff82017f80ff808080ffff04ffff04ff3cffff01ff248080ffff04ffff04ff28ffff04ff82017fff808080ff80808080ffff01ff04ffff04ff24ffff04ff2fff808080ffff04ffff04ff2cffff04ff5fffff04ff81bfff80808080ffff04ffff04ff10ffff04ff81bfff808080ff8080808080ff0180ffff04ffff01ffffff49ff463fffff5002ff333cffff04ff0101ffff02ff02ffff03ff05ffff01ff02ff36ffff04ff02ffff04ff0dffff04ffff0bff26ffff0bff2aff1280ffff0bff26ffff0bff26ffff0bff2aff3a80ff0980ffff0bff26ff0bffff0bff2aff8080808080ff8080808080ffff010b80ff0180ffff0bff26ffff0bff2aff3480ffff0bff26ffff0bff26ffff0bff2aff3a80ff0580ffff0bff26ffff02ff36ffff04ff02ffff04ff07ffff04ffff0bff2aff2a80ff8080808080ffff0bff2aff8080808080ff02ffff03ffff07ff0580ffff01ff0bffff0102ffff02ff3effff04ff02ffff04ff09ff80808080ffff02ff3effff04ff02ffff04ff0dff8080808080ffff01ff0bffff0101ff058080ff0180ff018080 -------------------------------------------------------------------------------- /scam/wallet/puzzles/p2_singleton_or_delayed_puzhash.clvm.hex.sha256tree: -------------------------------------------------------------------------------- 1 | adb656e0211e2ab4f42069a4c5efc80dc907e7062be08bf1628c8e5b6d94d25b 2 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/pool_member_innerpuz.clvm.hex: -------------------------------------------------------------------------------- 1 | ff02ffff01ff02ffff03ff8202ffffff01ff02ff16ffff04ff02ffff04ff05ffff04ff8204bfffff04ff8206bfffff04ff82017fffff04ffff0bffff19ff2fffff18ffff019100ffffffffffffffffffffffffffffffffff8202ff8080ff0bff82017f80ff8080808080808080ffff01ff04ffff04ff08ffff04ff17ffff04ffff02ff1effff04ff02ffff04ff82017fff80808080ff80808080ffff04ffff04ff1cffff04ff5fffff04ff8206bfff80808080ff80808080ff0180ffff04ffff01ffff32ff3d33ff3effff04ffff04ff1cffff04ff0bffff04ff17ff80808080ffff04ffff04ff1cffff04ff05ffff04ff2fff80808080ffff04ffff04ff0affff04ff5fff808080ffff04ffff04ff14ffff04ffff0bff5fffff012480ff808080ff8080808080ff02ffff03ffff07ff0580ffff01ff0bffff0102ffff02ff1effff04ff02ffff04ff09ff80808080ffff02ff1effff04ff02ffff04ff0dff8080808080ffff01ff0bffff0101ff058080ff0180ff018080 -------------------------------------------------------------------------------- /scam/wallet/puzzles/pool_member_innerpuz.clvm.hex.sha256tree: -------------------------------------------------------------------------------- 1 | a8490702e333ddd831a3ac9c22d0fa26d2bfeaf2d33608deb22f0e0123eb0494 2 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/pool_waitingroom_innerpuz.clvm.hex: -------------------------------------------------------------------------------- 1 | ff02ffff01ff02ffff03ff82017fffff01ff04ffff04ff1cffff04ff5fff808080ffff04ffff04ff12ffff04ff8205ffffff04ff8206bfff80808080ffff04ffff04ff08ffff04ff17ffff04ffff02ff1effff04ff02ffff04ffff04ff8205ffffff04ff8202ffff808080ff80808080ff80808080ff80808080ffff01ff02ff16ffff04ff02ffff04ff05ffff04ff8204bfffff04ff8206bfffff04ff8202ffffff04ffff0bffff19ff2fffff18ffff019100ffffffffffffffffffffffffffffffffff8205ff8080ff0bff8202ff80ff808080808080808080ff0180ffff04ffff01ffff32ff3d52ffff333effff04ffff04ff12ffff04ff0bffff04ff17ff80808080ffff04ffff04ff12ffff04ff05ffff04ff2fff80808080ffff04ffff04ff1affff04ff5fff808080ffff04ffff04ff14ffff04ffff0bff5fffff012480ff808080ff8080808080ff02ffff03ffff07ff0580ffff01ff0bffff0102ffff02ff1effff04ff02ffff04ff09ff80808080ffff02ff1effff04ff02ffff04ff0dff8080808080ffff01ff0bffff0101ff058080ff0180ff018080 -------------------------------------------------------------------------------- /scam/wallet/puzzles/pool_waitingroom_innerpuz.clvm.hex.sha256tree: -------------------------------------------------------------------------------- 1 | a317541a765bf8375e1c6e7c13503d0d2cbf56cacad5182befe947e78e2c0307 2 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/recompile-all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # This hack is a quick way to recompile everything in this directory 4 | 5 | #BASE_DIR=`pwd | dirname` 6 | 7 | FILES=$(ls ./*.clvm) 8 | echo "$FILES" 9 | 10 | INCLUDE_DIR=$(pwd) 11 | 12 | for FILE in $FILES 13 | do 14 | echo "run -d -i $INCLUDE_DIR $FILE > $FILE.hex" 15 | # run -d -i $INCLUDE_DIR $FILE > $FILE.hex 16 | done 17 | 18 | for FILE in $FILES 19 | do 20 | echo "opd -H $FILE.hex | head -1 > $FILE.hex.sha256tree" 21 | done 22 | 23 | echo 24 | echo "Copy & paste the above to the shell to recompile" 25 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/rl.clvm.hex.sha256tree: -------------------------------------------------------------------------------- 1 | f663796a8c522b85bd9472cbea2bf7f138e8351e8e4032706fc0539e87f94faf 2 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/rl_aggregation.clvm: -------------------------------------------------------------------------------- 1 | (mod (wallet_puzzle 2 | my-id 3 | wallet-coin-primary-input 4 | wallet-coin-amount) 5 | 6 | (include condition_codes.clvm) 7 | 8 | (defun sha256tree (tree) 9 | (if (l tree) 10 | (sha256 2 (sha256tree (f tree)) (sha256tree (r tree))) 11 | (sha256 1 tree))) 12 | 13 | (defun-inline create-my-id-condition () 14 | (list ASSERT_MY_COIN_ID my-id)) 15 | 16 | (include create-lock-puzzlehash.clvm) 17 | 18 | (defun-inline parent-coin-id () 19 | (sha256 wallet-coin-primary-input wallet_puzzle wallet-coin-amount)) 20 | 21 | (defun-inline input-of-lock () 22 | (list ASSERT_COIN_ANNOUNCEMENT (sha256 (parent-coin-id) my-id))) 23 | 24 | (list (create-my-id-condition) 25 | (input-of-lock)) 26 | ) 27 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/rl_aggregation.clvm.hex: -------------------------------------------------------------------------------- 1 | ff02ffff01ff04ffff04ff06ffff04ff0bff808080ffff04ffff04ff04ffff04ffff0bffff0bff17ff05ff2f80ff0b80ff808080ff808080ffff04ffff01ff3d46ff018080 -------------------------------------------------------------------------------- /scam/wallet/puzzles/rl_aggregation.clvm.hex.sha256tree: -------------------------------------------------------------------------------- 1 | 007400187f63927ee023a7172bb88f14d49aaa4beb790ecaf7dde7c1a79b6481 2 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/rom_bootstrap_generator.clvm.hex.sha256tree: -------------------------------------------------------------------------------- 1 | 161bade1f822dcd62ab712ebaf30f3922a301e48a639e4295c5685f8bece7bd9 2 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/rom_bootstrap_generator.py: -------------------------------------------------------------------------------- 1 | from scam.types.blockchain_format.program import SerializedProgram 2 | 3 | from .load_clvm import load_clvm 4 | 5 | MOD = SerializedProgram.from_bytes(load_clvm("rom_bootstrap_generator.clvm").as_bin()) 6 | 7 | 8 | def get_generator(): 9 | return MOD 10 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/scamlisp_deserialisation.clvm.hex: -------------------------------------------------------------------------------- 1 | ff02ffff01ff05ffff02ff3effff04ff02ffff04ff05ff8080808080ffff04ffff01ffffff81ff7fff81df81bfffffff02ffff03ffff09ff0bffff01818080ffff01ff04ff80ffff04ff05ff808080ffff01ff02ffff03ffff0aff0bff1880ffff01ff02ff1affff04ff02ffff04ffff02ffff03ffff0aff0bff1c80ffff01ff02ffff03ffff0aff0bff1480ffff01ff0880ffff01ff04ffff0effff18ffff011fff0b80ffff0cff05ff80ffff01018080ffff04ffff0cff05ffff010180ff80808080ff0180ffff01ff04ffff18ffff013fff0b80ffff04ff05ff80808080ff0180ff80808080ffff01ff04ff0bffff04ff05ff80808080ff018080ff0180ff04ffff0cff15ff80ff0980ffff04ffff0cff15ff0980ff808080ffff04ffff04ff05ff1380ffff04ff2bff808080ffff02ff16ffff04ff02ffff04ff09ffff04ffff02ff3effff04ff02ffff04ff15ff80808080ff8080808080ff02ffff03ffff09ffff0cff05ff80ffff010180ff1080ffff01ff02ff2effff04ff02ffff04ffff02ff3effff04ff02ffff04ffff0cff05ffff010180ff80808080ff80808080ffff01ff02ff12ffff04ff02ffff04ffff0cff05ffff010180ffff04ffff0cff05ff80ffff010180ff808080808080ff0180ff018080 -------------------------------------------------------------------------------- /scam/wallet/puzzles/scamlisp_deserialisation.clvm.hex.sha256tree: -------------------------------------------------------------------------------- 1 | 94ec19077f9a34e0b11ad2456af0170f4cc03f11230ca42e3f82e6e644ac4f5d 2 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/sha256tree_module.clvm: -------------------------------------------------------------------------------- 1 | ( 2 | mod (program) 3 | 4 | ;; hash a tree 5 | ;; This is used to calculate a puzzle hash given a puzzle program. 6 | (defun sha256tree 7 | (TREE) 8 | (if (l TREE) 9 | (sha256 2 (sha256tree (f TREE)) (sha256tree (r TREE))) 10 | (sha256 1 TREE) 11 | ) 12 | ) 13 | 14 | (sha256tree program) 15 | ) -------------------------------------------------------------------------------- /scam/wallet/puzzles/sha256tree_module.clvm.hex: -------------------------------------------------------------------------------- 1 | ff02ffff01ff02ff02ffff04ff02ffff04ff05ff80808080ffff04ffff01ff02ffff03ffff07ff0580ffff01ff0bffff0102ffff02ff02ffff04ff02ffff04ff09ff80808080ffff02ff02ffff04ff02ffff04ff0dff8080808080ffff01ff0bffff0101ff058080ff0180ff018080 -------------------------------------------------------------------------------- /scam/wallet/puzzles/sha256tree_module.clvm.hex.sha256tree: -------------------------------------------------------------------------------- 1 | eb4ead6576048c9d730b5ced00646c7fdd390649cfdf48a00de1590cdd8ee18f 2 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/singleton_launcher.clvm: -------------------------------------------------------------------------------- 1 | (mod (singleton_full_puzzle_hash amount key_value_list) 2 | 3 | (include condition_codes.clvm) 4 | 5 | ; takes a lisp tree and returns the hash of it 6 | (defun sha256tree1 (TREE) 7 | (if (l TREE) 8 | (sha256 2 (sha256tree1 (f TREE)) (sha256tree1 (r TREE))) 9 | (sha256 1 TREE) 10 | ) 11 | ) 12 | 13 | ; main 14 | (list (list CREATE_COIN singleton_full_puzzle_hash amount) 15 | (list CREATE_COIN_ANNOUNCEMENT (sha256tree1 (list singleton_full_puzzle_hash amount key_value_list)))) 16 | ) 17 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/singleton_launcher.clvm.hex: -------------------------------------------------------------------------------- 1 | ff02ffff01ff04ffff04ff04ffff04ff05ffff04ff0bff80808080ffff04ffff04ff0affff04ffff02ff0effff04ff02ffff04ffff04ff05ffff04ff0bffff04ff17ff80808080ff80808080ff808080ff808080ffff04ffff01ff33ff3cff02ffff03ffff07ff0580ffff01ff0bffff0102ffff02ff0effff04ff02ffff04ff09ff80808080ffff02ff0effff04ff02ffff04ff0dff8080808080ffff01ff0bffff0101ff058080ff0180ff018080 -------------------------------------------------------------------------------- /scam/wallet/puzzles/singleton_launcher.clvm.hex.sha256tree: -------------------------------------------------------------------------------- 1 | eff07522495060c066f66f32acc2a77e3a3e737aca8baea4d1a64ea4cdc13da9 2 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/singleton_top_layer.clvm.hex.sha256tree: -------------------------------------------------------------------------------- 1 | 24e044101e57b3d8c908b8a38ad57848afd29d3eecc439dba45f4412df4954fd 2 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/test_generator_deserialize.clvm: -------------------------------------------------------------------------------- 1 | (mod (deserializer generator_list reserved_arg) 2 | (a deserializer (list reserved_arg)) 3 | ) 4 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/test_generator_deserialize.clvm.hex: -------------------------------------------------------------------------------- 1 | ff02ff02ffff04ff0bff808080 -------------------------------------------------------------------------------- /scam/wallet/puzzles/test_generator_deserialize.clvm.hex.sha256tree: -------------------------------------------------------------------------------- 1 | 52add794fc76e89512e4a063c383418bda084c8a78c74055abe80179e4a7832c 2 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/test_multiple_generator_input_arguments.clvm: -------------------------------------------------------------------------------- 1 | 2 | (mod (decompress_puzzle decompress_coin_solution_entry start1 end1 start2 end2 compressed_cses deserialize gen_list reserved_arg) 3 | 4 | (defun decompress_cses (decompress_puzzle decompress_coin_solution_entry cses deserialize puzzle_prefix) 5 | (if cses 6 | (c (a decompress_coin_solution_entry (list deserialize decompress_puzzle puzzle_prefix (f cses))) 7 | (decompress_cses decompress_puzzle decompress_coin_solution_entry (r cses) deserialize puzzle_prefix )) 8 | ()) ) 9 | 10 | (defun join_gen_args (generators start1 end1 start2 end2) 11 | (concat 12 | (substr (f generators) start1 end1) 13 | (substr (f (r generators)) start2 end2) 14 | ) 15 | ) 16 | 17 | (list (decompress_cses decompress_puzzle decompress_coin_solution_entry compressed_cses deserialize (join_gen_args gen_list start1 end1 start2 end2))) 18 | 19 | ) 20 | -------------------------------------------------------------------------------- /scam/wallet/puzzles/test_multiple_generator_input_arguments.clvm.hex: -------------------------------------------------------------------------------- 1 | ff02ffff01ff04ffff02ff04ffff04ff02ffff04ff05ffff04ff0bffff04ff82017fffff04ff8202ffffff04ffff02ff06ffff04ff02ffff04ff8205ffffff04ff17ffff04ff2fffff04ff5fffff04ff81bfff8080808080808080ff8080808080808080ff8080ffff04ffff01ffff02ffff03ff17ffff01ff04ffff02ff0bffff04ff2fffff04ff05ffff04ff5fffff04ff27ff808080808080ffff02ff04ffff04ff02ffff04ff05ffff04ff0bffff04ff37ffff04ff2fffff04ff5fff808080808080808080ff8080ff0180ff0effff0cff09ff0bff1780ffff0cff15ff2fff5f8080ff018080 -------------------------------------------------------------------------------- /scam/wallet/puzzles/test_multiple_generator_input_arguments.clvm.hex.sha256tree: -------------------------------------------------------------------------------- 1 | 156dafbddc3e1d3bfe1f2a84e48e5e46b287b8358bf65c3c091c93e855fbfc5b 2 | -------------------------------------------------------------------------------- /scam/wallet/rl_wallet/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam/wallet/rl_wallet/__init__.py -------------------------------------------------------------------------------- /scam/wallet/secret_key_store.py: -------------------------------------------------------------------------------- 1 | from typing import Dict, Optional 2 | 3 | from blspy import G1Element, PrivateKey 4 | 5 | GROUP_ORDER = 0x73EDA753299D7D483339D80809A1D80553BDA402FFFE5BFEFFFFFFFF00000001 6 | 7 | 8 | class SecretKeyStore: 9 | _pk2sk: Dict[G1Element, PrivateKey] 10 | 11 | def __init__(self): 12 | self._pk2sk = {} 13 | 14 | def save_secret_key(self, secret_key: PrivateKey): 15 | public_key = secret_key.get_g1() 16 | self._pk2sk[bytes(public_key)] = secret_key 17 | 18 | def secret_key_for_public_key(self, public_key: G1Element) -> Optional[PrivateKey]: 19 | return self._pk2sk.get(bytes(public_key)) 20 | -------------------------------------------------------------------------------- /scam/wallet/settings/default_settings.py: -------------------------------------------------------------------------------- 1 | from scam.wallet.settings.settings_objects import BackupInitialized 2 | 3 | default_backup_initialized = BackupInitialized(False, False, False, True) 4 | 5 | default_settings = {BackupInitialized.__name__: default_backup_initialized} 6 | -------------------------------------------------------------------------------- /scam/wallet/settings/settings_objects.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | 3 | from scam.util.streamable import Streamable, streamable 4 | 5 | 6 | @dataclass(frozen=True) 7 | @streamable 8 | class BackupInitialized(Streamable): 9 | """ 10 | Stores user decision regarding import of backup info 11 | """ 12 | 13 | user_initialized: bool # Stores if user made a selection in UI. (Skip vs Import backup) 14 | user_skipped: bool # Stores if user decided to skip import of backup info 15 | backup_info_imported: bool # Stores if backup info has been imported 16 | new_wallet: bool # Stores if this wallet is newly created / not restored from backup 17 | -------------------------------------------------------------------------------- /scam/wallet/trade_record.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | from typing import List, Optional, Tuple 3 | 4 | from scam.types.blockchain_format.coin import Coin 5 | from scam.types.blockchain_format.sized_bytes import bytes32 6 | from scam.types.spend_bundle import SpendBundle 7 | from scam.util.ints import uint8, uint32, uint64 8 | from scam.util.streamable import Streamable, streamable 9 | 10 | 11 | @dataclass(frozen=True) 12 | @streamable 13 | class TradeRecord(Streamable): 14 | """ 15 | Used for storing transaction data and status in wallets. 16 | """ 17 | 18 | confirmed_at_index: uint32 19 | accepted_at_time: Optional[uint64] 20 | created_at_time: uint64 21 | my_offer: bool 22 | sent: uint32 23 | spend_bundle: SpendBundle # This in not complete spendbundle 24 | tx_spend_bundle: Optional[SpendBundle] # this is full trade 25 | additions: List[Coin] 26 | removals: List[Coin] 27 | trade_id: bytes32 28 | status: uint32 # TradeStatus, enum not streamable 29 | sent_to: List[Tuple[str, uint8, Optional[str]]] 30 | -------------------------------------------------------------------------------- /scam/wallet/trading/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam/wallet/trading/__init__.py -------------------------------------------------------------------------------- /scam/wallet/trading/trade_status.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | 3 | 4 | class TradeStatus(Enum): 5 | PENDING_ACCEPT = 0 6 | PENDING_CONFIRM = 1 7 | PENDING_CANCEL = 2 8 | CANCELED = 3 9 | CONFIRMED = 4 10 | FAILED = 5 11 | -------------------------------------------------------------------------------- /scam/wallet/util/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/scam/wallet/util/__init__.py -------------------------------------------------------------------------------- /scam/wallet/util/transaction_type.py: -------------------------------------------------------------------------------- 1 | from enum import IntEnum 2 | 3 | 4 | class TransactionType(IntEnum): 5 | INCOMING_TX = 0 6 | OUTGOING_TX = 1 7 | COINBASE_REWARD = 2 8 | FEE_REWARD = 3 9 | INCOMING_TRADE = 4 10 | OUTGOING_TRADE = 5 11 | -------------------------------------------------------------------------------- /scam/wallet/util/wallet_types.py: -------------------------------------------------------------------------------- 1 | from enum import IntEnum 2 | 3 | 4 | class WalletType(IntEnum): 5 | # Wallet Types 6 | STANDARD_WALLET = 0 7 | RATE_LIMITED = 1 8 | ATOMIC_SWAP = 2 9 | AUTHORIZED_PAYEE = 3 10 | MULTI_SIG = 4 11 | CUSTODY = 5 12 | COLOURED_COIN = 6 13 | RECOVERABLE = 7 14 | DISTRIBUTED_ID = 8 15 | POOLING_WALLET = 9 16 | -------------------------------------------------------------------------------- /scam/wallet/wallet_coin_record.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | 3 | from scam.types.blockchain_format.coin import Coin 4 | from scam.types.blockchain_format.sized_bytes import bytes32 5 | from scam.util.ints import uint32 6 | from scam.wallet.util.wallet_types import WalletType 7 | 8 | 9 | @dataclass(frozen=True) 10 | class WalletCoinRecord: 11 | """ 12 | These are values that correspond to a CoinName that are used 13 | in keeping track of the unspent database. 14 | """ 15 | 16 | coin: Coin 17 | confirmed_block_height: uint32 18 | spent_block_height: uint32 19 | spent: bool 20 | coinbase: bool 21 | wallet_type: WalletType 22 | wallet_id: int 23 | 24 | def name(self) -> bytes32: 25 | return self.coin.name() 26 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/tests/__init__.py -------------------------------------------------------------------------------- /tests/blockchain/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/tests/blockchain/__init__.py -------------------------------------------------------------------------------- /tests/blockchain/config.py: -------------------------------------------------------------------------------- 1 | job_timeout = 60 2 | -------------------------------------------------------------------------------- /tests/check_pytest_monitor_output.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import sys 3 | 4 | ret = 0 5 | 6 | # example input line 7 | # test_non_tx_aggregate_limits 0.997759588095738 1.45325589179993 554.45703125 8 | for ln in sys.stdin: 9 | line = ln.strip().split() 10 | 11 | print(f"{float(line[1]) * 100.0: 8.1f}% CPU {float(line[2]):7.1f}s {float(line[3]): 8.2f} MB RAM {line[0]}") 12 | if float(line[3]) > 800: 13 | print(" ERROR: ^^ exceeded RAM limit ^^ \n") 14 | ret += 1 15 | 16 | if ret > 0: 17 | print("some tests used too much RAM") 18 | 19 | sys.exit(ret) 20 | -------------------------------------------------------------------------------- /tests/clvm/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/tests/clvm/__init__.py -------------------------------------------------------------------------------- /tests/clvm/config.py: -------------------------------------------------------------------------------- 1 | parallel = True 2 | checkout_blocks_and_plots = False 3 | install_timelord = False 4 | -------------------------------------------------------------------------------- /tests/core/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/tests/core/__init__.py -------------------------------------------------------------------------------- /tests/core/consensus/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/tests/core/consensus/__init__.py -------------------------------------------------------------------------------- /tests/core/full_node/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/tests/core/full_node/__init__.py -------------------------------------------------------------------------------- /tests/core/full_node/config.py: -------------------------------------------------------------------------------- 1 | job_timeout = 60 2 | -------------------------------------------------------------------------------- /tests/core/full_node/dos/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/tests/core/full_node/dos/__init__.py -------------------------------------------------------------------------------- /tests/core/full_node/dos/config.py: -------------------------------------------------------------------------------- 1 | job_timeout = 60 2 | -------------------------------------------------------------------------------- /tests/core/full_node/full_sync/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/tests/core/full_node/full_sync/__init__.py -------------------------------------------------------------------------------- /tests/core/full_node/full_sync/config.py: -------------------------------------------------------------------------------- 1 | job_timeout = 60 2 | -------------------------------------------------------------------------------- /tests/core/full_node/ram_db.py: -------------------------------------------------------------------------------- 1 | from typing import Tuple 2 | 3 | import aiosqlite 4 | 5 | from scam.consensus.blockchain import Blockchain 6 | from scam.consensus.constants import ConsensusConstants 7 | from scam.full_node.block_store import BlockStore 8 | from scam.full_node.coin_store import CoinStore 9 | from scam.util.db_wrapper import DBWrapper 10 | 11 | 12 | async def create_ram_blockchain(consensus_constants: ConsensusConstants) -> Tuple[aiosqlite.Connection, Blockchain]: 13 | connection = await aiosqlite.connect(":memory:") 14 | db_wrapper = DBWrapper(connection) 15 | block_store = await BlockStore.create(db_wrapper) 16 | coin_store = await CoinStore.create(db_wrapper) 17 | blockchain = await Blockchain.create(coin_store, block_store, consensus_constants) 18 | return connection, blockchain 19 | -------------------------------------------------------------------------------- /tests/core/node_height.py: -------------------------------------------------------------------------------- 1 | def node_height_at_least(node, h): 2 | if node.full_node.blockchain.get_peak() is not None: 3 | return node.full_node.blockchain.get_peak().height >= h 4 | return False 5 | 6 | 7 | def node_height_exactly(node, h): 8 | if node.full_node.blockchain.get_peak() is not None: 9 | return node.full_node.blockchain.get_peak().height == h 10 | return False 11 | 12 | 13 | def node_height_between(node, h1, h2): 14 | if node.full_node.blockchain.get_peak() is not None: 15 | height = node.full_node.blockchain.get_peak().height 16 | return h1 <= height <= h2 17 | return False 18 | -------------------------------------------------------------------------------- /tests/core/test_setproctitle.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | from scam.util.setproctitle import setproctitle 4 | 5 | 6 | class TestSetProcTitle(unittest.TestCase): 7 | def test_does_not_crash(self): 8 | setproctitle("scam test title") 9 | -------------------------------------------------------------------------------- /tests/core/types/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/tests/core/types/__init__.py -------------------------------------------------------------------------------- /tests/core/types/test_proof_of_space.py: -------------------------------------------------------------------------------- 1 | from secrets import token_bytes 2 | 3 | from scam.consensus.default_constants import DEFAULT_CONSTANTS 4 | from scam.types.blockchain_format.proof_of_space import ProofOfSpace # pylint: disable=E0401 5 | 6 | 7 | class TestProofOfSpace: 8 | def test_can_create_proof(self): 9 | """ 10 | Tests that the change of getting a correct proof is exactly 1/target_filter. 11 | """ 12 | num_trials = 100000 13 | success_count = 0 14 | target_filter = 2 ** DEFAULT_CONSTANTS.NUMBER_ZERO_BITS_PLOT_FILTER 15 | for _ in range(num_trials): 16 | challenge_hash = token_bytes(32) 17 | plot_id = token_bytes(32) 18 | sp_output = token_bytes(32) 19 | 20 | if ProofOfSpace.passes_plot_filter(DEFAULT_CONSTANTS, plot_id, challenge_hash, sp_output): 21 | success_count += 1 22 | 23 | assert abs((success_count * target_filter / num_trials) - 1) < 0.35 24 | -------------------------------------------------------------------------------- /tests/core/util/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/tests/core/util/__init__.py -------------------------------------------------------------------------------- /tests/pools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/tests/pools/__init__.py -------------------------------------------------------------------------------- /tests/pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | ; logging options 3 | log_cli = 1 4 | log_level = WARNING 5 | log_format = %(asctime)s %(name)s: %(levelname)s %(message)s 6 | -------------------------------------------------------------------------------- /tests/runner-templates/checkout-test-plots.include.yml: -------------------------------------------------------------------------------- 1 | - name: Checkout test blocks and plots 2 | uses: actions/checkout@v2 3 | with: 4 | repository: 'vrn00b/test-cache' 5 | path: '.scam' 6 | ref: '0.27.0' 7 | fetch-depth: 1 8 | 9 | -------------------------------------------------------------------------------- /tests/runner-templates/install-timelord.include.yml: -------------------------------------------------------------------------------- 1 | - name: Install timelord 2 | run: | 3 | . ./activate 4 | sh install-timelord.sh 5 | ./vdf_bench square_asm 400000 6 | -------------------------------------------------------------------------------- /tests/simulation/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/tests/simulation/__init__.py -------------------------------------------------------------------------------- /tests/simulation/config.py: -------------------------------------------------------------------------------- 1 | job_timeout = 60 2 | -------------------------------------------------------------------------------- /tests/testconfig.py: -------------------------------------------------------------------------------- 1 | # Github actions template config. 2 | oses = ["ubuntu", "macos"] 3 | root_test_dirs = ["blockchain", "clvm", "core", "generator", "pools", "simulation", "wallet"] 4 | 5 | # Defaults are conservative. 6 | parallel = False 7 | checkout_blocks_and_plots = True 8 | install_timelord = True 9 | job_timeout = 30 10 | -------------------------------------------------------------------------------- /tests/util/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/tests/util/__init__.py -------------------------------------------------------------------------------- /tests/util/config.py: -------------------------------------------------------------------------------- 1 | job_timeout = 60 2 | -------------------------------------------------------------------------------- /tests/wallet/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/tests/wallet/__init__.py -------------------------------------------------------------------------------- /tests/wallet/cc_wallet/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/tests/wallet/cc_wallet/__init__.py -------------------------------------------------------------------------------- /tests/wallet/rl_wallet/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/tests/wallet/rl_wallet/__init__.py -------------------------------------------------------------------------------- /tests/wallet/rpc/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/tests/wallet/rpc/__init__.py -------------------------------------------------------------------------------- /tests/wallet/sync/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VRn00b/scam-blockchain/1c01ff7e1a5d621e74673f7acd5969046cc53f1d/tests/wallet/sync/__init__.py -------------------------------------------------------------------------------- /tests/wallet/sync/config.py: -------------------------------------------------------------------------------- 1 | job_timeout = 60 2 | -------------------------------------------------------------------------------- /tests/wallet/test_taproot.py: -------------------------------------------------------------------------------- 1 | from scam.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import ( 2 | DEFAULT_HIDDEN_PUZZLE, 3 | calculate_synthetic_offset, 4 | calculate_synthetic_public_key, 5 | ) 6 | from tests.core.make_block_generator import int_to_public_key 7 | 8 | 9 | class TestTaproot: 10 | def test_1(self): 11 | for main_secret_exponent in range(500, 600): 12 | hidden_puzzle_hash = DEFAULT_HIDDEN_PUZZLE.get_tree_hash() 13 | main_pubkey = int_to_public_key(main_secret_exponent) 14 | offset = calculate_synthetic_offset(main_pubkey, hidden_puzzle_hash) 15 | offset_pubkey = int_to_public_key(offset) 16 | spk1 = main_pubkey + offset_pubkey 17 | spk2 = calculate_synthetic_public_key(main_pubkey, hidden_puzzle_hash) 18 | assert spk1 == spk2 19 | 20 | return 0 21 | --------------------------------------------------------------------------------