Solidity

Handling user profiles in Ethereum DApps

依然范特西╮ 提交于 2019-12-20 09:21:18
问题 I'm in the process of creating an Ethereum DApp. The DApp consists of users who have associated data like email, name, and a profile picture. I would like to store the contents of the user within IPFS as a JSON object and reference this on chain using the IPFS hash. How could I go about associating this data with a particular user? In the sense, that subsequent interactions with the DApp connect the user with the data stored in IPFS. Is this done using the users account hash with a password

Solidity Source Files Requires different compiler version

好久不见. 提交于 2019-12-20 04:15:40
问题 pragma solidity ^0.5.3; contract Inbox { string public message; function Inbox(string initialMessage) public { message = initialMessage; } function setMessage(string newMessage) public { message = newMessage; } function getMessage() public view returns (string) { return getMessage; } } Error : browser/Untitled.sol:3:1: ParserError: Source file requires different compiler version (current compiler is 0.5.3-nightly.2019.1.15+commit.6146c59a.Emscripten.clang - note that nightly builds are

RuntimeError: Can not reuse socket after connection was closed using docker

给你一囗甜甜゛ 提交于 2019-12-20 03:54:10
问题 I am following this tutorial to run Ethereum crawler using Docker on window 10 using docker after executing $ MYSQL_DATA_PATH="$HOME/indexer-data/mysql" GETH_DATA_PATH="$HOME/indexer-data/geth"docker-compose up in this line i got error 409 Client Error: Conflict for url: http+docker://localnpipe/v1.25/containers/ee2b46142bae704d4963853e22a77ba896a8f841120ecf5ac97befca91847672/attach?logs=0&stdout=1&stderr=1&stream=1 During handling of the above exception, another exception occurred: Traceback

How can I return an array of struct in solidity?

佐手、 提交于 2019-12-18 06:48:11
问题 I am designing a solution for an ethereum smart contract that does bidding . The use-case includes reserving a name eg. "myName" and assigning to an address. And then, people can bid for that name (in this case myName). There can be multiple such biddings happening for multiple names . struct Bid { address bidOwner; uint bidAmount; bytes32 nameEntity; } mapping(bytes32 => Bid[]) highestBidder; So, as you can see above, Bid struct holds data for one bidder, similarly, the key (eg. myName) in

invoke a smart contract function from java application without need to listen to events

China☆狼群 提交于 2019-12-13 02:13:03
问题 As I understood that we have to use TransactionReceipt if we want to extract the events.. TransactionReceipt transactionReceipt = contract.someMethod( <param1>, ...).send(); but what about for example if I have a function called "register" and need many accounts to register their self by invoking the function register. how I can define accounts ( many credentials ) if the TransactionReceipt doesn't have parameters for ( from which account, gas limit, ..etc). One more thing that I invoked the

How to improve smart contact design in order to distinguish data and their manipulation functions for the same domain object?

泪湿孤枕 提交于 2019-12-12 09:59:53
问题 We have a problem with contract redeploying. Each time when some logic is changed during new contract version deployment we are loosing all contract related data (which are stored in arrays, mappings). Then we need to execute data load procedures in order to restore environment to desired state which is time consuming action. I tried to split contract to tow ones (AbcDataContract, AbcActionsContract) but faced with problem of accessing to the mappings : Error: Indexed expression has to be a

The install of solidity extension was failed for Visual Studio 2017

不想你离开。 提交于 2019-12-12 04:57:38
问题 I tried to install solidity extension for Visual Studio 2017, I downloaded VSIX Installer from the link bellow: https://marketplace.visualstudio.com/items?itemName=ConsenSys.Solidity when I tried to run the VSIX file, the installation failed immediately with the given message: " Install Failed The install of the extension was not successful for all the selected products. For more information, click the install log link at the bottom of the dialog. This extension is not installable on any

Solidity: ParserError: Expected pragma, import directive or contract /interface/library definition

霸气de小男生 提交于 2019-12-12 01:25:29
问题 I am getting error with both latest solc (0.5.2 version) and 0.4.25 too while I am writing Simple contract I have tried following steps uninstalled Solc: npm uninstall solc Installed targeted version: npm install --save solc@0.4.25 node compile.js (code given below) { contracts: {}, errors: [ ':1:1: ParserError: Expected pragma, import directive or contract /interface/library definition.\nD:\\RND\\BlockChain\\contracts\\Inbox.sol\n^\n' ],sourceList: [ '' ],sources: {} } Compile.js const path

Web3j v3.3.1 : Error while generating compiled solidity smart contracts which returns array of struct

北城以北 提交于 2019-12-11 21:32:52
问题 I am returning an array of struct from solidity function as below. pragma solidity ^0.4.21; pragma experimental ABIEncoderV2; function getPurchaseOrderForVendor(string vendorNameInput) constant returns (PurchaseOrderStruct[]) It is compiled to abi and bin files. The issue is with creating wrapper files for the contract using web3j(v3.3.1). Im getting the below errors. Generating com.contract.InvoiceSettlement_sol_InvoiceSettlement ... Exception in thread "main" java.lang

what are state variables in solidity?

女生的网名这么多〃 提交于 2019-12-11 08:44:17
问题 I read some doc about storage , memory and view , pure , but I don't fully understand them. I have following code: contract { struct Random { uint32 state; uint8 i; } function main() pure internal { Random rand = Random(seed, 0); ... } function get_rand(Random rand, uint8 n) pure internal returns (uint16) { assert(n <= 16) while (true) { if (rand.i >= 8) { rand.state = xorshift32(rand.state); rand.i = 0; } uint8 r = uint8(rand.state >> (rand.i << 4)) & 0x0f; rand.i += 1; if (r < n) { return r