Romper
Romper

Reputation: 2259

Storing data in hyperledger

I want to store in hyperledger data about exchange usd to eur, something like(date -> rate):

"21 Mar 2017" -> 0.92940
"22 Mar 2017" -> 0.92583
"23 Mar 2017" -> 0.92699

so, as I understand, first I should call deploy a chaincode with empty map, and everyday I should call invoke to update the map

is this how it should be?

Upvotes: 1

Views: 580

Answers (2)

Mohan
Mohan

Reputation: 36

You can write chaincode to store that data in the world-state. You can dynamically run invokes by wrapping cron type logic within a nodeSDK javascript function to run the invokes based on time or other business rules.

Upvotes: 0

ecn
ecn

Reputation: 482

Basically yes.

You can write your chaincode, deploy it then you will be able to call the invoke method to store your data in the world state.

There is no need to initialize a map or whatsoever on the deploy. The data on the blockchain is modeled so it can store key/value.

Upvotes: 3

Related Questions