Package: energyweb
EnergywebSummaryEnergyweb if an Application framework designed to empower energy prosumers and utilities to leverage Blockchain and other cutting edge-cryptographic solutions. Just install it as a dependency withpip3 install energyweb. Create a python script and create your ownAppandTasksimporting classes fromenergyweb.dispatchermodule.Further development and contribution is much welcome, please contribute with issues and pull requests. :)FeaturesRaw transactions signingExtension and reusability through OOPEvent-loop logic with asynchronous I/O thread pool controlGeneral application abstractionGeneral Ethereum VM based network client abstractionTested onParityandGethEWF's Originrelease A smart-contract support for energy consumption and production registry forRECgenerationSuported Energy Data SourcesVerbund Eumel v1.0Verbund Eumel v2.1.1EWF's Energy APIWattime CO2 Emission API v1.0Wattime CO2 Emission API v2.0RoadmapGeneral EVM Smart-Contracts Event listener task triggerRemote logging in cloud platform. Check a listhere.Message Queue for off-line resilienceMerkle-tree proofs for collected data. Checkprecise proofsandtypescript implementation.Field-level validationDocument integrity validationDocument structure enforcementIPFS storageUUID pre-calculation and validation for smart-contract integrationEnforce TLS/SSL over httpARM TEE support:Offloaded cryptography to hardware acceleratorsStorage and access of the configuration file in secure enclavePrivate key generation and signature in CryptoCellEnergy Assets RoadmapGridx GridboxLoxone MiniserverSmart-Contracts RoadmapEWF's Originrelease BUniversal Sharing NetworkEWF's User and Assets RegistryYour project here - We are open for suggestions!Framework ArchitectureThe application consists of dynamically loading modules from the configuration file. After loading the modules, the main thread will spawn task threads when a trigger event occurs. In case the main thread dies or become a zombie, it must be restarted from an external command. It is the system administrator task to maintain services health, therefore no mitigation technique is applied.Ataskcan be of any nature, although it is a best practice that it's execution is finite and it's resource usage is predictable. This will avoidconcurrencebetween tasks and possibledeadlocks.ModulesA list of short explanations about the modules and libraries that compose the framework.EDSEnergyDataSources library has modules for supported smart-meterAPIsincludingenergyweb'sspecification written inSwagger, with this any utility or solar/wind farm could bundle many smart-meters and provide a simpleRestfulAPI using community provided code in many programming languages. Or even abstract legacy protocols instead of being forced to write a python module.Energywebmodule contains all abstract classes and interfaces to be inherited and implemented by concrete classes. It is the framework skeleton.Smart_Contractlibrary bundles all integration modules and assets to persist and query data onEVMbasedBlockchains. Most common assets arejsonfiles describingsmart-contractABIs.Base58module is a helper for parsingBitcoinaddressesIPFSfile hashes.Configmodule hasjsonandyamlformatted application configuration files parsers. App configuration files add better deployment, management, credentials safety and extension capabilities. This module also performs dynamic python module loading, allowing any registered class to be instantiated and parametrized by demand. This feature combined with OOP allows for the same device to be able to change smart-meters and smart-contracts seamlessly.Logwrites a stream of characters tostdoutand to files.Storagesupports EWF's Origin release A log storage, designed to record a sequence ofoff-chainfiles by updating the previous file contents SHA hash with the next. It is particularly useful to enforce data integrity, by comparing the sequence of raw smart-meter readings with the sequence registeredon-chain.Dispatchermodule is helper for handling asynchronous non I/O blocking threads of event triggered tasks. Also know as orevent loopit is the framework's main loop skeleton.Event loop abstraction:Example AppimportenergywebimportdatetimeclassMyTask(energyweb.Task):"""Example Task"""defcoroutine(self):print('Task{}:{}\n'.format(self.interval,datetime.datetime.now()))classMyApp(energyweb.App):"""Example Application"""defprepare(self):print('{}Prepared'.format(self.__class__.__name__))defconfigure(self):t1=MyTask(interval=energyweb.LifeCycle.FIVE_SECONDS)t2=MyTask(interval=energyweb.LifeCycle.ONE_MINUTE,is_eager=False)[self.add_task(t)fortin[t2,t1]]deffinish(self):print('{}Finished'.format(self.__class__.__name__))app=MyApp()"""Test loop"""if__name__=='__main__':app.run()