How to create a paid keyvalue storeHow to interact with a smart contract in practice (for free)? A bigger picture!DApp storage for data other than tranactions?Create contract that receives and sends bonus money to many addresses. What is the gas price?Are API tokens incompatible with Ethereum apps?Best practices for handling payment in smart contractsStore specific data related to usersThe better way to integrate Ethereum payments into web applicationHow can I create a modifier that requires the msg.sender be one of multiple addresses?Smart Contract To Send Multiple OutputsHow does Ethereum Smart Contract work on Mobile Client

How do I fix the group tension caused by my character stealing and possibly killing without provocation?

Non-trope happy ending?

Mimic lecturing on blackboard, facing audience

15% tax on $7.5k earnings. Is that right?

How to get directions in deep space?

What is going on with gets(stdin) on the site coderbyte?

Were Persian-Median kings illiterate?

Pre-mixing cryogenic fuels and using only one fuel tank

Why do some congregations only make noise at certain occasions of Haman?

How to draw a matrix with arrows in limited space

awk assign to multiple variables at once

"It doesn't matter" or "it won't matter"?

The IT department bottlenecks progress, how should I handle this?

Why does this expression simplify as such?

How to explain what's wrong with this application of the chain rule?

It grows, but water kills it

Is there a nicer/politer/more positive alternative for "negates"?

Is there a RAID 0 Equivalent for RAM?

What kind of floor tile is this?

Has the laser at Magurele, Romania reached a tenth of the Sun's power?

Change the color of a single dot in `ddot` symbol

Why does Carol not get rid of the Kree symbol on her suit when she changes its colours?

Does "he squandered his car on drink" sound natural?

Can I say "fingers" when referring to toes?



How to create a paid keyvalue store


How to interact with a smart contract in practice (for free)? A bigger picture!DApp storage for data other than tranactions?Create contract that receives and sends bonus money to many addresses. What is the gas price?Are API tokens incompatible with Ethereum apps?Best practices for handling payment in smart contractsStore specific data related to usersThe better way to integrate Ethereum payments into web applicationHow can I create a modifier that requires the msg.sender be one of multiple addresses?Smart Contract To Send Multiple OutputsHow does Ethereum Smart Contract work on Mobile Client













3















I'd like to create a contract through which people can set publicly available key=value information in exchange for some Ether sent to me (the owner of the contract).
This is to create a public decentralized database on which anyone can read and write, and the Ether cost would be to limit spam.



However, I'd like it to be free for all users to retrieve any key stored in the contract. My understanding of Ethereum is limited, is this possible?










share|improve this question







New contributor




