I am using Embark Framework.I am trying to store a string value in IPFS and then to retrieve that string using the hash.

Contract Code (simple_storage.sol) :-

pragma solidity ^0.4.7;

contract SimpleStorage {
         string public storedData;
         function SimpleStorage() {
                      storedData = "hello world";
         function set(string x) {
                      storedData = x;
         function get() constant returns (string x) {
                     return storedData;


Index.html Code :-

       <title>Embark - SimpleStorage Demo</title>
       <link rel="stylesheet" href="css/app.css">
       <script src="js/app.js"></script>
<body class="container">
      <h3>Embark - SimpleStorage Demo</h3>
      <h3> 1. Set the string in the blockchain</h3>
      <div class="form-group form-inline">
           <input type="text" class="text form-control">
           <button class="set btn btn-primary">Set String</button>
     <h3> 2. Get the current value</h3>
     <div class="form-group">
                current value is <span class="value"></span>
         <button class="get btn btn-primary">Get String</button>

Index.js Code :-

EmbarkJS.Messages.setProvider('orbit',{server: 'localhost', port: '5001'});
$(document).ready(function() {
      $("button.set").click(function() {
            var value = $("input.text").val();
            EmbarkJS.Storage.saveText(value).then(function(hash) {
     $("button.get").click(function() {
             SimpleStorage.get().then(function(hash) {
                     EmbarkJS.Storage.get(hash).then(function(content) {

I am given a string as input and it returns string as output correctly.How can i verify the values stored in orbit db?

I have tried using 'ipfs' instead of 'orbit'.But the code won't get worked?What is the issue?

  • @samuraj jack Please help me to develop a dapp using IPFS Jan 18, 2017 at 5:10

1 Answer 1


It seems you are mixing up EmbarkJS.Storage and EmbarkJS.Messages. You should be configuring the storage provider not the messages one:

EmbarkJS.Storage.setProvider('ipfs',{server: 'localhost', port: '5001'});


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.