Hot answers tagged

6

From where these exchanges get the current market price of ether? The price is dependent on what users are currently valuing ether at. The exchanges don't set the prices, nor get them from anywhere else. If someone who is trading on one exchange is willing to pay more than someone trading on another exchange, then the price of ether on the first exchange ...


4

The USD/ETH price is not intrinsically available on the blockchain. Therefore you need services such as Oraclize for pulling price feeds to your contract. Specifically, you could use the Kraken ticker API and use a simple Oraclize query to integrate that data into your contract. Beware that this is significantly more complicated than just hard-coding one ...


4

The price being shown by Etherscan is the price of your token on the open market, using data from market sources, such as exchanges. It's not the same thing as the purchase price you set in the contract itself. Until your token is being actively traded, and people apportion value to it, your dollar price will be zero.


3

You can set gas limit and gas price for each network in truffle.js Here is sample of truffle.js, module.exports = { // See <http://truffleframework.com/docs/advanced/configuration> // to customize your Truffle configuration! migrations_directory: "./migrations", networks: { development: { host: "127.0.0.1", ...


3

You are missing something. The amount of gas a transaction requires to submit depends on the amount of processing that miners have to do. A reasonable proxy to this is the amount of input data associated with a transaction. When submitting a contract you submit the encoded bytecode of the contract. The cost you incurred is significantly more than such a ...


3

Absolutely. Everyone should. There's a great site here that will help you understand gas and gas prices. It's called Ethereum Gas Station. I'm not sure who publishes it, but it's very well done. They just recently made this post which explains something they call the Safe Gas Price.


3

Etherscan does this. For example, here's a random old transaction: https://etherscan.io/tx/0x135ba7f5b2ffd81b0dbb3483716e87e5f8d374b2736f3d24967962893bc827fb By default, it shows the value in USD based on the current Ethereum price, but if you click on the dollar amount, it switches to the USD value at the time of the transaction.


2

This must be done off-chain for standard tokens. The ERC-721 standard specification -- http://eips.ethereum.org/EIPS/eip-721 -- does not provide an interface to query historical ownership of a token. Other extensions to the standard may include this additional functionality but this will be implemented on a contract-by-contract basis. For example, ...


2

I agree with @Jesse. "without knowing the index?" It will work out better with the question reframed as "How can I organize storage so deletes are efficient?" There is a process to delete from an indexed mapping (where you have implemented with an array and a mapping. In summary, move the last item of the unordered list into the row to delete and then ...


2

When adding to the array, you can also store the index you added it to. You can use a second mapping to do that: mapping(bytes32 => mapping(address => uint256)) public authorisation_arrayIndex; When adding to the authorisation mapping: authorisation_arrayIndex[hash][addr] = authorisation[hash].length; authorisation[hash].push(addr); Also, maybe you ...


2

The EVM has the notion of gas because computations need to be ending. Each block has a gas limit and different operations cost a certain amount of gas, thus we can only have a limited amount of computations in a block. Otherwise the blockchain wouldn't progress, all validators would be stuck trying to validate the computation. This would be the case if ...


1

price = ETHUSD(0x123abc...).priceETHUSD(); Replace 0x123abc... with the actual address of the deployed ETHUSD contract you want to use.


1

You can achieve this without sending any actual transactions. //create a web3 instance const web3 = new Web3(Web3.givenProvider || "ws://localhost:8546"); //create contract instance, leave address empty if creating new contract myContract = new web3.eth.Contract(jsonInterface, address, options) //check gas needed to deploy contract myContract.deploy({ ...


1

When you issue the transactions in Ropsten you'll see their gas usage. After that you need to decide a correct gas price for your transaction in the mainnet. You can use for example https://ethgasstation.info/ when deciding on a good gas price. You can use that same calculator to calculate the actual costs of your transactions once you have decided on the ...


1

Sort of. In Ethereum networks there is always gas involved. And as this is Ethereum StackExchange, I assume you are referring only to Ethereum networks. The trick is how the gas price is specified. You have at least two ways how to get free transactions: 1) Send a transaction with zero gas price to whichever network (even the mainnet). No matter how much ...


1

Usually, they lock the price just before starting the crowdsale. They set it to a certain value, and it will stay like that during the entire crowdsale. It can be something like that : function startCrowdsale(uint _price) { crowdsale_started = true; price = _price; //more code } Another way, but more costly, is the use of an oracle.


1

The formula should be really simple. Every internal amount is expressed in wei, it is better to use that unit to our calculation. 1 ether = 10^18 wei = 100000 tokens = 100000 * 10^decimals Now if you send msg.value wei using the cross product you have to receive msg.value * 100000 * 10^decimals / 10^18 wei It is recommended to always use 18 decimals ...


1

Distinguish between price and rate. Call rate the value inside your smart contact. The rate should not be adjustable. By making it non-adjustable, anyone who is interested in your ICO knows what they are getting before buying. They don't have to trust anyone or anything. They "see" the exact exchange rate in the code. Because the code is immutable (and the ...


1

Supply and demand. Poloniex, Kraken, many regional exchanges much like Bitcoin. Many of the same players. There seem to be as many ways to explain price moves as traders involved.


1

Prices are driven by supply and demand, just like what happens with FIAT currencies. Hence, different exchanges will provide different prices. Add to that the complication that some sites will just recollect information from one or several exchanges, apply (if needed) a number of calculations, and give you a processed price. If you want to create an API, ...


Only top voted, non community-wiki answers of a minimum length are eligible