├── .gitignore ├── LICENSE ├── README.md ├── account-ledger-module ├── account-ledger │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── io │ │ └── nuls │ │ └── account │ │ └── ledger │ │ ├── constant │ │ ├── AccountLedgerConstant.java │ │ └── AccountLedgerErrorCode.java │ │ ├── model │ │ ├── CoinDataResult.java │ │ ├── MultipleAddressTransferModel.java │ │ ├── TransactionDataResult.java │ │ └── TransactionInfo.java │ │ ├── module │ │ └── AbstractAccountLedgerModule.java │ │ ├── service │ │ └── AccountLedgerService.java │ │ └── util │ │ └── CoinDataTool.java ├── base │ ├── account-ledger-base │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── nuls │ │ │ │ └── account │ │ │ │ └── ledger │ │ │ │ └── base │ │ │ │ ├── manager │ │ │ │ ├── BalanceCacheEntity.java │ │ │ │ └── BalanceManager.java │ │ │ │ ├── module │ │ │ │ └── impl │ │ │ │ │ └── AccountLedgerModuleBootstrap.java │ │ │ │ ├── service │ │ │ │ ├── LocalUtxoService.java │ │ │ │ ├── TransactionInfoService.java │ │ │ │ └── impl │ │ │ │ │ ├── AccountLedgerServiceImpl.java │ │ │ │ │ ├── LocalUtxoServiceImpl.java │ │ │ │ │ └── TransactionInfoServiceImpl.java │ │ │ │ ├── task │ │ │ │ └── CheckUnConfirmTxThread.java │ │ │ │ └── util │ │ │ │ ├── AccountLegerUtils.java │ │ │ │ ├── CoinComparator.java │ │ │ │ ├── CoinComparatorDesc.java │ │ │ │ └── TxInfoComparator.java │ │ │ └── test │ │ │ └── java │ │ │ ├── BaseTest.java │ │ │ └── ScriptTransactionTestTool.java │ ├── account-ledger-rpc │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── nuls │ │ │ │ └── accout │ │ │ │ └── ledger │ │ │ │ └── rpc │ │ │ │ ├── AccountLedgerResource.java │ │ │ │ ├── cmd │ │ │ │ ├── CreateMultiTransferProcess.java │ │ │ │ ├── GetAccountTxListProcessor.java │ │ │ │ ├── GetUTXOProcessor.java │ │ │ │ ├── SignMultiTransactionProcess.java │ │ │ │ └── TransferProcessor.java │ │ │ │ ├── dto │ │ │ │ ├── ChangeToWholeFromDto.java │ │ │ │ ├── ChangeToWholeToDto.java │ │ │ │ ├── InputDto.java │ │ │ │ ├── MulipleTxFromDto.java │ │ │ │ ├── MultipleTxToDto.java │ │ │ │ ├── OutputDto.java │ │ │ │ ├── TransactionCreatedReturnInfo.java │ │ │ │ ├── TransactionDto.java │ │ │ │ ├── TransactionInfoDto.java │ │ │ │ └── UtxoDto.java │ │ │ │ ├── form │ │ │ │ ├── BroadHexTxForm.java │ │ │ │ ├── ChangeToWholeTransactionForm.java │ │ │ │ ├── CreateP2shTransactionForm.java │ │ │ │ ├── DataTransactionForm.java │ │ │ │ ├── MulitpleTransactionForm.java │ │ │ │ ├── MulitpleTxForm.java │ │ │ │ ├── SignMultiTransactionForm.java │ │ │ │ ├── TransactionForm.java │ │ │ │ ├── TransactionHexForm.java │ │ │ │ ├── TransferFeeForm.java │ │ │ │ ├── TransferForm.java │ │ │ │ └── TransferSimpleForm.java │ │ │ │ └── util │ │ │ │ ├── ConvertCoinTool.java │ │ │ │ ├── LedgerRpcUtil.java │ │ │ │ └── UtxoDtoComparator.java │ │ │ └── test │ │ │ └── java │ │ │ └── io │ │ │ └── nuls │ │ │ └── account │ │ │ └── ledger │ │ │ ├── BaseTest.java │ │ │ └── rpc │ │ │ ├── MultiAddressTransferTest.java │ │ │ └── TransferTest.java │ └── account-ledger-storage │ │ ├── pom.xml │ │ └── src │ │ └── main │ │ └── java │ │ └── io │ │ └── nuls │ │ └── account │ │ └── ledger │ │ └── storage │ │ ├── constant │ │ └── AccountLedgerStorageConstant.java │ │ ├── po │ │ ├── TransactionInfoPo.java │ │ └── UnconfirmedTxPo.java │ │ └── service │ │ ├── LocalUtxoStorageService.java │ │ ├── TransactionInfoStorageService.java │ │ ├── UnconfirmedTransactionStorageService.java │ │ └── impl │ │ ├── LocalUtxoStorageServiceImpl.java │ │ ├── TransactionInfoStorageServiceImpl.java │ │ └── UnconfiredmTransactionStorageImpl.java └── pom.xml ├── account-module ├── account │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── io │ │ │ └── nuls │ │ │ └── account │ │ │ ├── constant │ │ │ ├── AccountConstant.java │ │ │ └── AccountErrorCode.java │ │ │ ├── model │ │ │ ├── Account.java │ │ │ ├── AccountKeyStore.java │ │ │ ├── Alias.java │ │ │ ├── Balance.java │ │ │ └── MultiSigAccount.java │ │ │ ├── module │ │ │ └── AbstractAccountModuleBootstrap.java │ │ │ ├── service │ │ │ ├── AccountService.java │ │ │ └── AccountTxService.java │ │ │ ├── tx │ │ │ └── AliasTransaction.java │ │ │ └── util │ │ │ └── AccountTool.java │ │ └── resources │ │ └── account-protocol.xml ├── base │ ├── account-base │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── nuls │ │ │ │ └── account │ │ │ │ ├── module │ │ │ │ └── AccountModuleBootstrap.java │ │ │ │ ├── process │ │ │ │ └── AliasTxProcessor.java │ │ │ │ ├── service │ │ │ │ ├── AccountBaseService.java │ │ │ │ ├── AccountCacheService.java │ │ │ │ ├── AliasService.java │ │ │ │ └── impl │ │ │ │ │ └── AccountServiceImpl.java │ │ │ │ └── validator │ │ │ │ └── AliasTransactionValidator.java │ │ │ └── test │ │ │ ├── java │ │ │ └── io │ │ │ │ └── nuls │ │ │ │ └── account │ │ │ │ ├── model │ │ │ │ └── AddressTest.java │ │ │ │ └── service │ │ │ │ ├── AccountBaseServiceTest.java │ │ │ │ ├── AccountServiceTest.java │ │ │ │ ├── AccountTest.java │ │ │ │ └── AliasServiceTest.java │ │ │ └── resources │ │ │ ├── block │ │ │ └── genesis-block.json │ │ │ ├── languages │ │ │ ├── en.properties │ │ │ └── zh-CHS.properties │ │ │ ├── logback.xml │ │ │ ├── modules.ini │ │ │ └── nuls.ini │ ├── account-rpc │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── nuls │ │ │ │ └── account │ │ │ │ └── rpc │ │ │ │ ├── cmd │ │ │ │ ├── BackupAccountProcessor.java │ │ │ │ ├── CreateMultiAliasProcess.java │ │ │ │ ├── CreateMultiSigAccountProcessor.java │ │ │ │ ├── CreateProcessor.java │ │ │ │ ├── GetAccountProcessor.java │ │ │ │ ├── GetAccountsProcessor.java │ │ │ │ ├── GetAssetProcessor.java │ │ │ │ ├── GetBalanceProcessor.java │ │ │ │ ├── GetMultiSigAccountCountProcessor.java │ │ │ │ ├── GetMultiSigAccountListProcessor.java │ │ │ │ ├── GetMultiSigAccountProcessor.java │ │ │ │ ├── GetPrivateKeyProcessor.java │ │ │ │ ├── GetWalletBalanceProcessor.java │ │ │ │ ├── ImportByKeyStoreProcessor.java │ │ │ │ ├── ImportByPrivateKeyProcessor.java │ │ │ │ ├── ImportForcedByPrivateKeyProcessor.java │ │ │ │ ├── ImportMultiSigAccountProcessor.java │ │ │ │ ├── RemoveAccountProcessor.java │ │ │ │ ├── RemoveMultiSigAccountProcessor.java │ │ │ │ ├── ResetPasswordProcessor.java │ │ │ │ ├── SetAliasProcessor.java │ │ │ │ ├── SetPasswordProcessor.java │ │ │ │ ├── SignMessageProcessor.java │ │ │ │ └── VerifyMessageSignatureProcessor.java │ │ │ │ ├── model │ │ │ │ ├── AccountDto.java │ │ │ │ ├── AccountKeyStoreDto.java │ │ │ │ ├── AccountOfflineDto.java │ │ │ │ ├── AssetDto.java │ │ │ │ ├── BalanceDto.java │ │ │ │ ├── MultiSigAccountDto.java │ │ │ │ └── form │ │ │ │ │ ├── AccountAliasFeeForm.java │ │ │ │ │ ├── AccountAliasForm.java │ │ │ │ │ ├── AccountCreateForm.java │ │ │ │ │ ├── AccountKeyStoreBackup.java │ │ │ │ │ ├── AccountKeyStoreImportForm.java │ │ │ │ │ ├── AccountKeyStoreResetPasswordForm.java │ │ │ │ │ ├── AccountParamForm.java │ │ │ │ │ ├── AccountPasswordForm.java │ │ │ │ │ ├── AccountPriKeyChangePasswordForm.java │ │ │ │ │ ├── AccountPriKeyPasswordForm.java │ │ │ │ │ ├── AccountPriKeysPasswordForm.java │ │ │ │ │ ├── AccountRemarkForm.java │ │ │ │ │ ├── AccountUnlockForm.java │ │ │ │ │ ├── AccountUpdatePasswordForm.java │ │ │ │ │ ├── CreateMultiAliasForm.java │ │ │ │ │ ├── MultiAccountAliasFeeForm.java │ │ │ │ │ ├── MultiAccountCreateForm.java │ │ │ │ │ ├── MultiAccountImportForm.java │ │ │ │ │ ├── MultiAliasFeeForm.java │ │ │ │ │ ├── MultiTransactionSignForm.java │ │ │ │ │ ├── OfflineAccountPasswordForm.java │ │ │ │ │ ├── SignMessageForm.java │ │ │ │ │ └── VerifyMessageSignatureForm.java │ │ │ │ └── resource │ │ │ │ └── AccountResource.java │ │ │ └── test │ │ │ └── java │ │ │ └── io │ │ │ └── nuls │ │ │ └── account │ │ │ └── test │ │ │ └── CreateAccountTest.java │ └── account-storage │ │ ├── pom.xml │ │ └── src │ │ └── main │ │ └── java │ │ └── io.nuls.account.storage │ │ ├── constant │ │ └── AccountStorageConstant.java │ │ ├── po │ │ ├── AccountPo.java │ │ └── AliasPo.java │ │ └── service │ │ ├── AccountStorageService.java │ │ ├── AliasStorageService.java │ │ ├── MultiSigAccountStorageService.java │ │ └── impl │ │ ├── AccountStorageServiceImpl.java │ │ ├── AliasStorageServiceImpl.java │ │ └── MultiSigAccountStorageServiceImpl.java └── pom.xml ├── client-module ├── client │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── assembly │ │ │ └── assembly.xml │ │ ├── java │ │ │ └── io │ │ │ │ └── nuls │ │ │ │ └── client │ │ │ │ ├── Bootstrap.java │ │ │ │ ├── cmd │ │ │ │ ├── CommandHandler.java │ │ │ │ ├── ExitProcessor.java │ │ │ │ ├── HelpProcessor.java │ │ │ │ ├── UpgradeProcessor.java │ │ │ │ └── VersionProcessor.java │ │ │ │ ├── constant │ │ │ │ └── CommandConstant.java │ │ │ │ ├── rpc │ │ │ │ ├── RpcServerManager.java │ │ │ │ ├── config │ │ │ │ │ ├── NulsResourceConfig.java │ │ │ │ │ └── NulsSwaggerSerializers.java │ │ │ │ ├── constant │ │ │ │ │ └── RpcConstant.java │ │ │ │ ├── filter │ │ │ │ │ ├── HttpContextHelper.java │ │ │ │ │ └── RpcServerFilter.java │ │ │ │ └── resources │ │ │ │ │ ├── ClientResource.java │ │ │ │ │ ├── SystemResource.java │ │ │ │ │ ├── dto │ │ │ │ │ ├── ProtocolContainerDTO.java │ │ │ │ │ ├── UpgradeProcessDTO.java │ │ │ │ │ └── VersionDto.java │ │ │ │ │ ├── model │ │ │ │ │ ├── JarSig.java │ │ │ │ │ └── VersionFile.java │ │ │ │ │ ├── thread │ │ │ │ │ ├── ShutdownHook.java │ │ │ │ │ └── UpgradeThread.java │ │ │ │ │ └── util │ │ │ │ │ └── FileUtil.java │ │ │ │ ├── storage │ │ │ │ ├── LanguageService.java │ │ │ │ └── impl │ │ │ │ │ └── LanguageServiceImpl.java │ │ │ │ ├── version │ │ │ │ ├── SyncVersionRunner.java │ │ │ │ ├── WalletVersionManager.java │ │ │ │ └── constant │ │ │ │ │ └── VersionConstant.java │ │ │ │ └── web │ │ │ │ └── view │ │ │ │ └── WebViewBootstrap.java │ │ ├── resources │ │ │ ├── block │ │ │ │ └── genesis-block.json │ │ │ ├── client-web │ │ │ │ ├── favicon.ico │ │ │ │ ├── index.html │ │ │ │ └── static │ │ │ │ │ ├── css │ │ │ │ │ └── app.992816facf4b046c3db3bbd60919a502.css │ │ │ │ │ ├── fonts │ │ │ │ │ └── element-icons.6f0a763.ttf │ │ │ │ │ ├── img │ │ │ │ │ ├── favicon-16x16.png │ │ │ │ │ └── favicon-32x32.png │ │ │ │ │ └── js │ │ │ │ │ ├── 0.25d60a2f0da14ea954b4.js │ │ │ │ │ ├── 1.5e153827bbdd90d4b33d.js │ │ │ │ │ ├── 10.025682a491522a21ea0f.js │ │ │ │ │ ├── 11.2a0802b8065d1a739018.js │ │ │ │ │ ├── 12.e8f588396d47c3b0c226.js │ │ │ │ │ ├── 13.318966657c44475f1844.js │ │ │ │ │ ├── 14.19ef8b1e7e2e6dc0a42a.js │ │ │ │ │ ├── 15.acf2c30f16e3e54d89fa.js │ │ │ │ │ ├── 16.0e7fae3ed9980079bc50.js │ │ │ │ │ ├── 17.30a6e39f65184db2da73.js │ │ │ │ │ ├── 18.8203ca2414f527b2243e.js │ │ │ │ │ ├── 19.2e49d0c79d8867106ea3.js │ │ │ │ │ ├── 2.9cced2cbaf68de474d89.js │ │ │ │ │ ├── 20.9f2556bc548a6af583fc.js │ │ │ │ │ ├── 21.582832afcd1c37ad77f4.js │ │ │ │ │ ├── 22.351e7dd5f06900ce2148.js │ │ │ │ │ ├── 23.66e632027d87a6edcbc5.js │ │ │ │ │ ├── 24.7254e9af5f56d8b8d05a.js │ │ │ │ │ ├── 25.511c54ba96db126a4850.js │ │ │ │ │ ├── 26.99c85b25693bd54099ac.js │ │ │ │ │ ├── 27.107e6157b3820c62b841.js │ │ │ │ │ ├── 28.1fc368269a8230349133.js │ │ │ │ │ ├── 29.9034270957fe5ca6d0ad.js │ │ │ │ │ ├── 3.2e3d8e622038991fb16a.js │ │ │ │ │ ├── 30.7065991d975ecc890935.js │ │ │ │ │ ├── 31.9b0e86442e61fbbd5918.js │ │ │ │ │ ├── 32.b59556130f3d8371708d.js │ │ │ │ │ ├── 33.3a9e537f391ac3fbe48d.js │ │ │ │ │ ├── 4.179c7470708772016cd4.js │ │ │ │ │ ├── 5.d114e84884d90e63adb5.js │ │ │ │ │ ├── 6.c5ccd3054882b91036f5.js │ │ │ │ │ ├── 7.27c0af5420c132c088b3.js │ │ │ │ │ ├── 8.1ca5ea41deee8e67c81c.js │ │ │ │ │ ├── 9.5b79c4a0791f030c8875.js │ │ │ │ │ ├── app.a8d00bba6eff65058f1f.js │ │ │ │ │ ├── app.bc67474aa40f9165cabc.js │ │ │ │ │ ├── manifest.dd2c69967388f2aec6c9.js │ │ │ │ │ └── vendor.b7b1d7f8be78cdcff386.js │ │ │ ├── contract │ │ │ │ └── nrc20.json │ │ │ ├── db_config.properties │ │ │ ├── dev │ │ │ │ ├── block │ │ │ │ │ └── genesis-block.json │ │ │ │ ├── modules.ini │ │ │ │ └── nuls-version.xml │ │ │ ├── image │ │ │ │ ├── logo.png │ │ │ │ └── tray.png │ │ │ ├── languages │ │ │ │ ├── en.properties │ │ │ │ └── zh-CHS.properties │ │ │ ├── logback.xml │ │ │ ├── modules.ini │ │ │ ├── nuls-version.xml │ │ │ ├── nuls.ini │ │ │ ├── swagger-ui │ │ │ │ ├── favicon-16x16.png │ │ │ │ ├── favicon-32x32.png │ │ │ │ ├── index.html │ │ │ │ ├── oauth2-redirect.html │ │ │ │ ├── swagger-ui-bundle.js │ │ │ │ ├── swagger-ui-bundle.js.map │ │ │ │ ├── swagger-ui-standalone-preset.js │ │ │ │ ├── swagger-ui-standalone-preset.js.map │ │ │ │ ├── swagger-ui.css │ │ │ │ ├── swagger-ui.css.map │ │ │ │ ├── swagger-ui.js │ │ │ │ └── swagger-ui.js.map │ │ │ └── test │ │ │ │ ├── block │ │ │ │ └── genesis-block.json │ │ │ │ ├── modules.ini │ │ │ │ └── nuls-version.xml │ │ └── script │ │ │ ├── cmd.sh │ │ │ ├── nuls.sh │ │ │ ├── start.bat │ │ │ ├── start.sh │ │ │ ├── stop.bat │ │ │ └── stop.sh │ │ └── test │ │ ├── java │ │ └── io │ │ │ └── nuls │ │ │ ├── client │ │ │ └── rpc │ │ │ │ ├── RpcServerManagerTest.java │ │ │ │ └── resources │ │ │ │ ├── thread │ │ │ │ └── UpgradeThreadTest.java │ │ │ │ └── util │ │ │ │ └── FileUtilTest.java │ │ │ ├── license │ │ │ └── FileScanUtils.java │ │ │ ├── sdk │ │ │ └── SimpleTransferTest.java │ │ │ ├── test │ │ │ └── network │ │ │ │ └── TestNetwork.java │ │ │ └── transfer │ │ │ ├── TestMain.java │ │ │ └── TransferTest.java │ │ └── resources │ │ └── image │ │ └── icon.ico └── pom.xml ├── consensus-module ├── README.md ├── consensus │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── io │ │ └── nuls │ │ └── consensus │ │ ├── constant │ │ └── ConsensusConstant.java │ │ ├── module │ │ └── AbstractConsensusModule.java │ │ └── service │ │ └── ConsensusService.java ├── poc │ ├── consensus-poc-base │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── nuls │ │ │ │ └── consensus │ │ │ │ └── poc │ │ │ │ ├── block │ │ │ │ └── validator │ │ │ │ │ └── BifurcationUtil.java │ │ │ │ ├── cache │ │ │ │ ├── CacheLoader.java │ │ │ │ └── TxMemoryPool.java │ │ │ │ ├── config │ │ │ │ ├── ConsensusConfig.java │ │ │ │ └── GenesisBlock.java │ │ │ │ ├── constant │ │ │ │ ├── BlockContainerStatus.java │ │ │ │ ├── ConsensusStatus.java │ │ │ │ └── PocConsensusConstant.java │ │ │ │ ├── container │ │ │ │ ├── BlockContainer.java │ │ │ │ ├── ChainContainer.java │ │ │ │ └── TxContainer.java │ │ │ │ ├── context │ │ │ │ ├── ConsensusStatusContext.java │ │ │ │ └── PocConsensusContext.java │ │ │ │ ├── locker │ │ │ │ └── Lockers.java │ │ │ │ ├── manager │ │ │ │ ├── CacheManager.java │ │ │ │ ├── ChainManager.java │ │ │ │ └── RoundManager.java │ │ │ │ ├── model │ │ │ │ ├── BlockData.java │ │ │ │ ├── BlockExtendsData.java │ │ │ │ ├── BlockRoundData.java │ │ │ │ ├── Chain.java │ │ │ │ ├── Evidence.java │ │ │ │ ├── MeetingMember.java │ │ │ │ ├── MeetingRound.java │ │ │ │ ├── RewardItem.java │ │ │ │ └── RewardStatisticsParam.java │ │ │ │ ├── module │ │ │ │ └── impl │ │ │ │ │ └── PocConsensusModuleBootstrap.java │ │ │ │ ├── process │ │ │ │ ├── BlockMonitorProcess.java │ │ │ │ ├── BlockProcess.java │ │ │ │ ├── ConsensusProcess.java │ │ │ │ ├── ForkChainProcess.java │ │ │ │ ├── NulsProtocolProcess.java │ │ │ │ ├── OrphanBlockProcess.java │ │ │ │ └── RewardStatisticsProcess.java │ │ │ │ ├── provider │ │ │ │ ├── BlockQueueProvider.java │ │ │ │ └── OrphanBlockProvider.java │ │ │ │ ├── scheduler │ │ │ │ └── ConsensusScheduler.java │ │ │ │ ├── service │ │ │ │ └── impl │ │ │ │ │ ├── ConsensusPocServiceImpl.java │ │ │ │ │ ├── PocRewardCacheService.java │ │ │ │ │ └── RandomSeedService.java │ │ │ │ ├── task │ │ │ │ ├── BlockMonitorProcessTask.java │ │ │ │ ├── BlockProcessTask.java │ │ │ │ ├── ConsensusProcessTask.java │ │ │ │ ├── ForkChainProcessTask.java │ │ │ │ ├── RewardCalculatorTask.java │ │ │ │ ├── RewardStatisticsProcessTask.java │ │ │ │ └── TxProcessTask.java │ │ │ │ ├── tx │ │ │ │ ├── processor │ │ │ │ │ ├── CancelDepositTxProcessor.java │ │ │ │ │ ├── CreateAgentTxProcessor.java │ │ │ │ │ ├── DepositTxProcessor.java │ │ │ │ │ ├── RedPunishTxProcessor.java │ │ │ │ │ ├── StopAgentTxProcessor.java │ │ │ │ │ └── YellowPunishTxProcessor.java │ │ │ │ └── validator │ │ │ │ │ ├── AgentAddressesValidator.java │ │ │ │ │ ├── AgentCountValidator.java │ │ │ │ │ ├── BaseConsensusProtocolValidator.java │ │ │ │ │ ├── CancelDepositTxValidator.java │ │ │ │ │ ├── CreateAgentTxValidator.java │ │ │ │ │ ├── DepositTxValidator.java │ │ │ │ │ └── StopAgentTxValidator.java │ │ │ │ └── util │ │ │ │ ├── CoinDataComparator.java │ │ │ │ ├── ConsensusTool.java │ │ │ │ ├── ProtocolTransferTool.java │ │ │ │ └── RandomSeedUtils.java │ │ │ └── test │ │ │ ├── java │ │ │ └── io │ │ │ │ └── nuls │ │ │ │ └── consensus │ │ │ │ └── poc │ │ │ │ ├── BaseChainTest.java │ │ │ │ ├── BaseTest.java │ │ │ │ ├── TestTransaction.java │ │ │ │ ├── cache │ │ │ │ └── TxMemoryPoolTest.java │ │ │ │ ├── container │ │ │ │ └── ChainContainerTest.java │ │ │ │ ├── customer │ │ │ │ ├── ConsensusBlockServiceImpl.java │ │ │ │ ├── ConsensusDownloadServiceImpl.java │ │ │ │ └── ConsensusNetworkService.java │ │ │ │ ├── manager │ │ │ │ ├── ChainManagerTest.java │ │ │ │ └── RoundManagerTest.java │ │ │ │ ├── model │ │ │ │ ├── ChainTest.java │ │ │ │ ├── MeetingMemberTest.java │ │ │ │ └── MeetingRoundTest.java │ │ │ │ ├── module │ │ │ │ └── PocConsensusModuleBootstrapTest.java │ │ │ │ ├── process │ │ │ │ └── RegisterAgentProcessTest.java │ │ │ │ ├── provider │ │ │ │ └── BlockQueueProviderTest.java │ │ │ │ ├── storage │ │ │ │ └── service │ │ │ │ │ └── ConsensusPocServiceTest.java │ │ │ │ ├── task │ │ │ │ └── BlockProcessTaskTest.java │ │ │ │ ├── util │ │ │ │ ├── ConsensusToolTest.java │ │ │ │ └── RandomSeedUtilsTest.java │ │ │ │ └── validator │ │ │ │ └── CreateAgentTxValidatorTest.java │ │ │ └── resources │ │ │ ├── block │ │ │ └── genesis-block.json │ │ │ ├── languages │ │ │ ├── en.properties │ │ │ └── zh-CHS.properties │ │ │ ├── modules.ini │ │ │ └── nuls.ini │ ├── consensus-poc-protocol │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── io │ │ │ │ │ └── nuls │ │ │ │ │ └── consensus │ │ │ │ │ └── poc │ │ │ │ │ └── protocol │ │ │ │ │ ├── constant │ │ │ │ │ ├── PocConsensusErrorCode.java │ │ │ │ │ ├── PocConsensusProtocolConstant.java │ │ │ │ │ ├── PunishReasonEnum.java │ │ │ │ │ └── PunishType.java │ │ │ │ │ ├── entity │ │ │ │ │ ├── Agent.java │ │ │ │ │ ├── CancelDeposit.java │ │ │ │ │ ├── Deposit.java │ │ │ │ │ ├── RedPunishData.java │ │ │ │ │ ├── StopAgent.java │ │ │ │ │ └── YellowPunishData.java │ │ │ │ │ ├── tx │ │ │ │ │ ├── CancelDepositTransaction.java │ │ │ │ │ ├── CreateAgentTransaction.java │ │ │ │ │ ├── DepositTransaction.java │ │ │ │ │ ├── RedPunishTransaction.java │ │ │ │ │ ├── StopAgentTransaction.java │ │ │ │ │ └── YellowPunishTransaction.java │ │ │ │ │ └── util │ │ │ │ │ ├── AgentComparator.java │ │ │ │ │ ├── DepositComparator.java │ │ │ │ │ └── PoConvertUtil.java │ │ │ └── resources │ │ │ │ └── consensus-protocol.xml │ │ │ └── test │ │ │ ├── java │ │ │ └── io │ │ │ │ └── nuls │ │ │ │ └── consensus │ │ │ │ └── poc │ │ │ │ └── protocol │ │ │ │ ├── BaseTest.java │ │ │ │ ├── tx │ │ │ │ ├── CancelDepositTransactionTest.java │ │ │ │ └── TxSerializeTest.java │ │ │ │ └── util │ │ │ │ └── PoConvertUtilTest.java │ │ │ └── resources │ │ │ ├── block │ │ │ └── genesis-block.json │ │ │ ├── languages │ │ │ ├── en.properties │ │ │ └── zh-CHS.properties │ │ │ ├── modules.ini │ │ │ └── nuls.ini │ ├── consensus-poc-rpc │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── nuls │ │ │ │ └── consensus │ │ │ │ └── poc │ │ │ │ └── rpc │ │ │ │ ├── cmd │ │ │ │ ├── CreateAgentProcessor.java │ │ │ │ ├── CreateMultiAgentProcessor.java │ │ │ │ ├── CreateMultiDepositProcessor.java │ │ │ │ ├── CreateMultiStopAgentProcessor.java │ │ │ │ ├── CreateMultiWithdrawProcessor.java │ │ │ │ ├── DepositProcessor.java │ │ │ │ ├── GetAgentProcessor.java │ │ │ │ ├── GetAgentsProcessor.java │ │ │ │ ├── GetConsensusProcessor.java │ │ │ │ ├── GetDepositedAgentsProcessor.java │ │ │ │ ├── GetDepositedInfoProcessor.java │ │ │ │ ├── GetDepositedsProcessor.java │ │ │ │ ├── StopAgentProcessor.java │ │ │ │ ├── WithdrawMultiProcessor.java │ │ │ │ └── WithdrawProcessor.java │ │ │ │ ├── model │ │ │ │ ├── AccountConsensusInfoDTO.java │ │ │ │ ├── AgentDTO.java │ │ │ │ ├── ConsensusInfoDTO.java │ │ │ │ ├── CreateAgentForm.java │ │ │ │ ├── CreateMultiAgentForm.java │ │ │ │ ├── CreateMultiDepositForm.java │ │ │ │ ├── CreateMultiWithdrawForm.java │ │ │ │ ├── CreateStopMultiAgentForm.java │ │ │ │ ├── DepositDTO.java │ │ │ │ ├── DepositForm.java │ │ │ │ ├── GetCreateAgentFeeForm.java │ │ │ │ ├── GetDepositFeeForm.java │ │ │ │ ├── PunishLogDTO.java │ │ │ │ ├── RandomSeedDTO.java │ │ │ │ ├── StopAgentForm.java │ │ │ │ ├── WholeNetConsensusInfoDTO.java │ │ │ │ └── WithdrawForm.java │ │ │ │ ├── resource │ │ │ │ ├── PocConsensusResource.java │ │ │ │ └── RandomSeedResource.java │ │ │ │ └── utils │ │ │ │ └── AgentComparator.java │ │ │ └── test │ │ │ └── java │ │ │ └── CreateAgentTest.java │ └── consensus-poc-storage │ │ ├── pom.xml │ │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── nuls │ │ │ └── consensus │ │ │ └── poc │ │ │ └── storage │ │ │ ├── constant │ │ │ └── ConsensusStorageConstant.java │ │ │ ├── po │ │ │ ├── AgentPo.java │ │ │ ├── DepositPo.java │ │ │ ├── EvidencePo.java │ │ │ ├── PunishLogPo.java │ │ │ ├── RandomSeedPo.java │ │ │ └── RandomSeedStatusPo.java │ │ │ ├── service │ │ │ ├── AgentStorageService.java │ │ │ ├── BifurcationEvidenceStorageService.java │ │ │ ├── DepositStorageService.java │ │ │ ├── OrphanStorageService.java │ │ │ ├── PunishLogStorageService.java │ │ │ ├── RandomSeedsStorageService.java │ │ │ ├── TransactionCacheStorageService.java │ │ │ ├── TransactionQueueStorageService.java │ │ │ └── impl │ │ │ │ ├── AgentStorageServiceImpl.java │ │ │ │ ├── BifurcationEvidenceStorageServiceImpl.java │ │ │ │ ├── DepositStorageServiceImpl.java │ │ │ │ ├── OrphanStorageServiceImpl.java │ │ │ │ ├── PunishLogStorageServiceImpl.java │ │ │ │ ├── RandomSeedsStorageServiceImpl.java │ │ │ │ ├── TransactionCacheStorageServiceImpl.java │ │ │ │ └── TransactionQueueStorageServiceImpl.java │ │ │ └── utils │ │ │ └── PunishLogComparator.java │ │ └── test │ │ ├── java │ │ └── io │ │ │ └── nuls │ │ │ └── consensus │ │ │ └── poc │ │ │ └── storage │ │ │ ├── BaseTest.java │ │ │ └── service │ │ │ ├── AgentStorageServiceTest.java │ │ │ ├── TransactionCacheStorageServiceTest.java │ │ │ └── TransactionPoTest.java │ │ └── resources │ │ ├── block │ │ └── genesis-block.json │ │ ├── languages │ │ ├── en.properties │ │ └── zh-CHS.properties │ │ ├── modules.ini │ │ └── nuls.ini └── pom.xml ├── contract-module ├── base │ ├── contract-base │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── io │ │ │ └── nuls │ │ │ └── contract │ │ │ ├── module │ │ │ └── impl │ │ │ │ └── ContractModuleBootstrap.java │ │ │ ├── service │ │ │ └── impl │ │ │ │ └── ContractServiceImpl.java │ │ │ └── util │ │ │ └── ContractCoinComparator.java │ ├── contract-ledger │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── io │ │ │ └── nuls │ │ │ └── contract │ │ │ └── ledger │ │ │ ├── manager │ │ │ └── ContractBalanceManager.java │ │ │ ├── module │ │ │ └── ContractBalance.java │ │ │ ├── service │ │ │ ├── ContractTransactionInfoService.java │ │ │ ├── ContractUtxoService.java │ │ │ └── impl │ │ │ │ ├── ContractTransactionInfoServiceImpl.java │ │ │ │ └── ContractUtxoServiceImpl.java │ │ │ └── util │ │ │ └── ContractLedgerUtil.java │ ├── contract-rpc │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── nuls │ │ │ │ └── contract │ │ │ │ └── rpc │ │ │ │ ├── cmd │ │ │ │ ├── CallContractProcessor.java │ │ │ │ ├── CreateContractProcessor.java │ │ │ │ ├── DeleteContractProcessor.java │ │ │ │ ├── GetContractAddressValidProcessor.java │ │ │ │ ├── GetContractBalanceProcessor.java │ │ │ │ ├── GetContractConstructorProcessor.java │ │ │ │ ├── GetContractInfoProcessor.java │ │ │ │ ├── GetContractResultProcessor.java │ │ │ │ ├── GetContractTxListProcessor.java │ │ │ │ ├── GetContractTxProcessor.java │ │ │ │ ├── GetTokenBalanceProcessor.java │ │ │ │ ├── GetWalletContractsProcessor.java │ │ │ │ ├── TokenTransferProcessor.java │ │ │ │ ├── TransferToContractProcessor.java │ │ │ │ └── ViewContractProcessor.java │ │ │ │ ├── form │ │ │ │ ├── ContractAddressBase.java │ │ │ │ ├── ContractBase.java │ │ │ │ ├── ContractCall.java │ │ │ │ ├── ContractCode.java │ │ │ │ ├── ContractCollection.java │ │ │ │ ├── ContractCreate.java │ │ │ │ ├── ContractCreateFile.java │ │ │ │ ├── ContractDelete.java │ │ │ │ ├── ContractTokenTransfer.java │ │ │ │ ├── ContractTransfer.java │ │ │ │ ├── ContractTransferFee.java │ │ │ │ ├── ContractValidateCall.java │ │ │ │ ├── ContractValidateCreate.java │ │ │ │ ├── ContractValidateDelete.java │ │ │ │ ├── ContractViewCall.java │ │ │ │ ├── ImputedGasContractCall.java │ │ │ │ ├── ImputedGasContractCreate.java │ │ │ │ ├── ImputedPrice.java │ │ │ │ ├── PreContractCreate.java │ │ │ │ └── transaction │ │ │ │ │ ├── CallContractTx.java │ │ │ │ │ ├── CreateContractTx.java │ │ │ │ │ └── DeleteContractTx.java │ │ │ │ ├── model │ │ │ │ ├── CallContractDataDto.java │ │ │ │ ├── ContractAccountUtxoDto.java │ │ │ │ ├── ContractAddressDto.java │ │ │ │ ├── ContractCollectionDto.java │ │ │ │ ├── ContractResultDto.java │ │ │ │ ├── ContractTokenInfoDto.java │ │ │ │ ├── ContractTokenTransferDto.java │ │ │ │ ├── ContractTransactionCreatedReturnInfo.java │ │ │ │ ├── ContractTransactionDto.java │ │ │ │ ├── ContractTransactionInfoDto.java │ │ │ │ ├── ContractTransferDataDto.java │ │ │ │ ├── ContractTransferDto.java │ │ │ │ ├── ContractUtxoDto.java │ │ │ │ ├── CreateContractDataDto.java │ │ │ │ ├── DeleteContractDataDto.java │ │ │ │ ├── InputDto.java │ │ │ │ └── OutputDto.java │ │ │ │ └── resource │ │ │ │ ├── ContractResource.java │ │ │ │ └── ContractSdkResource.java │ │ │ └── test │ │ │ ├── java │ │ │ └── io │ │ │ │ └── nuls │ │ │ │ └── contract │ │ │ │ ├── BaseTest.java │ │ │ │ └── rpc │ │ │ │ ├── ContractTest.java │ │ │ │ └── ContractTxTest.java │ │ │ └── resources │ │ │ └── vote-contract-hex.txt │ ├── contract-storage │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── io │ │ │ └── nuls │ │ │ └── contract │ │ │ └── storage │ │ │ ├── constant │ │ │ └── ContractStorageConstant.java │ │ │ ├── po │ │ │ ├── ContractAddressInfoPo.java │ │ │ ├── ContractCollectionInfoPo.java │ │ │ └── TransactionInfoPo.java │ │ │ └── service │ │ │ ├── ContractAddressStorageService.java │ │ │ ├── ContractCollectionStorageService.java │ │ │ ├── ContractExecuteResultStorageService.java │ │ │ ├── ContractTokenTransferStorageService.java │ │ │ ├── ContractTransactionInfoStorageService.java │ │ │ ├── ContractTransferTransactionStorageService.java │ │ │ ├── ContractUtxoStorageService.java │ │ │ └── impl │ │ │ ├── ContractAddressStorageServiceImpl.java │ │ │ ├── ContractCollectionStorageServiceImpl.java │ │ │ ├── ContractExecuteResultStorageServiceImpl.java │ │ │ ├── ContractTokenTransferStorageServiceImpl.java │ │ │ ├── ContractTransactionInfoStorageServiceImpl.java │ │ │ ├── ContractTransferTransactionStorageImpl.java │ │ │ └── ContractUtxoStorageServiceImpl.java │ ├── contract-tx │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── io │ │ │ └── nuls │ │ │ └── contract │ │ │ ├── entity │ │ │ └── tx │ │ │ │ ├── processor │ │ │ │ ├── CallContractTxProcessor.java │ │ │ │ ├── ContractTransferTxProcessor.java │ │ │ │ ├── CreateContractTxProcessor.java │ │ │ │ └── DeleteContractTxProcessor.java │ │ │ │ └── validator │ │ │ │ ├── CallContractTxValidator.java │ │ │ │ ├── ContractAcceptTransferredTxValidator.java │ │ │ │ ├── CreateContractTxValidator.java │ │ │ │ └── DeleteContractTxValidator.java │ │ │ └── service │ │ │ ├── ContractTxService.java │ │ │ └── impl │ │ │ └── ContractTxServiceImpl.java │ └── contract-vm │ │ ├── pom.xml │ │ └── src │ │ ├── main │ │ ├── java │ │ │ ├── io │ │ │ │ └── nuls │ │ │ │ │ └── contract │ │ │ │ │ ├── entity │ │ │ │ │ ├── BlockHeaderDto.java │ │ │ │ │ └── ContractInfoDto.java │ │ │ │ │ ├── helper │ │ │ │ │ └── VMHelper.java │ │ │ │ │ ├── sdk │ │ │ │ │ ├── Address.java │ │ │ │ │ ├── Block.java │ │ │ │ │ ├── BlockHeader.java │ │ │ │ │ ├── Contract.java │ │ │ │ │ ├── Event.java │ │ │ │ │ ├── Msg.java │ │ │ │ │ ├── Utils.java │ │ │ │ │ └── annotation │ │ │ │ │ │ ├── Payable.java │ │ │ │ │ │ ├── Required.java │ │ │ │ │ │ └── View.java │ │ │ │ │ ├── util │ │ │ │ │ └── VMContext.java │ │ │ │ │ └── vm │ │ │ │ │ ├── Frame.java │ │ │ │ │ ├── GasCost.java │ │ │ │ │ ├── Heap.java │ │ │ │ │ ├── LocalVariables.java │ │ │ │ │ ├── MethodArea.java │ │ │ │ │ ├── MethodArgs.java │ │ │ │ │ ├── ObjectRef.java │ │ │ │ │ ├── OpCode.java │ │ │ │ │ ├── OperandStack.java │ │ │ │ │ ├── Result.java │ │ │ │ │ ├── VM.java │ │ │ │ │ ├── VMFactory.java │ │ │ │ │ ├── VMStack.java │ │ │ │ │ ├── code │ │ │ │ │ ├── ClassCode.java │ │ │ │ │ ├── ClassCodeCacheKey.java │ │ │ │ │ ├── ClassCodeLoader.java │ │ │ │ │ ├── ClassCodes.java │ │ │ │ │ ├── Descriptors.java │ │ │ │ │ ├── FieldCode.java │ │ │ │ │ ├── LocalVariableCode.java │ │ │ │ │ ├── MethodCode.java │ │ │ │ │ └── VariableType.java │ │ │ │ │ ├── exception │ │ │ │ │ └── ErrorException.java │ │ │ │ │ ├── instructions │ │ │ │ │ ├── comparisons │ │ │ │ │ │ ├── Dcmp.java │ │ │ │ │ │ ├── Fcmp.java │ │ │ │ │ │ ├── IfAcmp.java │ │ │ │ │ │ ├── IfCmp.java │ │ │ │ │ │ ├── IfIcmp.java │ │ │ │ │ │ └── Lcmp.java │ │ │ │ │ ├── constants │ │ │ │ │ │ ├── Aconst.java │ │ │ │ │ │ ├── Dconst.java │ │ │ │ │ │ ├── Fconst.java │ │ │ │ │ │ ├── Iconst.java │ │ │ │ │ │ ├── Lconst.java │ │ │ │ │ │ ├── Ldc.java │ │ │ │ │ │ ├── Nop.java │ │ │ │ │ │ └── Xipush.java │ │ │ │ │ ├── control │ │ │ │ │ │ ├── Goto.java │ │ │ │ │ │ ├── Jsr.java │ │ │ │ │ │ ├── Lookupswitch.java │ │ │ │ │ │ ├── Ret.java │ │ │ │ │ │ ├── Return.java │ │ │ │ │ │ └── Tableswitch.java │ │ │ │ │ ├── conversions │ │ │ │ │ │ ├── D2x.java │ │ │ │ │ │ ├── F2x.java │ │ │ │ │ │ ├── I2x.java │ │ │ │ │ │ └── L2x.java │ │ │ │ │ ├── extended │ │ │ │ │ │ ├── Ifnonnull.java │ │ │ │ │ │ ├── Ifnull.java │ │ │ │ │ │ └── Multianewarray.java │ │ │ │ │ ├── loads │ │ │ │ │ │ ├── Aload.java │ │ │ │ │ │ ├── Dload.java │ │ │ │ │ │ ├── Fload.java │ │ │ │ │ │ ├── Iload.java │ │ │ │ │ │ ├── Lload.java │ │ │ │ │ │ └── Xaload.java │ │ │ │ │ ├── math │ │ │ │ │ │ ├── Add.java │ │ │ │ │ │ ├── And.java │ │ │ │ │ │ ├── Div.java │ │ │ │ │ │ ├── Iinc.java │ │ │ │ │ │ ├── Mul.java │ │ │ │ │ │ ├── Neg.java │ │ │ │ │ │ ├── Or.java │ │ │ │ │ │ ├── Rem.java │ │ │ │ │ │ ├── Shl.java │ │ │ │ │ │ ├── Shr.java │ │ │ │ │ │ ├── Sub.java │ │ │ │ │ │ ├── Ushr.java │ │ │ │ │ │ └── Xor.java │ │ │ │ │ ├── references │ │ │ │ │ │ ├── Anewarray.java │ │ │ │ │ │ ├── Arraylength.java │ │ │ │ │ │ ├── Athrow.java │ │ │ │ │ │ ├── Checkcast.java │ │ │ │ │ │ ├── Getfield.java │ │ │ │ │ │ ├── Getstatic.java │ │ │ │ │ │ ├── Instanceof.java │ │ │ │ │ │ ├── Invokedynamic.java │ │ │ │ │ │ ├── Invokeinterface.java │ │ │ │ │ │ ├── Invokespecial.java │ │ │ │ │ │ ├── Invokestatic.java │ │ │ │ │ │ ├── Invokevirtual.java │ │ │ │ │ │ ├── Monitorenter.java │ │ │ │ │ │ ├── Monitorexit.java │ │ │ │ │ │ ├── New.java │ │ │ │ │ │ ├── Newarray.java │ │ │ │ │ │ ├── Putfield.java │ │ │ │ │ │ └── Putstatic.java │ │ │ │ │ ├── stack │ │ │ │ │ │ ├── Dup.java │ │ │ │ │ │ ├── Pop.java │ │ │ │ │ │ └── Swap.java │ │ │ │ │ └── stores │ │ │ │ │ │ ├── Astore.java │ │ │ │ │ │ ├── Dstore.java │ │ │ │ │ │ ├── Fstore.java │ │ │ │ │ │ ├── Istore.java │ │ │ │ │ │ ├── Lstore.java │ │ │ │ │ │ └── Xastore.java │ │ │ │ │ ├── natives │ │ │ │ │ ├── NativeMethod.java │ │ │ │ │ ├── io │ │ │ │ │ │ └── nuls │ │ │ │ │ │ │ └── contract │ │ │ │ │ │ │ └── sdk │ │ │ │ │ │ │ ├── NativeAddress.java │ │ │ │ │ │ │ ├── NativeBlock.java │ │ │ │ │ │ │ ├── NativeMsg.java │ │ │ │ │ │ │ └── NativeUtils.java │ │ │ │ │ └── java │ │ │ │ │ │ ├── lang │ │ │ │ │ │ ├── NativeAbstractStringBuilder.java │ │ │ │ │ │ ├── NativeCharacter.java │ │ │ │ │ │ ├── NativeClass.java │ │ │ │ │ │ ├── NativeDouble.java │ │ │ │ │ │ ├── NativeFloat.java │ │ │ │ │ │ ├── NativeObject.java │ │ │ │ │ │ ├── NativeRuntime.java │ │ │ │ │ │ ├── NativeSecurityManager.java │ │ │ │ │ │ ├── NativeStrictMath.java │ │ │ │ │ │ ├── NativeString.java │ │ │ │ │ │ ├── NativeSystem.java │ │ │ │ │ │ ├── NativeThrowable.java │ │ │ │ │ │ └── reflect │ │ │ │ │ │ │ └── NativeArray.java │ │ │ │ │ │ └── sun │ │ │ │ │ │ └── misc │ │ │ │ │ │ └── NativeVM.java │ │ │ │ │ ├── program │ │ │ │ │ ├── ProgramAccount.java │ │ │ │ │ ├── ProgramCall.java │ │ │ │ │ ├── ProgramCreate.java │ │ │ │ │ ├── ProgramExecutor.java │ │ │ │ │ ├── ProgramMethod.java │ │ │ │ │ ├── ProgramMethodArg.java │ │ │ │ │ ├── ProgramResult.java │ │ │ │ │ ├── ProgramStatus.java │ │ │ │ │ ├── ProgramTransfer.java │ │ │ │ │ └── impl │ │ │ │ │ │ ├── ProgramChecker.java │ │ │ │ │ │ ├── ProgramConstants.java │ │ │ │ │ │ ├── ProgramContext.java │ │ │ │ │ │ ├── ProgramDescriptors.java │ │ │ │ │ │ ├── ProgramExecutorImpl.java │ │ │ │ │ │ ├── ProgramInvoke.java │ │ │ │ │ │ └── ProgramTime.java │ │ │ │ │ └── util │ │ │ │ │ ├── CloneUtils.java │ │ │ │ │ ├── Constants.java │ │ │ │ │ ├── JsonUtils.java │ │ │ │ │ ├── Log.java │ │ │ │ │ └── Utils.java │ │ │ └── org │ │ │ │ └── ethereum │ │ │ │ ├── config │ │ │ │ ├── BlockchainNetConfig.java │ │ │ │ ├── CommonConfig.java │ │ │ │ ├── Constants.java │ │ │ │ ├── DefaultConfig.java │ │ │ │ └── SystemProperties.java │ │ │ │ ├── core │ │ │ │ ├── AccountState.java │ │ │ │ ├── Block.java │ │ │ │ ├── BlockHeader.java │ │ │ │ └── Repository.java │ │ │ │ ├── crypto │ │ │ │ ├── HashUtil.java │ │ │ │ ├── cryptohash │ │ │ │ │ ├── Digest.java │ │ │ │ │ ├── DigestEngine.java │ │ │ │ │ ├── Keccak256.java │ │ │ │ │ ├── Keccak512.java │ │ │ │ │ └── KeccakCore.java │ │ │ │ └── jce │ │ │ │ │ ├── ECAlgorithmParameters.java │ │ │ │ │ ├── ECKeyAgreement.java │ │ │ │ │ ├── ECKeyFactory.java │ │ │ │ │ ├── ECKeyPairGenerator.java │ │ │ │ │ ├── ECSignatureFactory.java │ │ │ │ │ └── SpongyCastleProvider.java │ │ │ │ ├── datasource │ │ │ │ ├── AbstractCachedSource.java │ │ │ │ ├── AbstractChainedSource.java │ │ │ │ ├── AsyncFlushable.java │ │ │ │ ├── AsyncWriteCache.java │ │ │ │ ├── BatchSource.java │ │ │ │ ├── BatchSourceWriter.java │ │ │ │ ├── BloomFilter.java │ │ │ │ ├── BloomedSource.java │ │ │ │ ├── CachedSource.java │ │ │ │ ├── CountingBytesSource.java │ │ │ │ ├── CountingQuotientFilter.java │ │ │ │ ├── DataSourceArray.java │ │ │ │ ├── DbSettings.java │ │ │ │ ├── DbSource.java │ │ │ │ ├── HashedKeySource.java │ │ │ │ ├── JournalSource.java │ │ │ │ ├── MemSizeEstimator.java │ │ │ │ ├── MultiCache.java │ │ │ │ ├── NoDeleteSource.java │ │ │ │ ├── NodeKeyCompositor.java │ │ │ │ ├── ObjectDataSource.java │ │ │ │ ├── PrefixLookupSource.java │ │ │ │ ├── QuotientFilter.java │ │ │ │ ├── ReadCache.java │ │ │ │ ├── ReadWriteCache.java │ │ │ │ ├── Serializer.java │ │ │ │ ├── Serializers.java │ │ │ │ ├── Source.java │ │ │ │ ├── SourceChainBox.java │ │ │ │ ├── SourceCodec.java │ │ │ │ ├── WriteCache.java │ │ │ │ ├── XorDataSource.java │ │ │ │ ├── inmem │ │ │ │ │ ├── HashMapDB.java │ │ │ │ │ └── HashMapDBSimple.java │ │ │ │ └── leveldb │ │ │ │ │ └── LevelDbDataSource.java │ │ │ │ ├── db │ │ │ │ ├── AbstractBlockstore.java │ │ │ │ ├── BlockStore.java │ │ │ │ ├── BlockStoreDummy.java │ │ │ │ ├── ByteArrayWrapper.java │ │ │ │ ├── ContractDetails.java │ │ │ │ ├── DbFlushManager.java │ │ │ │ ├── HeaderStore.java │ │ │ │ ├── IndexedBlockStore.java │ │ │ │ ├── PruneManager.java │ │ │ │ ├── RepositoryImpl.java │ │ │ │ ├── RepositoryRoot.java │ │ │ │ ├── RepositoryWrapper.java │ │ │ │ ├── StateSource.java │ │ │ │ ├── index │ │ │ │ │ ├── ArrayListIndex.java │ │ │ │ │ └── Index.java │ │ │ │ └── prune │ │ │ │ │ ├── Chain.java │ │ │ │ │ ├── ChainItem.java │ │ │ │ │ ├── Pruner.java │ │ │ │ │ └── Segment.java │ │ │ │ ├── facade │ │ │ │ └── Repository.java │ │ │ │ ├── trie │ │ │ │ ├── CollectFullSetOfNodes.java │ │ │ │ ├── CountAllNodes.java │ │ │ │ ├── Node.java │ │ │ │ ├── SecureTrie.java │ │ │ │ ├── TraceAllNodes.java │ │ │ │ ├── Trie.java │ │ │ │ ├── TrieImpl.java │ │ │ │ └── TrieKey.java │ │ │ │ ├── util │ │ │ │ ├── ALock.java │ │ │ │ ├── BIUtil.java │ │ │ │ ├── BuildInfo.java │ │ │ │ ├── ByteArrayMap.java │ │ │ │ ├── ByteArraySet.java │ │ │ │ ├── ByteUtil.java │ │ │ │ ├── CollectionUtils.java │ │ │ │ ├── CompactEncoder.java │ │ │ │ ├── CopyOnWriteMap.java │ │ │ │ ├── DecodeResult.java │ │ │ │ ├── ExecutorPipeline.java │ │ │ │ ├── FastByteComparisons.java │ │ │ │ ├── FileUtil.java │ │ │ │ ├── MinMaxMap.java │ │ │ │ ├── RLP.java │ │ │ │ ├── RLPElement.java │ │ │ │ ├── RLPItem.java │ │ │ │ ├── RLPList.java │ │ │ │ ├── SetAdapter.java │ │ │ │ ├── TimeUtils.java │ │ │ │ ├── Utils.java │ │ │ │ ├── Value.java │ │ │ │ └── blockchain │ │ │ │ │ └── EtherUtil.java │ │ │ │ └── vm │ │ │ │ └── DataWord.java │ │ └── resources │ │ │ ├── used_classes │ │ │ └── used_classes_v3 │ │ └── test │ │ ├── java │ │ ├── contracts │ │ │ ├── crowdsale │ │ │ │ ├── Crowdsale.java │ │ │ │ ├── Crowdsale.sol │ │ │ │ ├── distribution │ │ │ │ │ ├── FinalizableCrowdsale.java │ │ │ │ │ ├── FinalizableCrowdsale.sol │ │ │ │ │ ├── RefundableCrowdsale.java │ │ │ │ │ ├── RefundableCrowdsale.sol │ │ │ │ │ └── utils │ │ │ │ │ │ ├── RefundVault.java │ │ │ │ │ │ └── RefundVault.sol │ │ │ │ ├── emission │ │ │ │ │ ├── MintedCrowdsale.java │ │ │ │ │ └── MintedCrowdsale.sol │ │ │ │ └── validation │ │ │ │ │ ├── CappedCrowdsale.java │ │ │ │ │ ├── CappedCrowdsale.sol │ │ │ │ │ ├── TimedCrowdsale.java │ │ │ │ │ └── TimedCrowdsale.sol │ │ │ ├── examples │ │ │ │ ├── SampleCrowdsale.java │ │ │ │ ├── SampleCrowdsale.sol │ │ │ │ ├── SimpleToken.java │ │ │ │ ├── SimpleToken.sol │ │ │ │ ├── TestCrowdsale.java │ │ │ │ ├── TestToken.java │ │ │ │ ├── cmd.md │ │ │ │ └── solidity.md │ │ │ ├── ownership │ │ │ │ ├── Ownable.java │ │ │ │ ├── Ownable.sol │ │ │ │ └── OwnableImpl.java │ │ │ └── token │ │ │ │ └── ERC20 │ │ │ │ ├── BasicToken.java │ │ │ │ ├── BasicToken.sol │ │ │ │ ├── BurnableToken.java │ │ │ │ ├── BurnableToken.sol │ │ │ │ ├── CappedToken.sol │ │ │ │ ├── DetailedERC20.sol │ │ │ │ ├── ERC20.java │ │ │ │ ├── ERC20.sol │ │ │ │ ├── ERC20Basic.java │ │ │ │ ├── ERC20Basic.sol │ │ │ │ ├── MintableToken.java │ │ │ │ ├── MintableToken.sol │ │ │ │ ├── PausableToken.sol │ │ │ │ ├── RBACMintableToken.sol │ │ │ │ ├── SafeERC20.sol │ │ │ │ ├── StandardBurnableToken.sol │ │ │ │ ├── StandardToken.java │ │ │ │ ├── StandardToken.sol │ │ │ │ ├── TokenTimelock.sol │ │ │ │ └── TokenVesting.sol │ │ ├── io │ │ │ └── nuls │ │ │ │ └── contract │ │ │ │ ├── ContractTest.java │ │ │ │ ├── CrowdsaleTest.java │ │ │ │ └── VoteTest.java │ │ └── testcontract │ │ │ ├── balancecheck │ │ │ └── TestBalanceCheck.java │ │ │ ├── bigdecimal │ │ │ └── BigDecimalTest.java │ │ │ ├── contractcallcontract │ │ │ └── ContractCallContract.java │ │ │ ├── incorrectaddress │ │ │ └── TestIncorrectAddress.java │ │ │ ├── loadjar │ │ │ └── LoadJarTest.java │ │ │ ├── multytransfer │ │ │ └── TestMultyTransfer.java │ │ │ ├── nrc20 │ │ │ ├── NRC20.java │ │ │ └── SimpleToken.java │ │ │ ├── simple │ │ │ └── ContractCodeHexString.java │ │ │ ├── test │ │ │ └── TestContract.java │ │ │ ├── testlotoftransfer │ │ │ └── TestLotOfTransfer.java │ │ │ └── testsign │ │ │ └── TestSignData.java │ │ └── resources │ │ ├── block │ │ └── genesis-block.json │ │ ├── crowdsale_contract │ │ ├── languages │ │ ├── en.properties │ │ └── zh-CHS.properties │ │ ├── modules.ini │ │ ├── nuls.ini │ │ ├── token_contract │ │ └── vote_contract ├── contract │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── io │ │ │ │ └── nuls │ │ │ │ └── contract │ │ │ │ ├── constant │ │ │ │ ├── ContractConstant.java │ │ │ │ └── ContractErrorCode.java │ │ │ │ ├── dto │ │ │ │ ├── ContractResult.java │ │ │ │ ├── ContractTokenInfo.java │ │ │ │ ├── ContractTokenTransferInfoPo.java │ │ │ │ └── ContractTransfer.java │ │ │ │ ├── entity │ │ │ │ ├── tx │ │ │ │ │ ├── CallContractTransaction.java │ │ │ │ │ ├── ContractTransaction.java │ │ │ │ │ ├── ContractTransferTransaction.java │ │ │ │ │ ├── CreateContractTransaction.java │ │ │ │ │ └── DeleteContractTransaction.java │ │ │ │ └── txdata │ │ │ │ │ ├── CallContractData.java │ │ │ │ │ ├── ContractData.java │ │ │ │ │ ├── ContractTransferData.java │ │ │ │ │ ├── CreateContractData.java │ │ │ │ │ └── DeleteContractData.java │ │ │ │ ├── module │ │ │ │ └── AbstractContractModule.java │ │ │ │ ├── service │ │ │ │ └── ContractService.java │ │ │ │ └── util │ │ │ │ └── ContractUtil.java │ │ └── resources │ │ │ └── contract-protocol.xml │ │ └── test │ │ └── java │ │ └── io │ │ └── nuls │ │ └── contract │ │ └── entity │ │ └── txdata │ │ └── CallContractDataTest.java └── pom.xml ├── core-module ├── README.md ├── kernel-rpc │ └── pom.xml ├── kernel │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java-templates │ │ │ └── io │ │ │ │ └── nuls │ │ │ │ └── module │ │ │ │ └── version │ │ │ │ └── KernelMavenInfo.java │ │ └── java │ │ │ └── io │ │ │ └── nuls │ │ │ └── kernel │ │ │ ├── MicroKernelBootstrap.java │ │ │ ├── args │ │ │ └── NULSParams.java │ │ │ ├── cfg │ │ │ └── NulsConfig.java │ │ │ ├── constant │ │ │ ├── ErrorCode.java │ │ │ ├── KernelErrorCode.java │ │ │ ├── ModuleStatusEnum.java │ │ │ ├── NulsConstant.java │ │ │ ├── SeverityLevelEnum.java │ │ │ ├── TransactionErrorCode.java │ │ │ └── TxStatusEnum.java │ │ │ ├── context │ │ │ └── NulsContext.java │ │ │ ├── exception │ │ │ ├── NulsException.java │ │ │ ├── NulsRuntimeException.java │ │ │ └── NulsVerificationException.java │ │ │ ├── func │ │ │ └── TimeService.java │ │ │ ├── i18n │ │ │ └── I18nUtils.java │ │ │ ├── lite │ │ │ ├── annotation │ │ │ │ ├── Autowired.java │ │ │ │ ├── Cmd.java │ │ │ │ ├── Component.java │ │ │ │ ├── Interceptor.java │ │ │ │ └── Service.java │ │ │ ├── core │ │ │ │ ├── DefaultMethodInterceptor.java │ │ │ │ ├── ModularServiceMethodInterceptor.java │ │ │ │ ├── SpringLiteContext.java │ │ │ │ ├── bean │ │ │ │ │ └── InitializingBean.java │ │ │ │ └── interceptor │ │ │ │ │ ├── BeanMethodInterceptor.java │ │ │ │ │ ├── BeanMethodInterceptorChain.java │ │ │ │ │ ├── BeanMethodInterceptorManager.java │ │ │ │ │ └── MultipleBeanMethodInterceptorChain.java │ │ │ ├── exception │ │ │ │ └── BeanStatusException.java │ │ │ └── utils │ │ │ │ └── ScanUtil.java │ │ │ ├── model │ │ │ ├── Address.java │ │ │ ├── BaseNulsData.java │ │ │ ├── Block.java │ │ │ ├── BlockHeader.java │ │ │ ├── Coin.java │ │ │ ├── CoinData.java │ │ │ ├── CommandResult.java │ │ │ ├── ErrorData.java │ │ │ ├── Na.java │ │ │ ├── NulsData.java │ │ │ ├── NulsDigestData.java │ │ │ ├── NulsSignData.java │ │ │ ├── NulsVersion.java │ │ │ ├── Result.java │ │ │ ├── RpcClientResult.java │ │ │ ├── Transaction.java │ │ │ └── TransactionLogicData.java │ │ │ ├── module │ │ │ ├── BaseModuleBootstrap.java │ │ │ ├── manager │ │ │ │ ├── ModuleManager.java │ │ │ │ └── ServiceManager.java │ │ │ ├── service │ │ │ │ └── ModuleService.java │ │ │ └── thread │ │ │ │ ├── ModuleProcess.java │ │ │ │ ├── ModuleProcessFactory.java │ │ │ │ └── ModuleRunner.java │ │ │ ├── processor │ │ │ ├── CommandProcessor.java │ │ │ ├── ConflictDetectProcessor.java │ │ │ └── TransactionProcessor.java │ │ │ ├── script │ │ │ ├── BlockSignature.java │ │ │ ├── P2PHKSignature.java │ │ │ ├── Script.java │ │ │ ├── ScriptBuilder.java │ │ │ ├── ScriptChunk.java │ │ │ ├── ScriptException.java │ │ │ ├── ScriptOpCodes.java │ │ │ ├── ScriptSign.java │ │ │ ├── ScriptUtil.java │ │ │ ├── SignatureUtil.java │ │ │ └── TransactionSignature.java │ │ │ ├── service │ │ │ └── KernelService.java │ │ │ ├── thread │ │ │ ├── BaseThread.java │ │ │ ├── cache │ │ │ │ └── TaskTable.java │ │ │ └── manager │ │ │ │ ├── NulsThreadFactory.java │ │ │ │ ├── TaskManager.java │ │ │ │ └── ThreadPoolInterceiptor.java │ │ │ ├── utils │ │ │ ├── AddressTool.java │ │ │ ├── ByteArrayWrapper.java │ │ │ ├── CommandBuilder.java │ │ │ ├── CommandHelper.java │ │ │ ├── MappedBufferCleanUtil.java │ │ │ ├── NulsByteBuffer.java │ │ │ ├── NulsOutputStreamBuffer.java │ │ │ ├── RandomSeedCaculator.java │ │ │ ├── RestFulUtils.java │ │ │ ├── SerializeUtils.java │ │ │ ├── TransactionFeeCalculator.java │ │ │ ├── TransactionManager.java │ │ │ └── VarInt.java │ │ │ └── validate │ │ │ ├── DataValidatorChain.java │ │ │ ├── NulsDataValidator.java │ │ │ ├── ValidateResult.java │ │ │ └── ValidatorManager.java │ │ └── test │ │ ├── java │ │ └── io │ │ │ └── nuls │ │ │ └── kernel │ │ │ ├── MicroKernelBootstrapTest.java │ │ │ ├── func │ │ │ └── TimeServiceTest.java │ │ │ ├── model │ │ │ └── NulsDigestDataTest.java │ │ │ └── type │ │ │ └── Int48Test.java │ │ └── resources │ │ ├── block │ │ └── genesis-block.json │ │ ├── languages │ │ ├── en.properties │ │ └── zh-CHS.properties │ │ ├── logback.xml │ │ ├── modules.ini │ │ └── nuls.ini └── pom.xml ├── db-module ├── README.md ├── db │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── io │ │ └── nuls │ │ └── db │ │ ├── constant │ │ ├── DBConstant.java │ │ └── DBErrorCode.java │ │ ├── model │ │ ├── Entry.java │ │ └── ModelWrapper.java │ │ ├── module │ │ └── AbstractDBModule.java │ │ └── service │ │ ├── BatchOperation.java │ │ └── DBService.java ├── leveldb │ └── db-leveldb │ │ ├── pom.xml │ │ └── src │ │ ├── main │ │ ├── java │ │ │ └── io │ │ │ │ └── nuls │ │ │ │ └── db │ │ │ │ ├── manager │ │ │ │ └── LevelDBManager.java │ │ │ │ ├── module │ │ │ │ └── impl │ │ │ │ │ └── LevelDbModuleBootstrap.java │ │ │ │ └── service │ │ │ │ └── impl │ │ │ │ ├── BatchOperationImpl.java │ │ │ │ └── LevelDBServiceImpl.java │ │ └── resources │ │ │ └── db_config.properties │ │ └── test │ │ ├── java │ │ └── io │ │ │ └── nuls │ │ │ └── db │ │ │ ├── entity │ │ │ ├── DBTestEntity.java │ │ │ └── TestTransaction.java │ │ │ └── service │ │ │ ├── LevelDBServiceTest.java │ │ │ └── PerformanceTest.java │ │ └── resources │ │ └── db_config.properties └── pom.xml ├── ledger-module ├── README.md ├── ledger │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── io │ │ └── nuls │ │ └── ledger │ │ ├── constant │ │ ├── LedgerConstant.java │ │ └── LedgerErrorCode.java │ │ ├── module │ │ └── AbstractLedgerModule.java │ │ ├── service │ │ └── LedgerService.java │ │ └── util │ │ └── LedgerUtil.java ├── pom.xml └── utxo │ ├── ledger-utxo-base │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── nuls │ │ │ └── ledger │ │ │ ├── module │ │ │ └── impl │ │ │ │ └── UtxoLedgerModuleBootstrap.java │ │ │ ├── service │ │ │ └── impl │ │ │ │ └── UtxoLedgerServiceImpl.java │ │ │ └── task │ │ │ └── TotalCoinTask.java │ │ └── test │ │ └── resources │ │ ├── block │ │ └── genesis-block.json │ │ ├── languages │ │ ├── en.properties │ │ └── zh-CHS.properties │ │ ├── modules.ini │ │ └── nuls.ini │ ├── ledger-utxo-rpc │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── io │ │ └── nuls │ │ └── ledger │ │ └── rpc │ │ ├── cmd │ │ └── GetTxProcessor.java │ │ ├── model │ │ ├── AccountUtxoDto.java │ │ ├── Holder.java │ │ ├── HolderDto.java │ │ ├── InputDto.java │ │ ├── NulsInfoDto.java │ │ ├── OutputDto.java │ │ ├── TokenInfoDto.java │ │ ├── TransactionDto.java │ │ └── UtxoDto.java │ │ └── resource │ │ ├── TransactionResource.java │ │ └── UtxoResource.java │ └── ledger-utxo-storage │ ├── pom.xml │ └── src │ └── main │ └── java │ └── io │ └── nuls │ └── ledger │ └── storage │ ├── constant │ └── LedgerStorageConstant.java │ ├── service │ ├── UtxoLedgerTransactionStorageService.java │ ├── UtxoLedgerUtxoStorageService.java │ └── impl │ │ ├── UtxoLedgerTransactionStorageServiceImpl.java │ │ └── UtxoLedgerUtxoStorageServiceImpl.java │ └── util │ └── CoinComparator.java ├── message-bus-module ├── README.md ├── base │ └── message-bus-base │ │ ├── pom.xml │ │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── nuls │ │ │ └── message │ │ │ └── bus │ │ │ ├── manager │ │ │ ├── DispatchManager.java │ │ │ └── HandlerManager.java │ │ │ ├── model │ │ │ └── ProcessData.java │ │ │ ├── module │ │ │ └── MessageBusModuleBootstrap.java │ │ │ ├── processor │ │ │ ├── MessageClassificationProcessor.java │ │ │ └── thread │ │ │ │ └── NulsMessageCall.java │ │ │ └── service │ │ │ └── impl │ │ │ └── MessageBusServiceImpl.java │ │ └── test │ │ └── java │ │ ├── TestHandler │ │ └── BlockMessageHandler.java │ │ └── io │ │ └── nuls │ │ └── message │ │ └── bus │ │ ├── module │ │ └── MessageBusModuleBootstrapTest.java │ │ └── service │ │ └── impl │ │ └── MessageBusServiceImplTest.java ├── message-bus │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── io │ │ └── nuls │ │ └── message │ │ └── bus │ │ ├── constant │ │ ├── MessageBusConstant.java │ │ └── MessageBusErrorCode.java │ │ ├── filter │ │ ├── NulsMessageFilter.java │ │ └── NulsMessageFilterChain.java │ │ ├── handler │ │ ├── AbstractMessageHandler.java │ │ └── intf │ │ │ └── NulsMessageHandler.java │ │ ├── manager │ │ └── MessageManager.java │ │ ├── module │ │ └── AbstractMessageBusModule.java │ │ └── service │ │ └── MessageBusService.java └── pom.xml ├── network-module ├── README.md ├── base │ ├── network-netty │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── nuls │ │ │ │ └── network │ │ │ │ └── netty │ │ │ │ ├── broadcast │ │ │ │ └── BroadcastHandler.java │ │ │ │ ├── conn │ │ │ │ ├── NettyClient.java │ │ │ │ ├── NettyServer.java │ │ │ │ ├── NodeAttributeKey.java │ │ │ │ ├── handler │ │ │ │ │ ├── ClientChannelHandler.java │ │ │ │ │ ├── HeartbeatServerHandler.java │ │ │ │ │ └── ServerChannelHandler.java │ │ │ │ ├── initializer │ │ │ │ │ └── NulsChannelInitializer.java │ │ │ │ └── serialization │ │ │ │ │ ├── NulsLengthFieldBasedFrameDecoder.java │ │ │ │ │ ├── NulsMessageDecoder.java │ │ │ │ │ └── NulsMessageEncoder.java │ │ │ │ ├── container │ │ │ │ ├── GroupContainer.java │ │ │ │ └── NodesContainer.java │ │ │ │ ├── manager │ │ │ │ ├── ConnectionManager.java │ │ │ │ └── NodeManager.java │ │ │ │ ├── message │ │ │ │ ├── MessageProcessor.java │ │ │ │ ├── NetworkMessageHandlerFactory.java │ │ │ │ ├── NetworkMessageHandlerPool.java │ │ │ │ ├── filter │ │ │ │ │ ├── MessageFilterChain.java │ │ │ │ │ ├── NulsMessageFilter.java │ │ │ │ │ └── impl │ │ │ │ │ │ └── MagicNumberFilter.java │ │ │ │ └── handler │ │ │ │ │ ├── GetNodesIpMessageHandler.java │ │ │ │ │ ├── GetNodesMessageHandler.java │ │ │ │ │ ├── GetVersionMessageHandler.java │ │ │ │ │ ├── HandshakeMessageHandler.java │ │ │ │ │ ├── NodesIpMessageHandler.java │ │ │ │ │ ├── NodesMessageHandler.java │ │ │ │ │ ├── P2pNodeMessageHandler.java │ │ │ │ │ └── VersionMessageHandler.java │ │ │ │ ├── module │ │ │ │ └── impl │ │ │ │ │ └── NettyNetworkModuleBootstrap.java │ │ │ │ ├── report │ │ │ │ └── PlatformDepedentReporter.java │ │ │ │ ├── service │ │ │ │ └── impl │ │ │ │ │ └── NetworkServiceImpl.java │ │ │ │ └── task │ │ │ │ ├── GetNodeVersionTask.java │ │ │ │ ├── NodeDiscoverTask.java │ │ │ │ ├── NodeMaintenanceTask.java │ │ │ │ ├── RunOnceAfterStartupTask.java │ │ │ │ └── SaveNodeInfoTask.java │ │ │ └── test │ │ │ └── java │ │ │ └── io │ │ │ └── nuls │ │ │ └── network │ │ │ └── test │ │ │ └── NetworkTest.java │ ├── network-protocol │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── io │ │ │ │ └── nuls │ │ │ │ └── network │ │ │ │ └── protocol │ │ │ │ ├── handler │ │ │ │ └── BaseNetworkMeesageHandler.java │ │ │ │ └── message │ │ │ │ ├── BaseNetworkMessage.java │ │ │ │ ├── GetNodesIpMessage.java │ │ │ │ ├── GetNodesMessage.java │ │ │ │ ├── GetVersionMessage.java │ │ │ │ ├── HandshakeMessage.java │ │ │ │ ├── NetworkMessageBody.java │ │ │ │ ├── NodeMessageBody.java │ │ │ │ ├── NodesIpMessage.java │ │ │ │ ├── NodesMessage.java │ │ │ │ ├── P2PNodeBody.java │ │ │ │ ├── P2PNodeMessage.java │ │ │ │ └── VersionMessage.java │ │ │ └── resources │ │ │ └── network-protocol.xml │ ├── network-rpc │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── io │ │ │ └── nuls │ │ │ └── network │ │ │ └── rpc │ │ │ ├── cmd │ │ │ ├── GetNetInfoProcessor.java │ │ │ └── GetNetNodesProcessor.java │ │ │ ├── model │ │ │ ├── NetworkInfoDto.java │ │ │ └── NodeDto.java │ │ │ └── resource │ │ │ └── NetworkResource.java │ └── network-storage │ │ ├── pom.xml │ │ └── src │ │ └── main │ │ └── java │ │ └── io │ │ └── nuls │ │ └── network │ │ └── storage │ │ ├── constant │ │ └── NetworkStorageConstant.java │ │ ├── po │ │ ├── NetworkTransferTool.java │ │ ├── NodeContainerPo.java │ │ └── NodePo.java │ │ └── service │ │ ├── NetworkStorageService.java │ │ └── impl │ │ └── NetworkStorageServiceImpl.java ├── network │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── io │ │ └── nuls │ │ └── network │ │ ├── constant │ │ ├── NetworkConstant.java │ │ ├── NetworkErrorCode.java │ │ └── NetworkParam.java │ │ ├── listener │ │ └── EventListener.java │ │ ├── model │ │ ├── BroadcastResult.java │ │ ├── NetworkEventResult.java │ │ ├── Node.java │ │ ├── NodeArea.java │ │ ├── NodeConnectStatusEnum.java │ │ ├── NodeGroup.java │ │ └── NodeStatusEnum.java │ │ ├── module │ │ └── AbstractNetworkModule.java │ │ └── service │ │ └── NetworkService.java └── pom.xml ├── pom.xml ├── protocol-module ├── README.md ├── base │ ├── protocol-base │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── nuls │ │ │ │ └── protocol │ │ │ │ └── base │ │ │ │ ├── cache │ │ │ │ ├── DataCacher.java │ │ │ │ ├── ProtocolCacheHandler.java │ │ │ │ └── TransactionDuplicateRemoval.java │ │ │ │ ├── constant │ │ │ │ └── DownloadStatus.java │ │ │ │ ├── download │ │ │ │ ├── entity │ │ │ │ │ ├── DownloadRound.java │ │ │ │ │ ├── NetworkNewestBlockInfos.java │ │ │ │ │ ├── NodeDownloadingStatus.java │ │ │ │ │ └── ResultMessage.java │ │ │ │ ├── processor │ │ │ │ │ └── DownloadProcessor.java │ │ │ │ ├── thread │ │ │ │ │ ├── CollectThread.java │ │ │ │ │ ├── DownloadThreadManager.java │ │ │ │ │ └── RequestThread.java │ │ │ │ └── utils │ │ │ │ │ ├── DownloadUtils.java │ │ │ │ │ └── NodeComparator.java │ │ │ │ ├── handler │ │ │ │ ├── BlockMessageHandler.java │ │ │ │ ├── BlocksHashHandler.java │ │ │ │ ├── CompleteHandler.java │ │ │ │ ├── ForwardSmallBlockHandler.java │ │ │ │ ├── ForwardTxMessageHandler.java │ │ │ │ ├── GetBlockHandler.java │ │ │ │ ├── GetBlocksByHashHandler.java │ │ │ │ ├── GetBlocksByHeightHandler.java │ │ │ │ ├── GetBlocksHashHandler.java │ │ │ │ ├── GetSmallBlockHandler.java │ │ │ │ ├── GetTxGroupHandler.java │ │ │ │ ├── GetTxMessageHandler.java │ │ │ │ ├── NotFoundHander.java │ │ │ │ ├── ReactMessageHandler.java │ │ │ │ ├── SmallBlockHandler.java │ │ │ │ ├── TransactionMessageHandler.java │ │ │ │ └── TxGroupHandler.java │ │ │ │ ├── module │ │ │ │ └── BaseProtocolsModuleBootstrap.java │ │ │ │ ├── service │ │ │ │ ├── BlockServiceImpl.java │ │ │ │ ├── DownloadServiceImpl.java │ │ │ │ └── TransactionServiceImpl.java │ │ │ │ ├── utils │ │ │ │ ├── AssemblyBlockUtil.java │ │ │ │ ├── BlockRequest.java │ │ │ │ ├── BlockSendThread.java │ │ │ │ ├── PoConvertUtil.java │ │ │ │ ├── filter │ │ │ │ │ └── InventoryFilter.java │ │ │ │ └── xml │ │ │ │ │ └── XmlLoader.java │ │ │ │ ├── validator │ │ │ │ ├── TransferValidator.java │ │ │ │ └── TxEffectiveValidator.java │ │ │ │ └── version │ │ │ │ ├── NulsVersionHandler.java │ │ │ │ ├── NulsVersionManager.java │ │ │ │ ├── ProtocolContainer.java │ │ │ │ └── ProtocolVersionHandler.java │ │ │ └── test │ │ │ ├── java │ │ │ └── io │ │ │ │ └── nuls │ │ │ │ └── protocol │ │ │ │ └── base │ │ │ │ ├── service │ │ │ │ ├── BlockServiceImplTest.java │ │ │ │ └── TransactionServiceImplTest.java │ │ │ │ └── utils │ │ │ │ └── filter │ │ │ │ └── InventoryFilterTest.java │ │ │ └── resources │ │ │ ├── block │ │ │ └── genesis-block.json │ │ │ ├── languages │ │ │ ├── en.properties │ │ │ └── zh-CHS.properties │ │ │ ├── logback.xml │ │ │ ├── modules.ini │ │ │ └── nuls.ini │ ├── protocol-rpc │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── nuls │ │ │ │ └── protocol │ │ │ │ └── rpc │ │ │ │ ├── cmd │ │ │ │ ├── GetBestBlockHeaderProcessor.java │ │ │ │ ├── GetBlockHeaderListProcessor.java │ │ │ │ ├── GetBlockHeaderProcessor.java │ │ │ │ └── GetBlockProcessor.java │ │ │ │ ├── model │ │ │ │ ├── BlockDto.java │ │ │ │ ├── BlockHeaderDto.java │ │ │ │ ├── BlockInfoDto.java │ │ │ │ ├── InputDto.java │ │ │ │ ├── OutputDto.java │ │ │ │ └── TransactionDto.java │ │ │ │ └── resources │ │ │ │ └── BlockResource.java │ │ │ └── test │ │ │ └── java │ │ │ └── io │ │ │ └── nuls │ │ │ └── protocol │ │ │ └── rpc │ │ │ └── resources │ │ │ └── BlockResourceTest.java │ └── protocol-storage │ │ ├── pom.xml │ │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── nuls │ │ │ └── protocol │ │ │ └── storage │ │ │ ├── constant │ │ │ └── ProtocolStorageConstant.java │ │ │ ├── po │ │ │ ├── BlockHeaderPo.java │ │ │ ├── BlockProtocolInfoPo.java │ │ │ ├── ProtocolInfoPo.java │ │ │ └── ProtocolTempInfoPo.java │ │ │ └── service │ │ │ ├── BlockHeaderStorageService.java │ │ │ ├── VersionManagerStorageService.java │ │ │ └── impl │ │ │ ├── BlockHeaderStorageServiceImpl.java │ │ │ └── VersionManagerStorageServiceImpl.java │ │ └── test │ │ ├── java │ │ └── io │ │ │ └── nuls │ │ │ └── protocol │ │ │ └── storage │ │ │ ├── po │ │ │ └── BlockHeaderPoTest.java │ │ │ └── service │ │ │ └── impl │ │ │ └── BlockHeaderStorageServiceImplTest.java │ │ └── resources │ │ ├── block │ │ └── genesis-block.json │ │ ├── languages │ │ ├── en.properties │ │ └── zh-CHS.properties │ │ ├── logback.xml │ │ ├── modules.ini │ │ └── nuls.ini ├── pom.xml └── protocol │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── io │ │ │ └── nuls │ │ │ └── protocol │ │ │ ├── cache │ │ │ └── TemporaryCacheManager.java │ │ │ ├── constant │ │ │ ├── MessageDataType.java │ │ │ ├── ProtocolConstant.java │ │ │ └── ProtocolErroeCode.java │ │ │ ├── message │ │ │ ├── BaseProtocolMessage.java │ │ │ ├── BlockHeaderMessage.java │ │ │ ├── BlockMessage.java │ │ │ ├── BlocksHashMessage.java │ │ │ ├── CompleteMessage.java │ │ │ ├── ForwardSmallBlockMessage.java │ │ │ ├── ForwardTxMessage.java │ │ │ ├── GetBlockHeaderRequest.java │ │ │ ├── GetBlockMessage.java │ │ │ ├── GetBlocksByHashMessage.java │ │ │ ├── GetBlocksByHeightMessage.java │ │ │ ├── GetBlocksHashMessage.java │ │ │ ├── GetSmallBlockMessage.java │ │ │ ├── GetTxGroupRequest.java │ │ │ ├── GetTxMessage.java │ │ │ ├── NotFoundMessage.java │ │ │ ├── ReactMessage.java │ │ │ ├── SmallBlockMessage.java │ │ │ ├── TransactionMessage.java │ │ │ ├── TxGroupMessage.java │ │ │ ├── base │ │ │ │ ├── BaseMessage.java │ │ │ │ ├── CommonStringMessage.java │ │ │ │ └── MessageHeader.java │ │ │ └── validator │ │ │ │ └── NulsMessageValidator.java │ │ │ ├── model │ │ │ ├── BasicTypeData.java │ │ │ ├── BlockHashResponse.java │ │ │ ├── CompleteParam.java │ │ │ ├── GetBlockParam.java │ │ │ ├── GetBlocksByHashParam.java │ │ │ ├── GetBlocksByHeightParam.java │ │ │ ├── GetBlocksHashParam.java │ │ │ ├── GetTxGroupParam.java │ │ │ ├── NotFound.java │ │ │ ├── ReactParam.java │ │ │ ├── SmallBlock.java │ │ │ ├── TxGroup.java │ │ │ ├── basic │ │ │ │ ├── NulsBytesData.java │ │ │ │ ├── NulsDoubleData.java │ │ │ │ ├── NulsIntegerData.java │ │ │ │ ├── NulsLongData.java │ │ │ │ └── NulsStringData.java │ │ │ ├── tx │ │ │ │ ├── CoinBaseTransaction.java │ │ │ │ ├── DataTransaction.java │ │ │ │ ├── DataTransaction.java~HEAD │ │ │ │ ├── LogicData.java │ │ │ │ └── TransferTransaction.java │ │ │ └── validator │ │ │ │ ├── BlockFieldValidator.java │ │ │ │ ├── BlockHeaderValidator.java │ │ │ │ ├── BlockMaxSizeValidator.java │ │ │ │ ├── BlockMerkleValidator.java │ │ │ │ ├── HeaderFieldValidator.java │ │ │ │ ├── HeaderSignValidator.java │ │ │ │ ├── TxCoinValidator.java │ │ │ │ ├── TxFeeValidator.java │ │ │ │ ├── TxFieldValidator.java │ │ │ │ ├── TxMaxSizeValidator.java │ │ │ │ ├── TxRemarkValidator.java │ │ │ │ ├── TxSignValidator.java │ │ │ │ └── TxVersionForScriptValidator.java │ │ │ ├── module │ │ │ └── AbstractProtocolModule.java │ │ │ ├── service │ │ │ ├── BlockService.java │ │ │ ├── DownloadService.java │ │ │ └── TransactionService.java │ │ │ └── utils │ │ │ ├── HashSetDuplicateProcessor.java │ │ │ ├── SmallBlockDuplicateRemoval.java │ │ │ └── TransactionTimeComparator.java │ └── resources │ │ └── protocol-protocol.xml │ └── test │ └── java │ └── io │ └── nuls │ └── protocol │ ├── cache │ ├── CacheTestTx.java │ ├── LimitHashMapTest.java │ └── TemporaryCacheManagerTest.java │ └── service │ └── TransactionServiceTest.java ├── tools-module ├── cache │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── nuls │ │ │ └── cache │ │ │ ├── CacheMap.java │ │ │ ├── LimitHashMap.java │ │ │ ├── listener │ │ │ └── intf │ │ │ │ └── NulsCacheListener.java │ │ │ ├── manager │ │ │ └── EhCacheManager.java │ │ │ ├── model │ │ │ ├── CacheElement.java │ │ │ ├── CacheListenerItem.java │ │ │ └── CacheMapParams.java │ │ │ └── utils │ │ │ ├── CacheObjectSerializer.java │ │ │ └── EhcacheListener.java │ │ └── test │ │ └── java │ │ └── io │ │ └── nuls │ │ └── cache │ │ └── CacheMapTest.java ├── pom.xml └── tools │ ├── pom.xml │ └── src │ ├── main │ └── java │ │ └── io │ │ └── nuls │ │ └── core │ │ └── tools │ │ ├── BloomFilter │ │ └── BloomFilter.java │ │ ├── aop │ │ ├── AopUtils.java │ │ └── NulsMethodInterceptor.java │ │ ├── array │ │ └── ArraysTool.java │ │ ├── calc │ │ ├── DoubleUtils.java │ │ └── LongUtils.java │ │ ├── cfg │ │ ├── ConfigLoader.java │ │ ├── IniEntity.java │ │ └── PropertiesEntity.java │ │ ├── crypto │ │ ├── AESEncrypt.java │ │ ├── Base58.java │ │ ├── ByteStreams.java │ │ ├── Cipher.java │ │ ├── ECKey.java │ │ ├── EncryptedData.java │ │ ├── Exception │ │ │ └── CryptoException.java │ │ ├── Hex.java │ │ ├── Ints.java │ │ ├── KeccakHash.java │ │ ├── LinuxSecureRandom.java │ │ ├── SM2.java │ │ ├── SM2Result.java │ │ ├── SM2Utils.java │ │ ├── SM3.java │ │ ├── SM3Digest.java │ │ ├── SM4.java │ │ ├── SM4Utils.java │ │ ├── SM4_Context.java │ │ ├── Sha256Hash.java │ │ ├── Sha3Hash.java │ │ ├── UnsafeByteArrayOutputStream.java │ │ ├── Util.java │ │ ├── Utils.java │ │ └── VarInt.java │ │ ├── date │ │ └── DateUtil.java │ │ ├── disruptor │ │ ├── DisruptorData.java │ │ ├── DisruptorUtil.java │ │ └── NulsExceptionHandler.java │ │ ├── io │ │ ├── HttpDownloadUtils.java │ │ └── StringFileLoader.java │ │ ├── json │ │ └── JSONUtils.java │ │ ├── log │ │ ├── BlockLog.java │ │ ├── ChainLog.java │ │ ├── ConsensusLog.java │ │ ├── Log.java │ │ └── MessageLog.java │ │ ├── map │ │ └── MapUtil.java │ │ ├── network │ │ └── IpUtil.java │ │ ├── page │ │ └── Page.java │ │ ├── param │ │ └── AssertUtil.java │ │ ├── status │ │ └── StatLog.java │ │ └── str │ │ ├── StringUtils.java │ │ └── VersionUtils.java │ └── test │ └── java │ └── io │ └── nuls │ └── core │ └── tools │ ├── crypto │ └── ECKeyTest.java │ └── str │ └── VersionUtilsTest.java └── utxo-accounts-module ├── base ├── utxo-accounts-base │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── nuls │ │ │ └── utxo │ │ │ └── accounts │ │ │ ├── constant │ │ │ ├── UtxoAccountsConstant.java │ │ │ └── UtxoAccountsErrorCode.java │ │ │ ├── locker │ │ │ └── Lockers.java │ │ │ ├── module │ │ │ ├── AbstractUtxoAccountsModule.java │ │ │ └── impl │ │ │ │ └── UtxoAccountsModuleBootstrap.java │ │ │ ├── service │ │ │ ├── UtxoAccountsService.java │ │ │ └── impl │ │ │ │ ├── UtxoAccountsBalanceServiceImpl.java │ │ │ │ └── UtxoAccountsServiceImpl.java │ │ │ ├── task │ │ │ └── UtxoAccountsThread.java │ │ │ └── util │ │ │ └── UtxoAccountsUtil.java │ │ └── test │ │ └── java │ │ └── Test.java ├── utxo-accounts-rpc │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── io │ │ └── nuls │ │ └── utxo │ │ └── accounts │ │ └── rpc │ │ ├── cmd │ │ └── GetUtxoAccountsProcessor.java │ │ ├── dto │ │ └── AccountBalanceDto.java │ │ └── resource │ │ └── UtxoAccountsResource.java └── utxo-accounts-storage │ ├── pom.xml │ └── src │ └── main │ └── java │ └── io │ └── nuls │ └── utxo │ └── accounts │ └── storage │ ├── constant │ └── UtxoAccountsStorageConstant.java │ ├── po │ ├── LocalCacheBlockBalance.java │ ├── LockedBalance.java │ ├── UtxoAccountsBalancePo.java │ └── UtxoAccountsSynInfo.java │ └── service │ ├── UtxoAccountsStorageService.java │ └── impl │ └── UtxoAccountsStorageServiceImpl.java ├── pom.xml └── utxo-accounts ├── pom.xml └── src └── main └── java └── io └── nuls └── utxo └── accounts ├── model └── UtxoAccountsBalance.java └── service └── UtxoAccountsBalanceService.java /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017-2019 nuls.io 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /account-ledger-module/account-ledger/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | account-ledger-module 7 | io.nuls 8 | 1.3.0 9 | ../pom.xml 10 | 11 | 4.0.0 12 | 13 | io.nuls.account-ledger-module 14 | account-ledger 15 | 1.3.0 16 | 17 | 18 | 19 | io.nuls.core-module 20 | kernel 21 | 1.3.0 22 | 23 | 24 | io.nuls.account-module 25 | account 26 | 1.3.0 27 | 28 | 29 | 30 | ${project.artifactId}-${project.version} 31 | 32 | -------------------------------------------------------------------------------- /account-ledger-module/account-ledger/src/main/java/io/nuls/account/ledger/constant/AccountLedgerConstant.java: -------------------------------------------------------------------------------- 1 | /** 2 | * MIT License 3 | *

4 | * Copyright (c) 2017-2019 nuls.io 5 | *

6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | *

13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | *

16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package io.nuls.account.ledger.constant; 25 | 26 | import io.nuls.kernel.constant.NulsConstant; 27 | 28 | 29 | public interface AccountLedgerConstant extends NulsConstant { 30 | 31 | short MODULE_ID_ACCOUNTLEDGER = 9; 32 | /** 33 | * 默认200NULS 34 | */ 35 | long MAX_VALUE = 20000000000L; 36 | } 37 | -------------------------------------------------------------------------------- /account-ledger-module/account-ledger/src/main/java/io/nuls/account/ledger/model/TransactionDataResult.java: -------------------------------------------------------------------------------- 1 | package io.nuls.account.ledger.model; 2 | 3 | import io.nuls.kernel.model.Transaction; 4 | 5 | public class TransactionDataResult { 6 | 7 | private Transaction transaction; 8 | 9 | private boolean enough; 10 | 11 | /** 12 | * 判断交易中UTXO的签名类型(只包含老交易为00000001,只包含新交易为00000010,都包含为00000011) 13 | * */ 14 | private byte signType; 15 | 16 | public Transaction getTransaction() { 17 | return transaction; 18 | } 19 | 20 | public void setTransaction(Transaction transaction) { 21 | this.transaction = transaction; 22 | } 23 | 24 | public boolean isEnough() { 25 | return enough; 26 | } 27 | 28 | public void setEnough(boolean enough) { 29 | this.enough = enough; 30 | } 31 | 32 | public byte getSignType() { 33 | return signType; 34 | } 35 | 36 | public void setSignType(byte signType) { 37 | this.signType = signType; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /account-ledger-module/base/account-ledger-storage/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | account-ledger-module 7 | io.nuls 8 | 1.3.0 9 | ../../pom.xml 10 | 11 | 4.0.0 12 | 13 | io.nuls.account-ledger-module 14 | account-ledger-storage 15 | 1.3.0 16 | 17 | 18 | 19 | 20 | io.nuls.account-ledger-module 21 | account-ledger 22 | 1.3.0 23 | 24 | 25 | io.nuls.db-module 26 | db 27 | 1.3.0 28 | 29 | 30 | io.nuls.ledger-module 31 | ledger 32 | 1.3.0 33 | 34 | 35 | 36 | ${project.artifactId}-${project.version} 37 | 38 | -------------------------------------------------------------------------------- /account-ledger-module/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | nuls 7 | io.nuls 8 | 1.3.0 9 | ../pom.xml 10 | 11 | 4.0.0 12 | io.nuls 13 | account-ledger-module 14 | pom 15 | 1.3.0 16 | 17 | account-ledger 18 | base/account-ledger-storage 19 | base/account-ledger-rpc 20 | base/account-ledger-base 21 | 22 | 23 | -------------------------------------------------------------------------------- /account-module/account/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | account-module 7 | io.nuls 8 | 1.3.0 9 | ../pom.xml 10 | 11 | 4.0.0 12 | 13 | io.nuls.account-module 14 | account 15 | 1.3.0 16 | 17 | 18 | 19 | 20 | io.nuls.core-module 21 | kernel 22 | 1.3.0 23 | 24 | 25 | 26 | ${project.artifactId}-${project.version} 27 | 28 | -------------------------------------------------------------------------------- /account-module/account/src/main/resources/account-protocol.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /account-module/base/account-base/src/test/resources/block/genesis-block.json: -------------------------------------------------------------------------------- 1 | { 2 | "height": 0, 3 | "time": "1514736000000", 4 | "txs": [ 5 | { 6 | "address": "2CjzG5atBtD3kk2MatNpHCVDLzg7zNb", 7 | "nuls": 20000000, 8 | "unlockHeight": 0 9 | }, 10 | { 11 | "address": "2CjK6vkn1Z5QvcgidFy69dmneav3WHY", 12 | "nuls": 20000000, 13 | "unlockHeight": 0 14 | }, 15 | { 16 | "address": "2CbdQroDQjeTSshE9SdMBkLZcYih7j8", 17 | "nuls": 20000000, 18 | "unlockHeight": 0 19 | }, 20 | { 21 | "address": "2CYC8j4P4jr1yiX9U27QPQj5LeP8Bay", 22 | "nuls": 20000000, 23 | "unlockHeight": 0 24 | }, 25 | { 26 | "address": "2Cb2osdHyiiys5THNHNXTk2KZYD7vvU", 27 | "nuls": 20000000, 28 | "unlockHeight": 0 29 | } 30 | ] 31 | } -------------------------------------------------------------------------------- /account-module/base/account-base/src/test/resources/modules.ini: -------------------------------------------------------------------------------- 1 | [db] 2 | bootstrap=io.nuls.db.module.impl.MybatisDbModuleBootstrap 3 | 4 | [cache] 5 | bootstrap=io.nuls.cache.module.impl.EhCacheModuleBootstrap 6 | 7 | [account] 8 | bootstrap=io.nuls.account.module.impl.AccountModuleBootstrap 9 | 10 | [event-bus] 11 | bootstrap=io.nuls.event.bus.module.impl.EventBusModuleBootstrap 12 | 13 | [ledger] 14 | bootstrap=io.nuls.ledger.module.impl.UtxoLedgerModuleBootstrap 15 | 16 | [protocol] 17 | bootstrap=io.nuls.protocol.base.module.impl.BaseProtocolsModuleBootstrap 18 | 19 | [network] 20 | bootstrap=io.nuls.network.module.impl.NetworkModuleBootstrap 21 | network.server.port=8004 22 | network.magic=12312333 23 | network.max.in=10 24 | network.max.out=10 25 | network.seed.ip=192.168.1.201:8004 26 | [consensus] 27 | bootstrap=PocConsensusModuleBootstrap 28 | partake.packing=true 29 | seed.nodes=2CiYPSsrXVGmPudD6rumANCBT7tjJk7 30 | 31 | [notify] 32 | bootstrap=io.nuls.notify.module.NotifyModuleBootstrap 33 | notify.port=8002 34 | 35 | [rpc] 36 | bootstrap=io.nuls.rpc.module.impl.RpcServerModuleBootstrap 37 | server.ip=127.0.0.1 38 | server.port=8001 39 | request.white.sheet=127.0.0.1 -------------------------------------------------------------------------------- /account-module/base/account-base/src/test/resources/nuls.ini: -------------------------------------------------------------------------------- 1 | [System] 2 | language=en 3 | encoding=UTF-8 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /account-module/base/account-rpc/src/main/java/io/nuls/account/rpc/model/form/AccountKeyStoreBackup.java: -------------------------------------------------------------------------------- 1 | package io.nuls.account.rpc.model.form; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | 6 | /** 7 | * @author: Charlie 8 | * @date: 2018/10/29 9 | */ 10 | @ApiModel(value = "备份ketstore表单") 11 | public class AccountKeyStoreBackup { 12 | @ApiModelProperty(name = "password", value = "密码", required = true) 13 | private String password; 14 | 15 | @ApiModelProperty(name = "path", value = "文件路径") 16 | private String path; 17 | 18 | public String getPassword() { 19 | return password; 20 | } 21 | 22 | public void setPassword(String password) { 23 | this.password = password; 24 | } 25 | 26 | public String getPath() { 27 | return path; 28 | } 29 | 30 | public void setPath(String path) { 31 | this.path = path; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /account-module/base/account-storage/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | account-module 7 | io.nuls 8 | 1.3.0 9 | ../../pom.xml 10 | 11 | 4.0.0 12 | 13 | io.nuls.account-module 14 | account-storage 15 | 16 | 1.3.0 17 | 18 | 19 | 20 | io.nuls.account-module 21 | account 22 | 1.3.0 23 | 24 | 25 | io.nuls.db-module 26 | db 27 | 1.3.0 28 | 29 | 30 | 31 | ${project.artifactId}-${project.version} 32 | 33 | -------------------------------------------------------------------------------- /account-module/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | nuls 7 | io.nuls 8 | 1.3.0 9 | ../pom.xml 10 | 11 | 4.0.0 12 | io.nuls 13 | account-module 14 | pom 15 | 1.3.0 16 | 17 | account 18 | base/account-storage 19 | base/account-rpc 20 | base/account-base 21 | 22 | -------------------------------------------------------------------------------- /client-module/client/src/main/java/io/nuls/client/storage/LanguageService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | package io.nuls.client.storage; 26 | 27 | import io.nuls.kernel.model.Result; 28 | 29 | /** 30 | * 系统语言设置数据存储服务接口 31 | * @author: Charlie 32 | */ 33 | public interface LanguageService { 34 | 35 | Result saveLanguage(String language); 36 | 37 | Result getLanguage(); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /client-module/client/src/main/resources/client-web/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nuls-io/nuls-v1/6748a8d53a6f6ed3258a87c8baa2cdb24dba2a7d/client-module/client/src/main/resources/client-web/favicon.ico -------------------------------------------------------------------------------- /client-module/client/src/main/resources/client-web/index.html: -------------------------------------------------------------------------------- 1 | nuls-wallet

-------------------------------------------------------------------------------- /client-module/client/src/main/resources/client-web/static/fonts/element-icons.6f0a763.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nuls-io/nuls-v1/6748a8d53a6f6ed3258a87c8baa2cdb24dba2a7d/client-module/client/src/main/resources/client-web/static/fonts/element-icons.6f0a763.ttf -------------------------------------------------------------------------------- /client-module/client/src/main/resources/client-web/static/img/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nuls-io/nuls-v1/6748a8d53a6f6ed3258a87c8baa2cdb24dba2a7d/client-module/client/src/main/resources/client-web/static/img/favicon-16x16.png -------------------------------------------------------------------------------- /client-module/client/src/main/resources/client-web/static/img/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nuls-io/nuls-v1/6748a8d53a6f6ed3258a87c8baa2cdb24dba2a7d/client-module/client/src/main/resources/client-web/static/img/favicon-32x32.png -------------------------------------------------------------------------------- /client-module/client/src/main/resources/client-web/static/js/13.318966657c44475f1844.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([13],{Uu8r:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={data:function(){return{url:this.$route.params.url}},created:function(){console.log(this.url),this.$router.replace(this.url)},methods:{}},u={render:function(){var e=this.$createElement;return(this._self._c||e)("div")},staticRenderFns:[]};var l=r("vSla")(n,u,!1,function(e){r("zeQ5")},null,null);t.default=l.exports},zeQ5:function(e,t){}}); -------------------------------------------------------------------------------- /client-module/client/src/main/resources/client-web/static/js/28.1fc368269a8230349133.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([28],{o6h8:function(t,s){},uRvb:function(t,s,e){"use strict";Object.defineProperty(s,"__esModule",{value:!0});var i={data:function(){return{}},components:{Back:e("LPk9").a}},a={render:function(){var t=this.$createElement,s=this._self._c||t;return s("div",{staticClass:"users-log"},[s("Back",{attrs:{backTitle:this.$t("message.setManagement")}}),this._v(" "),s("h2",[this._v("Log")]),this._v(" "),this._m(0),this._v(" "),this._m(1)],1)},staticRenderFns:[function(){var t=this.$createElement,s=this._self._c||t;return s("div",{staticClass:"users-log-info"},[s("p",[this._v("This function is being prepareing, please wait.")]),this._v(" "),s("p",[this._v(" ")]),this._v(" "),s("p",[this._v(" ")])])},function(){var t=this.$createElement,s=this._self._c||t;return s("div",{staticClass:"users-log-bottom"},[s("span",{staticClass:"cursor-p fr"},[this._v("Copy")]),s("span",{staticClass:"cursor-p fr"},[this._v("Save as")])])}]};var n=e("vSla")(i,a,!1,function(t){e("o6h8")},null,null);s.default=n.exports}}); -------------------------------------------------------------------------------- /client-module/client/src/main/resources/db_config.properties: -------------------------------------------------------------------------------- 1 | #levelDB dataPath 2 | leveldb.datapath=./data 3 | leveldb.area.max=100 -------------------------------------------------------------------------------- /client-module/client/src/main/resources/dev/block/genesis-block.json: -------------------------------------------------------------------------------- 1 | { 2 | "height": 0, 3 | "time": "1531152000000", 4 | "txs": [ 5 | { 6 | "address": "TTarYnUfsftmm7DrStandCEdd4SNiELS", 7 | "amount": 80000000, 8 | "lockTime": 0 9 | } 10 | ], 11 | "remark": "4f70656e2c204c69626572616c2c204175746f6e6f6d6f75732c2053656c662d45766f6c76696e670ae5bc80e694beefbc8ce887aae794b1efbc8ce887aae6b2bbefbc8ce8bf9be58c960a4f75766572742c204c696272652c204175746f6e6f6d652c20c389766f6c757469660ae382aae383bce38397e383b3e38081e38395e383aae383bce38081e887aae6b2bbe38081e980b2e58c960ad09ed182d0bad180d18bd182d18bd0b92c20d0a1d0b2d0bed0b1d0bed0b4d0bdd0b0d18f2c20d090d0b2d182d0bed0bdd0bed0bcd0bdd0b0d18f2c20d18dd0b2d0bed0bbd18ed186d0b8d18f0aeab09cebb0a9eca0812020eca784ebb3b4eca08120ec9e90ec9ca8eca08120ed9881ebaa85eca0810a4162696572746f2c204c696272652c20417574c3b36e6f6d6f2c2045766f6c757469766f0ad981d8aad8ad20d88c20d8add8b120d88c20d985d8b3d8aad982d98420d88c20d8aad8b7d988d8b10a4f6666656e2c20667265692c206175746f6e6f6d2c2045766f6c7574696f6e0a45766f6c75c3a7c3a36f206162657274612c206c69767265206520617574c3b36e6f6d610ac39670706e612c20667269612c206175746f6e6f6d612c2065766f6c7574696f6e0ace91cebdcebfceb9cebacf84ceae2c20ceb5cebbceb5cf8dceb8ceb5cf81ceb72c20ceb1cf85cf84cf8ccebdcebfcebcceb72c20ceb5cebeceadcebbceb9cebeceb70a41c3a7c4b16b2c20c3b67a67c3bc722c20c3b67a65726b2c20657672696d0a4f736361696c2c2073616f7220696e2061697363652c206e65616d6873706c65c3a163682c20c3a96162686cc3b36964" 12 | } -------------------------------------------------------------------------------- /client-module/client/src/main/resources/dev/modules.ini: -------------------------------------------------------------------------------- 1 | [db] 2 | bootstrap=io.nuls.db.module.impl.LevelDbModuleBootstrap 3 | 4 | [account] 5 | bootstrap=io.nuls.account.module.AccountModuleBootstrap 6 | 7 | [account-ledger] 8 | bootstrap=io.nuls.account.ledger.base.module.impl.AccountLedgerModuleBootstrap 9 | 10 | [msg-bus] 11 | bootstrap=io.nuls.message.bus.module.MessageBusModuleBootstrap 12 | 13 | [ledger] 14 | bootstrap=io.nuls.ledger.module.impl.UtxoLedgerModuleBootstrap 15 | 16 | [protocol] 17 | bootstrap=io.nuls.protocol.base.module.BaseProtocolsModuleBootstrap 18 | 19 | [network] 20 | bootstrap=io.nuls.network.netty.module.impl.NettyNetworkModuleBootstrap 21 | network.server.port=8003 22 | network.magic=20190721 23 | network.max.in=100 24 | network.max.out=10 25 | network.seed.ip=192.168.1.37:8003,192.168.1.38:8003 26 | 27 | [consensus] 28 | bootstrap=io.nuls.consensus.poc.module.impl.PocConsensusModuleBootstrap 29 | partake.packing=true 30 | min.upgrade.delay=1 31 | seed.nodes=TTakkAtUaBCY6XLLbEt7vWLqP4SuNULS,TTak8TVrVWwG42RXAD1g4AAnYqNrNULS 32 | stop.delay=30 33 | 34 | [client] 35 | server.ip=127.0.0.1 36 | server.port=8001 37 | request.white.sheet=127.0.0.1 38 | version.root.url=https://raw.githubusercontent.com/nuls-io/nuls-wallet-release/master/test/release/ 39 | 40 | [contract] 41 | bootstrap=io.nuls.contract.module.impl.ContractModuleBootstrap 42 | max.view.gas=100000000 43 | 44 | [utxo-accounts] 45 | bootstrap=io.nuls.utxo.accounts.module.impl.UtxoAccountsModuleBootstrap -------------------------------------------------------------------------------- /client-module/client/src/main/resources/image/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nuls-io/nuls-v1/6748a8d53a6f6ed3258a87c8baa2cdb24dba2a7d/client-module/client/src/main/resources/image/logo.png -------------------------------------------------------------------------------- /client-module/client/src/main/resources/image/tray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nuls-io/nuls-v1/6748a8d53a6f6ed3258a87c8baa2cdb24dba2a7d/client-module/client/src/main/resources/image/tray.png -------------------------------------------------------------------------------- /client-module/client/src/main/resources/modules.ini: -------------------------------------------------------------------------------- 1 | [db] 2 | bootstrap=io.nuls.db.module.impl.LevelDbModuleBootstrap 3 | 4 | [account] 5 | bootstrap=io.nuls.account.module.AccountModuleBootstrap 6 | 7 | [account-ledger] 8 | bootstrap=io.nuls.account.ledger.base.module.impl.AccountLedgerModuleBootstrap 9 | 10 | [msg-bus] 11 | bootstrap=io.nuls.message.bus.module.MessageBusModuleBootstrap 12 | 13 | [ledger] 14 | bootstrap=io.nuls.ledger.module.impl.UtxoLedgerModuleBootstrap 15 | 16 | [protocol] 17 | bootstrap=io.nuls.protocol.base.module.BaseProtocolsModuleBootstrap 18 | 19 | [network] 20 | bootstrap=io.nuls.network.netty.module.impl.NettyNetworkModuleBootstrap 21 | network.server.port=8016 22 | network.magic=20180712 23 | network.max.in=100 24 | network.max.out=20 25 | network.seed.ip=seed1.nuls.io:8016,seed2.nuls.io5:8016,seed3.nuls.io:8016,seed4.nuls.io:8016,seed5.nuls.io:8016,seed6.nuls.io:8016 26 | 27 | [consensus] 28 | bootstrap=io.nuls.consensus.poc.module.impl.PocConsensusModuleBootstrap 29 | partake.packing=true 30 | min.upgrade.delay=10000 31 | seed.nodes=Nse82gBCKKk7VqZZBQriobM7qJLTNULS,Nse4QvHepkFw8igZC8qzH9VUj2KPNULS,Nse6tpcdrkBeZyzeRpea4wHxuRL9NULS,NsdtQumE67eeSTEJtNmq27Fv9uCWNULS,NsduWJCm1JhSzqQgHVEUEAfUpmT7NULS 32 | stop.delay=80000 33 | 34 | [client] 35 | server.ip=127.0.0.1 36 | server.port=6001 37 | request.white.sheet=127.0.0.1 38 | version.root.url=https://raw.githubusercontent.com/nuls-io/nuls-wallet-release/master/main/release/ 39 | 40 | [contract] 41 | bootstrap=io.nuls.contract.module.impl.ContractModuleBootstrap 42 | max.view.gas=100000000 43 | 44 | [utxo-accounts] 45 | bootstrap=io.nuls.utxo.accounts.module.impl.UtxoAccountsModuleBootstrap -------------------------------------------------------------------------------- /client-module/client/src/main/resources/nuls.ini: -------------------------------------------------------------------------------- 1 | [System] 2 | mode=main 3 | language=en 4 | encoding=UTF-8 5 | chain.id=8964 6 | ;chain.id=261 7 | -------------------------------------------------------------------------------- /client-module/client/src/main/resources/swagger-ui/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nuls-io/nuls-v1/6748a8d53a6f6ed3258a87c8baa2cdb24dba2a7d/client-module/client/src/main/resources/swagger-ui/favicon-16x16.png -------------------------------------------------------------------------------- /client-module/client/src/main/resources/swagger-ui/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nuls-io/nuls-v1/6748a8d53a6f6ed3258a87c8baa2cdb24dba2a7d/client-module/client/src/main/resources/swagger-ui/favicon-32x32.png -------------------------------------------------------------------------------- /client-module/client/src/main/resources/swagger-ui/swagger-ui.css.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":[],"names":[],"mappings":"","file":"swagger-ui.css","sourceRoot":""} -------------------------------------------------------------------------------- /client-module/client/src/main/resources/test/modules.ini: -------------------------------------------------------------------------------- 1 | [db] 2 | bootstrap=io.nuls.db.module.impl.LevelDbModuleBootstrap 3 | 4 | [account] 5 | bootstrap=io.nuls.account.module.AccountModuleBootstrap 6 | 7 | [account-ledger] 8 | bootstrap=io.nuls.account.ledger.base.module.impl.AccountLedgerModuleBootstrap 9 | 10 | [msg-bus] 11 | bootstrap=io.nuls.message.bus.module.MessageBusModuleBootstrap 12 | 13 | [ledger] 14 | bootstrap=io.nuls.ledger.module.impl.UtxoLedgerModuleBootstrap 15 | 16 | [protocol] 17 | bootstrap=io.nuls.protocol.base.module.BaseProtocolsModuleBootstrap 18 | 19 | [network] 20 | bootstrap=io.nuls.network.netty.module.impl.NettyNetworkModuleBootstrap 21 | network.server.port=8003 22 | network.magic=20190528 23 | network.max.in=100 24 | network.max.out=20 25 | network.seed.ip=seedt1.nuls.io:8003,seedt2.nuls.io:8003,seedt3.nuls.io:8003 26 | 27 | [consensus] 28 | bootstrap=io.nuls.consensus.poc.module.impl.PocConsensusModuleBootstrap 29 | partake.packing=true 30 | min.upgrade.delay=1000 31 | seed.nodes=TTakkAtUaBCY6XLLbEt7vWLqP4SuNULS,TTak8TVrVWwG42RXAD1g4AAnYqNrNULS,TTavq5rDMcnU4FRRRBJdPFMXfYfuNULS 32 | stop.delay=40000 33 | 34 | [client] 35 | server.ip=0.0.0.0 36 | server.port=8001 37 | request.white.sheet=0.0.0.0 38 | version.root.url=https://raw.githubusercontent.com/nuls-io/nuls-wallet-release/master/test/release/ 39 | 40 | [contract] 41 | bootstrap=io.nuls.contract.module.impl.ContractModuleBootstrap 42 | max.view.gas=100000000 43 | 44 | [utxo-accounts] 45 | bootstrap=io.nuls.utxo.accounts.module.impl.UtxoAccountsModuleBootstrap -------------------------------------------------------------------------------- /client-module/client/src/main/script/stop.bat: -------------------------------------------------------------------------------- 1 | taskkill /f /im javaw.exe -------------------------------------------------------------------------------- /client-module/client/src/main/script/stop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | scriptdir=$(cd `dirname $0`; pwd) 3 | homedir=`dirname $scriptdir` 4 | pid=`ps -ef| grep $homedir |grep -v 'grep' |awk '{print $2}'` 5 | if [ ! -z "$pid" ]; then 6 | kill -9 $pid 7 | fi -------------------------------------------------------------------------------- /client-module/client/src/test/resources/image/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nuls-io/nuls-v1/6748a8d53a6f6ed3258a87c8baa2cdb24dba2a7d/client-module/client/src/test/resources/image/icon.ico -------------------------------------------------------------------------------- /consensus-module/README.md: -------------------------------------------------------------------------------- 1 | # account module 2 | -------------------------------------------------------------------------------- /consensus-module/poc/consensus-poc-base/src/main/java/io/nuls/consensus/poc/constant/BlockContainerStatus.java: -------------------------------------------------------------------------------- 1 | /* 2 | * * 3 | * * MIT License 4 | * * 5 | * * Copyright (c) 2017-2019 nuls.io 6 | * * 7 | * * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * * of this software and associated documentation files (the "Software"), to deal 9 | * * in the Software without restriction, including without limitation the rights 10 | * * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * * copies of the Software, and to permit persons to whom the Software is 12 | * * furnished to do so, subject to the following conditions: 13 | * * 14 | * * The above copyright notice and this permission notice shall be included in all 15 | * * copies or substantial portions of the Software. 16 | * * 17 | * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | * * SOFTWARE. 24 | * 25 | */ 26 | 27 | package io.nuls.consensus.poc.constant; 28 | 29 | /** 30 | * 31 | * @author ln 32 | */ 33 | public final class BlockContainerStatus { 34 | 35 | public final static int DOWNLOADING = 1; 36 | public final static int RECEIVED = 2; 37 | 38 | } 39 | -------------------------------------------------------------------------------- /consensus-module/poc/consensus-poc-base/src/main/java/io/nuls/consensus/poc/util/RandomSeedUtils.java: -------------------------------------------------------------------------------- 1 | package io.nuls.consensus.poc.util; 2 | 3 | import io.nuls.consensus.poc.storage.po.RandomSeedStatusPo; 4 | import io.nuls.core.tools.crypto.Sha256Hash; 5 | 6 | import java.math.BigInteger; 7 | import java.util.Random; 8 | 9 | /** 10 | * @author Niels 11 | */ 12 | public class RandomSeedUtils { 13 | 14 | public static RandomSeedStatusPo CACHE_SEED = new RandomSeedStatusPo(); 15 | 16 | public static byte[] createRandomSeed() { 17 | BigInteger value = new BigInteger(256, new Random()); 18 | byte[] result = value.toByteArray(); 19 | 20 | if (result.length > 32) { 21 | byte[] temp = new byte[32]; 22 | System.arraycopy(result, result.length - 32, temp, 0, 32); 23 | result = temp; 24 | } else if (result.length < 32) { 25 | byte[] temp = new byte[32]; 26 | System.arraycopy(result, 0, temp, 0, result.length); 27 | result = temp; 28 | } 29 | return result; 30 | } 31 | 32 | public static byte[] getLastDigestEightBytes(byte[] bytes) { 33 | byte[] hash = Sha256Hash.hashTwice(bytes); 34 | byte[] result = new byte[8]; 35 | System.arraycopy(hash, bytes.length - 8, result, 0, 8); 36 | return result; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /consensus-module/poc/consensus-poc-base/src/test/java/io/nuls/consensus/poc/util/RandomSeedUtilsTest.java: -------------------------------------------------------------------------------- 1 | package io.nuls.consensus.poc.util; 2 | 3 | import io.nuls.core.tools.array.ArraysTool; 4 | import org.junit.Test; 5 | 6 | import static org.junit.Assert.*; 7 | 8 | /** 9 | * @author Niels 10 | */ 11 | public class RandomSeedUtilsTest { 12 | 13 | @Test 14 | public void createRandomSeed() { 15 | for (int i = 0; i < 1000000; i++) { 16 | byte[] result = RandomSeedUtils.createRandomSeed(); 17 | assertEquals(result.length, 32); 18 | } 19 | } 20 | 21 | @Test 22 | public void getLastDigestEightBytes() { 23 | byte[] seed = RandomSeedUtils.createRandomSeed(); 24 | byte[] hash = RandomSeedUtils.getLastDigestEightBytes(seed); 25 | byte[] hash2 = RandomSeedUtils.getLastDigestEightBytes(seed); 26 | assertTrue(ArraysTool.arrayEquals(hash, hash2)); 27 | assertEquals(hash.length, 8); 28 | } 29 | } -------------------------------------------------------------------------------- /consensus-module/poc/consensus-poc-base/src/test/resources/block/genesis-block.json: -------------------------------------------------------------------------------- 1 | { 2 | "height": 0, 3 | "time": "1514736000000", 4 | "txs": [ 5 | { 6 | "address": "2CjzG5atBtD3kk2MatNpHCVDLzg7zNb", 7 | "nuls": 20000000, 8 | "unlockHeight": 0 9 | }, 10 | { 11 | "address": "2CjK6vkn1Z5QvcgidFy69dmneav3WHY", 12 | "nuls": 20000000, 13 | "unlockHeight": 0 14 | }, 15 | { 16 | "address": "2CbdQroDQjeTSshE9SdMBkLZcYih7j8", 17 | "nuls": 20000000, 18 | "unlockHeight": 0 19 | }, 20 | { 21 | "address": "2CYC8j4P4jr1yiX9U27QPQj5LeP8Bay", 22 | "nuls": 20000000, 23 | "unlockHeight": 0 24 | }, 25 | { 26 | "address": "2Cb2osdHyiiys5THNHNXTk2KZYD7vvU", 27 | "nuls": 20000000, 28 | "unlockHeight": 0 29 | } 30 | ] 31 | } -------------------------------------------------------------------------------- /consensus-module/poc/consensus-poc-base/src/test/resources/languages/zh-CHS.properties: -------------------------------------------------------------------------------- 1 | 10000=操作成功 2 | 10001=操作失败 3 | 10998=警告 4 | 10999=未知错误 5 | 99999=未知错误 6 | 10002=找不到文件 7 | 10003=参数为空 8 | 10004=接口重复注册 9 | 10005=线程名称重复 10 | 10006=数据错误 11 | 10007=线程必须指定所属模块 12 | 10008=接口未找到 13 | 10009=配置项不存在 14 | 10010=语言类型不能设置为空 15 | 10011=读写错误 16 | 10012=反序列化错误 17 | 10013=计算摘要错误 18 | 10014=数据大小错误 19 | 10015=数据字段错误 20 | 10016=配置错误 21 | 10017=模块加载超时 22 | 10018=参数错误 23 | 10019=数据不存在 24 | 10020=文件损坏 25 | 11000=验证不通过 26 | 11001=数据解析错误 27 | 11002=数据超出限制 28 | 11003=输入值错误 29 | 20000=数据存储模块启动失败 30 | 20001=数据存储异常 31 | 20002=会话未初始化 32 | 20003=不能保存null数据 33 | 20004=批量保存数量超出限制 34 | 20005=数据不正确 35 | 20006=保存失败 36 | 20007=更新失败 37 | 20008=回滚出错 38 | 30000=点对点网络未知异常 39 | 30001=P2P分组已存在 40 | 40001=网络服务启动失败 41 | 40002=网络消息错误 42 | 40003=网络消息异或错误 43 | 40004=网络消息长度错误 44 | 40005=P2P错误 45 | 40006=节点组已存在 46 | 40007=节点区域已存在 47 | 40008=节点组不存在 48 | 40009=节点区域不存在 49 | 40010=节点不存在 50 | 45000=密码错误 51 | 45001=账户不存在 52 | 45002=账户已加密 53 | 45003=账户已经存在 54 | 45004=账户地址格式不正确 55 | 45005=该昵称已经被占用 56 | 50001=请求被拒绝 57 | 60000=共识未知异常 58 | 60001=超时 59 | 60002=保证金不正确 60 | 60003=保证金不足 61 | 60004=共识会议中异常 62 | 60005=佣金超出范围 63 | 60006=信用不足 64 | 60007=超出可委托数量 65 | 60008=超出委托金额 66 | 69980=尝试分叉 67 | 69981=尝试双花 68 | 69997=未参与共识 69 | 69998=共识中 70 | 69999=等待加入共识 71 | 70001=UTXO不可花费 72 | 70002=UTXO状态错误 73 | 70003=余额不足 74 | 70004=交易输入无效 75 | 70005=交易输出无效 76 | 70006=孤儿交易 77 | 70007=孤儿块 78 | 70008=数据不存在 79 | 80001=接收到一笔交易 80 | 80002=接收到一个新的区块头 81 | 80003=创建了一个新的地址 82 | 80004=修改了默认账户 83 | 80005=修改了钱包账户 84 | 80006=地址设置了别名 85 | 80007=导入了账户 86 | 80008=成功打包区块 87 | 80009=注册代理节点 88 | 80010=组装了区块 89 | 80011=抵押参与共识 90 | 80012=注销共识节点 91 | 80013=撤销一笔抵押共识 92 | 80014=余额变动 -------------------------------------------------------------------------------- /consensus-module/poc/consensus-poc-base/src/test/resources/modules.ini: -------------------------------------------------------------------------------- 1 | [consensus] 2 | partake.packing=true 3 | seed.nodes=2CiYPSsrXVGmPudD6rumANCBT7tjJk7 -------------------------------------------------------------------------------- /consensus-module/poc/consensus-poc-base/src/test/resources/nuls.ini: -------------------------------------------------------------------------------- 1 | [System] 2 | language=en 3 | encoding=UTF-8 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /consensus-module/poc/consensus-poc-protocol/src/main/resources/consensus-protocol.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /consensus-module/poc/consensus-poc-protocol/src/test/resources/block/genesis-block.json: -------------------------------------------------------------------------------- 1 | { 2 | "height": 0, 3 | "time": "1514736000000", 4 | "txs": [ 5 | { 6 | "address": "2CjzG5atBtD3kk2MatNpHCVDLzg7zNb", 7 | "nuls": 20000000, 8 | "unlockHeight": 0 9 | }, 10 | { 11 | "address": "2CjK6vkn1Z5QvcgidFy69dmneav3WHY", 12 | "nuls": 20000000, 13 | "unlockHeight": 0 14 | }, 15 | { 16 | "address": "2CbdQroDQjeTSshE9SdMBkLZcYih7j8", 17 | "nuls": 20000000, 18 | "unlockHeight": 0 19 | }, 20 | { 21 | "address": "2CYC8j4P4jr1yiX9U27QPQj5LeP8Bay", 22 | "nuls": 20000000, 23 | "unlockHeight": 0 24 | }, 25 | { 26 | "address": "2Cb2osdHyiiys5THNHNXTk2KZYD7vvU", 27 | "nuls": 20000000, 28 | "unlockHeight": 0 29 | } 30 | ] 31 | } -------------------------------------------------------------------------------- /consensus-module/poc/consensus-poc-protocol/src/test/resources/languages/zh-CHS.properties: -------------------------------------------------------------------------------- 1 | 10000=操作成功 2 | 10001=操作失败 3 | 10998=警告 4 | 10999=未知错误 5 | 99999=未知错误 6 | 10002=找不到文件 7 | 10003=参数为空 8 | 10004=接口重复注册 9 | 10005=线程名称重复 10 | 10006=数据错误 11 | 10007=线程必须指定所属模块 12 | 10008=接口未找到 13 | 10009=配置项不存在 14 | 10010=语言类型不能设置为空 15 | 10011=读写错误 16 | 10012=反序列化错误 17 | 10013=计算摘要错误 18 | 10014=数据大小错误 19 | 10015=数据字段错误 20 | 10016=配置错误 21 | 10017=模块加载超时 22 | 10018=参数错误 23 | 10019=数据不存在 24 | 10020=文件损坏 25 | 11000=验证不通过 26 | 11001=数据解析错误 27 | 11002=数据超出限制 28 | 11003=输入值错误 29 | 20000=数据存储模块启动失败 30 | 20001=数据存储异常 31 | 20002=会话未初始化 32 | 20003=不能保存null数据 33 | 20004=批量保存数量超出限制 34 | 20005=数据不正确 35 | 20006=保存失败 36 | 20007=更新失败 37 | 20008=回滚出错 38 | 30000=点对点网络未知异常 39 | 30001=P2P分组已存在 40 | 40001=网络服务启动失败 41 | 40002=网络消息错误 42 | 40003=网络消息异或错误 43 | 40004=网络消息长度错误 44 | 40005=P2P错误 45 | 40006=节点组已存在 46 | 40007=节点区域已存在 47 | 40008=节点组不存在 48 | 40009=节点区域不存在 49 | 40010=节点不存在 50 | 45000=密码错误 51 | 45001=账户不存在 52 | 45002=账户已加密 53 | 45003=账户已经存在 54 | 45004=账户地址格式不正确 55 | 45005=该昵称已经被占用 56 | 50001=请求被拒绝 57 | 60000=共识未知异常 58 | 60001=超时 59 | 60002=保证金不正确 60 | 60003=保证金不足 61 | 60004=共识会议中异常 62 | 60005=佣金超出范围 63 | 60006=信用不足 64 | 60007=超出可委托数量 65 | 60008=超出委托金额 66 | 69980=尝试分叉 67 | 69981=尝试双花 68 | 69997=未参与共识 69 | 69998=共识中 70 | 69999=等待加入共识 71 | 70001=UTXO不可花费 72 | 70002=UTXO状态错误 73 | 70003=余额不足 74 | 70004=交易输入无效 75 | 70005=交易输出无效 76 | 70006=孤儿交易 77 | 70007=孤儿块 78 | 70008=数据不存在 79 | 80001=接收到一笔交易 80 | 80002=接收到一个新的区块头 81 | 80003=创建了一个新的地址 82 | 80004=修改了默认账户 83 | 80005=修改了钱包账户 84 | 80006=地址设置了别名 85 | 80007=导入了账户 86 | 80008=成功打包区块 87 | 80009=注册代理节点 88 | 80010=组装了区块 89 | 80011=抵押参与共识 90 | 80012=注销共识节点 91 | 80013=撤销一笔抵押共识 92 | 80014=余额变动 -------------------------------------------------------------------------------- /consensus-module/poc/consensus-poc-protocol/src/test/resources/modules.ini: -------------------------------------------------------------------------------- 1 | [consensus] 2 | partake.packing=true 3 | seed.nodes=2CiYPSsrXVGmPudD6rumANCBT7tjJk7 -------------------------------------------------------------------------------- /consensus-module/poc/consensus-poc-protocol/src/test/resources/nuls.ini: -------------------------------------------------------------------------------- 1 | [System] 2 | language=en 3 | encoding=UTF-8 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /consensus-module/poc/consensus-poc-rpc/src/main/java/io/nuls/consensus/poc/rpc/model/PunishLogDTO.java: -------------------------------------------------------------------------------- 1 | package io.nuls.consensus.poc.rpc.model; 2 | 3 | import io.nuls.consensus.poc.protocol.constant.PunishReasonEnum; 4 | import io.nuls.consensus.poc.storage.po.PunishLogPo; 5 | import io.nuls.core.tools.date.DateUtil; 6 | import io.nuls.kernel.utils.AddressTool; 7 | 8 | import java.util.Date; 9 | 10 | /** 11 | * @author: Niels Wang 12 | * @date: 2018/10/11 13 | */ 14 | public class PunishLogDTO { 15 | 16 | private byte type; 17 | private String address; 18 | private String time; 19 | private long height; 20 | private long roundIndex; 21 | private String reasonCode; 22 | 23 | public PunishLogDTO(PunishLogPo po) { 24 | this.type = po.getType(); 25 | this.address = AddressTool.getStringAddressByBytes(po.getAddress()); 26 | this.time = DateUtil.convertDate(new Date(po.getTime())); 27 | this.height = po.getHeight(); 28 | this.roundIndex = po.getRoundIndex(); 29 | this.reasonCode = PunishReasonEnum.getEnum(po.getReasonCode()).getMessage(); 30 | } 31 | 32 | public byte getType() { 33 | return type; 34 | } 35 | 36 | public String getAddress() { 37 | return address; 38 | } 39 | 40 | public String getTime() { 41 | return time; 42 | } 43 | 44 | public long getHeight() { 45 | return height; 46 | } 47 | 48 | public long getRoundIndex() { 49 | return roundIndex; 50 | } 51 | 52 | public String getReasonCode() { 53 | return reasonCode; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /consensus-module/poc/consensus-poc-rpc/src/main/java/io/nuls/consensus/poc/rpc/model/RandomSeedDTO.java: -------------------------------------------------------------------------------- 1 | package io.nuls.consensus.poc.rpc.model; 2 | 3 | /** 4 | * @author Niels 5 | */ 6 | public class RandomSeedDTO { 7 | 8 | private String seed; 9 | 10 | private String algorithm; 11 | private int count; 12 | 13 | public String getSeed() { 14 | return seed; 15 | } 16 | 17 | public void setSeed(String seed) { 18 | this.seed = seed; 19 | } 20 | 21 | public String getAlgorithm() { 22 | return algorithm; 23 | } 24 | 25 | public void setAlgorithm(String algorithm) { 26 | this.algorithm = algorithm; 27 | } 28 | 29 | public void setCount(int count) { 30 | this.count = count; 31 | } 32 | 33 | public int getCount() { 34 | return count; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /consensus-module/poc/consensus-poc-storage/src/main/java/io/nuls/consensus/poc/storage/service/RandomSeedsStorageService.java: -------------------------------------------------------------------------------- 1 | package io.nuls.consensus.poc.storage.service; 2 | 3 | import io.nuls.consensus.poc.storage.po.RandomSeedPo; 4 | import io.nuls.consensus.poc.storage.po.RandomSeedStatusPo; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @author Niels 10 | */ 11 | public interface RandomSeedsStorageService { 12 | 13 | RandomSeedStatusPo getAddressStatus(byte[] address); 14 | 15 | boolean saveAddressStatus(byte[] address, long nowHeight, byte[] nextSeed, byte[] seedHash); 16 | 17 | boolean saveRandomSeed(long height, long preHeight, byte[] seed, byte[] nextSeedHash); 18 | 19 | boolean deleteRandomSeed(long height); 20 | 21 | List getSeeds(long maxHeight, int seedCount); 22 | 23 | List getSeeds(long startHeight, long endHeight); 24 | 25 | void deleteAddressStatus(byte[] address); 26 | 27 | RandomSeedPo getSeed(long height); 28 | } 29 | -------------------------------------------------------------------------------- /consensus-module/poc/consensus-poc-storage/src/main/java/io/nuls/consensus/poc/storage/service/TransactionQueueStorageService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | package io.nuls.consensus.poc.storage.service; 26 | 27 | import io.nuls.kernel.model.Transaction; 28 | 29 | public interface TransactionQueueStorageService { 30 | 31 | boolean putTx(Transaction tx); 32 | 33 | Transaction pollTx(); 34 | } 35 | -------------------------------------------------------------------------------- /consensus-module/poc/consensus-poc-storage/src/test/resources/block/genesis-block.json: -------------------------------------------------------------------------------- 1 | { 2 | "height": 0, 3 | "time": "1514736000000", 4 | "txs": [ 5 | { 6 | "address": "2CjzG5atBtD3kk2MatNpHCVDLzg7zNb", 7 | "nuls": 20000000, 8 | "unlockHeight": 0 9 | }, 10 | { 11 | "address": "2CjK6vkn1Z5QvcgidFy69dmneav3WHY", 12 | "nuls": 20000000, 13 | "unlockHeight": 0 14 | }, 15 | { 16 | "address": "2CbdQroDQjeTSshE9SdMBkLZcYih7j8", 17 | "nuls": 20000000, 18 | "unlockHeight": 0 19 | }, 20 | { 21 | "address": "2CYC8j4P4jr1yiX9U27QPQj5LeP8Bay", 22 | "nuls": 20000000, 23 | "unlockHeight": 0 24 | }, 25 | { 26 | "address": "2Cb2osdHyiiys5THNHNXTk2KZYD7vvU", 27 | "nuls": 20000000, 28 | "unlockHeight": 0 29 | } 30 | ] 31 | } -------------------------------------------------------------------------------- /consensus-module/poc/consensus-poc-storage/src/test/resources/languages/zh-CHS.properties: -------------------------------------------------------------------------------- 1 | 10000=操作成功 2 | 10001=操作失败 3 | 10998=警告 4 | 10999=未知错误 5 | 99999=未知错误 6 | 10002=找不到文件 7 | 10003=参数为空 8 | 10004=接口重复注册 9 | 10005=线程名称重复 10 | 10006=数据错误 11 | 10007=线程必须指定所属模块 12 | 10008=接口未找到 13 | 10009=配置项不存在 14 | 10010=语言类型不能设置为空 15 | 10011=读写错误 16 | 10012=反序列化错误 17 | 10013=计算摘要错误 18 | 10014=数据大小错误 19 | 10015=数据字段错误 20 | 10016=配置错误 21 | 10017=模块加载超时 22 | 10018=参数错误 23 | 10019=数据不存在 24 | 10020=文件损坏 25 | 11000=验证不通过 26 | 11001=数据解析错误 27 | 11002=数据超出限制 28 | 11003=输入值错误 29 | 20000=数据存储模块启动失败 30 | 20001=数据存储异常 31 | 20002=会话未初始化 32 | 20003=不能保存null数据 33 | 20004=批量保存数量超出限制 34 | 20005=数据不正确 35 | 20006=保存失败 36 | 20007=更新失败 37 | 20008=回滚出错 38 | 30000=点对点网络未知异常 39 | 30001=P2P分组已存在 40 | 40001=网络服务启动失败 41 | 40002=网络消息错误 42 | 40003=网络消息异或错误 43 | 40004=网络消息长度错误 44 | 40005=P2P错误 45 | 40006=节点组已存在 46 | 40007=节点区域已存在 47 | 40008=节点组不存在 48 | 40009=节点区域不存在 49 | 40010=节点不存在 50 | 45000=密码错误 51 | 45001=账户不存在 52 | 45002=账户已加密 53 | 45003=账户已经存在 54 | 45004=账户地址格式不正确 55 | 45005=该昵称已经被占用 56 | 50001=请求被拒绝 57 | 60000=共识未知异常 58 | 60001=超时 59 | 60002=保证金不正确 60 | 60003=保证金不足 61 | 60004=共识会议中异常 62 | 60005=佣金超出范围 63 | 60006=信用不足 64 | 60007=超出可委托数量 65 | 60008=超出委托金额 66 | 69980=尝试分叉 67 | 69981=尝试双花 68 | 69997=未参与共识 69 | 69998=共识中 70 | 69999=等待加入共识 71 | 70001=UTXO不可花费 72 | 70002=UTXO状态错误 73 | 70003=余额不足 74 | 70004=交易输入无效 75 | 70005=交易输出无效 76 | 70006=孤儿交易 77 | 70007=孤儿块 78 | 70008=数据不存在 79 | 80001=接收到一笔交易 80 | 80002=接收到一个新的区块头 81 | 80003=创建了一个新的地址 82 | 80004=修改了默认账户 83 | 80005=修改了钱包账户 84 | 80006=地址设置了别名 85 | 80007=导入了账户 86 | 80008=成功打包区块 87 | 80009=注册代理节点 88 | 80010=组装了区块 89 | 80011=抵押参与共识 90 | 80012=注销共识节点 91 | 80013=撤销一笔抵押共识 92 | 80014=余额变动 -------------------------------------------------------------------------------- /consensus-module/poc/consensus-poc-storage/src/test/resources/modules.ini: -------------------------------------------------------------------------------- 1 | [consensus] 2 | partake.packing=true 3 | seed.nodes=2CiYPSsrXVGmPudD6rumANCBT7tjJk7 -------------------------------------------------------------------------------- /consensus-module/poc/consensus-poc-storage/src/test/resources/nuls.ini: -------------------------------------------------------------------------------- 1 | [System] 2 | language=en 3 | encoding=UTF-8 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /contract-module/base/contract-tx/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | contract-module 7 | io.nuls 8 | 1.3.0 9 | ../../pom.xml 10 | 11 | 4.0.0 12 | 13 | io.nuls.contract-module 14 | contract-tx 15 | 1.3.0 16 | jar 17 | contract-tx 18 | 19 | 20 | 21 | io.nuls.contract-module 22 | contract-storage 23 | 1.3.0 24 | 25 | 26 | io.nuls.contract-module 27 | contract-vm 28 | 1.3.0 29 | 30 | 31 | io.nuls.account-ledger-module 32 | account-ledger 33 | 1.3.0 34 | 35 | 36 | 37 | 38 | ${project.artifactId}-${project.version} 39 | 40 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/main/java/io/nuls/contract/sdk/Block.java: -------------------------------------------------------------------------------- 1 | package io.nuls.contract.sdk; 2 | 3 | public class Block { 4 | 5 | /** 6 | * 给定块的区块头 7 | * 8 | * @param blockNumber 区块高度 9 | * @return 给定块的区块头 10 | */ 11 | public static native BlockHeader getBlockHeader(long blockNumber); 12 | 13 | /** 14 | * 当前块的区块头 15 | * 16 | * @return 当前块的区块头 17 | */ 18 | public static native BlockHeader currentBlockHeader(); 19 | 20 | /** 21 | * 最新块的区块头 22 | * 23 | * @return 最新块的区块头 24 | */ 25 | public static native BlockHeader newestBlockHeader(); 26 | 27 | /** 28 | * 给定块的哈希值 29 | * hash of the given block 30 | * 31 | * @param blockNumber 32 | * @return 给定块的哈希值 33 | */ 34 | public static String blockhash(long blockNumber) { 35 | return getBlockHeader(blockNumber).getHash(); 36 | } 37 | 38 | /** 39 | * 当前块矿工地址 40 | * current block miner’s address 41 | * 42 | * @return 地址 43 | */ 44 | public static Address coinbase() { 45 | return currentBlockHeader().getPackingAddress(); 46 | } 47 | 48 | /** 49 | * 当前块编号 50 | * current block number 51 | * 52 | * @return number 53 | */ 54 | public static long number() { 55 | return currentBlockHeader().getHeight(); 56 | } 57 | 58 | /** 59 | * 当前块时间戳 60 | * current block timestamp 61 | * 62 | * @return timestamp 63 | */ 64 | public static long timestamp() { 65 | return currentBlockHeader().getTime(); 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/main/java/io/nuls/contract/sdk/Contract.java: -------------------------------------------------------------------------------- 1 | package io.nuls.contract.sdk; 2 | 3 | /** 4 | * 合约接口,合约类实现这个接口 5 | */ 6 | public interface Contract { 7 | 8 | /** 9 | * 直接向合约转账,会触发这个方法,默认不做任何操作,可以重载这个方法。 10 | */ 11 | default void _payable() { 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/main/java/io/nuls/contract/sdk/Event.java: -------------------------------------------------------------------------------- 1 | package io.nuls.contract.sdk; 2 | 3 | /** 4 | * 事件接口,事件类实现这个接口 5 | */ 6 | public interface Event { 7 | } 8 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/main/java/io/nuls/contract/sdk/Msg.java: -------------------------------------------------------------------------------- 1 | package io.nuls.contract.sdk; 2 | 3 | import java.math.BigInteger; 4 | 5 | public class Msg { 6 | 7 | /** 8 | * 剩余Gas 9 | * remaining gas 10 | * 11 | * @return 剩余gas 12 | */ 13 | public static native long gasleft(); 14 | 15 | /** 16 | * 合约发送者地址 17 | * sender of the contract 18 | * 19 | * @return 消息发送者地址 20 | */ 21 | public static native Address sender(); 22 | 23 | /** 24 | * 合约发送者转入合约地址的Nuls数量,单位是Na,1Nuls=1亿Na 25 | * The number of Nuls transferred by the contract sender to the contract address, the unit is Na, 1Nuls = 1 billion Na 26 | * 27 | * @return 28 | */ 29 | public static native BigInteger value(); 30 | 31 | /** 32 | * Gas价格 33 | * gas price 34 | * 35 | * @return Gas价格 36 | */ 37 | public static native long gasprice(); 38 | 39 | /** 40 | * 合约地址 41 | * contract address 42 | * 43 | * @return 合约地址 44 | */ 45 | public static native Address address(); 46 | 47 | } 48 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/main/java/io/nuls/contract/sdk/annotation/Payable.java: -------------------------------------------------------------------------------- 1 | package io.nuls.contract.sdk.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | @Target({ElementType.METHOD}) 6 | @Retention(RetentionPolicy.RUNTIME) 7 | @Documented 8 | public @interface Payable { 9 | } 10 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/main/java/io/nuls/contract/sdk/annotation/Required.java: -------------------------------------------------------------------------------- 1 | package io.nuls.contract.sdk.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | @Target({ElementType.PARAMETER}) 6 | @Retention(RetentionPolicy.RUNTIME) 7 | @Documented 8 | public @interface Required { 9 | } 10 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/main/java/io/nuls/contract/sdk/annotation/View.java: -------------------------------------------------------------------------------- 1 | package io.nuls.contract.sdk.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | @Target({ElementType.METHOD}) 6 | @Retention(RetentionPolicy.RUNTIME) 7 | @Documented 8 | public @interface View { 9 | } 10 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/main/java/io/nuls/contract/vm/instructions/constants/Aconst.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | package io.nuls.contract.vm.instructions.constants; 26 | 27 | import io.nuls.contract.vm.Frame; 28 | import io.nuls.contract.vm.util.Log; 29 | 30 | public class Aconst { 31 | 32 | public static void aconst_null(final Frame frame) { 33 | frame.operandStack.pushRef(null); 34 | 35 | //Log.opcode(frame.getCurrentOpCode()); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/main/java/io/nuls/contract/vm/instructions/constants/Nop.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | package io.nuls.contract.vm.instructions.constants; 26 | 27 | import io.nuls.contract.vm.Frame; 28 | import io.nuls.contract.vm.util.Log; 29 | 30 | public class Nop { 31 | 32 | public static void nop(Frame frame) { 33 | //Log.opcode(frame.getCurrentOpCode()); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/main/java/io/nuls/contract/vm/instructions/control/Goto.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | package io.nuls.contract.vm.instructions.control; 26 | 27 | import io.nuls.contract.vm.Frame; 28 | import io.nuls.contract.vm.util.Log; 29 | 30 | public class Goto { 31 | 32 | public static void goto_(final Frame frame) { 33 | frame.jump(); 34 | 35 | //Log.opcode(frame.getCurrentOpCode()); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/main/java/io/nuls/contract/vm/instructions/control/Jsr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | package io.nuls.contract.vm.instructions.control; 26 | 27 | import io.nuls.contract.vm.Frame; 28 | 29 | public class Jsr { 30 | 31 | public static void jsr(final Frame frame) { 32 | frame.nonsupportOpCode(); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/main/java/io/nuls/contract/vm/instructions/control/Ret.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | package io.nuls.contract.vm.instructions.control; 26 | 27 | import io.nuls.contract.vm.Frame; 28 | 29 | public class Ret { 30 | 31 | public static void ret(final Frame frame) { 32 | frame.nonsupportOpCode(); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/main/java/io/nuls/contract/vm/instructions/references/Invokedynamic.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | package io.nuls.contract.vm.instructions.references; 26 | 27 | import io.nuls.contract.vm.Frame; 28 | 29 | public class Invokedynamic { 30 | 31 | public static void invokedynamic(Frame frame) { 32 | frame.nonsupportOpCode(); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/main/java/io/nuls/contract/vm/instructions/references/Monitorenter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | package io.nuls.contract.vm.instructions.references; 26 | 27 | import io.nuls.contract.vm.Frame; 28 | import io.nuls.contract.vm.ObjectRef; 29 | 30 | public class Monitorenter { 31 | 32 | public static void monitorenter(Frame frame) { 33 | ObjectRef objectRef = frame.operandStack.popRef(); 34 | //frame.nonsupportOpCode(); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/main/java/io/nuls/contract/vm/instructions/references/Monitorexit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | package io.nuls.contract.vm.instructions.references; 26 | 27 | import io.nuls.contract.vm.Frame; 28 | import io.nuls.contract.vm.ObjectRef; 29 | 30 | public class Monitorexit { 31 | 32 | public static void monitorexit(Frame frame) { 33 | ObjectRef objectRef = frame.operandStack.popRef(); 34 | //frame.nonsupportOpCode(); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/main/java/io/nuls/contract/vm/program/ProgramAccount.java: -------------------------------------------------------------------------------- 1 | package io.nuls.contract.vm.program; 2 | 3 | import java.math.BigInteger; 4 | 5 | public class ProgramAccount { 6 | 7 | private byte[] address; 8 | 9 | private BigInteger balance; 10 | 11 | public ProgramAccount(byte[] address, BigInteger balance) { 12 | this.address = address; 13 | this.balance = balance; 14 | } 15 | 16 | public byte[] getAddress() { 17 | return address; 18 | } 19 | 20 | public BigInteger getBalance() { 21 | return balance; 22 | } 23 | 24 | public BigInteger addBalance(BigInteger value) { 25 | balance = balance.add(value); 26 | return balance; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/main/java/io/nuls/contract/vm/program/ProgramStatus.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | package io.nuls.contract.vm.program; 26 | 27 | public enum ProgramStatus { 28 | 29 | not_found, 30 | 31 | normal, 32 | 33 | stop, 34 | 35 | } 36 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/main/java/org/ethereum/config/BlockchainNetConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) [2016] [ ] 3 | * This file is part of the ethereumJ library. 4 | * 5 | * The ethereumJ library is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * The ethereumJ library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with the ethereumJ library. If not, see . 17 | */ 18 | package org.ethereum.config; 19 | 20 | /** 21 | * Describes a set of configs for a specific blockchain depending on the block number 22 | * E.g. the main Ethereum net has at least FrontierConfig and HomesteadConfig depending on the block 23 | *

24 | * Created by Anton Nashatyrev on 25.02.2016. 25 | */ 26 | public interface BlockchainNetConfig { 27 | 28 | /** 29 | * Get the config for the specific block 30 | */ 31 | //BlockchainConfig getConfigForBlock(long blockNumber); 32 | 33 | /** 34 | * Returns the constants common for all the blocks in this blockchain 35 | */ 36 | Constants getCommonConstants(); 37 | } 38 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/main/java/org/ethereum/datasource/HashedKeySource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) [2016] [ ] 3 | * This file is part of the ethereumJ library. 4 | * 5 | * The ethereumJ library is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * The ethereumJ library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with the ethereumJ library. If not, see . 17 | */ 18 | package org.ethereum.datasource; 19 | 20 | /** 21 | * Indicator interface which narrows the Source contract: 22 | * the same Key always maps to the same Value, 23 | * there could be no put() with the same Key and different Value 24 | * Normally the Key is the hash of the Value 25 | * Usually such kind of sources are Merkle Trie backing stores 26 | *

27 | * Created by Anton Nashatyrev on 08.11.2016. 28 | */ 29 | public interface HashedKeySource extends Source { 30 | } 31 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/main/java/org/ethereum/datasource/MemSizeEstimator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) [2016] [ ] 3 | * This file is part of the ethereumJ library. 4 | * 5 | * The ethereumJ library is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * The ethereumJ library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with the ethereumJ library. If not, see . 17 | */ 18 | package org.ethereum.datasource; 19 | 20 | /** 21 | * Interface for estimating size of a specific Java type 22 | *

23 | * Created by Anton Nashatyrev on 01.12.2016. 24 | */ 25 | public interface MemSizeEstimator { 26 | 27 | long estimateSize(E e); 28 | 29 | /** 30 | * byte[] type size estimator 31 | */ 32 | MemSizeEstimator ByteArrayEstimator = bytes -> { 33 | return bytes == null ? 0 : bytes.length + 16; // 4 - compressed ref size, 12 - Object header 34 | }; 35 | 36 | 37 | } 38 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/main/java/org/ethereum/datasource/Serializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) [2016] [ ] 3 | * This file is part of the ethereumJ library. 4 | * 5 | * The ethereumJ library is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * The ethereumJ library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with the ethereumJ library. If not, see . 17 | */ 18 | package org.ethereum.datasource; 19 | 20 | /** 21 | * Converter from one type to another and vice versa 22 | *

23 | * Created by Anton Nashatyrev on 17.03.2016. 24 | */ 25 | public interface Serializer { 26 | /** 27 | * Converts T ==> S 28 | * Should correctly handle null parameter 29 | */ 30 | S serialize(T object); 31 | 32 | /** 33 | * Converts S ==> T 34 | * Should correctly handle null parameter 35 | */ 36 | T deserialize(S stream); 37 | } 38 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/main/java/org/ethereum/db/index/Index.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) [2016] [ ] 3 | * This file is part of the ethereumJ library. 4 | * 5 | * The ethereumJ library is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * The ethereumJ library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with the ethereumJ library. If not, see . 17 | */ 18 | package org.ethereum.db.index; 19 | 20 | import java.util.Collection; 21 | 22 | /** 23 | * @author Mikhail Kalinin 24 | * @since 28.01.2016 25 | */ 26 | public interface Index extends Iterable { 27 | 28 | void addAll(Collection nums); 29 | 30 | void add(Long num); 31 | 32 | Long peek(); 33 | 34 | Long poll(); 35 | 36 | boolean contains(Long num); 37 | 38 | boolean isEmpty(); 39 | 40 | int size(); 41 | 42 | void clear(); 43 | 44 | void removeAll(Collection indexes); 45 | 46 | Long peekLast(); 47 | 48 | void remove(Long num); 49 | } 50 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/main/java/org/ethereum/db/prune/ChainItem.java: -------------------------------------------------------------------------------- 1 | package org.ethereum.db.prune; 2 | 3 | import org.ethereum.core.Block; 4 | import org.ethereum.util.FastByteComparisons; 5 | 6 | import java.util.Arrays; 7 | 8 | /** 9 | * Represents a block in the {@link Chain} 10 | * 11 | * @author Mikhail Kalinin 12 | * @since 26.01.2018 13 | */ 14 | class ChainItem { 15 | long number; 16 | byte[] hash; 17 | byte[] parentHash; 18 | 19 | ChainItem(Block block) { 20 | this.number = block.getNumber(); 21 | this.hash = block.getHash(); 22 | this.parentHash = block.getParentHash(); 23 | } 24 | 25 | ChainItem(long number, byte[] hash, byte[] parentHash) { 26 | this.number = number; 27 | this.hash = hash; 28 | this.parentHash = parentHash; 29 | } 30 | 31 | boolean isParentOf(ChainItem that) { 32 | return FastByteComparisons.equal(hash, that.parentHash); 33 | } 34 | 35 | @Override 36 | public boolean equals(Object o) { 37 | if (this == o) { 38 | return true; 39 | } 40 | if (o == null || getClass() != o.getClass()) { 41 | return false; 42 | } 43 | ChainItem that = (ChainItem) o; 44 | return FastByteComparisons.equal(hash, that.hash); 45 | } 46 | 47 | @Override 48 | public int hashCode() { 49 | return hash != null ? Arrays.hashCode(hash) : 0; 50 | } 51 | 52 | @Override 53 | public String toString() { 54 | return String.valueOf(number); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/main/java/org/ethereum/trie/CollectFullSetOfNodes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) [2016] [ ] 3 | * This file is part of the ethereumJ library. 4 | * 5 | * The ethereumJ library is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * The ethereumJ library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with the ethereumJ library. If not, see . 17 | */ 18 | package org.ethereum.trie; 19 | 20 | import org.ethereum.db.ByteArrayWrapper; 21 | 22 | import java.util.HashSet; 23 | import java.util.Set; 24 | 25 | /** 26 | * @author Roman Mandeleil 27 | * @since 29.08.2014 28 | */ 29 | public class CollectFullSetOfNodes implements TrieImpl.ScanAction { 30 | Set nodes = new HashSet<>(); 31 | 32 | @Override 33 | public void doOnNode(byte[] hash, TrieImpl.Node node) { 34 | nodes.add(new ByteArrayWrapper(hash)); 35 | } 36 | 37 | @Override 38 | public void doOnValue(byte[] nodeHash, TrieImpl.Node node, byte[] key, byte[] value) { 39 | } 40 | 41 | public Set getCollectedHashes() { 42 | return nodes; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/main/java/org/ethereum/trie/CountAllNodes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) [2016] [ ] 3 | * This file is part of the ethereumJ library. 4 | * 5 | * The ethereumJ library is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * The ethereumJ library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with the ethereumJ library. If not, see . 17 | */ 18 | package org.ethereum.trie; 19 | 20 | /** 21 | * @author Roman Mandeleil 22 | * @since 29.08.2014 23 | */ 24 | public class CountAllNodes implements TrieImpl.ScanAction { 25 | 26 | int counted = 0; 27 | 28 | @Override 29 | public void doOnNode(byte[] hash, TrieImpl.Node node) { 30 | ++counted; 31 | } 32 | 33 | @Override 34 | public void doOnValue(byte[] nodeHash, TrieImpl.Node node, byte[] key, byte[] value) { 35 | } 36 | 37 | public int getCounted() { 38 | return counted; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/main/java/org/ethereum/trie/TraceAllNodes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) [2016] [ ] 3 | * This file is part of the ethereumJ library. 4 | * 5 | * The ethereumJ library is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * The ethereumJ library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with the ethereumJ library. If not, see . 17 | */ 18 | package org.ethereum.trie; 19 | 20 | import org.spongycastle.util.encoders.Hex; 21 | 22 | /** 23 | * @author Roman Mandeleil 24 | * @since 29.08.2014 25 | */ 26 | public class TraceAllNodes implements TrieImpl.ScanAction { 27 | 28 | StringBuilder output = new StringBuilder(); 29 | 30 | @Override 31 | public void doOnNode(byte[] hash, TrieImpl.Node node) { 32 | 33 | output.append(Hex.toHexString(hash)).append(" ==> ").append(node.toString()).append("\n"); 34 | } 35 | 36 | @Override 37 | public void doOnValue(byte[] nodeHash, TrieImpl.Node node, byte[] key, byte[] value) { 38 | } 39 | 40 | public String getOutput() { 41 | return output.toString(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/main/java/org/ethereum/trie/Trie.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) [2016] [ ] 3 | * This file is part of the ethereumJ library. 4 | * 5 | * The ethereumJ library is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * The ethereumJ library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with the ethereumJ library. If not, see . 17 | */ 18 | package org.ethereum.trie; 19 | 20 | import org.ethereum.datasource.Source; 21 | 22 | /** 23 | * Created by Anton Nashatyrev on 05.10.2016. 24 | */ 25 | public interface Trie extends Source { 26 | 27 | byte[] getRootHash(); 28 | 29 | void setRoot(byte[] root); 30 | 31 | /** 32 | * Recursively delete all nodes from root 33 | */ 34 | void clear(); 35 | } 36 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/main/java/org/ethereum/util/ALock.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) [2016] [ ] 3 | * This file is part of the ethereumJ library. 4 | * 5 | * The ethereumJ library is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * The ethereumJ library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with the ethereumJ library. If not, see . 17 | */ 18 | package org.ethereum.util; 19 | 20 | import java.util.concurrent.locks.Lock; 21 | 22 | /** 23 | * AutoClosable Lock wrapper. Use case: 24 | *

25 | * try (ALock l = wLock.lock()) { 26 | * // do smth under lock 27 | * } 28 | *

29 | * Created by Anton Nashatyrev on 27.01.2017. 30 | */ 31 | public final class ALock implements AutoCloseable { 32 | private final Lock lock; 33 | 34 | public ALock(Lock l) { 35 | this.lock = l; 36 | } 37 | 38 | public final ALock lock() { 39 | this.lock.lock(); 40 | return this; 41 | } 42 | 43 | @Override 44 | public final void close() { 45 | this.lock.unlock(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/main/java/org/ethereum/util/RLPElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) [2016] [ ] 3 | * This file is part of the ethereumJ library. 4 | * 5 | * The ethereumJ library is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * The ethereumJ library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with the ethereumJ library. If not, see . 17 | */ 18 | package org.ethereum.util; 19 | 20 | import java.io.Serializable; 21 | 22 | /** 23 | * Wrapper class for decoded elements from an RLP encoded byte array. 24 | * 25 | * @author Roman Mandeleil 26 | * @since 01.04.2014 27 | */ 28 | public interface RLPElement extends Serializable { 29 | 30 | byte[] getRLPData(); 31 | } 32 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/main/java/org/ethereum/util/RLPItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) [2016] [ ] 3 | * This file is part of the ethereumJ library. 4 | * 5 | * The ethereumJ library is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * The ethereumJ library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with the ethereumJ library. If not, see . 17 | */ 18 | package org.ethereum.util; 19 | 20 | /** 21 | * @author Roman Mandeleil 22 | * @since 21.04.14 23 | */ 24 | public class RLPItem implements RLPElement { 25 | 26 | private final byte[] rlpData; 27 | 28 | public RLPItem(byte[] rlpData) { 29 | this.rlpData = rlpData; 30 | } 31 | 32 | @Override 33 | public byte[] getRLPData() { 34 | if (rlpData.length == 0) { 35 | return null; 36 | } 37 | return rlpData; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/main/resources/used_classes: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nuls-io/nuls-v1/6748a8d53a6f6ed3258a87c8baa2cdb24dba2a7d/contract-module/base/contract-vm/src/main/resources/used_classes -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/main/resources/used_classes_v3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nuls-io/nuls-v1/6748a8d53a6f6ed3258a87c8baa2cdb24dba2a7d/contract-module/base/contract-vm/src/main/resources/used_classes_v3 -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/test/java/contracts/crowdsale/distribution/FinalizableCrowdsale.java: -------------------------------------------------------------------------------- 1 | package contracts.crowdsale.distribution; 2 | 3 | import contracts.crowdsale.validation.TimedCrowdsale; 4 | import contracts.ownership.Ownable; 5 | import io.nuls.contract.sdk.Address; 6 | import io.nuls.contract.sdk.Event; 7 | import io.nuls.contract.sdk.annotation.View; 8 | 9 | import java.math.BigInteger; 10 | 11 | import static io.nuls.contract.sdk.Utils.emit; 12 | import static io.nuls.contract.sdk.Utils.require; 13 | 14 | public abstract class FinalizableCrowdsale extends TimedCrowdsale implements Ownable { 15 | 16 | private boolean isFinalized = false; 17 | 18 | @View 19 | public boolean isFinalized() { 20 | return isFinalized; 21 | } 22 | 23 | class Finalized implements Event { 24 | 25 | } 26 | 27 | public void finalized() { 28 | onlyOwner(); 29 | require(!isFinalized); 30 | require(hasClosed()); 31 | 32 | finalization(); 33 | emit(new Finalized()); 34 | 35 | isFinalized = true; 36 | } 37 | 38 | protected void finalization() { 39 | } 40 | 41 | public FinalizableCrowdsale(long openingTime, long closingTime, BigInteger rate, Address wallet, Address token) { 42 | super(openingTime, closingTime, rate, wallet, token); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/test/java/contracts/crowdsale/distribution/FinalizableCrowdsale.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.23; 2 | 3 | import "../../math/SafeMath.sol"; 4 | import "../../ownership/Ownable.sol"; 5 | import "../validation/TimedCrowdsale.sol"; 6 | 7 | 8 | /** 9 | * @title FinalizableCrowdsale 10 | * @dev Extension of Crowdsale where an owner can do extra work 11 | * after finishing. 12 | */ 13 | contract FinalizableCrowdsale is TimedCrowdsale, Ownable { 14 | using SafeMath for uint256; 15 | 16 | bool public isFinalized = false; 17 | 18 | event Finalized(); 19 | 20 | /** 21 | * @dev Must be called after crowdsale ends, to do some extra finalization 22 | * work. Calls the contract's finalization function. 23 | */ 24 | function finalize() onlyOwner public { 25 | require(!isFinalized); 26 | require(hasClosed()); 27 | 28 | finalization(); 29 | emit Finalized(); 30 | 31 | isFinalized = true; 32 | } 33 | 34 | /** 35 | * @dev Can be overridden to add finalization logic. The overriding function 36 | * should call super.finalization() to ensure the chain of finalization is 37 | * executed entirely. 38 | */ 39 | function finalization() internal { 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/test/java/contracts/crowdsale/emission/MintedCrowdsale.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.23; 2 | 3 | import "../Crowdsale.sol"; 4 | import "../../token/ERC20/MintableToken.sol"; 5 | 6 | 7 | /** 8 | * @title MintedCrowdsale 9 | * @dev Extension of Crowdsale contract whose tokens are minted in each purchase. 10 | * Token ownership should be transferred to MintedCrowdsale for minting. 11 | */ 12 | contract MintedCrowdsale is Crowdsale { 13 | 14 | /** 15 | * @dev Overrides delivery by minting tokens upon purchase. 16 | * @param _beneficiary Token purchaser 17 | * @param _tokenAmount Number of tokens to be minted 18 | */ 19 | function _deliverTokens( 20 | address _beneficiary, 21 | uint256 _tokenAmount 22 | ) 23 | internal 24 | { 25 | require(MintableToken(token).mint(_beneficiary, _tokenAmount)); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/test/java/contracts/crowdsale/validation/CappedCrowdsale.java: -------------------------------------------------------------------------------- 1 | package contracts.crowdsale.validation; 2 | 3 | import contracts.crowdsale.Crowdsale; 4 | import io.nuls.contract.sdk.Address; 5 | import io.nuls.contract.sdk.annotation.View; 6 | 7 | import java.math.BigInteger; 8 | 9 | import static io.nuls.contract.sdk.Utils.require; 10 | 11 | public class CappedCrowdsale extends Crowdsale { 12 | 13 | private BigInteger cap; 14 | 15 | @View 16 | public BigInteger getCap() { 17 | return cap; 18 | } 19 | 20 | public CappedCrowdsale(BigInteger rate, Address wallet, Address token, BigInteger cap) { 21 | super(rate, wallet, token); 22 | require(cap.compareTo(BigInteger.ZERO) > 0); 23 | this.cap = cap; 24 | } 25 | 26 | @View 27 | public boolean capReached() { 28 | return getWeiRaised().compareTo(cap) >= 0; 29 | } 30 | 31 | protected void preValidatePurchase(Address beneficiary, BigInteger weiAmount) { 32 | super.preValidatePurchase(beneficiary, weiAmount); 33 | require(getWeiRaised().add(weiAmount).compareTo(cap) <= 0); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/test/java/contracts/crowdsale/validation/CappedCrowdsale.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.23; 2 | 3 | import "../../math/SafeMath.sol"; 4 | import "../Crowdsale.sol"; 5 | 6 | 7 | /** 8 | * @title CappedCrowdsale 9 | * @dev Crowdsale with a limit for total contributions. 10 | */ 11 | contract CappedCrowdsale is Crowdsale { 12 | using SafeMath for uint256; 13 | 14 | uint256 public cap; 15 | 16 | /** 17 | * @dev Constructor, takes maximum amount of wei accepted in the crowdsale. 18 | * @param _cap Max amount of wei to be contributed 19 | */ 20 | constructor(uint256 _cap) public { 21 | require(_cap > 0); 22 | cap = _cap; 23 | } 24 | 25 | /** 26 | * @dev Checks whether the cap has been reached. 27 | * @return Whether the cap was reached 28 | */ 29 | function capReached() public view returns (bool) { 30 | return weiRaised >= cap; 31 | } 32 | 33 | /** 34 | * @dev Extend parent behavior requiring purchase to respect the funding cap. 35 | * @param _beneficiary Token purchaser 36 | * @param _weiAmount Amount of wei contributed 37 | */ 38 | function _preValidatePurchase( 39 | address _beneficiary, 40 | uint256 _weiAmount 41 | ) 42 | internal 43 | { 44 | super._preValidatePurchase(_beneficiary, _weiAmount); 45 | require(weiRaised.add(_weiAmount) <= cap); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/test/java/contracts/crowdsale/validation/TimedCrowdsale.java: -------------------------------------------------------------------------------- 1 | package contracts.crowdsale.validation; 2 | 3 | import contracts.crowdsale.Crowdsale; 4 | import io.nuls.contract.sdk.Address; 5 | import io.nuls.contract.sdk.Block; 6 | import io.nuls.contract.sdk.annotation.View; 7 | 8 | import java.math.BigInteger; 9 | 10 | import static io.nuls.contract.sdk.Utils.require; 11 | 12 | public class TimedCrowdsale extends Crowdsale { 13 | 14 | private long openingTime; 15 | private long closingTime; 16 | 17 | @View 18 | public long getOpeningTime() { 19 | return openingTime; 20 | } 21 | 22 | @View 23 | public long getClosingTime() { 24 | return closingTime; 25 | } 26 | 27 | public void onlyWhileOpen() { 28 | require(Block.timestamp() >= openingTime && Block.timestamp() <= closingTime); 29 | } 30 | 31 | public TimedCrowdsale(long openingTime, long closingTime, BigInteger rate, Address wallet, Address token) { 32 | super(rate, wallet, token); 33 | require(openingTime >= Block.timestamp()); 34 | require(closingTime >= openingTime); 35 | 36 | this.openingTime = openingTime; 37 | this.closingTime = closingTime; 38 | } 39 | 40 | @View 41 | public boolean hasClosed() { 42 | return Block.timestamp() > closingTime; 43 | } 44 | 45 | @Override 46 | protected void preValidatePurchase(Address beneficiary, BigInteger weiAmount) { 47 | onlyWhileOpen(); 48 | super.preValidatePurchase(beneficiary, weiAmount); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/test/java/contracts/examples/SampleCrowdsale.java: -------------------------------------------------------------------------------- 1 | package contracts.examples; 2 | 3 | import contracts.crowdsale.emission.MintedCrowdsale; 4 | import io.nuls.contract.sdk.Address; 5 | 6 | import java.math.BigInteger; 7 | 8 | import static io.nuls.contract.sdk.Utils.require; 9 | 10 | public class SampleCrowdsale extends MintedCrowdsale { 11 | 12 | public SampleCrowdsale(long openingTime, long closingTime, BigInteger rate, Address wallet, BigInteger cap, Address token, BigInteger goal) { 13 | super(openingTime, closingTime, rate, wallet, cap, token, goal); 14 | require(goal.compareTo(cap) <= 0); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/test/java/contracts/examples/SimpleToken.java: -------------------------------------------------------------------------------- 1 | package contracts.examples; 2 | 3 | import contracts.token.ERC20.StandardToken; 4 | import io.nuls.contract.sdk.Msg; 5 | import io.nuls.contract.sdk.annotation.View; 6 | 7 | import java.math.BigInteger; 8 | 9 | import static io.nuls.contract.sdk.Utils.emit; 10 | 11 | public class SimpleToken extends StandardToken { 12 | 13 | private final String name = "SimpleToken"; 14 | private final String symbol = "SIM"; 15 | private final int decimals = 18; 16 | private final BigInteger initialSupply = new BigInteger("10000").multiply(BigInteger.TEN.pow(decimals)); 17 | 18 | @View 19 | public String getName() { 20 | return name; 21 | } 22 | 23 | @View 24 | public String getSymbol() { 25 | return symbol; 26 | } 27 | 28 | @View 29 | public int getDecimals() { 30 | return decimals; 31 | } 32 | 33 | @View 34 | public BigInteger getInitialSupply() { 35 | return initialSupply; 36 | } 37 | 38 | public SimpleToken() { 39 | totalSupply = initialSupply; 40 | balances.put(Msg.sender(), initialSupply); 41 | emit(new TransferEvent(null, Msg.sender(), initialSupply)); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/test/java/contracts/examples/SimpleToken.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.23; 2 | 3 | 4 | import "../token/ERC20/StandardToken.sol"; 5 | 6 | 7 | /** 8 | * @title SimpleToken 9 | * @dev Very simple ERC20 Token example, where all tokens are pre-assigned to the creator. 10 | * Note they can later distribute these tokens as they wish using `transfer` and other 11 | * `StandardToken` functions. 12 | */ 13 | contract SimpleToken is StandardToken { 14 | 15 | string public constant name = "SimpleToken"; // solium-disable-line uppercase 16 | string public constant symbol = "SIM"; // solium-disable-line uppercase 17 | uint8 public constant decimals = 18; // solium-disable-line uppercase 18 | 19 | uint256 public constant INITIAL_SUPPLY = 10000 * (10 ** uint256(decimals)); 20 | 21 | /** 22 | * @dev Constructor that gives msg.sender all of existing tokens. 23 | */ 24 | constructor() public { 25 | totalSupply_ = INITIAL_SUPPLY; 26 | balances[msg.sender] = INITIAL_SUPPLY; 27 | emit Transfer(0x0, msg.sender, INITIAL_SUPPLY); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/test/java/contracts/examples/TestCrowdsale.java: -------------------------------------------------------------------------------- 1 | package contracts.examples; 2 | 3 | import contracts.crowdsale.emission.MintedCrowdsale; 4 | import io.nuls.contract.sdk.Address; 5 | 6 | import java.math.BigInteger; 7 | 8 | import static io.nuls.contract.sdk.Utils.require; 9 | 10 | public class TestCrowdsale extends MintedCrowdsale { 11 | 12 | public TestCrowdsale(long openingTime, long closingTime, BigInteger rate, Address wallet, BigInteger cap, Address token, BigInteger goal) { 13 | super(openingTime, closingTime, rate, wallet, cap, token, goal); 14 | require(goal.compareTo(cap) <= 0); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/test/java/contracts/examples/TestToken.java: -------------------------------------------------------------------------------- 1 | package contracts.examples; 2 | 3 | import contracts.token.ERC20.MintableToken; 4 | import io.nuls.contract.sdk.Contract; 5 | import io.nuls.contract.sdk.Msg; 6 | import io.nuls.contract.sdk.annotation.Payable; 7 | import io.nuls.contract.sdk.annotation.View; 8 | 9 | import java.math.BigInteger; 10 | 11 | import static io.nuls.contract.sdk.Utils.emit; 12 | 13 | public class TestToken extends MintableToken implements Contract { 14 | 15 | private final String name = "TestToken"; 16 | private final String symbol = "TT"; 17 | private final int decimals = 18; 18 | private final BigInteger initialSupply = new BigInteger("10000").multiply(BigInteger.TEN.pow(decimals)); 19 | 20 | @View 21 | public String getName() { 22 | return name; 23 | } 24 | 25 | @View 26 | public String getSymbol() { 27 | return symbol; 28 | } 29 | 30 | @View 31 | public int getDecimals() { 32 | return decimals; 33 | } 34 | 35 | @View 36 | public BigInteger getInitialSupply() { 37 | return initialSupply; 38 | } 39 | 40 | public TestToken() { 41 | totalSupply = initialSupply; 42 | balances.put(Msg.sender(), initialSupply); 43 | emit(new TransferEvent(null, Msg.sender(), initialSupply)); 44 | } 45 | 46 | @Payable 47 | @Override 48 | public void _payable() { 49 | 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/test/java/contracts/examples/cmd.md: -------------------------------------------------------------------------------- 1 | 2 | jar -cvf ./contract-module/base/contract-vm/target/contract.jar -C ./contract-module/base/contract-vm/target/test-classes ./contracts/ 3 | jar -cvf ./contract-module/base/contract-vm/target/test-classes/contract.jar -C ./contract-module/base/contract-vm/target/test-classes ./testcontract/ 4 | jar -cvf /tmp/classes.jar -C /tmp ./ 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | javac -encoding utf-8 -sourcepath ./nvm/src/main/java -d ./nvm/target/classes ./nvm/src/main/java/nuls/contract/examples/token/*.java 14 | 15 | jar -cvf ./nvm/target/contract.jar -C ./nvm/target/classes ./nuls/contract/examples/token/ 16 | 17 | create 18 | 19 | 20 | javac -encoding utf-8 -sourcepath ./nuls-contract-sdk/src/main/java -d ./nvm/target/classes ./nuls-contract-sdk/src/main/java/nuls/contract/sdk/examples/java/token/*.java 21 | 22 | jar -cvf ./nvm/target/contract.jar -C ./nvm/target/classes ./nuls/contract/sdk/examples/java/token/ 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/test/java/contracts/examples/solidity.md: -------------------------------------------------------------------------------- 1 | https://solidity.readthedocs.org/ 2 | 3 | Block and Transaction Properties 4 | 5 | block.blockhash(uint blockNumber) returns (bytes32): hash of the given block - only works for 256 most recent blocks excluding current 6 | block.coinbase (address): current block miner’s address 7 | block.difficulty (uint): current block difficulty 8 | block.gaslimit (uint): current block gaslimit 9 | block.number (uint): current block number 10 | block.timestamp (uint): current block timestamp as seconds since unix epoch 11 | gasleft() returns (uint256): remaining gas 12 | msg.data (bytes): complete calldata 13 | msg.gas (uint): remaining gas - deprecated in version 0.4.21 and to be replaced by gasleft() 14 | msg.sender (address): sender of the message (current call) 15 | msg.sig (bytes4): first four bytes of the calldata (i.e. function identifier) 16 | msg.value (uint): number of wei sent with the message 17 | now (uint): current block timestamp (alias for block.timestamp) 18 | tx.gasprice (uint): gas price of the transaction 19 | tx.origin (address): sender of the transaction (full call chain) 20 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/test/java/contracts/ownership/Ownable.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.23; 2 | 3 | 4 | /** 5 | * @title Ownable 6 | * @dev The Ownable contract has an owner address, and provides basic authorization control 7 | * functions, this simplifies the implementation of "user permissions". 8 | */ 9 | contract Ownable { 10 | address public owner; 11 | 12 | 13 | event OwnershipRenounced(address indexed previousOwner); 14 | event OwnershipTransferred( 15 | address indexed previousOwner, 16 | address indexed newOwner 17 | ); 18 | 19 | 20 | /** 21 | * @dev The Ownable constructor sets the original `owner` of the contract to the sender 22 | * account. 23 | */ 24 | constructor() public { 25 | owner = msg.sender; 26 | } 27 | 28 | /** 29 | * @dev Throws if called by any account other than the owner. 30 | */ 31 | modifier onlyOwner() { 32 | require(msg.sender == owner); 33 | _; 34 | } 35 | 36 | /** 37 | * @dev Allows the current owner to transfer control of the contract to a newOwner. 38 | * @param newOwner The address to transfer ownership to. 39 | */ 40 | function transferOwnership(address newOwner) public onlyOwner { 41 | require(newOwner != address(0)); 42 | emit OwnershipTransferred(owner, newOwner); 43 | owner = newOwner; 44 | } 45 | 46 | /** 47 | * @dev Allows the current owner to relinquish control of the contract. 48 | */ 49 | function renounceOwnership() public onlyOwner { 50 | emit OwnershipRenounced(owner); 51 | owner = address(0); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/test/java/contracts/ownership/OwnableImpl.java: -------------------------------------------------------------------------------- 1 | package contracts.ownership; 2 | 3 | import io.nuls.contract.sdk.Address; 4 | import io.nuls.contract.sdk.Msg; 5 | import io.nuls.contract.sdk.annotation.View; 6 | 7 | import static io.nuls.contract.sdk.Utils.emit; 8 | import static io.nuls.contract.sdk.Utils.require; 9 | 10 | public class OwnableImpl implements Ownable { 11 | 12 | private Address owner; 13 | 14 | public OwnableImpl() { 15 | this.owner = Msg.sender(); 16 | } 17 | 18 | @Override 19 | @View 20 | public Address getOwner() { 21 | return owner; 22 | } 23 | 24 | @Override 25 | public void onlyOwner() { 26 | require(Msg.sender().equals(owner)); 27 | } 28 | 29 | @Override 30 | public void transferOwnership(Address newOwner) { 31 | onlyOwner(); 32 | emit(new OwnershipTransferredEvent(owner, newOwner)); 33 | owner = newOwner; 34 | } 35 | 36 | @Override 37 | public void renounceOwnership() { 38 | onlyOwner(); 39 | emit(new OwnershipRenouncedEvent(owner)); 40 | owner = null; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/test/java/contracts/token/ERC20/BasicToken.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.23; 2 | 3 | 4 | import "./ERC20Basic.sol"; 5 | import "../../math/SafeMath.sol"; 6 | 7 | 8 | /** 9 | * @title Basic token 10 | * @dev Basic version of StandardToken, with no allowances. 11 | */ 12 | contract BasicToken is ERC20Basic { 13 | using SafeMath for uint256; 14 | 15 | mapping(address => uint256) balances; 16 | 17 | uint256 totalSupply_; 18 | 19 | /** 20 | * @dev total number of tokens in existence 21 | */ 22 | function totalSupply() public view returns (uint256) { 23 | return totalSupply_; 24 | } 25 | 26 | /** 27 | * @dev transfer token for a specified address 28 | * @param _to The address to transfer to. 29 | * @param _value The amount to be transferred. 30 | */ 31 | function transfer(address _to, uint256 _value) public returns (bool) { 32 | require(_to != address(0)); 33 | require(_value <= balances[msg.sender]); 34 | 35 | balances[msg.sender] = balances[msg.sender].sub(_value); 36 | balances[_to] = balances[_to].add(_value); 37 | emit Transfer(msg.sender, _to, _value); 38 | return true; 39 | } 40 | 41 | /** 42 | * @dev Gets the balance of the specified address. 43 | * @param _owner The address to query the the balance of. 44 | * @return An uint256 representing the amount owned by the passed address. 45 | */ 46 | function balanceOf(address _owner) public view returns (uint256) { 47 | return balances[_owner]; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/test/java/contracts/token/ERC20/BurnableToken.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.23; 2 | 3 | import "./BasicToken.sol"; 4 | 5 | 6 | /** 7 | * @title Burnable Token 8 | * @dev Token that can be irreversibly burned (destroyed). 9 | */ 10 | contract BurnableToken is BasicToken { 11 | 12 | event Burn(address indexed burner, uint256 value); 13 | 14 | /** 15 | * @dev Burns a specific amount of tokens. 16 | * @param _value The amount of token to be burned. 17 | */ 18 | function burn(uint256 _value) public { 19 | _burn(msg.sender, _value); 20 | } 21 | 22 | function _burn(address _who, uint256 _value) internal { 23 | require(_value <= balances[_who]); 24 | // no need to require value <= totalSupply, since that would imply the 25 | // sender's balance is greater than the totalSupply, which *should* be an assertion failure 26 | 27 | balances[_who] = balances[_who].sub(_value); 28 | totalSupply_ = totalSupply_.sub(_value); 29 | emit Burn(_who, _value); 30 | emit Transfer(_who, address(0), _value); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/test/java/contracts/token/ERC20/CappedToken.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.23; 2 | 3 | import "./MintableToken.sol"; 4 | 5 | 6 | /** 7 | * @title Capped token 8 | * @dev Mintable token with a token cap. 9 | */ 10 | contract CappedToken is MintableToken { 11 | 12 | uint256 public cap; 13 | 14 | constructor(uint256 _cap) public { 15 | require(_cap > 0); 16 | cap = _cap; 17 | } 18 | 19 | /** 20 | * @dev Function to mint tokens 21 | * @param _to The address that will receive the minted tokens. 22 | * @param _amount The amount of tokens to mint. 23 | * @return A boolean that indicates if the operation was successful. 24 | */ 25 | function mint( 26 | address _to, 27 | uint256 _amount 28 | ) 29 | onlyOwner 30 | canMint 31 | public 32 | returns (bool) 33 | { 34 | require(totalSupply_.add(_amount) <= cap); 35 | 36 | return super.mint(_to, _amount); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/test/java/contracts/token/ERC20/DetailedERC20.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.23; 2 | 3 | import "./ERC20.sol"; 4 | 5 | 6 | contract DetailedERC20 is ERC20 { 7 | string public name; 8 | string public symbol; 9 | uint8 public decimals; 10 | 11 | constructor(string _name, string _symbol, uint8 _decimals) public { 12 | name = _name; 13 | symbol = _symbol; 14 | decimals = _decimals; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/test/java/contracts/token/ERC20/ERC20.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.23; 2 | 3 | import "./ERC20Basic.sol"; 4 | 5 | 6 | /** 7 | * @title ERC20 interface 8 | * @dev see https://github.com/ethereum/EIPs/issues/20 9 | */ 10 | contract ERC20 is ERC20Basic { 11 | function allowance(address owner, address spender) 12 | public view returns (uint256); 13 | 14 | function transferFrom(address from, address to, uint256 value) 15 | public returns (bool); 16 | 17 | function approve(address spender, uint256 value) public returns (bool); 18 | event Approval( 19 | address indexed owner, 20 | address indexed spender, 21 | uint256 value 22 | ); 23 | } 24 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/test/java/contracts/token/ERC20/ERC20Basic.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.23; 2 | 3 | 4 | /** 5 | * @title ERC20Basic 6 | * @dev Simpler version of ERC20 interface 7 | * @dev see https://github.com/ethereum/EIPs/issues/179 8 | */ 9 | contract ERC20Basic { 10 | function totalSupply() public view returns (uint256); 11 | function balanceOf(address who) public view returns (uint256); 12 | function transfer(address to, uint256 value) public returns (bool); 13 | event Transfer(address indexed from, address indexed to, uint256 value); 14 | } 15 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/test/java/contracts/token/ERC20/PausableToken.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.23; 2 | 3 | import "./StandardToken.sol"; 4 | import "../../lifecycle/Pausable.sol"; 5 | 6 | 7 | /** 8 | * @title Pausable token 9 | * @dev StandardToken modified with pausable transfers. 10 | **/ 11 | contract PausableToken is StandardToken, Pausable { 12 | 13 | function transfer( 14 | address _to, 15 | uint256 _value 16 | ) 17 | public 18 | whenNotPaused 19 | returns (bool) 20 | { 21 | return super.transfer(_to, _value); 22 | } 23 | 24 | function transferFrom( 25 | address _from, 26 | address _to, 27 | uint256 _value 28 | ) 29 | public 30 | whenNotPaused 31 | returns (bool) 32 | { 33 | return super.transferFrom(_from, _to, _value); 34 | } 35 | 36 | function approve( 37 | address _spender, 38 | uint256 _value 39 | ) 40 | public 41 | whenNotPaused 42 | returns (bool) 43 | { 44 | return super.approve(_spender, _value); 45 | } 46 | 47 | function increaseApproval( 48 | address _spender, 49 | uint _addedValue 50 | ) 51 | public 52 | whenNotPaused 53 | returns (bool success) 54 | { 55 | return super.increaseApproval(_spender, _addedValue); 56 | } 57 | 58 | function decreaseApproval( 59 | address _spender, 60 | uint _subtractedValue 61 | ) 62 | public 63 | whenNotPaused 64 | returns (bool success) 65 | { 66 | return super.decreaseApproval(_spender, _subtractedValue); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/test/java/contracts/token/ERC20/RBACMintableToken.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.23; 2 | 3 | import "./MintableToken.sol"; 4 | import "../../ownership/rbac/RBAC.sol"; 5 | 6 | 7 | /** 8 | * @title RBACMintableToken 9 | * @author Vittorio Minacori (@vittominacori) 10 | * @dev Mintable Token, with RBAC minter permissions 11 | */ 12 | contract RBACMintableToken is MintableToken, RBAC { 13 | /** 14 | * A constant role name for indicating minters. 15 | */ 16 | string public constant ROLE_MINTER = "minter"; 17 | 18 | /** 19 | * @dev override the Mintable token modifier to add role based logic 20 | */ 21 | modifier hasMintPermission() { 22 | checkRole(msg.sender, ROLE_MINTER); 23 | _; 24 | } 25 | 26 | /** 27 | * @dev add a minter role to an address 28 | * @param minter address 29 | */ 30 | function addMinter(address minter) onlyOwner public { 31 | addRole(minter, ROLE_MINTER); 32 | } 33 | 34 | /** 35 | * @dev remove a minter role from an address 36 | * @param minter address 37 | */ 38 | function removeMinter(address minter) onlyOwner public { 39 | removeRole(minter, ROLE_MINTER); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/test/java/contracts/token/ERC20/SafeERC20.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.23; 2 | 3 | import "./ERC20Basic.sol"; 4 | import "./ERC20.sol"; 5 | 6 | 7 | /** 8 | * @title SafeERC20 9 | * @dev Wrappers around ERC20 operations that throw on failure. 10 | * To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract, 11 | * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. 12 | */ 13 | library SafeERC20 { 14 | function safeTransfer(ERC20Basic token, address to, uint256 value) internal { 15 | require(token.transfer(to, value)); 16 | } 17 | 18 | function safeTransferFrom( 19 | ERC20 token, 20 | address from, 21 | address to, 22 | uint256 value 23 | ) 24 | internal 25 | { 26 | require(token.transferFrom(from, to, value)); 27 | } 28 | 29 | function safeApprove(ERC20 token, address spender, uint256 value) internal { 30 | require(token.approve(spender, value)); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/test/java/contracts/token/ERC20/StandardBurnableToken.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.23; 2 | 3 | import "./BurnableToken.sol"; 4 | import "./StandardToken.sol"; 5 | 6 | 7 | /** 8 | * @title Standard Burnable Token 9 | * @dev Adds burnFrom method to ERC20 implementations 10 | */ 11 | contract StandardBurnableToken is BurnableToken, StandardToken { 12 | 13 | /** 14 | * @dev Burns a specific amount of tokens from the target address and decrements allowance 15 | * @param _from address The address which you want to send tokens from 16 | * @param _value uint256 The amount of token to be burned 17 | */ 18 | function burnFrom(address _from, uint256 _value) public { 19 | require(_value <= allowed[_from][msg.sender]); 20 | // Should https://github.com/OpenZeppelin/zeppelin-solidity/issues/707 be accepted, 21 | // this function needs to emit an event with the updated approval. 22 | allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); 23 | _burn(_from, _value); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/test/java/contracts/token/ERC20/TokenTimelock.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.23; 2 | 3 | import "./SafeERC20.sol"; 4 | 5 | 6 | /** 7 | * @title TokenTimelock 8 | * @dev TokenTimelock is a token holder contract that will allow a 9 | * beneficiary to extract the tokens after a given release time 10 | */ 11 | contract TokenTimelock { 12 | using SafeERC20 for ERC20Basic; 13 | 14 | // ERC20 basic token contract being held 15 | ERC20Basic public token; 16 | 17 | // beneficiary of tokens after they are released 18 | address public beneficiary; 19 | 20 | // timestamp when token release is enabled 21 | uint256 public releaseTime; 22 | 23 | constructor( 24 | ERC20Basic _token, 25 | address _beneficiary, 26 | uint256 _releaseTime 27 | ) 28 | public 29 | { 30 | // solium-disable-next-line security/no-block-members 31 | require(_releaseTime > block.timestamp); 32 | token = _token; 33 | beneficiary = _beneficiary; 34 | releaseTime = _releaseTime; 35 | } 36 | 37 | /** 38 | * @notice Transfers tokens held by timelock to beneficiary. 39 | */ 40 | function release() public { 41 | // solium-disable-next-line security/no-block-members 42 | require(block.timestamp >= releaseTime); 43 | 44 | uint256 amount = token.balanceOf(this); 45 | require(amount > 0); 46 | 47 | token.safeTransfer(beneficiary, amount); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/test/resources/block/genesis-block.json: -------------------------------------------------------------------------------- 1 | { 2 | "height": 0, 3 | "time": "1514736000000", 4 | "txs": [ 5 | { 6 | "address": "2CjzG5atBtD3kk2MatNpHCVDLzg7zNb", 7 | "nuls": 20000000, 8 | "unlockHeight": 0 9 | }, 10 | { 11 | "address": "2CjK6vkn1Z5QvcgidFy69dmneav3WHY", 12 | "nuls": 20000000, 13 | "unlockHeight": 0 14 | }, 15 | { 16 | "address": "2CbdQroDQjeTSshE9SdMBkLZcYih7j8", 17 | "nuls": 20000000, 18 | "unlockHeight": 0 19 | }, 20 | { 21 | "address": "2CYC8j4P4jr1yiX9U27QPQj5LeP8Bay", 22 | "nuls": 20000000, 23 | "unlockHeight": 0 24 | }, 25 | { 26 | "address": "2Cb2osdHyiiys5THNHNXTk2KZYD7vvU", 27 | "nuls": 20000000, 28 | "unlockHeight": 0 29 | } 30 | ] 31 | } -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/test/resources/crowdsale_contract: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nuls-io/nuls-v1/6748a8d53a6f6ed3258a87c8baa2cdb24dba2a7d/contract-module/base/contract-vm/src/test/resources/crowdsale_contract -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/test/resources/modules.ini: -------------------------------------------------------------------------------- 1 | [db] 2 | bootstrap= io.nuls.db.module.impl.LevelDbModuleBootstrap 3 | 4 | [contract] 5 | bootstrap= io.nuls.contract.module.impl.ContractModuleBootstrap 6 | 7 | [protocol] 8 | bootstrap= io.nuls.protocol.base.module.BaseProtocolsModuleBootstrap 9 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/test/resources/nuls.ini: -------------------------------------------------------------------------------- 1 | [System] 2 | language=en 3 | encoding=UTF-8 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/test/resources/token_contract: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nuls-io/nuls-v1/6748a8d53a6f6ed3258a87c8baa2cdb24dba2a7d/contract-module/base/contract-vm/src/test/resources/token_contract -------------------------------------------------------------------------------- /contract-module/base/contract-vm/src/test/resources/vote_contract: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nuls-io/nuls-v1/6748a8d53a6f6ed3258a87c8baa2cdb24dba2a7d/contract-module/base/contract-vm/src/test/resources/vote_contract -------------------------------------------------------------------------------- /contract-module/contract/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | contract-module 7 | io.nuls 8 | 1.3.0 9 | 10 | 4.0.0 11 | io.nuls.contract-module 12 | contract 13 | 1.3.0 14 | jar 15 | contract 16 | 17 | 18 | 19 | io.nuls.db-module 20 | db 21 | 1.3.0 22 | 23 | 24 | 25 | io.nuls.db-module 26 | db-leveldb 27 | 1.3.0 28 | test 29 | 30 | 31 | 32 | io.nuls.ledger-module 33 | ledger 34 | 1.3.0 35 | test 36 | 37 | 38 | 39 | 40 | ${project.artifactId}-${project.version} 41 | 42 | -------------------------------------------------------------------------------- /contract-module/contract/src/main/java/io/nuls/contract/entity/txdata/ContractData.java: -------------------------------------------------------------------------------- 1 | /** 2 | * MIT License 3 | *

4 | * Copyright (c) 2017-2019 nuls.io 5 | *

6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | *

13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | *

16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package io.nuls.contract.entity.txdata; 25 | 26 | /** 27 | * @desription: 28 | * @author: PierreLuo 29 | * @date: 2018/7/19 30 | */ 31 | public interface ContractData { 32 | 33 | long getGasLimit(); 34 | 35 | byte[] getSender(); 36 | 37 | byte[] getContractAddress(); 38 | 39 | long getPrice(); 40 | 41 | long getValue(); 42 | } 43 | -------------------------------------------------------------------------------- /contract-module/contract/src/main/resources/contract-protocol.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /contract-module/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | nuls 7 | io.nuls 8 | 1.3.0 9 | 10 | 4.0.0 11 | 12 | io.nuls 13 | contract-module 14 | pom 15 | 1.3.0 16 | 17 | 18 | contract 19 | base/contract-base 20 | base/contract-vm 21 | base/contract-storage 22 | base/contract-tx 23 | base/contract-rpc 24 | base/contract-ledger 25 | 26 | 27 | 28 | 29 | junit 30 | junit 31 | 4.12 32 | 33 | 34 | io.nuls.core-module 35 | kernel 36 | 1.3.0 37 | 38 | 39 | -------------------------------------------------------------------------------- /core-module/README.md: -------------------------------------------------------------------------------- 1 | # nuls micro kernel modules 2 | -------------------------------------------------------------------------------- /core-module/kernel/src/main/java/io/nuls/kernel/constant/TxStatusEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | package io.nuls.kernel.constant; 26 | 27 | /** 28 | * 交易状态枚举 29 | * Enumeration of transaction status 30 | * 31 | * @author Niels 32 | */ 33 | public enum TxStatusEnum { 34 | 35 | /** 36 | * 未确认状态 37 | * not packaged 38 | */ 39 | UNCONFIRM, 40 | /** 41 | * 已确认状态 42 | * packaged and saved 43 | */ 44 | CONFIRMED 45 | 46 | 47 | } 48 | -------------------------------------------------------------------------------- /core-module/kernel/src/main/java/io/nuls/kernel/model/NulsData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package io.nuls.kernel.model; 27 | 28 | import io.nuls.kernel.exception.NulsException; 29 | 30 | import java.io.IOException; 31 | 32 | /** 33 | * @author: Niels Wang 34 | */ 35 | public interface NulsData { 36 | 37 | int size(); 38 | 39 | byte[] serialize() throws IOException; 40 | 41 | void parse(byte[] bytes, int cursor) throws NulsException; 42 | } 43 | -------------------------------------------------------------------------------- /core-module/kernel/src/main/java/io/nuls/kernel/model/NulsVersion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | package io.nuls.kernel.model; 26 | 27 | /** 28 | * @author vivi 29 | */ 30 | public interface NulsVersion { 31 | 32 | String getVersion(); 33 | 34 | String getArtifactId(); 35 | 36 | String getGroupId(); 37 | } 38 | -------------------------------------------------------------------------------- /core-module/kernel/src/main/java/io/nuls/kernel/model/TransactionLogicData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package io.nuls.kernel.model; 27 | 28 | import java.util.Set; 29 | 30 | /** 31 | * author Facjas 32 | * date 2018/5/10. 33 | */ 34 | public abstract class TransactionLogicData extends BaseNulsData { 35 | public abstract Set getAddresses(); 36 | } 37 | -------------------------------------------------------------------------------- /core-module/kernel/src/main/java/io/nuls/kernel/script/ScriptException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package io.nuls.kernel.script; 27 | 28 | public class ScriptException extends RuntimeException { 29 | public ScriptException(String msg) { 30 | super(msg); 31 | } 32 | 33 | public ScriptException(String msg, Exception e) { 34 | super(msg, e); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /core-module/kernel/src/main/java/io/nuls/kernel/validate/NulsDataValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | package io.nuls.kernel.validate; 26 | 27 | import io.nuls.kernel.exception.NulsException; 28 | import io.nuls.kernel.model.NulsData; 29 | 30 | /** 31 | * @author Niels 32 | */ 33 | public interface NulsDataValidator { 34 | 35 | ValidateResult validate(T data) throws NulsException; 36 | } 37 | -------------------------------------------------------------------------------- /core-module/kernel/src/test/resources/block/genesis-block.json: -------------------------------------------------------------------------------- 1 | { 2 | "height": 0, 3 | "time": "1514736000000", 4 | "txs": [ 5 | { 6 | "address": "2CjzG5atBtD3kk2MatNpHCVDLzg7zNb", 7 | "nuls": 20000000, 8 | "unlockHeight": 0 9 | }, 10 | { 11 | "address": "2CjK6vkn1Z5QvcgidFy69dmneav3WHY", 12 | "nuls": 20000000, 13 | "unlockHeight": 0 14 | }, 15 | { 16 | "address": "2CbdQroDQjeTSshE9SdMBkLZcYih7j8", 17 | "nuls": 20000000, 18 | "unlockHeight": 0 19 | }, 20 | { 21 | "address": "2CYC8j4P4jr1yiX9U27QPQj5LeP8Bay", 22 | "nuls": 20000000, 23 | "unlockHeight": 0 24 | }, 25 | { 26 | "address": "2Cb2osdHyiiys5THNHNXTk2KZYD7vvU", 27 | "nuls": 20000000, 28 | "unlockHeight": 0 29 | } 30 | ] 31 | } -------------------------------------------------------------------------------- /core-module/kernel/src/test/resources/modules.ini: -------------------------------------------------------------------------------- 1 | [db] 2 | bootstrap=io.nuls.db.module.impl.MybatisDbModuleBootstrap 3 | 4 | [cache] 5 | bootstrap=io.nuls.cache.module.impl.EhCacheModuleBootstrap 6 | 7 | [account] 8 | bootstrap=io.nuls.account.module.impl.AccountModuleBootstrap 9 | 10 | [event-bus] 11 | bootstrap=io.nuls.event.bus.module.impl.EventBusModuleBootstrap 12 | 13 | [ledger] 14 | bootstrap=io.nuls.ledger.module.impl.UtxoLedgerModuleBootstrap 15 | 16 | [protocol] 17 | bootstrap=io.nuls.protocol.base.module.impl.BaseProtocolsModuleBootstrap 18 | 19 | [network] 20 | bootstrap=io.nuls.network.module.impl.NetworkModuleBootstrap 21 | network.server.port=8004 22 | network.magic=12312333 23 | network.max.in=10 24 | network.max.out=10 25 | network.seed.ip=192.168.1.201:8004 26 | [consensus] 27 | bootstrap=PocConsensusModuleBootstrap 28 | partake.packing=true 29 | seed.nodes=2CiYPSsrXVGmPudD6rumANCBT7tjJk7 30 | 31 | [notify] 32 | bootstrap=io.nuls.notify.module.NotifyModuleBootstrap 33 | notify.port=8002 34 | 35 | [rpc] 36 | bootstrap=io.nuls.rpc.module.impl.RpcServerModuleBootstrap 37 | server.ip=127.0.0.1 38 | server.port=8001 39 | request.white.sheet=127.0.0.1 -------------------------------------------------------------------------------- /core-module/kernel/src/test/resources/nuls.ini: -------------------------------------------------------------------------------- 1 | [System] 2 | language=en 3 | encoding=UTF-8 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /core-module/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | nuls 7 | io.nuls 8 | 1.3.0 9 | 10 | 4.0.0 11 | io.nuls 12 | core-module 13 | 1.3.0 14 | pom 15 | 16 | kernel 17 | kernel-rpc 18 | 19 | -------------------------------------------------------------------------------- /db-module/README.md: -------------------------------------------------------------------------------- 1 | # account module 2 | -------------------------------------------------------------------------------- /db-module/db/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | db-module 7 | io.nuls 8 | 1.3.0 9 | 10 | 4.0.0 11 | 12 | io.nuls.db-module 13 | db 14 | 1.3.0 15 | 16 | db 17 | 18 | ${project.artifactId}-${project.version} 19 | 20 | -------------------------------------------------------------------------------- /db-module/db/src/main/java/io/nuls/db/constant/DBConstant.java: -------------------------------------------------------------------------------- 1 | /** 2 | * MIT License 3 | * Copyright (c) 2017-2019 nuls.io 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 18 | * SOFTWARE. 19 | */ 20 | package io.nuls.db.constant; 21 | 22 | import io.nuls.kernel.constant.NulsConstant; 23 | 24 | public interface DBConstant extends NulsConstant { 25 | 26 | short MODULE_ID_DB = 2; 27 | 28 | String BASE_AREA_NAME = "base"; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /db-module/db/src/main/java/io/nuls/db/constant/DBErrorCode.java: -------------------------------------------------------------------------------- 1 | 2 | package io.nuls.db.constant; 3 | 4 | import io.nuls.kernel.constant.ErrorCode; 5 | import io.nuls.kernel.constant.KernelErrorCode; 6 | 7 | public interface DBErrorCode extends KernelErrorCode { 8 | 9 | ErrorCode DB_MODULE_START_FAIL = ErrorCode.init("20000"); 10 | ErrorCode DB_UNKOWN_EXCEPTION = ErrorCode.init("20001"); 11 | ErrorCode DB_SESSION_MISS_INIT = ErrorCode.init("20002"); 12 | ErrorCode DB_SAVE_CANNOT_NULL = ErrorCode.init("20003"); 13 | ErrorCode DB_SAVE_BATCH_LIMIT_OVER = ErrorCode.init("20004"); 14 | ErrorCode DB_DATA_ERROR = ErrorCode.init("20005"); 15 | ErrorCode DB_SAVE_ERROR = ErrorCode.init("20006"); 16 | ErrorCode DB_UPDATE_ERROR = ErrorCode.init("20007"); 17 | ErrorCode DB_ROLLBACK_ERROR = ErrorCode.init("20008"); 18 | ErrorCode DB_AREA_EXIST = ErrorCode.init("20009"); 19 | ErrorCode DB_AREA_NOT_EXIST = ErrorCode.init("20010"); 20 | ErrorCode DB_AREA_CREATE_EXCEED_LIMIT = ErrorCode.init("20011"); 21 | ErrorCode DB_AREA_CREATE_ERROR = ErrorCode.init("20012"); 22 | ErrorCode DB_AREA_CREATE_PATH_ERROR = ErrorCode.init("20013"); 23 | ErrorCode DB_AREA_DESTROY_ERROR = ErrorCode.init("20014"); 24 | ErrorCode DB_BATCH_CLOSE = ErrorCode.init("20015"); 25 | ErrorCode DB_AREA_FAILED_BATCH_CLOSE = ErrorCode.init("20016"); 26 | } -------------------------------------------------------------------------------- /db-module/db/src/main/java/io/nuls/db/model/ModelWrapper.java: -------------------------------------------------------------------------------- 1 | /** 2 | * MIT License 3 | * Copyright (c) 2017-2019 nuls.io 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 18 | * SOFTWARE. 19 | */ 20 | package io.nuls.db.model; 21 | 22 | public class ModelWrapper { 23 | private T t; 24 | 25 | public ModelWrapper() { 26 | } 27 | 28 | public ModelWrapper(T t) { 29 | this.t = t; 30 | } 31 | 32 | public T getT() { 33 | return t; 34 | } 35 | 36 | public void setT(T t) { 37 | this.t = t; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /db-module/db/src/main/java/io/nuls/db/module/AbstractDBModule.java: -------------------------------------------------------------------------------- 1 | /** 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package io.nuls.db.module; 25 | 26 | 27 | import io.nuls.db.constant.DBConstant; 28 | import io.nuls.kernel.module.BaseModuleBootstrap; 29 | 30 | public abstract class AbstractDBModule extends BaseModuleBootstrap { 31 | 32 | protected AbstractDBModule() { 33 | super(DBConstant.MODULE_ID_DB); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /db-module/leveldb/db-leveldb/src/main/resources/db_config.properties: -------------------------------------------------------------------------------- 1 | #levelDB dataPath 2 | leveldb.datapath=./data 3 | leveldb.area.max=20 -------------------------------------------------------------------------------- /db-module/leveldb/db-leveldb/src/test/java/io/nuls/db/service/LevelDBServiceTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * * 3 | * * MIT License 4 | * * 5 | * * Copyright (c) 2017-2019 nuls.io 6 | * * 7 | * * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * * of this software and associated documentation files (the "Software"), to deal 9 | * * in the Software without restriction, including without limitation the rights 10 | * * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * * copies of the Software, and to permit persons to whom the Software is 12 | * * furnished to do so, subject to the following conditions: 13 | * * 14 | * * The above copyright notice and this permission notice shall be included in all 15 | * * copies or substantial portions of the Software. 16 | * * 17 | * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | * * SOFTWARE. 24 | * 25 | */ 26 | 27 | package io.nuls.db.service; 28 | 29 | /** 30 | * Created by ln on 2018/5/6. 31 | */ 32 | public class LevelDBServiceTest { 33 | 34 | } -------------------------------------------------------------------------------- /db-module/leveldb/db-leveldb/src/test/resources/db_config.properties: -------------------------------------------------------------------------------- 1 | # 2 | # /** 3 | # * MIT License 4 | # * 5 | # * Copyright (c) 2017-2019 nuls.io 6 | # * 7 | # * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | # * of this software and associated documentation files (the "Software"), to deal 9 | # * in the Software without restriction, including without limitation the rights 10 | # * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | # * copies of the Software, and to permit persons to whom the Software is 12 | # * furnished to do so, subject to the following conditions: 13 | # * 14 | # * The above copyright notice and this permission notice shall be included in all 15 | # * copies or substantial portions of the Software. 16 | # * 17 | # * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | # * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | # * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | # * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | # * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | # * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | # * SOFTWARE. 24 | # */ 25 | # 26 | 27 | #levelDB dataPath 28 | leveldb.datapath=./data/test 29 | leveldb.area.max=20 -------------------------------------------------------------------------------- /db-module/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | nuls 7 | io.nuls 8 | 1.3.0 9 | 10 | 4.0.0 11 | 12 | io.nuls 13 | db-module 14 | 1.3.0 15 | pom 16 | 17 | 18 | UTF-8 19 | 1.8 20 | 1.8 21 | 1.8 22 | 23 | 24 | 25 | db 26 | leveldb/db-leveldb 27 | 28 | 29 | 30 | 31 | 32 | junit 33 | junit 34 | 4.12 35 | 36 | 37 | io.nuls.core-module 38 | kernel 39 | 1.3.0 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /ledger-module/README.md: -------------------------------------------------------------------------------- 1 | # ledger module 2 | -------------------------------------------------------------------------------- /ledger-module/ledger/src/main/java/io/nuls/ledger/constant/LedgerConstant.java: -------------------------------------------------------------------------------- 1 | /** 2 | * MIT License 3 | *

4 | * Copyright (c) 2017-2019 nuls.io 5 | *

6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | *

13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | *

16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package io.nuls.ledger.constant; 25 | 26 | import io.nuls.kernel.constant.NulsConstant; 27 | 28 | /** 29 | * @desription: 30 | * @author: PierreLuo 31 | */ 32 | public interface LedgerConstant extends NulsConstant { 33 | 34 | short MODULE_ID_LEDGER = 8; 35 | 36 | } 37 | -------------------------------------------------------------------------------- /ledger-module/utxo/ledger-utxo-base/src/test/resources/block/genesis-block.json: -------------------------------------------------------------------------------- 1 | { 2 | "height": 0, 3 | "time": "1514736000000", 4 | "txs": [ 5 | { 6 | "address": "2CjzG5atBtD3kk2MatNpHCVDLzg7zNb", 7 | "nuls": 20000000, 8 | "unlockHeight": 0 9 | }, 10 | { 11 | "address": "2CjK6vkn1Z5QvcgidFy69dmneav3WHY", 12 | "nuls": 20000000, 13 | "unlockHeight": 0 14 | }, 15 | { 16 | "address": "2CbdQroDQjeTSshE9SdMBkLZcYih7j8", 17 | "nuls": 20000000, 18 | "unlockHeight": 0 19 | }, 20 | { 21 | "address": "2CYC8j4P4jr1yiX9U27QPQj5LeP8Bay", 22 | "nuls": 20000000, 23 | "unlockHeight": 0 24 | }, 25 | { 26 | "address": "2Cb2osdHyiiys5THNHNXTk2KZYD7vvU", 27 | "nuls": 20000000, 28 | "unlockHeight": 0 29 | } 30 | ] 31 | } -------------------------------------------------------------------------------- /ledger-module/utxo/ledger-utxo-base/src/test/resources/modules.ini: -------------------------------------------------------------------------------- 1 | [db] 2 | bootstrap= io.nuls.db.module.impl.LevelDbModuleBootstrap 3 | 4 | [ledger] 5 | bootstrap= io.nuls.ledger.module.impl.UtxoLedgerModuleBootstrap 6 | 7 | [protocol] 8 | bootstrap= io.nuls.protocol.base.module.BaseProtocolsModuleBootstrap 9 | -------------------------------------------------------------------------------- /ledger-module/utxo/ledger-utxo-base/src/test/resources/nuls.ini: -------------------------------------------------------------------------------- 1 | [System] 2 | language=en 3 | encoding=UTF-8 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ledger-module/utxo/ledger-utxo-rpc/src/main/java/io/nuls/ledger/rpc/model/Holder.java: -------------------------------------------------------------------------------- 1 | package io.nuls.ledger.rpc.model; 2 | 3 | import io.nuls.core.tools.calc.DoubleUtils; 4 | 5 | /** 6 | * @author: Niels Wang 7 | * @date: 2018/10/11 8 | */ 9 | public class Holder implements Comparable { 10 | 11 | private String address; 12 | 13 | private double totalNuls; 14 | 15 | private double lockedNuls; 16 | 17 | public String getAddress() { 18 | return address; 19 | } 20 | 21 | public void setAddress(String address) { 22 | this.address = address; 23 | } 24 | 25 | public double getTotalNuls() { 26 | return totalNuls; 27 | } 28 | 29 | public void setTotalNuls(double totalNuls) { 30 | this.totalNuls = totalNuls; 31 | } 32 | 33 | public double getLockedNuls() { 34 | return lockedNuls; 35 | } 36 | 37 | public void setLockedNuls(double lockedNuls) { 38 | this.lockedNuls = lockedNuls; 39 | } 40 | 41 | public void addTotal(double value) { 42 | totalNuls = DoubleUtils.sum(totalNuls, value); 43 | } 44 | 45 | public void addLocked(double value) { 46 | lockedNuls = DoubleUtils.sum(lockedNuls, value); 47 | } 48 | 49 | @Override 50 | public int compareTo(Object o) { 51 | if (null == o || !(o instanceof Holder)) { 52 | return -1; 53 | } 54 | Holder obj = (Holder) o; 55 | if (obj.getTotalNuls() > this.getTotalNuls()) { 56 | return 1; 57 | } 58 | if (obj.getTotalNuls() < this.getTotalNuls()) { 59 | return -1; 60 | } 61 | return 0; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /ledger-module/utxo/ledger-utxo-rpc/src/main/java/io/nuls/ledger/rpc/model/HolderDto.java: -------------------------------------------------------------------------------- 1 | package io.nuls.ledger.rpc.model; 2 | 3 | import io.nuls.core.tools.calc.DoubleUtils; 4 | import io.swagger.annotations.ApiModelProperty; 5 | 6 | /** 7 | * @author: Niels Wang 8 | * @date: 2018/10/11 9 | */ 10 | public class HolderDto { 11 | 12 | @ApiModelProperty(name = "address", value = "账户地址") 13 | private String address; 14 | 15 | @ApiModelProperty(name = "totalNuls", value = "账户余额") 16 | private String totalNuls; 17 | 18 | @ApiModelProperty(name = "lockedNuls", value = "账户锁定余额") 19 | private String lockedNuls; 20 | 21 | public HolderDto(Holder holder) { 22 | this.address = holder.getAddress(); 23 | this.totalNuls = DoubleUtils.getRoundStr(holder.getTotalNuls(),8,true); 24 | this.lockedNuls = DoubleUtils.getRoundStr(holder.getLockedNuls(),8,true); 25 | } 26 | 27 | public String getAddress() { 28 | return address; 29 | } 30 | 31 | public void setAddress(String address) { 32 | this.address = address; 33 | } 34 | 35 | public String getTotalNuls() { 36 | return totalNuls; 37 | } 38 | 39 | public void setTotalNuls(String totalNuls) { 40 | this.totalNuls = totalNuls; 41 | } 42 | 43 | public String getLockedNuls() { 44 | return lockedNuls; 45 | } 46 | 47 | public void setLockedNuls(String lockedNuls) { 48 | this.lockedNuls = lockedNuls; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /ledger-module/utxo/ledger-utxo-rpc/src/main/java/io/nuls/ledger/rpc/model/NulsInfoDto.java: -------------------------------------------------------------------------------- 1 | package io.nuls.ledger.rpc.model; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author: Niels Wang 9 | * @date: 2018/10/11 10 | */ 11 | public class NulsInfoDto { 12 | 13 | @ApiModelProperty(name = "totalNuls", value = "总的nuls数量") 14 | private Long totalNuls; 15 | 16 | @ApiModelProperty(name = "totalNuls", value = "总的nuls数量") 17 | private Long lockedNuls; 18 | 19 | public Long getTotalNuls() { 20 | return totalNuls; 21 | } 22 | 23 | public void setTotalNuls(Long totalNuls) { 24 | this.totalNuls = totalNuls; 25 | } 26 | 27 | public Long getLockedNuls() { 28 | return lockedNuls; 29 | } 30 | 31 | public void setLockedNuls(Long lockedNuls) { 32 | this.lockedNuls = lockedNuls; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ledger-module/utxo/ledger-utxo-rpc/src/main/java/io/nuls/ledger/rpc/model/TokenInfoDto.java: -------------------------------------------------------------------------------- 1 | package io.nuls.ledger.rpc.model; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author: Niels Wang 9 | * @date: 2018/10/11 10 | */ 11 | public class TokenInfoDto { 12 | 13 | @ApiModelProperty(name = "totalNuls", value = "总的nuls数量") 14 | private String totalNuls; 15 | 16 | @ApiModelProperty(name = "totalNuls", value = "总的nuls数量") 17 | private String lockedNuls; 18 | 19 | @ApiModelProperty(name = "addressList", value = "持币明细") 20 | private List addressList; 21 | 22 | public String getTotalNuls() { 23 | return totalNuls; 24 | } 25 | 26 | public void setTotalNuls(String totalNuls) { 27 | this.totalNuls = totalNuls; 28 | } 29 | 30 | public String getLockedNuls() { 31 | return lockedNuls; 32 | } 33 | 34 | public void setLockedNuls(String lockedNuls) { 35 | this.lockedNuls = lockedNuls; 36 | } 37 | 38 | public List getAddressList() { 39 | return addressList; 40 | } 41 | 42 | public void setAddressList(List addressList) { 43 | this.addressList = addressList; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /ledger-module/utxo/ledger-utxo-storage/src/main/java/io/nuls/ledger/storage/constant/LedgerStorageConstant.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package io.nuls.ledger.storage.constant; 27 | 28 | 29 | /** 30 | * @desription: 31 | * @author: PierreLuo 32 | */ 33 | public interface LedgerStorageConstant { 34 | 35 | String DB_NAME_LEDGER_TX = "ledger_tx"; 36 | String DB_NAME_LEDGER_UTXO = "ledger_utxo"; 37 | 38 | } 39 | -------------------------------------------------------------------------------- /message-bus-module/README.md: -------------------------------------------------------------------------------- 1 | # msg bus module 2 | -------------------------------------------------------------------------------- /message-bus-module/base/message-bus-base/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | message-bus-module 7 | io.nuls 8 | 1.3.0 9 | ../../pom.xml 10 | 11 | 4.0.0 12 | 13 | io.nuls.message-bus-module 14 | message-bus-base 15 | 1.3.0 16 | 17 | 18 | 19 | 20 | junit 21 | junit 22 | 4.12 23 | test 24 | 25 | 26 | io.nuls.message-bus-module 27 | message-bus 28 | 1.3.0 29 | 30 | 31 | io.nuls.network-module 32 | network-netty 33 | 1.3.0 34 | test 35 | 36 | 37 | 38 | ${project.artifactId}-${project.version} 39 | 40 | -------------------------------------------------------------------------------- /message-bus-module/base/message-bus-base/src/test/java/TestHandler/BlockMessageHandler.java: -------------------------------------------------------------------------------- 1 | package TestHandler; 2 | 3 | import io.nuls.kernel.exception.NulsException; 4 | import io.nuls.message.bus.handler.AbstractMessageHandler; 5 | import io.nuls.network.model.Node; 6 | import io.nuls.protocol.message.BlockMessage; 7 | 8 | /** 9 | * @author: Charlie 10 | */ 11 | public class BlockMessageHandler extends AbstractMessageHandler { 12 | 13 | @Override 14 | public void onMessage(BlockMessage message, Node node) throws NulsException { 15 | System.out.println("onMessage: this is a TestNetwork funtion"); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /message-bus-module/message-bus/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | message-bus-module 7 | io.nuls 8 | 1.3.0 9 | 10 | 4.0.0 11 | 12 | io.nuls.message-bus-module 13 | message-bus 14 | 1.3.0 15 | 16 | 17 | 18 | io.nuls.core-module 19 | kernel 20 | 1.3.0 21 | 22 | 23 | io.nuls.protocol-module 24 | protocol 25 | 1.3.0 26 | 27 | 28 | 29 | ${project.artifactId}-${project.version} 30 | 31 | 32 | -------------------------------------------------------------------------------- /message-bus-module/message-bus/src/main/java/io/nuls/message/bus/constant/MessageBusErrorCode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package io.nuls.message.bus.constant; 27 | 28 | 29 | import io.nuls.kernel.constant.ErrorCode; 30 | import io.nuls.kernel.constant.KernelErrorCode; 31 | 32 | /** 33 | * @author: Charlie 34 | */ 35 | public interface MessageBusErrorCode extends KernelErrorCode { 36 | 37 | ErrorCode UNKOWN_MSG_TYPE= ErrorCode.init("60001"); 38 | } 39 | -------------------------------------------------------------------------------- /message-bus-module/message-bus/src/main/java/io/nuls/message/bus/filter/NulsMessageFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package io.nuls.message.bus.filter; 27 | 28 | import io.nuls.protocol.message.base.BaseMessage; 29 | 30 | /** 31 | * Nuls事件过滤器 32 | * The Nuls event filter. 33 | * 34 | * @author: Charlie 35 | */ 36 | public interface NulsMessageFilter { 37 | 38 | void doFilter(T data, NulsMessageFilterChain chain); 39 | } 40 | -------------------------------------------------------------------------------- /message-bus-module/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | nuls 7 | io.nuls 8 | 1.3.0 9 | 10 | 4.0.0 11 | 12 | io.nuls 13 | message-bus-module 14 | 1.3.0 15 | pom 16 | 17 | 18 | message-bus 19 | base/message-bus-base 20 | 21 | 22 | -------------------------------------------------------------------------------- /network-module/README.md: -------------------------------------------------------------------------------- 1 | # account module 2 | -------------------------------------------------------------------------------- /network-module/base/network-netty/src/main/java/io/nuls/network/netty/conn/NodeAttributeKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package io.nuls.network.netty.conn; 27 | 28 | import io.netty.util.AttributeKey; 29 | import io.nuls.network.model.Node; 30 | 31 | public class NodeAttributeKey { 32 | public static AttributeKey NODE_KEY = AttributeKey.valueOf("node"); 33 | } 34 | -------------------------------------------------------------------------------- /network-module/base/network-netty/src/main/java/io/nuls/network/netty/message/filter/NulsMessageFilter.java: -------------------------------------------------------------------------------- 1 | /** 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package io.nuls.network.netty.message.filter; 25 | 26 | import io.nuls.protocol.message.base.BaseMessage; 27 | 28 | /** 29 | * @author vivi 30 | */ 31 | public interface NulsMessageFilter { 32 | 33 | boolean filter(BaseMessage message); 34 | } 35 | -------------------------------------------------------------------------------- /network-module/base/network-netty/src/test/java/io/nuls/network/test/NetworkTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package io.nuls.network.test; 27 | 28 | import org.junit.Test; 29 | 30 | public class NetworkTest { 31 | 32 | @Test 33 | public void testNetworkMessage() { 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /network-module/base/network-protocol/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | network-module 7 | io.nuls 8 | 1.3.0 9 | ../../pom.xml 10 | 11 | 4.0.0 12 | 13 | io.nuls.network-module 14 | network-protocol 15 | 1.3.0 16 | 17 | 18 | 19 | 20 | io.nuls.protocol-module 21 | protocol 22 | 1.3.0 23 | 24 | 25 | 26 | ${project.artifactId}-${project.version} 27 | 28 | -------------------------------------------------------------------------------- /network-module/base/network-protocol/src/main/java/io/nuls/network/protocol/handler/BaseNetworkMeesageHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package io.nuls.network.protocol.handler; 27 | 28 | import io.nuls.network.model.NetworkEventResult; 29 | import io.nuls.network.model.Node; 30 | import io.nuls.protocol.message.base.BaseMessage; 31 | 32 | public interface BaseNetworkMeesageHandler { 33 | 34 | NetworkEventResult process(BaseMessage message, Node node); 35 | } 36 | -------------------------------------------------------------------------------- /network-module/base/network-protocol/src/main/resources/network-protocol.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /network-module/base/network-storage/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | network-module 7 | io.nuls 8 | 1.3.0 9 | ../../pom.xml 10 | 11 | 4.0.0 12 | 13 | io.nuls.network-module 14 | network-storage 15 | 1.3.0 16 | 17 | 18 | 19 | 20 | io.nuls.db-module 21 | db 22 | 1.3.0 23 | 24 | 25 | io.nuls.network-module 26 | network 27 | 1.3.0 28 | 29 | 30 | 31 | ${project.artifactId}-${project.version} 32 | 33 | -------------------------------------------------------------------------------- /network-module/base/network-storage/src/main/java/io/nuls/network/storage/constant/NetworkStorageConstant.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package io.nuls.network.storage.constant; 27 | 28 | public interface NetworkStorageConstant { 29 | 30 | String DB_NAME_NETWORK_NODE = "network_node"; 31 | 32 | String DB_NAME_EXTERNAL_IP = "external_ip"; 33 | 34 | long NODE_DB_CACHE_SIZE = 1024 * 1024; 35 | } 36 | -------------------------------------------------------------------------------- /network-module/base/network-storage/src/main/java/io/nuls/network/storage/po/NodeContainerPo.java: -------------------------------------------------------------------------------- 1 | package io.nuls.network.storage.po; 2 | 3 | import java.io.Serializable; 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | 7 | public class NodeContainerPo implements Serializable { 8 | 9 | private List disConnectNodes; 10 | 11 | private List canConnectNodes; 12 | 13 | private List failNodes; 14 | 15 | private List uncheckNodes; 16 | 17 | public NodeContainerPo(){ 18 | disConnectNodes = new ArrayList<>(); 19 | canConnectNodes = new ArrayList<>(); 20 | failNodes = new ArrayList<>(); 21 | uncheckNodes = new ArrayList<>(); 22 | } 23 | 24 | public List getDisConnectNodes() { 25 | return disConnectNodes; 26 | } 27 | 28 | public void setDisConnectNodes(List disConnectNodes) { 29 | this.disConnectNodes = disConnectNodes; 30 | } 31 | 32 | public List getCanConnectNodes() { 33 | return canConnectNodes; 34 | } 35 | 36 | public void setCanConnectNodes(List canConnectNodes) { 37 | this.canConnectNodes = canConnectNodes; 38 | } 39 | 40 | public List getFailNodes() { 41 | return failNodes; 42 | } 43 | 44 | public void setFailNodes(List failNodes) { 45 | this.failNodes = failNodes; 46 | } 47 | 48 | public List getUncheckNodes() { 49 | return uncheckNodes; 50 | } 51 | 52 | public void setUncheckNodes(List uncheckNodes) { 53 | this.uncheckNodes = uncheckNodes; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /network-module/network/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | network-module 7 | io.nuls 8 | 1.3.0 9 | 10 | 4.0.0 11 | 12 | io.nuls.network-module 13 | network 14 | 1.3.0 15 | 16 | 17 | 18 | 19 | io.nuls.core-module 20 | kernel 21 | 1.3.0 22 | 23 | 24 | io.netty 25 | netty-all 26 | 4.1.32.Final 27 | 28 | 29 | 30 | ${project.artifactId}-${project.version} 31 | 32 | -------------------------------------------------------------------------------- /network-module/network/src/main/java/io/nuls/network/listener/EventListener.java: -------------------------------------------------------------------------------- 1 | package io.nuls.network.listener; 2 | 3 | public interface EventListener { 4 | void action(); 5 | } 6 | -------------------------------------------------------------------------------- /network-module/network/src/main/java/io/nuls/network/model/NodeConnectStatusEnum.java: -------------------------------------------------------------------------------- 1 | package io.nuls.network.model; 2 | 3 | public class NodeConnectStatusEnum { 4 | public final static int UNCONNECT = 0; 5 | public final static int CONNECTING = 1; 6 | public final static int CONNECTED = 2; 7 | public final static int DISCONNECT = 3; 8 | public final static int FAIL = 4; 9 | public final static int AVAILABLE = 5; 10 | } 11 | -------------------------------------------------------------------------------- /network-module/network/src/main/java/io/nuls/network/model/NodeStatusEnum.java: -------------------------------------------------------------------------------- 1 | package io.nuls.network.model; 2 | 3 | public class NodeStatusEnum { 4 | 5 | public final static int UNCHECK = 0; 6 | public final static int AVAILABLE = 1; 7 | public final static int CONNECTABLE = 2; 8 | public final static int UNAVAILABLE = 3; 9 | } 10 | -------------------------------------------------------------------------------- /network-module/network/src/main/java/io/nuls/network/module/AbstractNetworkModule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package io.nuls.network.module; 27 | 28 | import io.nuls.kernel.module.BaseModuleBootstrap; 29 | import io.nuls.network.constant.NetworkConstant; 30 | 31 | public abstract class AbstractNetworkModule extends BaseModuleBootstrap { 32 | 33 | protected AbstractNetworkModule() { 34 | super(NetworkConstant.NETWORK_MODULE_ID); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /network-module/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | nuls 7 | io.nuls 8 | 1.3.0 9 | 10 | 4.0.0 11 | 12 | io.nuls 13 | network-module 14 | 1.3.0 15 | pom 16 | 17 | network 18 | base/network-netty 19 | base/network-protocol 20 | base/network-storage 21 | base/network-rpc 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /protocol-module/README.md: -------------------------------------------------------------------------------- 1 | # nuls protocol modules 2 | -------------------------------------------------------------------------------- /protocol-module/base/protocol-base/src/main/java/io/nuls/protocol/base/constant/DownloadStatus.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package io.nuls.protocol.base.constant; 27 | 28 | /** 29 | * Created by ln on 2018/4/8. 30 | */ 31 | public enum DownloadStatus { 32 | 33 | WAIT, 34 | 35 | READY, 36 | 37 | DOWNLOADING, 38 | 39 | SUCCESS, 40 | 41 | FAILED, 42 | 43 | STOPPED; 44 | 45 | } 46 | -------------------------------------------------------------------------------- /protocol-module/base/protocol-base/src/test/resources/block/genesis-block.json: -------------------------------------------------------------------------------- 1 | { 2 | "height": 0, 3 | "time": "1514736000000", 4 | "txs": [ 5 | { 6 | "address": "2CjzG5atBtD3kk2MatNpHCVDLzg7zNb", 7 | "nuls": 20000000, 8 | "unlockHeight": 0 9 | }, 10 | { 11 | "address": "2CjK6vkn1Z5QvcgidFy69dmneav3WHY", 12 | "nuls": 20000000, 13 | "unlockHeight": 0 14 | }, 15 | { 16 | "address": "2CbdQroDQjeTSshE9SdMBkLZcYih7j8", 17 | "nuls": 20000000, 18 | "unlockHeight": 0 19 | }, 20 | { 21 | "address": "2CYC8j4P4jr1yiX9U27QPQj5LeP8Bay", 22 | "nuls": 20000000, 23 | "unlockHeight": 0 24 | }, 25 | { 26 | "address": "2Cb2osdHyiiys5THNHNXTk2KZYD7vvU", 27 | "nuls": 20000000, 28 | "unlockHeight": 0 29 | } 30 | ] 31 | } -------------------------------------------------------------------------------- /protocol-module/base/protocol-base/src/test/resources/languages/zh-CHS.properties: -------------------------------------------------------------------------------- 1 | 10000=操作成功 2 | 10001=操作失败 3 | 10998=警告 4 | 10999=未知错误 5 | 99999=未知错误 6 | 10002=找不到文件 7 | 10003=参数为空 8 | 10004=接口重复注册 9 | 10005=线程名称重复 10 | 10006=数据错误 11 | 10007=线程必须指定所属模块 12 | 10008=接口未找到 13 | 10009=配置项不存在 14 | 10010=语言类型不能设置为空 15 | 10011=读写错误 16 | 10012=反序列化错误 17 | 10013=计算摘要错误 18 | 10014=数据大小错误 19 | 10015=数据字段错误 20 | 10016=配置错误 21 | 10017=模块加载超时 22 | 10018=参数错误 23 | 10019=数据不存在 24 | 10020=文件损坏 25 | 11000=验证不通过 26 | 11001=数据解析错误 27 | 11002=数据超出限制 28 | 11003=输入值错误 29 | 20000=数据存储模块启动失败 30 | 20001=数据存储异常 31 | 20002=会话未初始化 32 | 20003=不能保存null数据 33 | 20004=批量保存数量超出限制 34 | 20005=数据不正确 35 | 20006=保存失败 36 | 20007=更新失败 37 | 20008=回滚出错 38 | 30000=点对点网络未知异常 39 | 30001=P2P分组已存在 40 | 40001=网络服务启动失败 41 | 40002=网络消息错误 42 | 40003=网络消息异或错误 43 | 40004=网络消息长度错误 44 | 40005=P2P错误 45 | 40006=节点组已存在 46 | 40007=节点区域已存在 47 | 40008=节点组不存在 48 | 40009=节点区域不存在 49 | 40010=节点不存在 50 | 45000=密码错误 51 | 45001=账户不存在 52 | 45002=账户已加密 53 | 45003=账户已经存在 54 | 45004=账户地址格式不正确 55 | 45005=该昵称已经被占用 56 | 50001=请求被拒绝 57 | 60000=共识未知异常 58 | 60001=超时 59 | 60002=保证金不正确 60 | 60003=保证金不足 61 | 60004=共识会议中异常 62 | 60005=佣金超出范围 63 | 60006=信用不足 64 | 60007=超出可委托数量 65 | 60008=超出委托金额 66 | 69980=尝试分叉 67 | 69981=尝试双花 68 | 69997=未参与共识 69 | 69998=共识中 70 | 69999=等待加入共识 71 | 12001=UTXO不可花费 72 | 12002=UTXO状态错误 73 | 12003=余额不足 74 | 12004=交易输入无效 75 | 12005=交易输出无效 76 | 12006=孤儿交易 77 | 12007=孤儿块 78 | 12008=数据不存在 79 | 80001=接收到一笔交易 80 | 80002=接收到一个新的区块头 81 | 80003=创建了一个新的地址 82 | 80004=修改了默认账户 83 | 80005=修改了钱包账户 84 | 80006=地址设置了别名 85 | 80007=导入了账户 86 | 80008=成功打包区块 87 | 80009=注册代理节点 88 | 80010=组装了区块 89 | 80011=抵押参与共识 90 | 80012=注销共识节点 91 | 80013=撤销一笔抵押共识 92 | 80014=余额变动 -------------------------------------------------------------------------------- /protocol-module/base/protocol-base/src/test/resources/modules.ini: -------------------------------------------------------------------------------- 1 | [db] 2 | bootstrap=io.nuls.db.module.impl.MybatisDbModuleBootstrap 3 | 4 | [cache] 5 | bootstrap=io.nuls.cache.module.impl.EhCacheModuleBootstrap 6 | 7 | [account] 8 | bootstrap=io.nuls.account.module.impl.AccountModuleBootstrap 9 | 10 | [event-bus] 11 | bootstrap=io.nuls.event.bus.module.impl.EventBusModuleBootstrap 12 | 13 | [ledger] 14 | bootstrap=io.nuls.ledger.module.impl.UtxoLedgerModuleBootstrap 15 | 16 | [protocol] 17 | bootstrap=io.nuls.protocol.base.module.impl.BaseProtocolsModuleBootstrap 18 | 19 | [network] 20 | bootstrap=io.nuls.network.module.impl.NetworkModuleBootstrap 21 | network.server.port=8004 22 | network.magic=12312345 23 | network.max.in=10 24 | network.max.out=10 25 | network.seed.ip=192.168.1.201:8004 26 | [consensus] 27 | bootstrap=PocConsensusModuleBootstrap 28 | partake.packing=true 29 | seed.nodes=2CiYPSsrXVGmPudD6rumANCBT7tjJk7 30 | 31 | [notify] 32 | bootstrap=io.nuls.notify.module.NotifyModuleBootstrap 33 | notify.port=8002 34 | 35 | [client] 36 | bootstrap=io.nuls.rpc.module.impl.RpcServerModuleBootstrap 37 | server.ip=127.0.0.1 38 | server.port=8001 39 | request.white.sheet=127.0.0.1 -------------------------------------------------------------------------------- /protocol-module/base/protocol-base/src/test/resources/nuls.ini: -------------------------------------------------------------------------------- 1 | [System] 2 | chain.id=-3068 3 | language=en 4 | encoding=UTF-8 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /protocol-module/base/protocol-storage/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | protocol-module 7 | io.nuls 8 | 1.3.0 9 | ../../pom.xml 10 | 11 | 4.0.0 12 | 13 | io.nuls.protocol-module 14 | protocol-storage 15 | 1.3.0 16 | 17 | 18 | 19 | io.nuls.db-module 20 | db-leveldb 21 | 1.3.0 22 | test 23 | 24 | 25 | 26 | io.nuls.db-module 27 | db 28 | 1.3.0 29 | 30 | 31 | 32 | ${project.artifactId}-${project.version} 33 | 34 | 35 | -------------------------------------------------------------------------------- /protocol-module/base/protocol-storage/src/test/resources/block/genesis-block.json: -------------------------------------------------------------------------------- 1 | { 2 | "height": 0, 3 | "time": "1514736000000", 4 | "txs": [ 5 | { 6 | "address": "2CjzG5atBtD3kk2MatNpHCVDLzg7zNb", 7 | "nuls": 20000000, 8 | "unlockHeight": 0 9 | }, 10 | { 11 | "address": "2CjK6vkn1Z5QvcgidFy69dmneav3WHY", 12 | "nuls": 20000000, 13 | "unlockHeight": 0 14 | }, 15 | { 16 | "address": "2CbdQroDQjeTSshE9SdMBkLZcYih7j8", 17 | "nuls": 20000000, 18 | "unlockHeight": 0 19 | }, 20 | { 21 | "address": "2CYC8j4P4jr1yiX9U27QPQj5LeP8Bay", 22 | "nuls": 20000000, 23 | "unlockHeight": 0 24 | }, 25 | { 26 | "address": "2Cb2osdHyiiys5THNHNXTk2KZYD7vvU", 27 | "nuls": 20000000, 28 | "unlockHeight": 0 29 | } 30 | ] 31 | } -------------------------------------------------------------------------------- /protocol-module/base/protocol-storage/src/test/resources/languages/zh-CHS.properties: -------------------------------------------------------------------------------- 1 | 10000=操作成功 2 | 10001=操作失败 3 | 10998=警告 4 | 10999=未知错误 5 | 99999=未知错误 6 | 10002=找不到文件 7 | 10003=参数为空 8 | 10004=接口重复注册 9 | 10005=线程名称重复 10 | 10006=数据错误 11 | 10007=线程必须指定所属模块 12 | 10008=接口未找到 13 | 10009=配置项不存在 14 | 10010=语言类型不能设置为空 15 | 10011=读写错误 16 | 10012=反序列化错误 17 | 10013=计算摘要错误 18 | 10014=数据大小错误 19 | 10015=数据字段错误 20 | 10016=配置错误 21 | 10017=模块加载超时 22 | 10018=参数错误 23 | 10019=数据不存在 24 | 10020=文件损坏 25 | 11000=验证不通过 26 | 11001=数据解析错误 27 | 11002=数据超出限制 28 | 11003=输入值错误 29 | 20000=数据存储模块启动失败 30 | 20001=数据存储异常 31 | 20002=会话未初始化 32 | 20003=不能保存null数据 33 | 20004=批量保存数量超出限制 34 | 20005=数据不正确 35 | 20006=保存失败 36 | 20007=更新失败 37 | 20008=回滚出错 38 | 30000=点对点网络未知异常 39 | 30001=P2P分组已存在 40 | 40001=网络服务启动失败 41 | 40002=网络消息错误 42 | 40003=网络消息异或错误 43 | 40004=网络消息长度错误 44 | 40005=P2P错误 45 | 40006=节点组已存在 46 | 40007=节点区域已存在 47 | 40008=节点组不存在 48 | 40009=节点区域不存在 49 | 40010=节点不存在 50 | 45000=密码错误 51 | 45001=账户不存在 52 | 45002=账户已加密 53 | 45003=账户已经存在 54 | 45004=账户地址格式不正确 55 | 45005=该昵称已经被占用 56 | 50001=请求被拒绝 57 | 60000=共识未知异常 58 | 60001=超时 59 | 60002=保证金不正确 60 | 60003=保证金不足 61 | 60004=共识会议中异常 62 | 60005=佣金超出范围 63 | 60006=信用不足 64 | 60007=超出可委托数量 65 | 60008=超出委托金额 66 | 69980=尝试分叉 67 | 69981=尝试双花 68 | 69997=未参与共识 69 | 69998=共识中 70 | 69999=等待加入共识 71 | 70001=UTXO不可花费 72 | 70002=UTXO状态错误 73 | 70003=余额不足 74 | 70004=交易输入无效 75 | 70005=交易输出无效 76 | 70006=孤儿交易 77 | 70007=孤儿块 78 | 70008=数据不存在 79 | 80001=接收到一笔交易 80 | 80002=接收到一个新的区块头 81 | 80003=创建了一个新的地址 82 | 80004=修改了默认账户 83 | 80005=修改了钱包账户 84 | 80006=地址设置了别名 85 | 80007=导入了账户 86 | 80008=成功打包区块 87 | 80009=注册代理节点 88 | 80010=组装了区块 89 | 80011=抵押参与共识 90 | 80012=注销共识节点 91 | 80013=撤销一笔抵押共识 92 | 80014=余额变动 -------------------------------------------------------------------------------- /protocol-module/base/protocol-storage/src/test/resources/modules.ini: -------------------------------------------------------------------------------- 1 | [db] 2 | bootstrap=io.nuls.db.module.impl.MybatisDbModuleBootstrap 3 | 4 | [cache] 5 | bootstrap=io.nuls.cache.module.impl.EhCacheModuleBootstrap 6 | 7 | [account] 8 | bootstrap=io.nuls.account.module.impl.AccountModuleBootstrap 9 | 10 | [event-bus] 11 | bootstrap=io.nuls.event.bus.module.impl.EventBusModuleBootstrap 12 | 13 | [ledger] 14 | bootstrap=io.nuls.ledger.module.impl.UtxoLedgerModuleBootstrap 15 | 16 | [protocol] 17 | bootstrap=io.nuls.protocol.base.module.impl.BaseProtocolsModuleBootstrap 18 | 19 | [network] 20 | bootstrap=io.nuls.network.module.impl.NetworkModuleBootstrap 21 | network.server.port=8004 22 | network.magic=12312333 23 | network.max.in=10 24 | network.max.out=10 25 | network.seed.ip=192.168.1.201:8004,192.168.1.90:8004,192.168.1.160:8004,192.168.1.203:8004,192.168.1.188:8004 26 | [consensus] 27 | bootstrap=io.nuls.consensus.poc.module.impl.PocConsensusModuleBootstrap 28 | partake.packing=true 29 | seed.nodes=2CiYPSsrXVGmPudD6rumANCBT7tjJk7 30 | 31 | [notify] 32 | bootstrap=io.nuls.notify.module.NotifyModuleBootstrap 33 | notify.port=8002 34 | 35 | [rpc] 36 | bootstrap=io.nuls.rpc.module.impl.RpcServerModuleBootstrap 37 | server.ip=127.0.0.1 38 | server.port=8001 39 | request.white.sheet=127.0.0.1 -------------------------------------------------------------------------------- /protocol-module/base/protocol-storage/src/test/resources/nuls.ini: -------------------------------------------------------------------------------- 1 | [System] 2 | language=en 3 | encoding=UTF-8 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /protocol-module/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | nuls 7 | io.nuls 8 | 1.3.0 9 | 10 | 4.0.0 11 | io.nuls 12 | protocol-module 13 | 1.3.0 14 | pom 15 | 16 | 17 | protocol 18 | base/protocol-rpc 19 | base/protocol-storage 20 | base/protocol-base 21 | 22 | 23 | 24 | io.nuls.core-module 25 | kernel 26 | 1.3.0 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /tools-module/cache/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | io.nuls 7 | tools-module 8 | 1.3.0 9 | ../pom.xml 10 | 11 | 4.0.0 12 | 13 | io.nuls.tools-module 14 | cache 15 | 1.3.0 16 | 17 | 18 | 19 | 20 | org.ehcache 21 | ehcache 22 | 3.5.2 23 | 24 | 25 | io.nuls.tools-module 26 | tools 27 | 1.3.0 28 | 29 | 30 | io.protostuff 31 | protostuff-core 32 | 1.6.0 33 | 34 | 35 | io.protostuff 36 | protostuff-runtime 37 | 1.6.0 38 | 39 | 40 | 41 | ${project.artifactId}-${project.version} 42 | 43 | -------------------------------------------------------------------------------- /tools-module/tools/src/main/java/io/nuls/core/tools/crypto/Exception/CryptoException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | package io.nuls.core.tools.crypto.Exception; 26 | 27 | /** 28 | * author Facjas 29 | * date 2018/6/13. 30 | */ 31 | public class CryptoException extends Exception{ 32 | } 33 | -------------------------------------------------------------------------------- /tools-module/tools/src/main/java/io/nuls/core/tools/crypto/Ints.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | package io.nuls.core.tools.crypto; 26 | 27 | public class Ints { 28 | 29 | public static int fromBytes(byte b1, byte b2, byte b3, byte b4) { 30 | return b1 << 24 | (b2 & 0xFF) << 16 | (b3 & 0xFF) << 8 | (b4 & 0xFF); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tools-module/tools/src/main/java/io/nuls/core/tools/crypto/SM4_Context.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | package io.nuls.core.tools.crypto; 26 | 27 | /** 28 | * Created by facjas on 2017/11/20. 29 | */ 30 | public class SM4_Context { 31 | public int mode; 32 | 33 | public long[] sk; 34 | 35 | public boolean isPadding; 36 | 37 | public SM4_Context() { 38 | this.mode = 1; 39 | this.isPadding = true; 40 | this.sk = new long[32]; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /tools-module/tools/src/test/java/io/nuls/core/tools/crypto/ECKeyTest.java: -------------------------------------------------------------------------------- 1 | package io.nuls.core.tools.crypto; 2 | 3 | import org.junit.Assert; 4 | import org.junit.Test; 5 | import org.spongycastle.util.encoders.Base64; 6 | 7 | import java.security.SignatureException; 8 | 9 | public class ECKeyTest { 10 | 11 | @Test 12 | public void signedMessageToKeyTest() throws SignatureException { 13 | ECKey key = new ECKey(); 14 | System.out.println(key.getPrivateKeyAsHex()); 15 | System.out.println(key.getPublicKeyAsHex()); 16 | String message = "Nuls Signed Message:\nHello,I'am test case!@##$%998877"; 17 | String signatureBase64 = key.signMessage(message,null); 18 | System.out.println(signatureBase64); 19 | System.out.println(Base64.decode(signatureBase64).length); 20 | ECKey recoveryECKey = ECKey.signedMessageToKey(message, signatureBase64); 21 | Assert.assertEquals(recoveryECKey.getPublicKeyAsHex(),key.getPublicKeyAsHex()); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /utxo-accounts-module/base/utxo-accounts-base/src/main/java/io/nuls/utxo/accounts/constant/UtxoAccountsErrorCode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package io.nuls.utxo.accounts.constant; 27 | 28 | 29 | import io.nuls.kernel.constant.KernelErrorCode; 30 | 31 | /** 32 | * @author: cody 33 | */ 34 | public interface UtxoAccountsErrorCode extends KernelErrorCode { 35 | } 36 | -------------------------------------------------------------------------------- /utxo-accounts-module/base/utxo-accounts-base/src/main/java/io/nuls/utxo/accounts/locker/Lockers.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | package io.nuls.utxo.accounts.locker; 26 | 27 | import java.util.concurrent.locks.Lock; 28 | import java.util.concurrent.locks.ReentrantLock; 29 | 30 | public class Lockers { 31 | public final static Lock SYN_UTXO_ACCOUNTS_LOCK = new ReentrantLock(); 32 | } 33 | -------------------------------------------------------------------------------- /utxo-accounts-module/base/utxo-accounts-base/src/test/java/Test.java: -------------------------------------------------------------------------------- 1 | import io.nuls.core.tools.log.Log; 2 | import io.nuls.kernel.exception.NulsException; 3 | 4 | import io.nuls.kernel.script.TransactionSignature; 5 | import io.nuls.kernel.utils.AddressTool; 6 | 7 | import java.util.Arrays; 8 | 9 | public class Test { 10 | public static void main(String []args){ 11 | String str="2102ac3f8f73d6a0f23d9ecd797fb14f96e82a032bb972f1ee39b4bf443d07a5d55e004630440220668f5538cdbbd90e3dfc1ea1197ddb03cd8628dedfc77afad795140f3867560302202453d0991dc254ae2a5f40f915ef22e0c0e9ba315516d22eaa2e002fc9239147"; 12 | TransactionSignature signature = new TransactionSignature(); 13 | try { 14 | signature.parse(str.getBytes(),0); 15 | } catch (NulsException e) { 16 | Log.error(e); 17 | } 18 | 19 | signature.getP2PHKSignatures().forEach(p -> { 20 | System.out.println(Arrays.toString(p.getPublicKey())); 21 | }); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /utxo-accounts-module/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | nuls 7 | io.nuls 8 | 1.3.0 9 | ../pom.xml 10 | 11 | 4.0.0 12 | io.nuls 13 | utxo-accounts-module 14 | pom 15 | 1.3.0 16 | 17 | base/utxo-accounts-base 18 | base/utxo-accounts-rpc 19 | base/utxo-accounts-storage 20 | utxo-accounts 21 | 22 | 23 | 24 | io.nuls.core-module 25 | kernel 26 | 1.3.0 27 | compile 28 | 29 | 30 | -------------------------------------------------------------------------------- /utxo-accounts-module/utxo-accounts/src/main/java/io/nuls/utxo/accounts/service/UtxoAccountsBalanceService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2017-2019 nuls.io 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | package io.nuls.utxo.accounts.service; 26 | 27 | 28 | import io.nuls.kernel.model.Result; 29 | import io.nuls.utxo.accounts.model.UtxoAccountsBalance; 30 | 31 | public interface UtxoAccountsBalanceService { 32 | Result getUtxoAccountsBalance(byte []owner); 33 | } 34 | --------------------------------------------------------------------------------