digital energy infrastructure for tomorrow.

Showcase: Working with Business Domains

Using STROMDAO Energy Blockchain you have several business domains covered in one place. The business object handles this by introducing two different ways to address a use case.

Default Instance of domain

Javascript

		var node = new document.StromDAOBO.Node(
		    {
				external_id:"1234",
				testMode:true,
				rpc:"https://demo.stromdao.de/rpc",
				abilocation:"https://cdn.rawgit.com/energychain/StromDAO-BusinessObject/6dc9e073/smart_contracts/"
			});
				
		node.mpr().then(
		   function(mpr) {
			    mpr.storeReading(1234).then(function(o) {console.log("TX Hash",o);});
			}
		 );
		

node.mpr() is equal to node.mpr("0x0000000000000000000000000000000000000008").

In case of a Meter Point Reading (MPR) as a business domain. There is a smart contract already deployed, which handles all of the required stuff expected by the business object. This Smart Contract has an Energy Blockchain address of 0x0...8. For all domains like Meter Reading, Factories, StromkontoProxy,... with an existing Default contract, you do not need to specify a contract address.

For a list of predefined contract addresses see Defaults.js.


Test it

Standard pattern to access functionality of a domain is:

node.DOMAIN(INSTANCE).then(function(object) { // use object.method() });

In an Energy use case you might find the introspect page useful to learn more about domains and use cases.