Questions tagged [ethereum]

Ethereum is a blockchain currency (like Bitcoin) with a public ledger. Questions should relate to programming. General questions about Ethereum should be asked on https://ethereum.stackexchange.com

is an open-source, public, blockchain-based distributed computing platform featuring smart contract (scripting) functionality. It provides a decentralized Turing-complete virtual machine, the Ethereum Virtual Machine (EVM), which can execute scripts using an international network of public nodes. Ethereum also provides a cryptocurrency token called , which can be transferred between accounts and used to compensate participant nodes for computations performed. Gas, an internal transaction pricing mechanism, is used to mitigate spam and allocate resources on the network.

was proposed in late 2013 by Vitalik Buterin, a cryptocurrency researcher and programmer.

The official website of is Ethereum.org

6757 questions
10
votes
1 answer

How to get the price of a BEP20 token?

I would like to calculate the price of a BEP20 token in BNB. I checked poocoin and pancakeswap how they calculate the price. As I see they call continously the bsc-dataseed through web3.js, but I didn't find the solution yet. The current status of…
Erik
  • 101
  • 1
  • 1
  • 4
10
votes
1 answer

How to send ERC20 token to smart contract balance?

I'm trying to build a smart contract and inherit some functions to swap ERC20 tokens, Here are my questions? Question A: Is it possible to transfer ERC20 token to smart contract balance?, Please provide an example, i.e. We can create a function to…
Giorgiu
  • 199
  • 1
  • 3
  • 10
10
votes
4 answers

Web3.js extending the window interface type definitions

Web3.js web3 into the window object. Browser Wallets like MetaMask inject ethereum into the window object. In typescript right now to mitigate compile errors I'm casting as follows (window as any).ethereum After looking in the Web3 repository and…
Xavier
  • 831
  • 3
  • 9
  • 22
10
votes
2 answers

How Execution price is calculated in Uniswap?

I've already spend few hours trying to understand execution price. I understand the the concept of Mid price as it is the reserve ratio between two pairs. According to Uniswap sdk documentation, Execution price is the ratio of assets sent/received.…
10
votes
4 answers

Where actual blockchain state data stored : in memory , in file or in database?

I have a query, where do blockchain data saved in every node. After a long search in google, StackOverflow, and some blogs, like got many answers: like: it saved in a database like level-DB or rocks-DB, some said it saves in memory in a variable,…
10
votes
3 answers

How to make an API call in solidity?

I have a smart contract that I’m trying to make, it pays out the winners of my League of Legends tournament. However I’m running into an issue. I need to make an API call to get the winner of the match, I have a simple URL that I’ve…
user13637241
10
votes
1 answer

How to send an array of structs from web3js to solidity contract?

I am getting an error when passing (javascript array of objects) from web3js, To solidity function that takes (array of structs) as a parameter. could you help me? below is the code and the error // web3js code let slctedItems = [{name:'item1',…
user13602695
10
votes
0 answers

How to fix 'write tcp 127.0.0.1:54917->127.0.0.1:8545: i/o timeout' error in golang code that listens to smart contract events

I am using golang to listen to the smart contract events. I deployed my contracts to ganache ui and ganache-cli ports. But I get the below error: ➜ sc_events go run main.go 2019/04/17 14:25:04 write tcp 127.0.0.1:54917->127.0.0.1:8545: i/o…
10
votes
3 answers

Solidity - Solidity code to Input JSON Description

I want to compile my ethereum HelloWorld.sol smart contract. In all the tutorials is that you do it like this: var solc = require('solc'); var compiledContract = solc.compile(fs.readFileSync('HelloWorld.sol').toString(); where HelloWorld.sol…
Banana Cake
  • 1,172
  • 1
  • 12
  • 31
10
votes
8 answers

Is it possible to store images on the Ethereum blockchain?

I'm ramping up on learning Solidity, and have some ideas. At the moment I am curious if files/images can be put on the blockchain. I'm thinking an alternative would be some hybrid approach where some stuff is on the blockchain, and some stuff is in…
Nik Hammer-Ellis
  • 1,042
  • 2
  • 9
  • 14
10
votes
1 answer

where is the privatekey and transation store in chrome file using metamask extension

i want to know where is the privatekey and transation store in google chrome file using metamask extension. can you help me? it is in /Users/jackson/Library/Application Support/Google/Chrome/Default/Extensions???
少年追梦
  • 121
  • 1
  • 1
  • 6
10
votes
2 answers

How can I get the same return value as solidity `abi.encodePacked` in Golang

How can i run abi.encodePacked in golang? in solidity i use keccak256(abi.encodePacked(a, b)) to calc the signature of the params. here is my contract. pragma solidity ^0.4.24; import "openzeppelin-solidity/contracts/ECRecovery.sol"; contract…
chengbin du
  • 512
  • 4
  • 13
10
votes
1 answer

Send ERC20 token with web3.py using a local private key

I am trying to send ERC20 tokens in python with web3.py using a local private key. With this code I can send ether: w3 = Web3(HTTPProvider('https://api.myetherapi.com/eth')) signed_txn = w3.eth.account.signTransaction(dict( …
user9915065
  • 101
  • 1
  • 1
  • 3
10
votes
8 answers

contract has not been deployed to detected network (network/artifact mismatch) on Rinkeby Network

I have been running into the specified in the title. I have developed a smart contract and have successfully compiled and deployed it to the network as follows: 1. Run testrpc 2. truffle compile 3. truffle migrate However, the error above is still…
Sho0310
  • 101
  • 1
  • 1
  • 5
10
votes
1 answer

Unhandled rejection Error: Invalid JSON RPC response: ""

I am trying to call a method on my ERC20 token contract. I am connecting to 'https://rinkeby.infura.io/' httpProvider. I can call() constant methods but when i want to change the state of the contract by calling send() function i get this mentioned…
sam k
  • 1,048
  • 2
  • 14
  • 22