thewondered is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
























    3















    I'd like to create a contract through which people can set publicly available key=value information in exchange for some Ether sent to me (the owner of the contract).
    This is to create a public decentralized database on which anyone can read and write, and the Ether cost would be to limit spam.



    However, I'd like it to be free for all users to retrieve any key stored in the contract. My understanding of Ethereum is limited, is this possible?










    share|improve this question







    New contributor




    thewondered is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      3












      3








      3








      I'd like to create a contract through which people can set publicly available key=value information in exchange for some Ether sent to me (the owner of the contract).
      This is to create a public decentralized database on which anyone can read and write, and the Ether cost would be to limit spam.



      However, I'd like it to be free for all users to retrieve any key stored in the contract. My understanding of Ethereum is limited, is this possible?










      share|improve this question







      New contributor




      thewondered is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I'd like to create a contract through which people can set publicly available key=value information in exchange for some Ether sent to me (the owner of the contract).
      This is to create a public decentralized database on which anyone can read and write, and the Ether cost would be to limit spam.



      However, I'd like it to be free for all users to retrieve any key stored in the contract. My understanding of Ethereum is limited, is this possible?







      contract-development contract-design






      share|improve this question







      New contributor




      thewondered is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question







      New contributor




      thewondered is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question






      New contributor




      thewondered is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 1 hour ago









      thewonderedthewondered

      161




      161




      New contributor




      thewondered is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      thewondered is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      thewondered is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          2 Answers
          2






          active

          oldest

          votes


















          2















          I'd like to create a contract through which people can set publicly
          available key=value information




          You can use a mapping to store data and public method to set values




          exchange for some Ether sent to me (the owner of the contract)




          You can make the set method payable and check for an amount of Ether from sender




          I'd like it to be free for all users to retrieve any key stored in the
          contract




          You can create the function a view one so no cost or transaction invlolved in reading values




          is this possible?




          Yes, This looks possible. It would look like below.



          pragma solidity >=0.4.22 <0.6.0;

          contract Store
          mapping(bytes32 => bytes32) public keyValStore;
          address payable public owner;
          uint storeFee;

          constructor(uint fee) public
          owner = msg.sender; // setting contract creator address as the owner
          storeFee = fee; // setting a store fee for to set values


          function set(bytes32 key, bytes32 value) public payable
          require(msg.value >= storeFee); // check if Ether value is greater than the store fee
          owner.transfer(msg.value); // transfer Ether to owner account
          keyValStore[key] = value; // setting the key value pair in mapping


          function get(bytes32 key) public view returns (bytes32)
          bytes32 val = keyValStore[key]; // get the relavant value for the given key
          return val;







          share|improve this answer
































            0














            Yes it's possible, here's an example key/value store contract to help you get started that requires 1 ether to set a key/value and anyone can read the data for free:



            pragma solidity >=0.4.22 <0.6.0;
            contract Store
            mapping(bytes32 => bytes32) private store;
            mapping(bytes32 => address) private authors;
            address private owner;

            constructor() public
            owner = msg.sender;


            function set(bytes32 key, bytes32 value) public payable authors[key] == msg.sender);
            store[key] = value;
            authors[key] = msg.sender;


            function get(bytes32 key) public view returns(bytes32)
            return store[key];


            function withdraw(address payable receiver) public
            require(msg.sender == owner);
            receiver.transfer(address(this).balance);




            https://rinkeby.etherscan.io/address/0xf7e0caef5cd7a18d31343670b60ff463fa23d5c8






            share|improve this answer
























              Your Answer








              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "642"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );






              thewondered is a new contributor. Be nice, and check out our Code of Conduct.









              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fethereum.stackexchange.com%2fquestions%2f68654%2fhow-to-create-a-paid-keyvalue-store%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              2















              I'd like to create a contract through which people can set publicly
              available key=value information




              You can use a mapping to store data and public method to set values




              exchange for some Ether sent to me (the owner of the contract)




              You can make the set method payable and check for an amount of Ether from sender




              I'd like it to be free for all users to retrieve any key stored in the
              contract




              You can create the function a view one so no cost or transaction invlolved in reading values




              is this possible?




              Yes, This looks possible. It would look like below.



              pragma solidity >=0.4.22 <0.6.0;

              contract Store
              mapping(bytes32 => bytes32) public keyValStore;
              address payable public owner;
              uint storeFee;

              constructor(uint fee) public
              owner = msg.sender; // setting contract creator address as the owner
              storeFee = fee; // setting a store fee for to set values


              function set(bytes32 key, bytes32 value) public payable
              require(msg.value >= storeFee); // check if Ether value is greater than the store fee
              owner.transfer(msg.value); // transfer Ether to owner account
              keyValStore[key] = value; // setting the key value pair in mapping


              function get(bytes32 key) public view returns (bytes32)
              bytes32 val = keyValStore[key]; // get the relavant value for the given key
              return val;







              share|improve this answer





























                2















                I'd like to create a contract through which people can set publicly
                available key=value information




                You can use a mapping to store data and public method to set values




                exchange for some Ether sent to me (the owner of the contract)




                You can make the set method payable and check for an amount of Ether from sender




                I'd like it to be free for all users to retrieve any key stored in the
                contract




                You can create the function a view one so no cost or transaction invlolved in reading values




                is this possible?




                Yes, This looks possible. It would look like below.



                pragma solidity >=0.4.22 <0.6.0;

                contract Store
                mapping(bytes32 => bytes32) public keyValStore;
                address payable public owner;
                uint storeFee;

                constructor(uint fee) public
                owner = msg.sender; // setting contract creator address as the owner
                storeFee = fee; // setting a store fee for to set values


                function set(bytes32 key, bytes32 value) public payable
                require(msg.value >= storeFee); // check if Ether value is greater than the store fee
                owner.transfer(msg.value); // transfer Ether to owner account
                keyValStore[key] = value; // setting the key value pair in mapping


                function get(bytes32 key) public view returns (bytes32)
                bytes32 val = keyValStore[key]; // get the relavant value for the given key
                return val;







                share|improve this answer



























                  2












                  2








                  2








                  I'd like to create a contract through which people can set publicly
                  available key=value information




                  You can use a mapping to store data and public method to set values




                  exchange for some Ether sent to me (the owner of the contract)




                  You can make the set method payable and check for an amount of Ether from sender




                  I'd like it to be free for all users to retrieve any key stored in the
                  contract




                  You can create the function a view one so no cost or transaction invlolved in reading values




                  is this possible?




                  Yes, This looks possible. It would look like below.



                  pragma solidity >=0.4.22 <0.6.0;

                  contract Store
                  mapping(bytes32 => bytes32) public keyValStore;
                  address payable public owner;
                  uint storeFee;

                  constructor(uint fee) public
                  owner = msg.sender; // setting contract creator address as the owner
                  storeFee = fee; // setting a store fee for to set values


                  function set(bytes32 key, bytes32 value) public payable
                  require(msg.value >= storeFee); // check if Ether value is greater than the store fee
                  owner.transfer(msg.value); // transfer Ether to owner account
                  keyValStore[key] = value; // setting the key value pair in mapping


                  function get(bytes32 key) public view returns (bytes32)
                  bytes32 val = keyValStore[key]; // get the relavant value for the given key
                  return val;







                  share|improve this answer
















                  I'd like to create a contract through which people can set publicly
                  available key=value information




                  You can use a mapping to store data and public method to set values




                  exchange for some Ether sent to me (the owner of the contract)




                  You can make the set method payable and check for an amount of Ether from sender




                  I'd like it to be free for all users to retrieve any key stored in the
                  contract




                  You can create the function a view one so no cost or transaction invlolved in reading values




                  is this possible?




                  Yes, This looks possible. It would look like below.



                  pragma solidity >=0.4.22 <0.6.0;

                  contract Store
                  mapping(bytes32 => bytes32) public keyValStore;
                  address payable public owner;
                  uint storeFee;

                  constructor(uint fee) public
                  owner = msg.sender; // setting contract creator address as the owner
                  storeFee = fee; // setting a store fee for to set values


                  function set(bytes32 key, bytes32 value) public payable
                  require(msg.value >= storeFee); // check if Ether value is greater than the store fee
                  owner.transfer(msg.value); // transfer Ether to owner account
                  keyValStore[key] = value; // setting the key value pair in mapping


                  function get(bytes32 key) public view returns (bytes32)
                  bytes32 val = keyValStore[key]; // get the relavant value for the given key
                  return val;








                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited 36 mins ago

























                  answered 1 hour ago









                  Achala DissanayakeAchala Dissanayake

                  3,74481629




                  3,74481629





















                      0














                      Yes it's possible, here's an example key/value store contract to help you get started that requires 1 ether to set a key/value and anyone can read the data for free:



                      pragma solidity >=0.4.22 <0.6.0;
                      contract Store
                      mapping(bytes32 => bytes32) private store;
                      mapping(bytes32 => address) private authors;
                      address private owner;

                      constructor() public
                      owner = msg.sender;


                      function set(bytes32 key, bytes32 value) public payable authors[key] == msg.sender);
                      store[key] = value;
                      authors[key] = msg.sender;


                      function get(bytes32 key) public view returns(bytes32)
                      return store[key];


                      function withdraw(address payable receiver) public
                      require(msg.sender == owner);
                      receiver.transfer(address(this).balance);




                      https://rinkeby.etherscan.io/address/0xf7e0caef5cd7a18d31343670b60ff463fa23d5c8






                      share|improve this answer





























                        0














                        Yes it's possible, here's an example key/value store contract to help you get started that requires 1 ether to set a key/value and anyone can read the data for free:



                        pragma solidity >=0.4.22 <0.6.0;
                        contract Store
                        mapping(bytes32 => bytes32) private store;
                        mapping(bytes32 => address) private authors;
                        address private owner;

                        constructor() public
                        owner = msg.sender;


                        function set(bytes32 key, bytes32 value) public payable authors[key] == msg.sender);
                        store[key] = value;
                        authors[key] = msg.sender;


                        function get(bytes32 key) public view returns(bytes32)
                        return store[key];


                        function withdraw(address payable receiver) public
                        require(msg.sender == owner);
                        receiver.transfer(address(this).balance);




                        https://rinkeby.etherscan.io/address/0xf7e0caef5cd7a18d31343670b60ff463fa23d5c8






                        share|improve this answer



























                          0












                          0








                          0







                          Yes it's possible, here's an example key/value store contract to help you get started that requires 1 ether to set a key/value and anyone can read the data for free:



                          pragma solidity >=0.4.22 <0.6.0;
                          contract Store
                          mapping(bytes32 => bytes32) private store;
                          mapping(bytes32 => address) private authors;
                          address private owner;

                          constructor() public
                          owner = msg.sender;


                          function set(bytes32 key, bytes32 value) public payable authors[key] == msg.sender);
                          store[key] = value;
                          authors[key] = msg.sender;


                          function get(bytes32 key) public view returns(bytes32)
                          return store[key];


                          function withdraw(address payable receiver) public
                          require(msg.sender == owner);
                          receiver.transfer(address(this).balance);




                          https://rinkeby.etherscan.io/address/0xf7e0caef5cd7a18d31343670b60ff463fa23d5c8






                          share|improve this answer















                          Yes it's possible, here's an example key/value store contract to help you get started that requires 1 ether to set a key/value and anyone can read the data for free:



                          pragma solidity >=0.4.22 <0.6.0;
                          contract Store
                          mapping(bytes32 => bytes32) private store;
                          mapping(bytes32 => address) private authors;
                          address private owner;

                          constructor() public
                          owner = msg.sender;


                          function set(bytes32 key, bytes32 value) public payable authors[key] == msg.sender);
                          store[key] = value;
                          authors[key] = msg.sender;


                          function get(bytes32 key) public view returns(bytes32)
                          return store[key];


                          function withdraw(address payable receiver) public
                          require(msg.sender == owner);
                          receiver.transfer(address(this).balance);




                          https://rinkeby.etherscan.io/address/0xf7e0caef5cd7a18d31343670b60ff463fa23d5c8







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited 51 mins ago

























                          answered 59 mins ago









                          Miguel MotaMiguel Mota

                          2,8421027




                          2,8421027




















                              thewondered is a new contributor. Be nice, and check out our Code of Conduct.









                              draft saved

                              draft discarded


















                              thewondered is a new contributor. Be nice, and check out our Code of Conduct.












                              thewondered is a new contributor. Be nice, and check out our Code of Conduct.











                              thewondered is a new contributor. Be nice, and check out our Code of Conduct.














                              Thanks for contributing an answer to Ethereum Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fethereum.stackexchange.com%2fquestions%2f68654%2fhow-to-create-a-paid-keyvalue-store%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Magento 2 duplicate PHPSESSID cookie when using session_start() in custom php scriptMagento 2: User cant logged in into to account page, no error showing!Magento duplicate on subdomainGrabbing storeview from cookie (after using language selector)How do I run php custom script on magento2Magento 2: Include PHP script in headerSession lock after using Cm_RedisSessionscript php to update stockMagento set cookie popupMagento 2 session id cookie - where to find it?How to import Configurable product from csv with custom attributes using php scriptMagento 2 run custom PHP script

                              Can not update quote_id field of “quote_item” table magento 2Magento 2.1 - We can't remove the item. (Shopping Cart doesnt allow us to remove items before becomes empty)Add value for custom quote item attribute using REST apiREST API endpoint v1/carts/cartId/items always returns error messageCorrect way to save entries to databaseHow to remove all associated quote objects of a customer completelyMagento 2 - Save value from custom input field to quote_itemGet quote_item data using quote id and product id filter in Magento 2How to set additional data to quote_item table from controller in Magento 2?What is the purpose of additional_data column in quote_item table in magento2Set Custom Price to Quote item magento2 from controller

                              How to solve knockout JS error in Magento 2 Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?(Magento2) knockout.js:3012 Uncaught ReferenceError: Unable to process bindingUnable to process binding Knockout.js magento 2Cannot read property `scopeLabel` of undefined on Product Detail PageCan't get Customer Data on frontend in Magento 2Magento2 Order Summary - unable to process bindingKO templates are not loading in Magento 2.1 applicationgetting knockout js error magento 2Product grid not load -— Unable to process binding Knockout.js magento 2Product form not loaded in magento2Uncaught ReferenceError: Unable to process binding “if: function()return (isShowLegend()) ” magento 2