What account controls Ethereum contract?

I am currently following this tutorial: https://medium.com/@mvmurthy/full-stack-hello-world-voting-ethereum-dapp-tutorial-part-2-30b3d335aa1f The way I deployed the contract was by using truffle migrate command which presumably automatically pushes it to the newtwork from a certain account which I should have created earlier using web3 library, specifically web3.personal.newAccount('some_password'). Considerring I have created multiple accounts, which one owns the contract i.e. what account g

What is the size of full geth ethereum node nowadays?

I'm going to setup a full Ethereum node on my PC here with geth --syncmode=full I have to buy SSD drive for that. My question is will 1TB SSD be enough or I have to buy even more bigger (= expensive) SSD drive? PS. I've searched over internet and didn't find recent information about it...

Ethereum web3.eth.sendSignedTransaction is not a function

I use the web3.eth.sendSignedTransaction function, but it is not working. This is code of problem var nonce = web3.eth.getTransactionCount("<from address>"); const txParams ={ nonce:web3.utils.toHex(nonce), to : "<to address>", value : web3.utils.numberToHex(web3.utils.toWei('0.01','ether')), gasPrice :web3.utils.numberToHex(web3.utils.toWei('1','Gwei')), gasLimit:web3.utils.numberToHex('300000'), chainId :3 //Ropsten } const tx

Ethereum Where is this Solidity mapping variable initialised?

There is sample code in "Modular Contracts" that uses a mapping, but I cannot see where that values of each mapping index get assigned. The mapping is defined as: mapping(address => uint256) balances; and it is passed into the library function "Balances": library Balances { function move(mapping(address => uint256) storage balances, address from, address to, uint amount) internal { require(balances[from] >= amount); require(bal

Ethereum the method txpool_inspect does not exist/is not available

I'm having trouble getting the python function web3.geth.txpool.inspect() to work. I've tried using a geth server from the command line, from the ethereum/client-go container, and from the trufflesuite/ganache-cli:v6.7.0 container. In every case, I get a txpool_inspect method missing error. The code I'm running is very simple, using Python 3.7.5 or 3.8: from web3 import Web3 thing = Web3("http://localhost:42424") thing.geth.txpool.inspect() I'm using web3py==5.2.2 . For Geth I tried: --d

Ethereum Return value from a deployed smart contract, via a smart contract, to a smart contract

I am trying to return a value using a function of a deployed smart contract on the blockchain. pragma solidity 0.6.2; contract Caller { address cont; function changeAdd(address _change) public { cont = _change; } function caller (bytes memory test) public returns(bool, bytes memory) { bytes memory payload = abi.encodeWithSignature("callMe(bytes)", test); (bool success, bytes memory result)= address(cont).call(payload); return (success, (result)); }

Ethereum NFT - what is actually stored on the block chain to represent the digital asset?

According to Wikipedia's entry on NFT the minting process "creates a copy of the file recorded on the digital ledger as an NFT". Is that literally true of Ethereum based NFT for example? For some reason I was under the impression that what is actually stored inside the blockchain is the cryptographic hash of the underlying digital asset, and possibly a reference to the file's location, not the actual file itself. I guess it's easy enough to store the whole file when it is a jpg, or

Ethereum Warning! Error encountered during contract execution [Reverted]

1)What can cause this message error to appear while depositing ERC20 on allowance? "Warning! Error encountered during contract execution [Reverted]" 2)Also from what I noticed while debugging it has something to do with 'require(b <= a)' while depositing. I haven't seen it with tokens using 'assert' instead of 'require' for their SafeMath, would using 'assert' display different error message for the same problem? Or I'm just missing something?

Ethereum Smart contract crowdfunding

I have a question concerning the smart contracts. I have a crowdfunding ICO idea to implement. It has a three date ranges to purchase tokens in a presale. For example: Total tokens - 300 000 Crowdfunding starts at 01.06.2018 There is a limit of 100 000 ICO until 10.06.2018 (50% price) Another limit of 100 000 ICO 10.06.2018 - 20.06.2018 (75% price) 100 000 after 20.06.2018 (100% price) I'm not sure how to implement a resale. Does it have to be implemented within one contract from the b

Ethereum How to create own multi-currency crypto-wallet?

I want to create my own cryptocurrency wallet. I know about private and public key concept which is used in the wallet but I could not understand how my wallet verified other public address? How my wallet verified other users? How coinomi manage their wallet to store all kind of currency? Can anyone explain the full logic of wallet?

Ethereum How to use older solc compilers with Truffle

I am trying to reproduce the DAO attack that happened on Ethereum, however, I was not able to compile the DAO code. The current stable version of truffle does not support specifying a solc version. I used the 5.0.0 beta 1 version for truffle, which supports specifying a solc version. When compiling the DAO code, I get this error. TypeError: Error parsing E:/Desktop/MetaCoin/contracts/DAO.sol: solc.compileStandard is not a function at Object.parseImports (C:\Users\Administrator\AppData\Roa

Ethereum Quorum blockchain explorer "connection refused"

I am trying to explore my transaction and I am using Quorum transaction explorer. I run the network via vagrant and I executed: NODE_ENDPOINT=http://localhost:2222 docker-compose up I get an error telling me "Connection refused" and I don't know why. Does anyone have an idea about this problem?

Ethereum Solidity event not showing up from Web3.js

I'm trying to set up an event in Solidity and listen to it from Web3 but I keep getting a null response. Here's my code: The relevant part of the contract: event NewUser(string userid); function createNewUser(string memory _userId) public { // creating the user and setting it to a mapping emit NewUser(_userId); } The Javascript, from Ethereum's reference: async function watchEvents(contract) { contract.events.allEvents({ fromBlock: 0 },function(error, event){ con

Ethereum Solidity error with balances[] in constructor, "Index expression cannot be omitted"

New to Solidity and smart contracts, been trying to setup a test environment on Windows but I'm stuck when trying to test run a truffle boxed environment (MetaCoin). In the constructor below balances[] is doing something wrong. My IDE (vscode with solidity extension) throws a message: "Index expression cannot be omitted". Why is this showing up? contract MetaCoin { mapping (address => uint) public balances; event Transfer(address indexed _from, address indexed _to, uint256 _value)

Ethereum Is it possible to provide access to the smart contract only from the application and block direct access?

For example, I have a game, and I want the players to interact, only through the application. But they can call functions if they just copy the ABI and contact address. Is there any case to allow call public contract functions only through the application, using some kind of secret token? But I don’t know how to make such a secret token in the public blockchain.

Ethereum Does web3js support Bitcoin

A quick question. I used web3js lib to create an app in which a user can create his own account and also a wallet. My question is is that wallet can be used only with the ethereum coin transfer or can I use to store or transfer btc as well?

Ethereum Assert vs. require within Solidity?

My understanding is that "require" refunds the remaining gas if it fails whereas "assert" doesn't. I'm a bit confused though b/c what is meant by remaining gas? I often specify a gas limit of a very large number even when the contract I'm calling requires very little. If I were to specify 4,700,000 gas limit, and only 50,000 gas was required, but "assert" failed in the called contract, would I lose all 4,700,000 gas?

Ethereum sidechains

I have just started learning blockchain development I have created an ethereum sidechain, which is running on docker containers in my local machine. I have previously used solidity to write smart contracts and deploy them on the testnet using truffle, or by getting the provider from infura. Note: wherein each container acts as a node. But how do I do the same thing for my private chain?

Ethereum: calling smart contract functions from Restful APIs

I am having an Ethereum Smart Contract and deployed on Ropsten TestNet network. Is there any way to call those functions using rest API? If yes please explain. If no, Please let me know how do Pre-sale of ICO works? because I believe pre-sale works similar to this. The concepts I know says: When presale happens. The owner/organization of ICO handles it using their website. They sell the coins at a dicounted price during pre-sale by calling the functions themselves on their website. In the case

Ethereum waitOnReceipt function doesn't work in solidity, running on SuperBlocks

Running on https://studio.superblocks.com/ trying to make a a fun game in Solidity. the problem happens when I call waitfor receipt inside the "addKity" function. Any ideas why? I suspect it could be because of a technical issue in superblocks but could very well be because of a coding error I have. It reaches the "heres" alert but doesn't reach alert("4"); Please let me know your thoughts! waitForReceipt(txHash, function(receipt){ Javascript File (function (Contract) { var web3_insta

Ethereum staking existing ERC20 token

How do I make a existing running erc20 to prevent some holders from transacting? I am trying to do a staking feature. Can I write a new contract to control the existing erc20 contract?

Ethereum Solidity/Truffle - cannot call function inside truffle console (But I can in remix)

I am working on a little "Betting Dapp" contract on solidity. I have a function called addContractFunds which allows me to send ethereum to the contract balance. However, when I call this function in the truffle console on the Ropsten test network, I get the following error: TypeError: Cannot read property 'address' of undefined Inside truffle console: The interesting thing is, when I run this contract and test it in Remix(on ropsten), or locally using ganache everything works fine.

Ethereum How to test payable/external method with waffle and ethers.js

Here is the smart contract, written in vyper, to be tested owner: public(address) name: public(String[100]) total_amount: uint256 @external def __init__(_name: String[100]): self.owner = tx.origin self.name = _name @external @payable def donate(): #anyone can donate to the piggy bank self.total_amount += msg.value @external @view def get_total_amount() -> uint256: return self.total_amount What is the right way to test the donate() method of the smart contract with waffl

Event.watch from ethereum-web3 gets fired infinitely many times

I am trying out truffle + web3 + ethereumjs-testrpc. In the app I have the following code: window.onload = function() { var meta = MetaCoin.deployed(); var event = meta.Transfer({}, {fromBlock: 0, toBlock: 'latest'}, function (error, result) { if (error) { console.log("Error: " + error); } else { console.log(result); } }); } and I am getting the latest transfer endlessly in console. The contract is standard MetaCoin with an event Transfer added. Here is the full

Ethereum greeter tutorial : contract returns "null [object Object]"

Trying to follow the greeter tutorial and while I've sidestepped some problem (couldn't get solC installed locally), this one has got me stuck. I've compiled the solidity online here https://ethereum.github.io/browser-solidity/#version=soljson-latest.js The result is two different sections on the right, one for 'greeter' and one for 'mortal'. I start up the geth console locally and unlock my account with "personal.unlockAccount". After pasting in the text from the "Web3 deploy" sections of

Ethereum Solidity Source Files Requires different compiler version

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 considered to be strictly less than the released version contract Inbox { I'm using the correct version. I've tried debugging and look on forums, but I cannot find the right solution. Any other experiencing same problem?

Ethereum Remix IDE getting error "Please select the folder in the file explorer where the metadata of contract can be found"

I've been following the tutorial in ethereuembook. I created a contract called faucet.sol in the browser directory of Remix IDE. The contract compiled successfully. However, when trying to deploy (in both Javascript VM and injected web3 environment with metamask), I'm getting the following error, creation of faucet errored: Please select the folder in the file explorer where the metadata of faucet can be found Not able to figure out how can I generate this metadata and select the folder in fi

Ethereum zsh: command not found: truffle

I have install: npm install -g truffle Node version: v10.20.1 NPM version: 6.14.4 After installing npm install -g truffle, it gets install successfully, but when I checked truffle version it shows me ,command not found truffle

Calling ethereum smart contracts with value using web3js and galanche

I'm fairly new to Ethereum smart contracts, so this might be a stupid question, but I need someone to help me out. I've set up Galanche on my machine (MacOS 11) and written a very simple currency smart contract (I don't intend to use it as an actual currency, I just want to learn about smart contracts) using truffle. I've compiled the contract and deployed it to my Galanche blockchain successfully. Now, I want to interact with it using web3.js. I have set up a nodejs project and installed web3.

Ethereum Solidity Code giving Gas estimation failed if I increase loop count

I have some basic solidity code which is running for pre-defined loop of 1 to max 8. The gas estimation works perfectly till 4 loops more than that I get below error. Using Ganache. And loop is pasted below Gas estimation failed Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending? Internal JSON-RPC error. { "message": "VM Exception while processing transaction: invalid opcode", "code"

Ethereum 'Invalid sender' error after upgrading to geth 1.4.0

My program was able to craft and send raw transactions to geth v1.3.3 before, but after I upgrade to geth v1.4.0, calling sendRawTransaction over RPC always returns invalid sender error. Is transaction serialization (i.e. RLP) changed somehow from v1.3.3 to v1.4.0? Here is a dump of by raw transaction that triggers an invalid user error: 0x0000: F8 CA 80 85 0B A4 3B 74 00 83 01 5F 90 94 08 BE ......;t..._.... 0x0010: 24 CD 8D CF 73 F8 FA 5D B4 2B 85 5B 43 70 BD 5C $...s..].+.[Cp.

How to return mapping list in Solidity? (Ethereum contract)

I want to make simple smart contract that has a list, can set item, and can get the list. Code in solidity: contract lister { mapping(int => string) list; int id = 0; function getList() returns ( /*HERE*/ ) { return list; } function setItemToList(string str) { list[id] = str; id++; } } I want to make getList() return the list, but return type is not compatible. How can I do that?

Ethereum How does the opcode JUMP work in the EVM Stack?

I'm following along on the "Advanced Solidity" tutorial here. I ran into an example I'm having trouble understanding. In this example, why does JUMP affect the state of the stack? I expected it to only affect the program counter. (i.e. I would expect after JUMP, at PC: 11, the length of the stack would be 3, not 2. The JUMP comes after PUSH 0x0B.) Thanks.

Ethereum Cannot run eth.getCompilers() in Geth

I am playing around with Geth and ethereum, and trying to install solc. I tried npm install solc as well as brew install solidity - the first one worked, and the second one was hung. Anyway, when I fire up my Geth console in mac OSX and try to run eth.getCompilers(), I keep getting the following error: Error: The method eth_getCompilers does not exist/is not available at web3.js:3104:20 at web3.js:6191:15 at web3.js:5004:36 at <anonymous>:1:1 Please help? Thanks, Laura

Ethereum eth.estimateGas fails with contract address as second parameter

Newbie. There is a go-ethereum method: eth.estimateGas({from:'firstAccount', to:'secondAccount'}) that works well, but same method with contract address like: eth.estimateGas({from:'firstAccount', to:'contractAddr'}) fails with error gas required exceeds allowance or always failing transaction I have looked into go-ethereum source code and it has the line, that contains proposal to use contract address as second parameter: https://github.com/ethereum/go-ethereum/blob/master/accounts

Ethereum Solidity: How to compile multiple smart contracts in compile.js file?

I would like to compile multiple contracts in one compile.js file but I'm not sure how to do it. My compile.js file with a single contract looks like this: const path = require('path'); const fs = require('fs'); const solc = require('solc'); const lotteryPath = path.resolve(__dirname, 'contracts', 'Lottery.sol'); const source = fs.readFileSync(lotteryPath, 'utf8'); module.exports = solc.compile(source, 1); How can I add more contracts to the compile.js file? I understand that the 1 must

Ethereum What do uints initiate to?

In solidity what do numbers initiate to assuming we just call a plain number. uint256 plainNumber I understand it's zero. But what I'm asking for, is there a way to detect if that number has been set by the compiler or a user variable. For example... uint256 plainNumber; ***some code and we continue*** plainNumber = 0; Is there any way to detect if I set the plainNumber or if it was simply initialized at zero? Any special protocol?

Ethereum Set price in Solidity contract using ERC-20 token

I have a ERC721 contract and I have one problem, I'm trying to set the price in another currency like UNI or SUSHI but the problem is that I don't know how to change it, I don't know a lot about contracts, here is the code. I was wondering if it is possible to make the following UNI work: uint256 public constant NFT_PRICE = 1 ether; I try to do something like this uint256 public constant NFT_PRICE = 1 UNI; But this doesn't work

Ethereum Keep track of all minted tokens on ERC721 Smart Contract

I have a Smart Contract that I'd like to build a web based marketplace app for. How can I list all available "Items" in the contract. Seeing as there is no upper limit to the number of minted Items, how can I implement pagination and search? What is a best practice and scalable solution: to simply return the Items[] array sync the array with my database on Transfer and other events other suggestions? pragma solidity ^0.4.24; contract Item is ERC721{ struct Item{ string name; /

Ethereum Receiving "invalid or does not take any parameters" when attempting to deploy a contract

here is my 2_deploy_contract.js syntax const DerbyToken = artifacts.require("./DerbyToken.sol"); module.exports = function(deployer) { // Deploy the Migrations contract as our only task deployer.deploy(DerbyToken); }; after I migrate the file using truffle I receive this error message Error: Migration /home/cyraidz/token_sale/migrations/2_deploy_contracts.js invalid or does not take any parameters at Migration._load (/usr/local/lib/node_modules/truffle/build/webpack:/pac

Ethereum Getting each wallet address balance

I’m currently having a hard time figuring how to get to check users wallet addresses and get the balances ie if a user wants to send out 3Eth and they have like 10 addresses with different amounts inside them, how do I subtract the amount from each address to get the 3Eth the user wants to send out?

Ethereum How to make automatic LP providing after time lock

I am learning solidity and want to create a contract that will lock token for Uniswap LP. What I've created is: List item on token creation I am creating uniswap pair with that token I am creating a Timelock for token amount assigned to creator address now on release() method I would like to automatically add liquidity with eth value that has been sent and token that was locked Problem here is that to add LP to uniswap token needs to be approved and from what I see the only way to approve toke

Ethereum how to return loop and array element | Data location must be "memory" for return parameter in function | Dynamic Array

I am using the following code to return array. function getActiveDepositIndexes() public view returns (uint256 [] storage) { User storage user = users[msg.sender]; Deposit[] storage deposits = user.deposits; uint[] memory indices = new uint[](deposits.length); for(uint i = 0; i < deposits.length; i++) { if(deposits[i].active && !deposits[i].closed){ indices.push(i); } } return indices; } But I am getting following error, TypeError

Ethereum How to connect to Livepeer to Rinkeby network?

I want to run livepeer and for that I need it to get connected to an Ethereum network. There are two options as mentioned here: Hosted API services Self hosted Ethereum node If I want to opt for the latter, how would I mention rinkeby? Because I only want to use for the test purposes.

  1    2   3   4   5  ... 下一页 共 5 页