This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SampleStruct defines the benchmark payload | |
type SampleStruct struct { | |
ID string `json:"ID"` | |
Name string `json:"Name"` | |
Salary string `json:"Salary"` | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Fetch the details by reading the DAG for key "inputKey" | |
fmt.Printf("READ: Value for key \"%s\" is: ", inputKey) | |
res, err := GetDag(cid, inputKey) | |
if err != nil { | |
fmt.Println(err) | |
} | |
fmt.Println(res) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Dag PUT operation which will return the CID for futher access or pinning etc. | |
cid, err := sh.DagPut(entryJSON, "json", "cbor") | |
if err != nil { | |
fmt.Fprintf(os.Stderr, "error: %s", err) | |
os.Exit(1) | |
} | |
fmt.Println("------\nOUTPUT\n------") | |
fmt.Printf("WRITE: Successfully added %sHere's the IPLD Explorer link: https://explore.ipld.io/#/explore/%s \n", string(cid+"\n"), string(cid+"\n")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Converting into JSON object | |
entryJSON, err := json.Marshal(m) | |
if err != nil { | |
fmt.Println(err) | |
} | |
// Display the marshaled JSON object before sending it to IPFS | |
jsonStr := string(entryJSON) | |
fmt.Println("The JSON object of your key-value entry is:") | |
fmt.Println(jsonStr) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scanner := bufio.NewScanner(os.Stdin) | |
fmt.Println("Enter value for the key field: ") | |
scanner.Scan() | |
inputKey := scanner.Text() | |
fmt.Println("Enter value for value field: ") | |
scanner.Scan() | |
inputValue := scanner.Text() | |
// Setting the key and values in the mapping | |
m[inputKey] = inputValue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Mapping-based structure to record key-value information | |
keyValueMap := make(map[string]interface{}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
/* eslint-disable no-console */ | |
const PeerId = require('peer-id') | |
const PeerInfo = require('peer-info') | |
const Node = require('./libp2p_bundle') | |
const pull = require('pull-stream') | |
const async = require('async') | |
const chalk = require('chalk'); | |
const emoji = require('node-emoji') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
/* eslint-disable no-console */ | |
const PeerId = require('peer-id') | |
const PeerInfo = require('peer-info') | |
const Node = require('./libp2p_bundle') | |
const pull = require('pull-stream') | |
const Pushable = require('pull-pushable') | |
const p = Pushable() | |
const chalk = require('chalk'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
/* eslint-disable no-console */ | |
const PeerId = require('peer-id') | |
const PeerInfo = require('peer-info') | |
const Node = require('./libp2p_bundle') | |
const pull = require('pull-stream') | |
const Pushable = require('pull-pushable') | |
const p = Pushable() | |
const chalk = require('chalk'); | |
const emoji = require('node-emoji') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": "Qma3GsJmB47xYuyahPZPSadh1avvxfyYQwk8R3UnFrQ6aP", | |
"privKey": "CAASpwkwggSjAgEAAoIBAQCaNSDOjPz6T8HZsf7LDpxiQRiN2OjeyIHUS05p8QWOr3EFUCFsC31R4moihE5HN+FxNalUyyFZU//yjf1pdnlMJqrVByJSMa+y2y4x2FucpoCAO97Tx+iWzwlZ2UXEUXM1Y81mhPbeWXy+wP2xElTgIER0Tsn/thoA0SD2u9wJuVvM7dB7cBcHYmqV6JH+KWCedRTum6O1BssqP/4Lbm2+rkrbZ4+oVRoU2DRLoFhKqwqLtylrbuj4XOI3XykMXV5+uQXz1JzubNOB9lsc6K+eRC+w8hhhDuFMgzkZ4qomCnx3uhO67KaICd8yqqBa6PJ/+fBM5Xk4hjyR40bwcf41AgMBAAECggEAZnrCJ6IYiLyyRdr9SbKXCNDb4YByGYPEi/HT1aHgIJfFE1PSMjxcdytxfyjP4JJpVtPjiT9JFVU2ddoYu5qJN6tGwjVwgJEWg1UXmPaAw1T/drjS94kVsAs82qICtFmwp52Apg3dBZ0Qwq/8qE1XbG7lLyohIbfCBiL0tiPYMfkcsN9gnFT/kFCX0LVs2pa9fHCRMY9rqCc4/rWJa1w8sMuQ23y4lDaxKF9OZVvOHFQkbBDrkquWHE4r55fchCz/rJklkPJUNENuncBRu0/2X+p4IKFD1DnttXNwb8j4LPiSlLro1T0hiUr5gO2QmdYwXFF63Q3mjQy0+5I4eNbjjQKBgQDZvZy3gUKS/nQNkYfq9za80uLbIj/cWbO+ZZjXCsj0fNIcQFJcKMBoA7DjJvu2S/lf86/41YHkPdmrLAEQAkJ+5BBNOycjYK9minTEjIMMmZDTXXugZ62wnU6F46uLkgEChTqEP57Y6xwwV+JaEDFEsW5N1eE9lEVX9nGIr4phMwKBgQC1TazLuEt1WBx/iUT83ita7obXqoKNzwsS/MWfY2innzYZKD |