How to create a paid keyvalue store The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)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?Where do you save the application data of a Dapp?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?How does Ethereum Smart Contract work on Mobile Client

Why can't devices on different VLANs, but on the same subnet, communicate?

Match Roman Numerals

How is simplicity better than precision and clarity in prose?

Mortgage adviser recommends a longer term than necessary combined with overpayments

How are presidential pardons supposed to be used?

How to stretch delimiters to envolve matrices inside of a kbordermatrix?

Are my PIs rude or am I just being too sensitive?

Why can't wing-mounted spoilers be used to steepen approaches?

Road tyres vs "Street" tyres for charity ride on MTB Tandem

How to pronounce 1ターン?

The variadic template constructor of my class cannot modify my class members, why is that so?

How did the audience guess the pentatonic scale in Bobby McFerrin's presentation?

Does Parliament hold absolute power in the UK?

Create an outline of font

The following signatures were invalid: EXPKEYSIG 1397BC53640DB551

Would an alien lifeform be able to achieve space travel if lacking in vision?

Wall plug outlet change

Can the prologue be the backstory of your main character?

Why does the Event Horizon Telescope (EHT) not include telescopes from Africa, Asia or Australia?

Are spiders unable to hurt humans, especially very small spiders?

Am I ethically obligated to go into work on an off day if the reason is sudden?

Is there a writing software that you can sort scenes like slides in PowerPoint?

Problems with Ubuntu mount /tmp

Can smartphones with the same camera sensor have different image quality?



How to create a paid keyvalue store



The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)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?Where do you save the application data of a Dapp?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?How 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
























  • do you still need any clarifications?

    – Achala Dissanayake
    Mar 28 at 16:37















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
























  • do you still need any clarifications?

    – Achala Dissanayake
    Mar 28 at 16:37













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
















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















share|improve this question













share|improve this question




share|improve this question








edited Mar 30 at 6:15









Achala Dissanayake

3,78781629




3,78781629










asked Mar 22 at 5:26









thewonderedthewondered

161




161












  • do you still need any clarifications?

    – Achala Dissanayake
    Mar 28 at 16:37

















  • do you still need any clarifications?

    – Achala Dissanayake
    Mar 28 at 16:37
















do you still need any clarifications?

– Achala Dissanayake
Mar 28 at 16:37





do you still need any clarifications?

– Achala Dissanayake
Mar 28 at 16:37










2 Answers
2






active

oldest

votes


















4















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

    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
      );



      );













      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









      4















      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





























        4















        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



























          4












          4








          4








          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 Mar 22 at 6:13

























          answered Mar 22 at 5:49









          Achala DissanayakeAchala Dissanayake

          3,78781629




          3,78781629





















              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

              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

                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

                  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

                  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 Mar 22 at 5:58

























                  answered Mar 22 at 5:50









                  Miguel MotaMiguel Mota

                  2,9221027




                  2,9221027



























                      draft saved

                      draft discarded
















































                      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

                      Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                      SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                      은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현