digital energy infrastructure for tomorrow.

Showcase: Instance of Business Object

Using STROMDAO Energy Blockchain is as easy as creating a instance of an object. This showcase shows you how to do this and allows you to test it directly in your browser.

Basic Usage in Browser

HTML

<script src="https://cdn.rawgit.com/energychain/StromDAO-BusinessObject/master/dist/loader.js"></script>

Javascript

// Create Instance with external ID 1234
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/"
});

Test it


Using External IDs (extid)

In previous example we have a hardcoded external id 1234. The logic of the business object ensures creation of a public key (address) and a private key. Both will be linked to this external id and persisted. If you use this outside your browser keys are stored in your file system. If you use this within your browser keys are stored as window.localStorage.

Using the following example you could create multiple key pairs. Note: if you use the same external id on a different browser - you will have different key pairs.

Test it


Inject Private Key

If you create a private key on a different browser and would like to reuse it with the same external id, you have to relink it once.

Relinking is done as a parameter during instance creation.

// Create Instance with external ID 1234 and relink private key.
var node = new document.StromDAOBO.Node({
 external_id:"1234",
 privateKey;"0x15b66c582665b97da4d8bc0e7864edde54378a4eb9c5809843e44ce0fc80e3fe",
 testMode:true,
 ,
 rpc:"https://demo.stromdao.de/rpc=",
 abilocation:"https://cdn.rawgit.com/energychain/StromDAO-BusinessObject/6dc9e073/smart_contracts/"
});

Test it