Linked Questions

3 votes
2 answers
2k views

How to set dynamic buy and sell price for my token?

I have built a simple erc-20 token. I used the code given on ethereum.org code as a reference. There they have talked about setting the price of my token. But how do I set it dynamically, as in ...
23 votes
2 answers
65k views

Gas price in ETH unit

I am wondering if there's a website that provides the price of the standard gas limit (21000 Gas, transaction cost for sending ETH) in ETH unit. I checked Ether.Fund site, but it provides the gas ...
19 votes
2 answers
5k views

How to access external knowledge / data in a smart contract

let’s say a contract wants to execute on knowledge contained outside the blockchain (e.g. whats the price of gold, what was the avg windspeed in NYC, how many people moved to portland in the last ...
0 votes
0 answers
82 views

Smart Contracts and BigchainDB

How can I access data stored in blockchain database like BigchainDB using a smart contract in Ethereum?
0 votes
1 answer
183 views

How to pass NFT property value to smart contract

I have an NFT staking contract that issues rewards based on the property rarity of the NFT staked. The four property tiers are 1,2,3 and 4. When a user clicks stakeNFT(tokenId, nftTier), I use the ...
5 votes
4 answers
6k views

Can I make 'wait n seconds' statement in solidity function? [duplicate]

I want to write a solidity function like function func(uint n, parameters*) payable public { ""wait n seconds"" other statements } Is it possible? It seems that delay parameter in ...
0 votes
0 answers
540 views

How to get "dna" from the metadata file of a ERC721 token in Solidity

here is the context, I would like to be able to burn n ERC721 token based on the "dna" and the attributes "type" in the metadata (see below): { "dna": "602472F&...
10 votes
3 answers
2k views

Flash loan security considerations and attacks

What do developers need to be aware of to make their contracts and systems safe against flash loans? What do they have to think about and protect against?
0 votes
0 answers
28 views

How do i get the price of an erc20 token from solidity smart contract [duplicate]

I'm building a dapp, i'm trying to get the erc20 token price in usd from my smart contract how do i go about this? this is very necessary as smart contracts cannot read from outside networks. I don't ...
5 votes
3 answers
2k views

Can we use block hash as verifiable randomness for the off-chain lottery?

My team is writing a discord lottery bot, we want to use the block hash of some block in the future as a seed for the random generator. We want to allow lottery participants to independently verify ...
4 votes
1 answer
6k views

How to find out the rate of ETH in USD in the contract?

I have a function which can rate ETH in USD. How can I find out the rate of ETH in USD in automatic mode? Can this be done in Solidty? Or do I have to use a third-party language, for example, ...
5 votes
2 answers
7k views

Is there a way to get the *current* price of ETH in solidity function?

Is it possible to get the current price of ETH in USD in a buyTokens function of a deployed solidity smart contract? For instance, every time GETH starts up is determines the price of ETH during ...
1 vote
1 answer
993 views

Getting stock market data from API or other means?

I'm trying to make a contract that interacts with a market price or a market out come : e.g APPL drops below X or NFLX > Y ... Is it possible in Solidity to call an external API during this ...
1 vote
1 answer
621 views

Retrieve Uniswap tx data in my solidity smart contract

As the title says, I have my Solidity smart contract and I am trying to import in ti some public data from the Uniswap contract. In particular I would like to have the tx data stored in my contract (...
107 votes
7 answers
37k views

How can an Ethereum contract get data from a website?

What is the process/workflow behind the process where an Ethereum contract gets some data from a website?
2 votes
3 answers
889 views

Decentralized database for ethereum?

I'm looking for a way to store data in a decentralized way such that I can access any record from within the smart contract, probably through oracles I guess? I've been looking into gundb but not ...
8 votes
3 answers
2k views

Reading Ethereum contract state variables

Is this assumption correct ? There is absolutely no way an ethereum contract can send data to the external world. It can only modify its state variables (later stored in the new block)and send ...
6 votes
3 answers
3k views

What is the Oracle Problem definition exactly and briefly?

What is the Oracle Problem definition exactly and briefly? Does it mean "trusting on a centralized Oracle" ? Or "How to reach a consensus between a group of Oracles" ? Is the matter "centralization" ...
70 votes
3 answers
19k views

Why can't contracts make API calls?

The model that contracts can only accept and process data, instead of also being able to retrieve data from the Internet, seems limiting (even if not, it's less direct). If a concern is that data or ...