texts: Does cellphone 4G tethering wifi cause the Ledger 'transaction rejected by server' error?

texts:
I have just tried once again to make an ETH transaction using the default suggestion of 45 Gwei, which seems much too high. Yet it was rejected by the server, and the Ledger support has only emailed me so far that I should increase the gas! Even though a price 5 times lower is being confirmed quickly...

Could the problem be that I'm using a cellphone company's 4G tethered wifi connection for my computer? Can that cause a the server rejection error? Could the cellphone company be blocking a port? If I can download blocks to sync Ethereum Wallet (which I can), does that mean the cellphone company is not blocking any ports?


texts: how to connect to a private ethereum testnet with blockcypher

texts: our project uses blockcypher to create eth wallet which can transfer eth now.Blockcypher supports ETH main network and its own testnet. Is there any way to connect the blockcypher node to a custom testnet such as https://sokol.poa.network?


texts: "DAO-Fork Check" Error When Running Geth in Terminal

texts:
I'm running Geth 1.4.15 (just released),and trying to sync the blockchain. For some reason, I always get this "DAO-fork dropping" error message when these spam attacks are occurring. I wanted to know if this is what everyone sees or if I have a unique problem that I can fix.

Here's the terminal screenshot: http://imgur.com/a/ePPeg


texts: ganache-cli issues: - How to retrive old ganache-cli account once cmd window close

texts:
I am using ganache-cli....and it is providing me 10 test accounts with 100ETH balance.

when I close that cmd and start ganache-cli it creates new 10 test accounts every time.

So how to retrieve my old account bcoz i have used that account reference in whole application?


texts:
I'm trying to send ether from one address to another. I have a valid generated address and a private key for that. I have a node is working on Linux in fullmode and RPC server listening on the default port. According to JSON RPC Wiki I'm trying to create the following transaction:

String transaction = "
{
  "from": "my address",
  "to": "an address of a recipient",
  "value": "a value in Wei converted to Hex String",
  "chainId": 1,
  "nonce": 0
}"

And then I'm creating a signature like

String txData = makeKeccak256(privateKey + transaction.toHex());

And sending this string as Hex to RPC server. But I'm getting the following error:

rlp: expected input list for types.txdata

I've read that the gasPrice and gas are calculating automatically and are optional. So please help me to find out how to send the transaction correctly. Thank you


texts: MetaMask custom RPC connection error with private ganache-cli, EC2

texts:
Currently I am trying to build private dapp using ganache-cli as a blockchain backend with aws ec2 instance.
I get the expected result when ssh from another shell.
request:
curl -X POST --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}' localhost:8545

response:
{"id":67,"jsonrpc":"2.0","result":"EthereumJS TestRPC/v2.10.2/ethereum-js"}

Here is my VPC setting for 8545 port:

Also netstat command result:
ubuntu@ip-192-168-0-102:~$ netstat -an | grep 8545
tcp        0      0 127.0.0.1:8545          0.0.0.0:*               LISTEN

However, I get following error when I set up MetaMask's custom rpc like: {MY_PUBLIC_IP}:8545 even though my ganache docker (and ipfs) is running.
Is there anything that I am missing?
inpage.js:1 MetaMask - RPC Error: JsonRpcEngine: Response has no error or result for request:
{
  "id": 1852126408,
  "jsonrpc": "2.0",
  "method": "eth_chainId",
  "params": [],
  "origin": "{MY_PUBLIC_IP_HERE}"
}

WebSocket connection to 'ws://{MY_PUBLIC_IP_HERE}/' failed: Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT

and here is my docker-compose setting:
version: "3"
services:
  ganache:
    image: trufflesuite/ganache-cli:latest
    ports:
      - "127.0.0.1:8545:8545"
      - "127.0.0.1:8546:8546"
    entrypoint:
    - node
    - /app/ganache-core.docker.cli.js
    - --deterministic
    - --db=/ganache_data
    - --mnemonic
    - 'minimum symptom minute gloom tragic situate silver mechanic salad amused elite beef'
    - --hostname
    - '0.0.0.0'
    restart: always
  ipfs:
    build: ./ipfs
    ports:
      - "127.0.0.1:4001:4001"
      - "127.0.0.1:4002:4002/udp"
      - "127.0.0.1:5001:5001"
      - "127.0.0.1:8080:8080"
      - "127.0.0.1:8081:8081"
    restart: always


texts: How to get all the transactions made by a token address

texts:
Given the address of a token, how I can get all the transactions related to that address using JSON RPC or an external api such a api.etherscan.io?

The transactions that gives a Ethereum address are different that the transaction that gives an ERC20 token. Example:

https://etherscan.io/address/0x9f7dd5ea934d188a599567ee104e97fa46cb4496
https://etherscan.io/token/Aragon?a=0x9f7dd5ea934d188a599567ee104e97fa46cb4496

I need to get the two transaction that are registered for Aragon via API.


texts: How to use key derivation and 'coin selection' to increase privacy, like in Bitcoin?

texts:
In Bitcoin, you can have increased privacy by never re-using addresses. A single private key can generate many addresses if you are using a key derivation scheme.

In Ethereum, instead of UTXOs you have accounts. And you can use a key derivation scheme on top of Ethereum, to generate multiple private keys for multiple accounts. I want to do the same thing in Ethereum - avoid account re-use in order to increase privacy.

But I can't seem to find an Ethereum wallet that will let you track these multiple accounts, then perform 'coin selection' (really, 'account selection') when sending ether out of the wallet.

Do any ethereum wallets support a 'coin selection' algorithm?


texts:
I'm wanting to set up a charity and want to use a public wallet for accepting donations with on Etherscan where I can have a displayed name next to the wallet like this:

How Can I Add My Name Next To Address On Etherscan?


texts: Can you tell how much money a user sent and sender/reciever when it comes to Zero Knowledge Proofs?

texts:
As I understand Zero-Knowledge Proofs:

You can tell someone sent a certain amount of money
You can tell someone received a certain amount of money
But you can't cryptographically tie the two together.

Or is even that information hidden?


texts:
Should I always put 0x at the start of Ethereum addresses?
Sending ether to addresses without 0x seem to work perfectly fine.

  when sending to an address, do you include the "0x" before the rest of
  the number?

  The address in my coinbase starts with 0x, then the rest of the
  receiving address. However my wallet file i created with geth doesn't
  have the 0x in the name.

Source


texts: Is there any other platform to check contract working?

texts:
I am trying from past few days but didn't get test ether to test my own contract...is there any other platform where I can test my contract or can you send me some ether

0x0aB6F803A232a9cd595efB9eaf496415Bb7E52e8


texts: Is it safe to use web3.eth.accounts.create() in frontend?

texts:
web3.eth.accounts.create returns the address along with private key so I was wondering if is it safe to call it using plain JS in website frontend instead of doing it server side in Node?

My use case is to let users create wallet address on the website and store the encrypted private key in database. Since only the authorized user creating the address would be able to see the private key (using console), I think it shouldn't be an issue but I just wanted to make sure it's safe to do it?

Also, I plan to build this dapp without NodeJs using a traditional server side language, e.g. Python or PHP with web3js. What are the things I should keep in mind while doing it from security perspective?


texts: How can ERC20 token implementations be verified?

texts:
The ERC20 Token Standard is great, in that it allows wallets, exchanges, and client implementations to allow users to interface with a variety of tokens in a common way. But how can one of these clients verify that the underlying implementation of a token behind the interface actually conforms to the expectation defined by the standard?

For example, any contract that implements the ERC20 interface, could implement the transfer(address to, uint256 value) function to just ignore the to param and transfer to a hardcoded address.

I think that one solution is to verify that the token contract bytecode actually matches a reference implementation, and I believe this is what Consensys has done with their HumanStandardTokenFactory.sol example. This makes a lot of sense.

But when you look at examples that want to extend the functionality of a token, but still be treated with respect to the standard, like Beercoin (which is also awesome)...is the only way to verify that this the implementation conforms to the standard via social inspection and audit? Are wallet providers, exchanges, etc performing any other type of provable verification before granting something "token status", or just checking the box that they implemented the few interface functions?


texts: I just want to query Parity what setup should I use?

texts:
I want to run javascript on node locally against Web3. I require a minimal amount of information security and I just want it to work.

I tried snap run parity --light and it is slow because it still needs to sync something.

I am seeking something about 100x faster. How can I do this?

version Parity/v1.9.7-unstable-7919629-20180423/x86_64-linux-gnu/rustc1.25.0


texts: Saving a function in a variable in Solidity

texts:
I am very new to solidity and stack exchange as well.
I am trying to use the date time api from https://github.com/pipermerriam/ethereum-datetime/tree/master/contracts.
What getYear(date) does is that it takes an argument date and returns the year of the date. I am trying to save the returned value of getYear() to a variable requiredYear like I do in Java or C++. The truffle compiler is giving me other errors so I cannot tell whether this is correct, but I was also not able to find any documentation about it. Any help would be appreciated!

 uint16 requiredYear = getYear(uint dateStampOfMileStone) constant returns (uint16);


texts: web3-core-method.umd.js:1191 Uncaught (in promise) Error: Transaction has been reverted by the EVM:

texts:
Keep getting this error and really not sure what's causing it.

Smart contract:

contract BasaltStore {
  // struct of how a document will be stored
  struct documentStore {
    // unique id of the doc
    uint256 id;
    // the url of the ipfs node where the document is stored
    string ipfsHash;
    // wallet address of who uploaded the document
    address uploader;
    // date the document was uploaded (created here)
    uint dateUploaded;
  }

  // mapping of all documents
  mapping (uint64 => documentStore) public ListOfDocuments;
  // count of all documents stored
  uint256 public documentCount;

  /** Stores the newly created document details */
  function sendDocument(
    string memory _ipfsLocation,
    uint256 _uploadDate,
    uint64 _key
  )
  public
  {
    documentCount ++;
    ListOfDocuments[_key] = documentStore(documentCount, _ipfsLocation, msg.sender, _uploadDate);
  }

  /** Retrieves docuement details */
  function getDocument(
    uint64 _id
  )
  public
  view
  returns (string memory, address, uint256)
  {
    // return the attributes of the documentStore we need
    string memory ipfsHash = ListOfDocuments[_id].ipfsHash;
    address uploader = ListOfDocuments[_id].uploader;
    uint256 dateUploaded = ListOfDocuments[_id].dateUploaded;
    return (ipfsHash, uploader, dateUploaded);
  }
}

React code calling smart contract:

var key = this.state.StudentNumber + this.state.account[0]
key = parseInt(hash(key), 10)
this.setState({idForBlockchain: key})
console.log(key)

//get todays date
let newDate = new Date()
newDate = newDate.getTime()
var _ipfsLink = this.state.IPFSlink
var _account = this.state.account[0]

await storehash.methods.sendDocument(_ipfsLink, newDate, key).send({from: _account})

//call the smart contract method to create a new document
//storehash.methods.sendDocument(this.state.IPFSlink, newDate).send({from: this.state.account})
console.log("adding student")
await this.createStudent(e)
console.log("student added")

It seems to fail after calling the

await storehash.methods.sendDocument(_ipfsLink, newDate, key).send({from: _account})

Can anyone help me figure out what's going wrong?


texts: Swapped BTC for ETH using Bity.com en MEW but lost funds

texts:
I used bity.com service to convert 0.2 BTC for ETH and bity did not deliver my ETH, is this a scam?

This is the confirmation message i got on MEW: Your TX has been broadcast to the network. It is waiting to be mined & confirmed. During ICOs, it may take 3+ hours to confirm. Use the Verify & Check buttons below to see. TX Hash: 0x851c85bc5d365209db738104ef84c79c04ff10ed3e0c41b5a2f122e36863eb6f
View your transaction

When I check the Tx or click on the link it says it doesnt exist.


texts: ERC721 - One NFT Token - Multiple Assets

texts:
Is it possible to associate and provide multiple assets for/with a single ERC721 Token?
So that when someone buys an ERC721 Token (NFT) they don't just get one .jpg or one .png file, but like 3 of 'em? Or maybe one image, one audio file, and one .PDF?
I know the standard ERC721 Metadata JSON Schema (as described here: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md) mandates a "name", "description", and "image" properties - as follows:
{
    "title": "Asset Metadata",
    "type": "object",
    "properties": {
        "name": {
            "type": "string",
            "description": "Identifies the asset to which this NFT represents"
        },
        "description": {
            "type": "string",
            "description": "Describes the asset to which this NFT represents"
        },
        "image": {
            "type": "string",
            "description": "A URI pointing to a resource with mime type image/* representing the asset to which this NFT represents. Consider making any images at a width between 320 and 1080 pixels and aspect ratio between 1.91:1 and 4:5 inclusive."
        }
    }
}

But I know it's also possible to add additional KEY-VALUE properties to these standard ones, like so:
...
"image" : "https://www.somedomain.com/someFolder/someImage.png”,
"attributes" :
  {
        “attr1” : “value1",
        "attr2” : “value2”
  }

So would this be a simple matter of just adding links to the other assets I'm proposing (the audio file, the PDF file, etc.) in this manner as additional attributes to the JSON file associated with the Token in question - and that's it?
It feels oddly simple - like maybe too simple, so I'm wondering if there are any gotchas - things I'm not aware of or overlooking - that'll prevent us from making this happen correctly.
One thing I can foresee is that Wallets and NFT Marketplaces/Platforms will default to displaying the image specified in the "image" attribute - and overlook the other 2 images that may potentially be specified in the JSON's custom attributes (or the audio and PDF files.)
So unless custom code is written to look for and display them (which is a simple enough task) they would only "live" in the Metadata file, right?
But is there anything else that needs to be figured out here?
Would love to hear any thoughts/suggestions about this!


texts:
Im trying to send a transaction to contract function with web3.py on ropsten testnet. while doing so, Im getting this error.

  AttributeError: 'list' object has no attribute 'buildTransaction'

here is my web3.py transaction signing code

tx = contract_instance.greet("Hi devs").buildTransaction({'nonce': web3.eth.getTransactionCount(account_address)})
# Get tx receipt to get contract address
signed_tx = web3.eth.account.signTransaction(tx, key)
tx_receipt = w3.eth.getTransactionReceipt(tx_hash)
web3.eth.sendRawTransaction(signed_tx.rawTransaction)

please let me know what seems to be the problem. full code here https://i.stack.imgur.com/3hMUP.jpg


texts: Studying the cryptopunks code. Why are these three conditions required?

texts:
So I recently started learning some solidity and was looking at code to make nft series like the punks.
I noticed that in their code there are always three conditions that appear to do the same thing.
!allPunksAssigned
punksRemainingToAssign == 0
punkIndex >= 10000

Why are the three of them needed? I see that one of them has to be manually activated but still, don't see the reason for the three conditions in almost every function. Shouldn't punkIndex >= 10000 suffice? I feel like I'm missing something.
function getPunk(uint punkIndex) {
        if (!allPunksAssigned) throw;
        if (punksRemainingToAssign == 0) throw;
        if (punkIndexToAddress[punkIndex] != 0x0) throw;
        if (punkIndex >= 10000) throw;
        punkIndexToAddress[punkIndex] = msg.sender;
        balanceOf[msg.sender]++;
        punksRemainingToAssign--;
        Assign(msg.sender, punkIndex);
    }

https://github.com/larvalabs/cryptopunks/blob/master/contracts/CryptoPunksMarket.sol


texts:
What are the average transaction propagation times in Ethereum for reaching 50% and 95% of nodes? That is, once a transaction is generated on a given node, how long does it take on average to reach 50% and 95% of nodes in the Ethereum network?

Vitalik mentions a paper presenting block propagation statistics for Bitcoin:
https://blog.ethereum.org/2014/07/11/toward-a-12-second-block-time/

  "According to a 2013 paper from Decker and Wattenhofer in Zurich, once
  a miner produces a block on average it takes 6.5 seconds for the block
  to reach 50% of nodes, 40 seconds for it to reach 95% of nodes and the
  mean delay is 12.6 seconds."

It would be interesting to have similar statistics for Ethereum transaction propagation times.


texts:
In all sources it's stated that transactions cost gas. Since the distinction between a transaction and a message (some name it an internal transaction) is not so clear it couldn't be sure if messages between contracts cost any gas.

There's a gas limit field in messages but I couldn't find any source explicitly stating messages do consume gas.

If messages consume gas, then I presume this is supplied by the ether balance of the contract account

Thanks


texts: I accidentally sent a token to a token contract. Can I get it back?

texts:
Instead of transferring my ERC20 token to my wallet, I accidentally sent it to the contract itself (the contract, with source code, is here).

Would the contract creator be able to send it back to me?


texts: Connecting to hosted web3 provider from NodeJS backend

texts:
I'm using these instructions from etherchain. Here's a similar question(seems like duplicate, but it's not). The solution provided there doesn't work for me, because I don't have a local ethereum client to connect to. I want to use one provided by Etherchain.

const Web3 = require('web3');
const web3 = new Web3(new Web3.providers.HttpProvider("http://rpc.ethapi.org:8545"));
web3.eth.getBlock("latest", (error, result) => {
  console.log('error:', error);
  console.log('results', result);
});

Error:

Error: Invalid JSON RPC response: ""
   at Object.InvalidResponse (/home/manid/Рабочий стол/Pogovorim/NODE_SERVER/node_modules/web3/lib/web3/errors.js:35:16)
    at XMLHttpRequest.request.onreadystatechange (/home/manid/Рабочий стол/Pogovorim/NODE_SERVER/node_modules/web3/lib/web3/httpprovider.js:116:32)
    at XMLHttpRequestEventTarget.dispatchEvent (/home/manid/Рабочий стол/Pogovorim/NODE_SERVER/node_modules/xhr2/lib/xhr2.js:64:18)
    at XMLHttpRequest._setReadyState (/home/manid/Рабочий стол/Pogovorim/NODE_SERVER/node_modules/xhr2/lib/xhr2.js:354:12)
    at XMLHttpRequest._onHttpRequestError (/home/manid/Рабочий стол/Pogovorim/NODE_SERVER/node_modules/xhr2/lib/xhr2.js:544:12)
    at ClientRequest.<anonymous> (/home/manid/Рабочий стол/Pogovorim/NODE_SERVER/node_modules/xhr2/lib/xhr2.js:414:24)
    at emitOne (events.js:96:13)
    at ClientRequest.emit (events.js:188:7)
    at Socket.socketErrorListener (_http_client.js:309:9)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at emitErrorNT (net.js:1281:8)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)

What am I missing?


texts:
Anyway to get the raw Hex of a transaction from etherscan?

I know in Bitcoin you can do this on blockchain info with ?format=hex

I want to rebroadcast a tx when it gets dropped from the mempool


texts:
I have transferred 0.11 ethereum to wallet today morning
0x5acc84a3e955Bdd76467d3348077d003f00fFB97
But it has failed. Now what i have to do. Whether the amount will be returned back to my wallet.
Transaction Hash:
0x193e584e18903a338f88d374864f3fb95553eb381b972c7d666748cffdf38acf
Status:
Fail
Block:
10391059 2024 Block Confirmations
Timestamp:
7 hrs 34 mins ago (Jul-04-2020 05:26:10 AM +UTC)
From:
0x3f1e01f65cac6cdb60ef5f7fc8f988f042949a2c
To:
Contract 0xd9f61a4a96f66afe09c6f55b72aeaf1590ac8495
Warning! Error encountered during contract execution [Reverted]
Value:
0 Ether ($0.00)
Transaction Fee:
0.01265 Ether ($2.86)
Click to see More
Private Note:
To access the Private Note feature, you must be Logged In


texts:
Cannot read property 'toNumber' of undefined?

Error message

  1) Contract: DappTokenSale
         ends token sale:
       TypeError: Cannot read property 'toNumber' of undefined
        at test/DappTokenSale.js:85:28
        at process.internalTickCallback (internal/process/next_tick.js:77:7)

Code

var DappToken = artifacts.require('./DappToken.sol');
var DappTokenSale = artifacts.require('./DappTokenSale.sol');

contract('DappTokenSale', function(accounts) {
var tokenInstance;
var tokenSaleInstance;
var admin = accounts[0];
var buyer = accounts[1];
var tokenPrice = 1000000000000000; // in wei
var tokensAvailable = 750000;
var numberOfTokens;

it('initializes the contract with the correct values', function() {
return DappTokenSale.deployed().then(function(instance) {
  tokenSaleInstance = instance;
  return tokenSaleInstance.address
}).then(function(address) {
  assert.notEqual(address, 0x0, 'has contract address');
  return tokenSaleInstance.tokenContract();
}).then(function(address) {
  assert.notEqual(address, 0x0, 'has token contract address');
  return tokenSaleInstance.tokenPrice();
}).then(function(price) {
  assert.equal(price, tokenPrice, 'token price is correct');
});
});

it('facilitates token buying', function() {
return DappToken.deployed().then(function(instance) {
  // Grab token instance first
  tokenInstance = instance;
  return DappTokenSale.deployed();
}).then(function(instance) {
  // Then grab token sale instance
  tokenSaleInstance = instance;
  // Provision 75% of all tokens to the token sale
  return tokenInstance.transfer(tokenSaleInstance.address, tokensAvailable, { from: admin })
}).then(function(receipt) {
  numberOfTokens = 10;
  return tokenSaleInstance.buyTokens(numberOfTokens, { from: buyer, value: numberOfTokens * tokenPrice })
}).then(function(receipt) {
  assert.equal(receipt.logs.length, 1, 'triggers one event');
  assert.equal(receipt.logs[0].event, 'Sell', 'should be the "Sell" event');
  assert.equal(receipt.logs[0].args._buyer, buyer, 'logs the account that purchased the tokens');
  assert.equal(receipt.logs[0].args._amount, numberOfTokens, 'logs the number of tokens purchased');
  return tokenSaleInstance.tokensSold();
}).then(function(amount) {
  assert.equal(amount.toNumber(), numberOfTokens, 'increments the number of tokens sold');
  return tokenInstance.balanceOf(buyer);
}).then(function(balance) {
  assert.equal(balance.toNumber(), numberOfTokens);
  return tokenInstance.balanceOf(tokenSaleInstance.address);
}).then(function(balance) {
  assert.equal(balance.toNumber(), tokensAvailable - numberOfTokens);
  // Try to buy tokens different from the ether value
  return tokenSaleInstance.buyTokens(numberOfTokens, { from: buyer, value: 1 });
}).then(assert.fail).catch(function(error) {
  assert(error.message.indexOf('revert') >= 0, 'msg.value must equal number of tokens in wei');
  return tokenSaleInstance.buyTokens(800000, { from: buyer, value: numberOfTokens * tokenPrice })
}).then(assert.fail).catch(function(error) {
  assert(error.message.indexOf('revert') >= 0, 'cannot purchase more tokens than available');
});
});

it('ends token sale', function() {
return DappToken.deployed().then(function(instance) {
  // Grab token instance first
  tokenInstance = instance;
  return DappTokenSale.deployed();
}).then(function(instance) {
  // Then grab token sale instance
  tokenSaleInstance = instance;
  // Try to end sale from account other than the admin
  return tokenSaleInstance.endSale({ from: buyer });
}).then(assert.fail).catch(function(error) {
  assert(error.message.indexOf('revert' >= 0, 'must be admin to end sale'));
  // End sale as admin
  return tokenSaleInstance.endSale({ from: admin });
}).then(function(receipt) {
  return tokenInstance.balanceOf(admin);
}).then(function(balance) {
  assert.equal(balance.toNumber(), 999990, 'returns all unsold dapp tokens to admin');
  // Check that the contract has no balance
  }).then(function(price) {
    assert.equal(price.toNumber(), 0, 'token price was reset');
});
});
});


texts: Multisig Wallet in Mist created but is in creating loop

texts:
We are using MIST and we've created a Multisig Wallet. It is actually creating (still grey and creating) and my partner imported it and it is importing (also grey). Is there some BUG in MIST why it is not working?

Here is the contract successful created  https://etherscan.io/address/0x7bf08cb1732e1246c65b51b83ac092f9b4ebb8c6

Any idea what todo?

Thanks for your help.
Nicky


texts: Calling onlyowner functions using owner's private key

texts:
I need to call a function with onlyOwner modifier in my smart contract via web3.js.
I want a user of my site to be able to send their information to a white list, but it sends the transaction from the owners account (I have access to the private keys).

Neither the user or the owner should need to access the website via metamask, and the owner would pay for the transaction gas.

What is the best way to achieve this proxy service? I would just need to send a signed transaction? I obviously don't want to expose private keys.


texts: How to prioritize a light client to make sure it's never kicked out?

texts:
Running a geth full node on a dedicated server:
geth --maxpeers 5000 --light.maxpeers 2000 --light.serve 500 --syncmode full
I want to make sure it'll always accept my light client(s) even if its LES limits are reached (it should kick out some other client in that case).
Conversely, while my light clients are connected, they should never be kicked out by the server.
Source code mentions a clientPool structure that maintains some priorities/counters for all known peers but I can't find a way to read the contents of it from geth console. Nor can I find a way to set the priorities manually.
I've tried whitelisting my client via admin.addTrustedPeer (executed on the server), but with no luck.
Despite the server not being currently busy serving other clients, my light client keeps getting kicked out all the time. (Note: I have a few thousands of ETH accounts watched by that light client, if that's relevant).
(Light) client log:
TRACE[02-24|19:28:08.383] Starting p2p dial                        id=abcdef123456789 ip=192.0.2.1 flag=staticdial
INFO [02-24|19:28:08.383] Looking for peers                        peercount=0 tried=1 static=1
DEBUG[02-24|19:28:08.388] Adding p2p peer                          peercount=1 id=abcdef123456789 conn=trusted-staticdial addr=192.0.2.1:30303 name=Geth/v1.9.25-stable-...
TRACE[02-24|19:28:08.388] Starting protocol les/3                  id=abcdef123456789 conn=trusted-staticdial
DEBUG[02-24|19:28:08.390] Node entered                             set=connected id=abcdef123456789 count=1
DEBUG[02-24|19:28:08.390] Saved node state                         id=abcdef123456789 state=[]
DEBUG[02-24|19:28:08.390] Node left                                set=connected id=abcdef123456789 count=0
DEBUG[02-24|19:28:08.390] Removing p2p peer                        peercount=0 id=abcdef123456789 duration=2.571ms  req=true err="disconnect requested"

Server (full node) log: (ignore the time gap; it repeats all the time...)
TRACE[02-24|18:05:55.640] Accepted connection                      addr=192.0.2.2:32932\n","stream":"stderr","time":"2021-02-24T18:05:55.640764336Z
DEBUG[02-24|18:05:55.642] Adding p2p peer                          peercount=166 id=fedcba987654321 conn=inbound addr=192.0.2.2:32932  name=Geth/v1.9.24-stable-...\n","stream":"stderr","time":"2021-02-24T18:05:55.642652501Z
TRACE[02-24|18:05:55.642] Starting protocol les/3                  id=fedcba987654321 conn=inbound\n","stream":"stderr","time":"2021-02-24T18:05:55.642660541Z
TRACE[02-24|18:05:55.642] Protocol les/3 failed                    id=fedcba987654321 conn=inbound err=\"disconnect requested\"\n","stream":"stderr","time":"2021-02-24T18:05:55.643015731Z

I can't see much in the logs, other than "disconnect requested" in both. It's not even saying which side has requested the disconnect, but I assume it was the server. The reason remains unknown, but again, I assume it is going to be related to that client score.
Interesting: when I try connecting another light client from another machine/IP, it gets in easily. If I try another from the same machine/IP, it's getting rejected as well (but I can't rule out a coincidence with certainty).
The client sits behind a NAT but otherwise there's no firewalls blocking it.
Any idea how one could manually whitelist an IP, or even better an enode (without the IP:port part as these may be dynamic, especially the port)?


texts: When is chain data (length) compared between nodes? Is there any way to control this?

texts: I am trying to use an ethereum blockchain in a multiagent network. I would like to control when information is exchanged between nodes to keep the network synchronous, so I am trying to figure out how to do this with ethereum. I figure the ganache client might be the best way to do this since you can control when blocks are mined, but I'm not sure if this is the only time the nodes communicated and compare chain versions. Thank you for the help.


texts: How to add data to an array inside a struct?

texts:
I have made a struct which contains an array . Now when I am adding data to the struct, I'm not able to add data to the array .
struct User {
        uint256 limit; // spending limit
        uint256 avlLimit;   // Limit available to spend
        uint256 cnumber; // card cnumber
        uint256 xdays; // time to repay outstanding amount after stmt generation;
        address[] dependents;

    }

mapping (address => User) profile;

function addUser(address _user, uint256 _cno, uint256 _limit, uint256 _days, address _dep1, address _dep2) public onlyAdmin {
        profile[_user] = User(_limit, _limit, _cno, _days, dependents.push(_dep1, _dep2));
    }

Error : DeclarationError: Undeclared identifier. profile[_user] = User(_limit, _limit, _cno, _days, dependents.push(_dep1, _dep2));
Usually , if I have to add data to a struct , I can do it as :
profile[_user].dependents.push(_dep1);
profile[_user].dependents.push(_dep2);

But how can I use the two commands together in a function ?
Thanks in advance.


texts: Since ERC token names, symbols cannot be reserved, anyone recommend selfdestruct/suicide method call?

texts:
As we know contracts are unique ..  has anyone 'reserved' a token name/ symbol before final deployment, by putting a suicide by owner method.. so this dummy can be 'removed' just before the same token name and symbol is then deployed to take its place.

Will a contract suicide (selfdestruct method call) 'remove' any reference from etherscan, I am sure it will as that contract will be nullified ? by that call.

how does the chain 'remove' or just blank out the Hash of the now suicided contract

thanks


texts: How does Blockchain handle physical properties that can be broken down?

texts:
Let's take a parcel of land, 1 hectare large, and I have this already registered to myself on the blockchain. How will this be done and at what granularity? In the future I could sell this an acre each or even at a square foot. Will there be a minimal granularity that is decided? Also, how is additional information stored - like what is the specific location/address/lat-long at which this property is and what are its dimensions?

Similarly for other things like a car. If I have a blockchain confirmed ownership of a car, what if I only want to sell off one of the tyres to somebody else? How will I potentially transfer ownership of only one tyre?

Not sure if the question is relevant, but I'm unable to get my head around this qn.


texts:
I am developing an eBay DAPP as my second project.

The transactions are taking time. How to reduce transaction times?

Moreover, I want to add an image uplaod option too.
Where should I store the image? On blockchain or IPFS? How?


texts: I am setting up a geth light client on an AWS EC2 instance. After running geth, the client seems to not be able to discover any peers and remains idle. Running admin.peers in the console shows that there are no active peers. Interestingly, unlike on my laptop geth node, where the output "looking for peers" is printed until a peer is found, on AWS there is simply no output after "http endpoint created". I have already ensured port 30303 is open for the server. What could be causing this lack of output and peers? And how do I get more peers for AWS? Is there a list somewhere that I can use?


texts: What kind of security measures do Testnets have in place?

texts:
Cryptographic work is spent verifying transactions on Ethereum, without which, there would be little to nothing preventing colluding to start a 51% attack or creating false identities to start a Sybil Attack.

What counteractive measures do testnets have set in place to prevent such attacks?


texts: Cannot transfer ether from smart contract to another address

texts:
I am using truffle and when we type
truffle develop it provides us with 10 address **

So, the problem I am facing is I have created 2 functions one to deposit ether and the other one to transfer the ether to another address **
You can view those 2 functions in .sol file

The deposit function is meant to take ether and store it into the smart contract
But the problem is with the transfer function as i am not able to access that stored ether and not able to transfer it to another truffle address

UPDATE: What i want is to access the stored ether and transfer it to another truffle address/account. Currently, I am getting no error. I have removed the "payable" Keyword from the transfer() function but the situation is still the same that-->>
Metamask transaction pop up comes up it clearly mentions that i want to transfer ether from player 1 to player 2 but when I confirm it does not sends any ether and no error is being displayed. And when i check transaction history it shows that only gas was sent to the player 2

Think of player 1 and player 2 as input address taking the address of accounts which truffle provides us

.sol

  mapping (address => uint256) public balances;

    event LogDeposit(address sender, uint amount);
    event LogTransfer(address sender, address to, uint amount);

    function deposit() payable returns(bool success) {

        balances[msg.sender] += msg.value;
        LogDeposit(msg.sender, msg.value);
        return true;
    }

    function transfer(address to, uint value) payable public returns(bool success)
    {
        if(balances[msg.sender] < value) throw;
        balances[msg.sender] -= value;
        to.transfer(value);
        LogTransfer(msg.sender, to, value);
        return true;
    }

The transfer function when called from App.js gives me a metamask transaction pop to confirm the transaction (similar to when i call the deposit function)
But even after confirming it does not sends out any ether to the another address
App.js

OraclizeContract.deployed().then(function(instance) {

  console.log("Initializing");
  instance.deposit({from: fromAddress1,
                    gas: 3000000,
                    value: web3.toWei(betAmount, 'ether')}) //betAmount is a input box and fetching its value into betamount variable and passing it over here
                               .then(function(v){
                                       console.log(v);
                                       console.log("Function Executed");

                                 });
                       }).then(function() {
                                              console.log("Testing");
                       }).catch(function(e) {
                                               console.log(e);
                       });

document.getElementById("transfer").addEventListener("submit", function(e){
      e.preventDefault();
       console.log("Initializing");
         contract.transfer(fromAddress2, 1,
              {gas: 3000000,
               from: fromAddress1},
                            function (error, result){
                                   if(!error){
                                     console.log(result);//transaction successful
                                    } else{
                                     console.log(error);//transaction failed
                                     }
         })})

This is best, I can do if you have any solution I would really appreciate it
or simply if you could provide me with the way through which i can store and release ether


texts: I know that a Uint is the same type of a Uint256 and both size is 256 bits, but how many number digits accept without launch an overflow in a smart contract ejecution?


texts: Is there a way to interchange between the Mist wallet and geth without having to redownload the whole blockchain?

texts:
I already have the ethereum wallet running on my laptop, when I exit it and go to run geth in terminal it redownloads the entire blockchain again? Same thing happens when I go from geth to the wallet.

Anyway to avoid this?


texts: How to increase the hash rate on 1050ti 12 gpu

texts: As i am new in this i have setup my 12 gpu for ethermining i am using simplemining Os i tried to push the hashrate through overclocking but its only 14.81 M/h which very disappointing could you please help me to increase it


texts: Calling function in one contract from another contract in private blockchain by Geth

texts:
I have problem with smart contract development using Remix solidity in private blockchain by Geth. I have two smart contracts such as Factory contract and Contract contract.

I create the Factory contract and then I call the createContract and getContract function, it works normally but when i call the getNum function I can not get the number.

I run this code in Remix solidity by JavaScript VM and Test network by Ganache or TestRPC work fine but when i use it with Private blockchain using Geth it has this problem

Here is my code.

contract Factory {
  address[] newContracts;

  function createContract(uint num) {
    address newContract = new Contract(num);
    newContracts.push(newContract);
  }

  function getContract() view public returns(address[]) {
    return newContracts;
  }

  function getNum(address _add) view public returns(uint) {
    return Contract(_add).getNum();
  }
}

contract Contract {
  uint public Num;

  function Contract(uint num) {
    Num = num;
  }

  function getNum() public returns(uint) {
    return Num;
  }
}


texts: How to prove an address is existed on my node?

texts:
I want to get whether an address is exited on my node in the Parity. But I just find the parity_allAccountsInfo. It will return all accounts. I don't need too much information. And it will take me a lot of time to deal with this information to find out whether this address is existed.

So I want to know is there any way to prove it with a simple way? Thanks a lot~ :)


texts: How to implement owner check in Solidity

texts:
Is there any EIP that specifies how to implement function in contract, that let's you call any other function as contract owner, with provided signature?
I don't want to reinvent wheel.
For example:
I want to create token contract, in which any address with ethers (for gas) can push transfer tokens transactions, as other address (sender) with its signature in which there may not be any ethers for gas.

  function transferFrom(address recipient, uint256 amount, uint8 _v, bytes32 _r, bytes32 _s) public {
    address recipient = msg.sender;
    bytes32 hash = keccak256('Transfer tokens:', recipient, amount);
    address caller = ecrecover(hash, _v, _r, _s);
...
  }

I need something like this.
My question is. Is there any EIP for that or maybe more generic EIP not only for token transfers?


texts: How long does it take a return the TxHash for a transaction in the MainNet?

texts:
I have been doing some work on the private ETH node and when I submit a transaction the local ETH node returns a TxHash immediately. My currently implementation completely relies on the immediate TxHash that returned to me.

Is this behavior same in the Ethereum Mainnet? Or the TxHash is returned only after the message is broadcasted to the whole Ethereum network? Will there be a delay?


texts:
I am new to Solidity, trying to store a product in the purchaser wallet and retrieve the information from the owner wallet. I have some ideas but didn't know which one will be best.

To store an individual product in a random address
Store products in owners address
Store product in an array of products in owners address
Storing product data as a transaction in a owner's wallet

Appreciate if you can share sample code.
Thanks in advance.

pragma solidity >=0.4.25 <0.7.0;

contract ItemBill{

    enum ProductState {Shipped, Store, Owned, Sale}
    address owner;
    bytes32 public name;
    uint public productCount = 0;

    struct Product
    {
            uint id;
            bytes32 name;
            bytes32 serlialNo;
            uint price;
            address UpdatedBy;
            bytes10 pro_state; //later change to ProductState
    }

    mapping(address => Product[]) OwnerOfProducts;

    //address[] public ProductAccts; //Array address of products
    //Product[] prod; //Array of products

    event ProductCreated
    (
        uint id,
        bytes32 name,
        bytes32 serlialNo,
        uint price,
        address owner,
        bytes10 pro_state //later change to ProductState
    );

    constructor() public {
            owner = msg.sender;
    }

    function createProduct(address _OwnerAddress, bytes32 _name, bytes32 _serialNo, uint _price, bytes10 _pro_state) public {
        // Require a valid name
        require(_name.length > 0);
        // Require a valid price
        require(_price >= 0);
        // Require a valid serlialNo
        require(_serialNo.length > 0);
        //Create new product
        Product memory p;
        //assign value to products
        p.id = productCount++;
        p.name = _name;
        p.serlialNo = _serialNo;
        p.price = _price;
        p.UpdatedBy = msg.sender;
        p.pro_state = _pro_state;

        OwnerOfProducts[_OwnerAddress].push(p);

        // Trigger an event
        emit ProductCreated(productCount, _name, _serialNo, _price, msg.sender, _pro_state );
    }

    function getProduct(address _address) view public returns(uint, bytes32, bytes32, uint, address, bytes10) {

        returns(OwnerOfProducts[_address].id, OwnerOfProducts[_address].name, OwnerOfProducts[_address].serlialNo, OwnerOfProducts[_address].price, OwnerOfProducts[_address].owner, OwnerOfProducts[_address].pro_state);

**//Getting ParseError: Expected primary expression. //In Remix**

    }

    function getproductcount() view public returns(uint){
        returns OwnerOfProducts.length;
    }
}


texts: how to store newly created solidity contract address in another contract securely

texts:
I am making an app where you can make battles with other people. I have created a Battle contract that is created for each new battle and I have created a Battles contract to keep track of all battle contract addresses and all player addresses.

Now what is the best way to create a new battle contract and then store that battle contract address and player address in the Battles contract?

I need to make sure that Battles contract which keeps track of all battles and players cannot be altered publicly.

What is the best way to do this?

Should the user create a Battle contract representing a new battle and from within the constructor function of that new contract, send a transaction to Battle contract to store the new battle contract address?

Or should the user make a transaction the the parent Battles contract and the parent Battles contract then makes a transaction to create a new battle? Could the parent Battles contract then receive the newly created contract address immediately for it to store?

Also does this make sense for a contract design to create a new contract for each individual battle and then have one parent contract store addresses for all the individual battle contracts?


texts:
I installed ropsten testnet and created 2 accounts. "eth.accounts" returns the following:

["0x54eb2b021a26c17b83927ad14587a24b0bd16b66", "0x14e6b19304fb3c98a73acea5f80d2c056ee5c09f"]

I wanted to import these accounts using Metamask and get some test ether. I uploaded the latest file from "/home/vivek/.ethereum/testnet/keystore". After importing when I copied the account address using metamask the account address copied to clipboard was :

"0x58708227265c1e38417D9B3AEf8FfCFb4Be9AE50"

The above account is none of the accounts from the "eth.accounts" command. But the address mentioned in the json file I imported is "14e6b19304fb3c98a73acea5f80d2c056ee5c09f"


texts:
Hi, if anyone can provide some help with this issue:

I recently downloaded ETH Mist Wallet and am @ 93% synced. My balance that I transferred to my "Main Account" is not displaying in my wallet.

According to Etherscan.io the transaction block was at 3,764,282 whereas my wallet is currently at block 3,863,910. The transaction should be showing up in my wallet by now as I have already downloaded the transaction block. (please see attached)

I am fearful of sending more Ether to my wallet if I am unable to resolve this.

Any thoughts, feedback is appreciated.

Also, my wallet seems to not sync 100%.... it will download up to 98% then just load in the chain data. (Any advice here...)

Mahalo in advance.


texts:
I use truffle to deploy contract to ganache network. I like to use the json file generated by the truffle in the DApp rather writing messy ABI into it. I tried the below piece of code and it gives error.

var fs = require('fs');
var publish_service_abi = JSON.parse(fs.readFileSync('./PublishService_abi.json', 'utf8'));
console.log(publish_service_abi); //prints the contents of the abi
var PublishServiceContractAddress = "0x0da136781e562e28fb1c0b3efc8ce9d8b4e226f2";
PublishServiceContract = await new web3.eth.Contract(publish_service_abi,PublishServiceContractAddress);

Here is the error that I get when I run the application.

  Error: You must provide the json interface of the contract when
  instantiating a contract object.
      at Contract (/home/ltu/Ganache/node3/node_modules/web3-eth-contract/src/index.js:70:15)
      at new Contract (/home/ltu/Ganache/node3/node_modules/web3-eth/src/index.js:147:22)
      at initweb3 (/home/ltu/Ganache/node3/app.js:32:34)

Any help please.


texts: How to get balances of all the accounts(~1000) in Geth node?

texts: How can I get the balance of all the accounts in my Go Ethereum node? I have about 1000 accounts and it is too slow to use eth_getBalance to get balance for each address. Are there any ways to use curl and rpc?


texts: Mining with a GTX 1080 and Radeon 570 on the same machine

texts: So currently I am able to mine with either one on their own by specifying the --opencl-platform, if I try to run them both then it crashes when it is "Grabbing DAG for ...".  I am using --no-precompute, and it makes no difference.


texts: Why is this Javascript Ethash implementation returning a wrong hash result?

texts:
I'm trying to calculate the hash result for the "light" implementation of the Etash algorithm from ethereum/ethash/js but I can't seem to get the correct result.
The expected result for comparison was calculated with both ethereumj and ethashjs.
My code for the Javascript implementation:
"use strict";

var ethash = require('./ethash');
var util = require('./util');

// init params
var ethashParams = ethash.defaultParams();
ethashParams.cacheSize = 16776896 //cachesize for epoc 0
ethashParams.dagSize = 1073739904 //fullsize for epoc 0

// create hasher
var seed = Buffer.alloc(32).fill(0); //epoc 0
var hasher = new ethash.Ethash(ethashParams, seed);

console.log('Ethash cache hash: ' + util.bytesToHexString(hasher.cacheDigest()));
// expected: 35ded12eecf2ce2e8da2e15c06d463aae9b84cb2530a00b932e4bbc484cde353 --> OK

var header = util.hexStringToBytes("c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470");
var nonce = util.hexStringToBytes("0000000000000000");

var hash = hasher.hash(header, nonce);
console.log("Ethash hash result: " + util.bytesToHexString(hash));
// expected: 89eaac0ac621d2bb2d1a62455119cb0d0a0883d554e748bab23c2066da080916 --> OK

header = util.hexStringToBytes("c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470");
nonce = util.hexStringToBytes("6c18bd55f3d77ab5");

hash = hasher.hash(header, nonce);
console.log("Ethash hash result: " + util.bytesToHexString(hash));
// expected: 0a9f8a9d1954c796b8bbafe0d443f1586c17ffe995070ea5a40436946c1bf2d7 --> NOT OK

Output:
$ node ./post.js
Ethash cache hash: 35ded12eecf2ce2e8da2e15c06d463aae9b84cb2530a00b932e4bbc484cde353
Ethash hash result: 89eaac0ac621d2bb2d1a62455119cb0d0a0883d554e748bab23c2066da080916
Ethash hash result: 72d628f1bb9e7229f43c210824975d179f6b55da47ebe4655b4a55d677697391

So it seems that the cache is calculated correctly (the hash matches that of the other implementations). The hash result for a nonce = '0x0000000000000000' also matches, but a random other nonce calculates a result that does not match.
I assume this has something to do with the byte order of the nonce... any ideas how the nonce should be specified for the Javascript implementation to get a correct hash result?


texts: Managing unforeseen changes in contract development

texts:
I'm reading here:

Centralized Administrator
All dapps are fully decentralized by default, but that doesn't mean
they can't have some sort of central manager, if you want them to.
Maybe you want the ability to mint more coins, maybe you want to ban
some people from using your currency. You can add any of those
features, but the catch is that you can only add them at the
beginning, so all the token holders will always know exactly the rules
of the game before they decide to own one.

(Emphasis mine)
What is a best practice to manage making changes you don't forsee when you start your dapp?  Eg, suppose you only issue 1000 things, and later find a bug, need to increase to 1500, how do you handle this?
I see this document goes on with instructions for...

Central Mint
Suppose you want the amount of coins in circulation to change.

But suppose you did not "only add them at the beginning."  What now?  How does this square with the statements above, and how do you manage such changes?


texts: Limit geth/parity node synchronization network usage

texts:
It is possible to limit the network usage of geth/parity while updating my node?

I want to be able to update (slowly, this doesn't matter), to reduce the strain on my network. Does anyone know a way to do this within geth or parity?


texts:
I would like to find some URL (or something), for the documentation of API functions in Solidity.
For instance: where can I get the information for the Solidity "CALL" function? and know what parameters it uses and how:

msg.sender.call{value: x}("");

Or another example, information for this API:

abi.encodeWithSignature

I know some place like docs.soliditylang.org but I am unable to find the API information.
Thanks a lot.


texts:
So I downloaded the Ethereum wallet and installed it. Once I launched it, it started to download the blocks, and I chose to connect with the mainnet. As indicated in the process, I may need to deposit some ETHs into the wallet to warm it up.

Followed the instructions, I deposited 0.01 bitcoins, and as being said: my bitcoins were sent to an address, and then it will be converted into ETH and be sent to my wallet address. However, even after all the blocks were synced, I never saw the ETHs in my wallet, the balance is still 0.

I was trying to figure out what was going on here, does anyone encounter the same issue?


texts: Truffle: how to get balance of any address or contract's address

texts:
For example I have a testing block like this:

contract('CreeptomaPresale', function(accounts) {
    describe("adopted over allow quantity", function () {
        it("test get balance", async function () {
            let instance = await CreeptomaPresale.deployed();
            console.log("deployed address:" +  address)
        });
    });
});

I can get deployed address. But now, I don't know how to get balance of this address or any other addresses.

Thanks


texts: How do I specify a different Solidity version in a Truffle contract?

texts:
I've got a contract where I want to use <address>.transfer(), which was released in the latest Solidity version 0.4.10.

I have as the first line of my contract: pragma solidity 0.4.10; but when I compile I get Error: Source file requires different compiler version which pretty obviously means truffle is trying to compile my contract with not that version of Solidity.  It still uses 0.4.8.

I installed 0.4.10 last night and solc --version shows 0.4.10.

So my question is, how do I change the version of Solidity in a truffle project?  I've looked in the config file and the truffle docs and could not find this.  I also cannot even find where 0.4.8 is installed (was assuming in truffle itself but it is not listed in truffle's package.json).


texts: How can we use web3 with React to access a getter?

texts:
I had some working code but it seems standards moved.

I have some new code which fails.

componentWillMount () {

    var abi=
  [{"constant":true,"inputs":[],"name":"contractWeight","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"jsonInput","type":"string"},{"name":"hashKey","type":"bytes32"}],"name":"addContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"weight","type":"uint256"}],"name":"addWeight","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"contracts","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"}]

    var web3 = new Web3(new Web3.providers.HttpProvider('https://ropsten.infura.io/'));

    let commodityContract = new web3.eth.Contract(abi, this.state.contractAddress);
  //  let newContract =   commodityContract.at(this.state.contractAddress);
    this.setState({commodityContract: commodityContract});
    web3.eth.defaultAccount = web3.eth.coinbase;
    var test1 = '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08';
  //  var testResult = commodityContract.contracts(test1);
  console.log(commodityContract);

}

Has anyone any idea about how to access a state variable (contracts) using web3?

Here is the smart contract -

pragma solidity ^0.4.18;

contract RegisterContract {

    uint public contractWeight;
    mapping(bytes32=>string) public contracts;

    function addContract ( string jsonInput, bytes32 hashKey) public {
        contracts[hashKey] = jsonInput;
    }

    function addWeight (uint weight) public {
        contractWeight = weight;
    }

}


texts: Can a solidity compiler be written in solidity? How much gas would it cost?


texts: does not get address from private key of account in Web3

texts:
const Web3 = require('web3');
const BridgeEth = require('../build/contracts/BridgeEth.json');
const BridgeBsc = require('../build/contracts/BridgeBsc.json');
const web3Eth = new Web3('Infura Rinkeby  url');
const web3Bsc = new Web3('https://data-seed-prebsc-1-s1.binance.org:8545');
const adminPrivKey = '';
const { address: admin } = web3Bsc.eth.accounts.wallet.add(adminPrivKey);
const bridgeEth = new web3Eth.eth.Contract(
BridgeEth.abi,
BridgeEth.networks['4'].address
);
const bridgeBsc = new web3Bsc.eth.Contract(
BridgeBsc.abi,
BridgeBsc.networks['97'].address
);
bridgeEth.events.Transfer(
{fromBlock: 0, step: 0}
)
.on('data', async event => {
const { from, to, amount, date, nonce } = event.returnValues;
const tx = bridgeBsc.methods.mint(to, amount, nonce);
const [gasPrice, gasCost] = await Promise.all([
web3Bsc.eth.getGasPrice(),
tx.estimateGas({from: admin}),
]);
const data = tx.encodeABI();
const txData = {
from: admin,
to: bridgeBsc.options.address,
data,
gas: gasCost,
gasPrice
};
const receipt = await web3Bsc.eth.sendTransaction(txData);
console.log(Transaction hash: ${receipt.transactionHash});
console.log(Processed transfer: - from ${from}  - to ${to}  - amount ${amount} tokens - date ${date});
});


texts: How to get address of an upgradeable smart contract in another smart contract

texts:
I have the following two contracts
contract MyNFT is ERC721Upgradeable, OwnableUpgradeable {
  function initialize() initializer public {
    __ERC721_init_unchained("My NFT", "MNF");
    __Ownable_init_unchained();
  }
}

contract MyUSD is ERC20Upgradeable, OwnableUpgradeable {
  address constant ADDRESS_MYNFT = ???;
  MyNFT myNFT;
  function initialize() initializer public {
    __ERC20_init_unchained("My USD", "USD");
    __Ownable_init_unchained();
    myNFT = MyNFT(ADDRESS_MYNFT);
  }
}

How can I obtain the address of the implementation contract MyNFT from the proxy in the smart contract MyUSD?


texts:
What does view mean in this example?
I have never seen this keyword before.

function symbol() view returns (string symbol)


texts:
I am learning about ethereum, when I learn I came across a term

  Parent transaction Hash

I would like to know regarding this


texts: Can't access swarm : bzz://theswarm.eth/ from mist browser

texts:
When accessing the URL in Mist, and after connecting my account, I get an empty white screen.
Running on OS X with the version 0.11.1 of Mist.
Any idea where it could come from ?
Thanks.


texts:
I have followed step by step this tutorial:
https://medium.com/pinata/how-to-build-erc-721-nfts-with-ipfs-e76a21d8f914
Everything works like a charm. I am working on ropsten Network.
I have create some tokens.
I have configure Metamask to see my tokens on this contract.
I can see my balance but unfortunately, i do not see the picture associated with my NFT.
Is there a way to see the picture of each token i own in metamask ?
Thanks


texts: The EVM throws an error "invalid opcode 0x1c"

texts:
I have written a simple smart contract that allows to store a string, and I'am trying to use go-ethereum(which is similar to web3j).
When I execute a transaction, I have this error

    VM returned with error err="invalid opcode 0x1c"

I am testing on a local network that I have developed using geth nodes.
When I tested the same smart contract using remix (connecting remix to my local network), everything went right and the smart contracts executes fine.


texts:
When a user enter his private key on metamask, where it store in metamask ?
Can metamask access this key through any activity ?


texts: What's wrong with an 'empty' fallback function?

texts:
Contract A interacts with another contract B, which generally interacts with humans  (ie, externally owned accounts). Thus when contract B sends ETH to contract A, contract A needs a fallback function to receive the ETH. I found the function below works, though my linter warns me that this is bad form ('no-empty-blocks'). Where's the danger?

 function() external payable { }

note: There are not multiple users of contract A. Contract B sends ETH using the following command:

msg.sender.transfer(amount);


texts: How to send ERC20 token from smart contract in Solidity?

texts:
I want to make a smart contract, where you can instantly swap your Ether to ERC20 token.

What I do have now:

pragma solidity >=0.4.16 <0.7.0;

contract Swap {
    address owner;
    address constant tokenAddress = address(
        0x14eb2ab8e6d09000a98e3166b3cc994375071f69 //ERC20 token address
    );
    uint8[] validTokenAmounts = [2, 16, 32];
    uint256 constant tokenPrice = 75000000000000;

    function isTokenAmountValid(uint8 tokenAmount) private view returns (bool) {
        for (uint8 i; i < validTokenAmounts.length; i++) {
            if (tokenAmount == validTokenAmounts[i]) {
                return true;
            }
        }
        return false;
    }

    function swap(uint8 amount) public payable {
        require(
            msg.value >= amount * tokenPrice,
            "You sent incorrect amount of Ether"
        );

        ??transfer()?? // Here I don't know what how to send ERC20 tokens
    }
}

I have a second question too - how do I deploy contract with XXX amount of ERC20 tokens in smart contract?
It's my first time with smart contracts, I hope you will find time to help me.

Thanks :)


texts:
is the DEVgrants program to promote the development of ethereum dapps still alive ?

https://blog.ethereum.org/2015/04/07/devgrants-help/


texts:
Does solidity have a way of fetching a persons geographic location(using something like msg.sender)?

Im building a dApp for national elections, and would need to verify the geographic location before doing the same.

Im a little new to solidity. Pls help.


texts: How to pass Multiple Values in a Solidity Event

texts:
I am emitting within a function the following in a solidity smart contract.
emit Transfer(address(0), to, tokenId)

In my front-end JavaScript code, I am reading the values as follows:
let transfer = receipt.events.Transfer.returnValues.tokenId

If I declare my event using only the tokenId parameter (as below) in my smart contract, I am receiving the values of all three parameters in my front-end and everything works properly.
event Transfer(uint256 tokenId);

However, if I declare the event as follows with the three parameters, following the standard practice, I am no longer receiving any values and it no longer works!
event Transfer(address indexed from, address indexed to, uint256 tokenId);

What am I missing?
Thank you. J


texts: how to decrypt aes 128 keystore offline with password

texts:
i want to create dapp like cold wallet on which i can access my sign transaction with private key but in order to get private key for each time i need offline code or script to decrypt my keystore that is in aes-128 ,with the help of password i want to get private key back to other function.

basically it should work like myetherwallet walletinfo/keystore or metamask kinda

any tutorial or document will work.. thanks


texts:
There has been a lot of talk about leveraging zk-SNARKs to bring privacy features to the Ethereum Blockchain. My question is, how is Ethereum facilitating the verification of zk-SNARKs at the moment, and, moreover, what further steps are planned in this direction?

I am aware that Byzantinum, the first Metropolis hard fork, includes some changes (see EIP 198, EIP 212 (197) and EIP 213 (196) and compare with ELI5: Byzantium Changes) in the form of pre-compiled contracts that allow for operations used in zk-SNARK verification, such as, e.g., elliptic curve addition and pairing. I am furthermore aware of ZoKrates, a stand-alone program that is able to compile a program (from what seems to be a limited set of programs) into yet another program which can generate a non-interactive zero-knowledge proof and a Smart Contract that does the on-chain verification. Unfortunately, I wasn't able to find any documentation on it.

I am wondering whether there is anything besides these EIPs and whether the support for zk-SNARK verification is going to stay at that level? Personally, I suspect that because Ethereum Smart Contracts can have arbitrary computations, the quadratic arithmetic programs (QAP) used to conduct zk-SNARKs, in general, differ vastly depending on the application such that a more high-level support is rendered infeasible.


texts: How can I estimate price of data storage?

texts:
I'd like to make estimations of the cost of an application, and one of the things I need is the price to store n kB of data on a contract. In ether and in USD.

Where could I find rates or prices of raw data storing? Sites showing ETH<->USD prices are rather easy to find but I can't seem to find an approximation of how much it would cost to store a certain amount of data.

The rates change pretty fast and a 2 years-old answer with "Right now, the fees are around ..." is helpful, but insufficient. Where could I get reliable, recent information about the rates?

Subsidiary question: When we store data on the blockchain, I understand that there's a price in gas for the transaction, and another price to actually put data in the blockchain (long term). Am I correct?


texts: Steps to deploy a contract using MetaMask and Truffle

texts: i'm noob, I want to deploy my contract on Ropsten network with MetaMask & Truffle, plz explain to me the steps to deploy it.


texts: Deploying and Using OpenZeppelin PaymentSplitter in Web3

texts:
I currently have a contract that is creating an "item" for a customer to purchase. I've managed to follow a well put together tutorial for implementing this contract into my test network using Ganache and also displaying/executing the contract via Web3 using the React framework.
My question is about using OpenZeppelin's PaymentSplitter contract. I've imported into a subcontract that I created called SplitFunds:
contract SplitFunds is PaymentSplitter {
    constructor (address[] memory payees, uint256[] memory shares)
    PaymentSplitter(payees, shares)
    public payable{}
}

With this code I was wondering how would I call this function in my Web3 instance? I know how to call other functions in my Items contract.
Thanks


texts: How can I generate hash of string received from function argument

texts:
I want to generate hash of string received through function argument. Sha256 require bytes in argument. How can I convert and then save hash in _hash variable.
struct ORGANIZATION{
    bytes32 hash;
    uint org_number;
}

function add_organization(string memory _stringvalue) public{
 bytes32 _hash;
 _hash=sha256(_stringvalue);
 organization[organization_counter].hash=_hash;
 organization[organization_counter].org_number=organization_counter;
 organization_counter++;
}


texts:
I've just started mining with a gtx 1070, and following a guide on the web I've set everything up, using a pool (nanopool).
Watching the result of the mining program I noticed alread 3 times that I found a solution, here is the screenshot:

So that means that my GPU found the solution of the block? It's strange to me to get 3 solution (should be 15 ether reward right?) in 30 minutes, it would be way too lucky imo.. Or am I missing something?

Also if I would like to mining in solo instead of pool, how should I set my  ethminer command line?


texts:
When I use the variable minimum in the require statement
require(msg.value >= minimum, "Below Minimum");

I get the below error in Remix. However, if I hardcode the require statement with 0 instead of minimum everything works.  Why?

transact to SendContractEther.sendEtherToContract errored: VM error:
revert. revert The transaction has been reverted to the initial state.
Note: The called function should be payable if you send value and the
value you send should be less than your current balance. Debug the
transaction to get more information.

I am sending Ether to contract King from contract SendContractEther.
Thank you for an explanation for this behavior.
// SPDX-License-Identifier: MIT

pragma solidity 0.7.4;

contract King {

  uint public minimum;
  address payable public owner;

  constructor() payable {
    owner = msg.sender;
    minimum = 0;
  }

  receive () external payable {

    require(msg.value >= minimum, "Below Minimum");
    owner.transfer(msg.value);

  }

}

// SPDX-License-Identifier: MIT

pragma solidity 0.7.4;

contract SendContractEther {

    address payable public contractAddress ;

    // Assign the address of the Contract
    constructor(address payable _contractAddress) payable {
        contractAddress = _contractAddress;
    }

    function sendEtherToContract() external payable {

        contractAddress.transfer(address(this).balance);

    }
}


texts: TestRPC and Metamask: hanging on pending transactions

texts:
I'm using Remix and connecting to Testrpc via Metamask.

I can successfully launch contracts to testrpc, but then it hangs on the subsequent calls that Remix makes to the public methods (Remix says "9 pending transactions" which never go through).

The contract deploys fine on Rinkeby. I've tried this setup with multiple working contracts but Remix always leaves me with "x pending transactions" (not always the same number for each contract).

Here is my testrpc output:

  Transaction: 0xbf367579e3cb1b414343a4f333bd79388e4fbfe668a57ea59b830934e41512bf
  Contract created: 0x81d49759138f933491a4125ce22c7173e782af4d
  Gas usage: 3347223
  Block Number: 1

eth_getTransactionReceipt
eth_getTransactionByHash
eth_call
eth_call
eth_call
...(more eth_calls)
eth_call
eth_call
eth_call
eth_getBlockByNumber
eth_getBlockByNumber
eth_getBalance
eth_getTransactionCount
eth_getBalance
eth_getTransactionCount
eth_getBalance
eth_getTransactionCount
eth_getBalance
eth_getTransactionCount
eth_getBalance
eth_getTransactionCount
eth_getBalance
eth_getTransactionCount
eth_getBlockByNumber
eth_getBlockByNumber
...(more eth_getBlockByNumber)

What could the problem be?


texts: Deployed site unable to get address with web3

texts:
I am able to get the user's wallet addresses with web3 on my local site, however when I deployed the site to netlify it is unable to get the wallet addresses. I walked through the code, and ensured it was establishing a provider and also executing the web3.eth.getAccounts(). So it seems that everything is identical except the deployed site isn't able to return any wallet addresses.
This is how I'm establishing the web3 provider:
const loadProvider = async () => {
  console.log("loading provider");
  if (window.ethereum) {
    setState(state => ({...state, web3: new Web3(window.ethereum), providerError: false}));
  } else if (window.web3) {
    setState(state => ({...state, web3: window.web3.currentProvider, providerError: false}));
  } else {
    console.warn("failed to load provider");
    setState(state => ({...state, web3: null, providerError: true}));
    setTimeout(() => loadProvider(), 2000);
  }
}


texts: How to call the functions of Ethereum Smart Contract from Android/iOS application?

texts:
I've been learning solidity & viper for some time now but i am wondering if it's possible to call the functions/methods of a smart contract (already deployed on Ethereum Network) from an Android/iOS application.
If it is, then how do we go about doing it?

I found this project on GitHub, which is creating APIs for the Smart Contract. Once the code is deployed on the server those APIs can be called from Android/iOS. But, in the project we are using TestRPC for deploying the Smart Contract. So, what i don't understand is how can it communicating with the Smart Contract which is already deployed on the Ethereum Network?


texts: Smart contracts: is every public function payable?

texts:
I am aware of the payable annotation on the public methods. But just want to make things more clear:

is every public function payable? Even without the payable annotation?
what would happen if a private function is annotated as payable?


texts: Why do token transfers sent to the Binance wallet cost very little gas?

texts:
I noticed that token transfers sent to Binance are barely using more gas than a regular Ether transfer. ~22,000 gas.
  Other transfers of these tokens seem to charge almost double the amount of gas.

https://etherscan.io/address/0x3f5ce5fbfe3e9af3971dd833d26ba9b5c936f0be#tokentxns

Examples:
https://etherscan.io/tx/0x7043bbef6b0fdf40a163fdf4f5d179e7f55094de72420b2577ce39e34b295881
https://etherscan.io/tx/0x637ce9ce1e6df798af45253ad017005fab553289a24e4e27672e317cb50a60d3


texts: Solidity: How to get "floor" of a floating value?

texts:
I'm aware that Solidity doesn't support double and floating values.

I'd like to know if there's any way, in Solidity, to get the floor of a division, like: floor(x/2), where x can be any arbitrary "uint" value? so we can get: floor(5/2)=2;


texts: I want some Information about Erc-20 Transactions. I want to transfer Erc-20Token from first wallet to a second wallet, I have Privet Key, But I want to transfer with Api,  So How can I transfer the Erc-20 Tokens?


texts: Clique PoA Private Blockchain: Need Suggestion for Block Gas Target and Block Gas Limit

texts:
I'm following this article to create my own PoA private blockchain.

Now I'm stucked at this section after number 13:

I've checked the Puppeth source code and Geth CLI docs, but I'm still not quite sure what's the best number for that What gas limit should full blocks target (MGas) question.

Should I make it 94000000 too or should I make it higher?
If higher, how much higher?
What is the formula to get block Gas Target and block Gas Limit?


texts: 'internal' keyword in a function definition in Solidity

texts:
Does the internal keyword in a function definition such as:

function doSomeThing(uint _param) internal {...}

work similar to designating a method as private in other languages and thus makes the function only callable from within the contract?


texts: Where does the number 21000 come from for the base gas consumption in Ethereum?

texts: Can you break it down in terms of the cost of opcodes?


texts:
This is my contract where I am building a list of members who will use a addVote function. The allMembersVoted function always seems to return false even though the Remix debugger shows that, the function does return true correctly. Can you please help me find out what is missing?

The flow is like this:

Create new contract
Build list
Vote
Check if every one has voted

struct ListMembers {
    bytes32 listOwner;
    bytes32[] members;
}
ListMembers public lm;
mapping(bytes32 => bool) public addedMembers;

// Constructor to initialise the ListMembers struct
function Lister(bytes32 listOwner) {
    lm.listOwner = listOwner;
    lm.members.length = 1;
    lm.members[0] = listOwner;
}

function buildList(bytes32[] listMembers) {
    lm.members.length = listMembers.length + 1;
    for (uint i = 0; i < listMembers.length; i++) {
        lm.members[i + 1] = listMembers[i];
    }
}
function addVote(bytes32 member, uint256 number) {
    if (memberAdded(member) == true) { // Check double votes
        return;
    } else {
        addedMembers[member] = true; // Confirm that vote added
        if (memberIsOwner(member) == true) {
            // Add vote with weight
        } else {
            // Add vote without weight
        }
    }
}

function memberAdded(bytes32 member) returns (bool) {
    return addedMembers[member];
}

function allMembersVoted() returns (bool) {
    bool voted = true;
    for (uint i = 0; i < lm.members.length; i++) {
        voted = voted && addedMembers[lm.members[i]];
    }

    return voted;
}


texts: System for paid retrieval of (secret) information possible?

texts:
I've been thinking about designing a system, where every student's grades are stored on the blockchain in encrypted form.

However, I've read enough posts describing why this is not a good idea:  Ethereum discourages the use of storage, and contracts cannot store the decryption key safely/hidden anyway (all contract data is visible to anyone on the blockchain, right?).

The system should facilitate a paid service for, e.g., companies that want information on a particular student.

My initial thoughts of such system is as follows (assuming both parties, i.e., university and company, have an Ethereum account with public/private key pair):

The company sends a request to the university web server, requesting information, and providing the public key of the company.
The university creates a smart contract with the encrypted information (under the company's public key) and a hash of the plaintext.
The company sends a transaction to the smart contract, paying some amount of ether, whereafter it gets the encrypted information and hash. The contract then suicides and transfer its funds to the university.
The company decrypts the information under its private key and verifies the hash.

There is a problem with this idea. After the smart contract (step 2.) has been deployed, the company can just read its data without sending any ether to it. How can this be fixed?

In general, what approach would I choose for designing such paid service for information retrieval?


texts: How to embed restrictions on token transfers after pancakeswap sale?

texts: I want to list a coin on pancakeswap (BEP20) that restricts people from selling for a period of time after purchasing. I don't want to restrict the pancakeswap address from being able to sell its tokens however. How would I do this?


texts: Error: "invalid sender" from web3.eth.sendSignedTransaction()

texts:
I have a client running a private blockchain. It was started with the following command:
geth --datadir private-chain --mine --miner.threads 4 --http --http.addr 127.0.0.1 --http.port 8545 --http.api eth,net,web3,personal --networkid 3456 console 2> private-chain/private-chain.log

My transaction is created in the following function which is supposed to send one ether. It is part of a nodejs application I wrote to interact with the private blockchain. It uses the ethereumjs-tx package. The two account parameters are passed in as strings (which include the 0x). The accounts were created in the genesis block when I initialized the blockchain. The nonce is the number returned by web3.eth.getTransactionCount for the from_account.
function send_one_ether (from_account, nonce, private_key, to_account)
{
    var transaction_data =
    {
        "from": from_account,
        "to": to_account,
        "value": 1000000000000000000,
        "nonce": nonce
    };

    var transaction = new Transaction (transaction_data);

    var bytes = [];
    var private_key_bytes = private_key.substr (2); // remove the 0x
    for (var b = 0; b < private_key_bytes.length; b += 2)
    {
        var hex_byte = private_key_bytes.substr (b, 2);
        var int_byte = parseInt (hex_byte, 16);
        bytes.push (int_byte);
    }

    transaction.sign (Buffer.from (bytes));

    var verified = transaction.verifySignature (); // returns true
    var valid = transaction.validate (); // returns false

    var serialized_transaction = transaction.serialize ();
    web3.eth.sendSignedTransaction ("0x" + serialized_transaction.toString ("hex")).on ("receipt", console.log);
}

The private_key variable passed into the above function comes from the account's keystore file under the datadir, and it was decrypted using the following code.
var json_data = JSON.parse (fs.readFileSync (file_path));
const decrypted_account = web3.eth.accounts.decrypt (json_data, pw);

The transaction object's validate function returns false, and the error message I receive from web3.eth.sendSignedTransaction says invalid sender. Does anyone have any idea what could be wrong or how to get this to work?


texts: Saving contract address after deploying with Truffle

texts:
To automate my development cycle I want to save the addresses of deployed contracts so that my DApp can read this information and know where  to find the contracts on my private block chain:

for example, this is what my truffle migration script looks like:

const fs  = require('fs');
var  FunnyToken = artifacts.require("FunnyToken");
var  TokenSale = artifacts.require("TokenSale");
var storage = {};
module.exports  = function(deployer, network, accounts) {
    deployer.deploy(FunnyToken, 1000000000000)
        .then(function(){
            storage.TOKEN_ADDRESS = FunnyToken.address;
            deployer.deploy(TokenSale, 1, accounts[0], FunnyToken.address).then(function () {
                storage.SALE_ADDRESS = TokenSale.address;
            });
        });

    console.log("adresses:")
    console.log(storage)
    fs.writeFileSync('.address.json',JSON.stringify(storage), 'utf-8');
};

But the .address.json generated this way contains simply an empty object: {}.

On the DApp side I want to connect to the Contract's address

web3.eth.contract(address=contract_address, abi=contract_abi)

I should also mention that I am Using Python and web3.py to write the DApp. So that, ideally, the address information should be stored in a file to be read by the Python application.

What is the recommended pattern for this?

The code for the Python DApp (Including the solution proposed)


texts:
String Literals As with integer literals, their type can vary,
  but they are implicitly convertible to bytes if they fit, to bytes and
  to string.

How? How can I convert uint to bytes?

also is there any way to cast address-typed variable to bytes32?


texts: Get return value of Contract using CALL method

texts:
I have a contract which has such field:

    mapping (address => int) balance;

It will hold the balance of account for coins. Let's assume that I've deployed this contract, but I want to disable it and deploy new one, however with keeping the balances of accounts. Is it possible for one contract to get return value of getBalance() of another contract by using CALL method or any other way ? Thanks for Help.

EDIT: I am interested in sending balances between contracts in general :)


texts: On what frameworks are sites like Cryptokitties made?

texts: Game contracts are written on Solidity. On what frameworks are sites like Cryptokitties and other games made? (Node js, React, Vue or something else?)


texts: Using a partial network to evaluate low-cost smart contract

texts:
Suppose a smart contracts settles a bet/transaction concerning a total value of 0.2*(the minimum Ethereum transaction fee).
Do there exist protocols/smart contracts that allow the transaction to be only processed by 2.0001*20%=40.0002% of the nodes/miners/transaction validators?
Assumption:
I assume the 40.0002% ensures a majority attack on that particular transaction would be pointless.


texts: Etherum dont show up after switching Harddrive

texts:
i just bought a new pc with also a new harddrive. I downloaded the whole blockchain and imported the Key into Etherum Wallet. But it still dont show me my ETH.

Etherscan saying to me that my ETH is there : https://etherscan.io/address/0x277a43260499e6045e0791171441d57d5d16c574
But my Wallet says my Balance is 0:
Searchinf for a solution for like 4 hours. But didnt find anything :(
pls Help !


texts:
How do I send 0.1 tokens from the Parity client to another address using a custom gas price and CLI only?

Hi,

I want to send 0.1 tokens from my Parity client running on Ubuntu to another address.

I also want to be able to specify the gas price (set a custom gas price) and I only want to use the Parity CLI.

How would I go about doing this?

Vesa


texts: Script to transfer tokens automatically based on time

texts: How can I create a simple script which calls a transfer function every 5 hours instead of me having to manually click it every 5 hours?


texts:
According to the newest version of the yellow paper and Solidity assembly specification, revert opcode can return an error code.

http://solidity.readthedocs.io/en/develop/assembly.html

  revert(p, s)  -   end execution, revert state changes, return data mem[p..(p+s))

The revert function in pure solidity however, has 0 arguments. I guess it's not supporting a return code yet.

[Q]: How can I use the revert from the Solidity assembly to pass an error code to the calling web3 JavaScript application? If this is not possible, please explain why.

Update: see also Solidity: How can we write a error message in "require"?


texts: gas required exceeds block limit : 300000

texts:
I am building a event application using Ethereum and smart contracts.

Contract Event.sol

pragma solidity ^0.4.4;

contract Event {

uint32 currentMaxNumOfEvents=0;
struct eventDetail{
uint32  eventId;
address  eventHost;
string  eventName;
uint32  noOfDaysToRegsiter;
uint32  maxMembers;
address[]  memberAddress;
}
mapping(uint32 => eventDetail) public events;
function joinEvent(uint32 selectedEventId)public{
    require(selectedEventId>=0&&selectedEventId<=currentMaxNumOfEvents);
    require(events[selectedEventId].memberAddress.length < events[selectedEventId].maxMembers);
    events[selectedEventId].memberAddress.push(msg.sender);
}
function createEvent(string eventName,uint32 noOfdays,uint32 maxMembers) public returns (uint){
    currentMaxNumOfEvents += 1;
    events[currentMaxNumOfEvents].eventId= currentMaxNumOfEvents;
    events[currentMaxNumOfEvents].eventHost =msg.sender;
    events[currentMaxNumOfEvents].eventName = eventName;
    events[currentMaxNumOfEvents].noOfDaysToRegsiter = noOfdays;
    events[currentMaxNumOfEvents].maxMembers = maxMembers;
    return events[currentMaxNumOfEvents].eventId;

}

}

What am i doing wrong? And how can I make people pay to create event?


texts:
I'm trying to create a npm module with functions for interact with the ethereum blockchain, for the interaction i'm using the web3js API and i will put this module inside the  my new module.

In my packaje.json  i put this:

"dependencies": {
    "web3": "^0.18.3"
  }

I'm installing the module with the option --save and in the folder node_module i have all the modules required for web3 and this one installed.

So when i try to test the functionality of my new module i obtain this error:

web3 = new Web3(new Web3.providers.HttpProvider("http://ropsten.infura.io/")
);          ^
ReferenceError: Web3 is not defined

Why is happening this if i have installed the module? Some idea?

More information:

I call my new module with:

 var ether = require('./lib/newmodule.js');

Inside the newmodule.jsi have this for the conection:

if (typeof web3 !== 'undefined') {
    web3 = new Web3(web3.currentProvider);
} else {
    // set the provider you want from Web3.providers
    web3 = new Web3(new Web3.providers.HttpProvider("http://ropsten.infura.io/"));
    if(!web3.isConnected())
        console.log("not connected");
    else
        console.log("connected");
}

and this for use the module:

module.exports = methods;

And inside methods one methode for print the data and test if work or not the js. In a other Dapp project the newmodule.js works fine, but the web3js is installed by meteor.js so i think's i'm not doing something well with the web3.js installation or building the structure of the module.


texts:
I would like to run a local fork of Ropsten to interact with some of the smart contracts without having to fill up from the tap.

My plan was to start a light parity node as follows:

parity --chain ropsten --light --no-serve-light

This worked well, however, when I try to run a local ganache-cli fork:

ganache-cli --fork <here I copy-pasted my enode:// URL>

It crashes with the following error:

Error: CONNECTION ERROR: Couldn't connect to node <my enode://>


texts: How can I make my contract send out my tokens?

texts: I've been experimenting with some generic copy-paste codes on the Ropsten Test Net and I am able to create a token and have the creator receive all the tokens. However, when I try to buy these test tokens on a second account, the Ether is sent, and no tokens ever come back my way. I'm just wondering where I should be looking in the code for this function since nothing anywhere else online seems to have my answer.


texts: How to get list of transaction for ERC20 token address?

texts:
Can anyone please help me to get list of transaction for ERC20 token similar to

https://api-ropsten.etherscan.io/api?module=account&action=txlist&address=0xd39bdb16d138e5219d013cba3d94c327bd246302&sort=asc

This is my ERC20 token address : 0xd39bdb16d138e5219d013cba3d94c327bd246302

I tried with this

http://api.etherscan.io/api?module=account&action=tokentx&address=0xd39bdb16d138e5219d013cba3d94c327bd246302&startblock=0&endblock=999999999&sort=asc&apikey=YourApiKeyToken

But am getting no transactions found

But i can see transactions in etherscan


texts: Is it possible to charge extra ETH fee for token transfers?

texts:
Is it possible to accumulate fee amount deducted from transfer transactions in a different address in smart contracts?
Person A transfers tokens to Person B. Let's say the transaction fee is 0.1 ETH, I want to make the transaction fee 0.2 ETH and send it to the address I specified at 0.1 eth while the 0.1 eth gas fee goes.
How can I do such a procedure?


texts:
I'm having an odd problem working with some ERC20 token contracts I've written:

When I specify a decimal value, let's say 4 here for simplicity, the values show up differently in Mist vs etherscan.

For example, if I create a token with a supply of 1 with decimals of 4, the tokens show up as a value of 0.0001 in Mist but the value shows up as 1 in etherscan; however, if I click on the ERC20 icon in etherscan to view details on the token, there it agrees with Mist and states that the token supply is 0.0001.

So, I understand that the contract is going to be working with the smallest unit of the token, as set by the decimals value in the constructor; but I'm not quite sure how to get the value of the token itself, rather than the smaller units, to display in Mist and etherscan. Let me know if that doesn't make sense.


texts: How can non-javascript applications communicate with Ethereum nodes?

texts:
Web3 implements the Ethereum JSON-RPC spec and seems to be the preferred method for communicating between a javascript applications and the Ethereum node. However there are situations where you might want a non javascript based application to interact with the blockchain for example:

IoT devices
Blockchain monitors
Oracles and services
Bridges between Ethereum and other server side code

What methods exist for communicating with Ethereum nodes from other languages?
That is are there any libraries for  Python, Java/Scala, Go, C++ ... ect which either:

Implement the Json-RPC spec
Allow communication using some other method such as IPC.
Allow a node to be embedded within existing code and expose an interface.


texts: Is gas fee paid for this transaction that was dropped?

texts:
This is transaction that was supposed to fund a smart contract but because of a low gas fee that I set, it resulted in an error

Gas fees were around 10-15 usd, but still it wasn't enough.
I can't figure out whether or not I was charged gas fees for it. In other words, are gas fees charged for such failed trasactions or do they not?


texts:
I read that smart contracts don’t have a private key, so they can’t sign a transaction. My question is: when a smart contract starts a transaction to an EOA, how are we sure that the smart contract made the transaction if it doesn’t sign anything?
I’m new in this world and I'm still studying English, so please forgive the mistakes.
Thanks you


texts:
I read a lecture about Bitcoin Blockchain. As shown in the slide below, a user Alice sends a transaction to BoB. Alice should

1-) Hash(Hash of the transaction of the coin  || Bob Public Key  || Alice address)

2-) Sign the hash

3-) Send the signed transaction and Alice public key.

My Question: Assuming this is accurate explanation of transation in bitcoin, why the user should hash the transaction before he send it? Also, How a miner can verify the transaction using the public key and the signed transaction? I guess a miner need the original transaction as well as the hash of the transaction.


texts: If a function calls another contract function that throws, will the initial function throw as well?

texts:
If I call a function in another contract that doesn't return a boolean, but has throw() invariant checks, is it safe to assume the function finished properly if the transaction isn't reverted?
I ask in the case of a token transfer being called by another contract, since there is no way to know within the contract if the token contract was a success. (ERC-20)

Assume the rest of SampleToken is filled out according to ERC-20 standards.......

contract SampleToken {

  /* Send coins */
  function transfer(address _to, uint256 _value) {
    if (balanceOf[msg.sender] < _value) throw;           // Check if the sender has enough
    if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows
    balanceOf[msg.sender] -= _value;                     // Subtract from the sender
    balanceOf[_to] += _value;                            // Add the same to the recipient
    Transfer(msg.sender, _to, _value);                   // Notify anyone listening that this transfer took place
  }

}

contract LockContract {

  function lockTokens(uint256 _period, uint256 _amount)
  external
  returns (bool) {
    require (sampleToken.transferFrom(msg.sender, this, _amount));    // Tokens are now transfered into this contract
    return true;
}

  function unlockTokens(uint256 _amountLocked)
  external
  returns (bool) {
    sampleToken.transfer(msg.sender, _amountLocked);     // This doesn't return boolean, but will throw if error
    return true;
  }

}


texts: Geth - How to clear queued transactions?

texts:
When typing txpool on Geth I get:

{
  status: {
    pending: 15,
    queued: 714
  },
  getStatus: function()
}

I don't even know why there are 714 queued transactions when there should be none. I guess I messed something up.

More importantly, my wallet just sent a week-old transaction to my kraken.com deposit that didn't go through at the time due to whatever reason but did now that I had sufficient ether.

How can I clear the transaction queue to prevent this from happening again?


texts: Deploying Goose Finance Front end and Connecting it to Smart Contracts

texts: I recently learned the fundamentals of Solidity and had some smart contracts deployed on testnets using truffle. Also, I've done a simple dapp by finishing dapp university tutorials on youtube. However, as a part of my learning process, I wanted to try to deploy Goose Finance's repo but the files on it are too different from what the tutorials taught me. So I'm asking if anyone here can guide me on how can I deploy Goose Finance's repo on github? I know this is too much to ask, but I'm really desperate and there aren't a lot of communities for blockchain devs. Thank you.


texts: get array.length without a getter from other contract?

texts:
Is there a way to get length of an array in an other contract without a getter?

pragma solidity ^0.4.11;

contract MyContractA {
    uint[] public myArray;

    function MyContractA() {
        myArray.length = 1;
    }

}

contract MyContractB {

    function test() returns (uint ret) {
        address instanceAddress = new MyContractA();
        MyContractA instance = MyContractA(instanceAddress);
        // works:
        return instance.myArray(0);
        //
        // doesn't work:
        //
        //  TypeError: Member "length" not found or not visible after argument-dependent lookup in function (uint256) constant external returns (uint256)
        // return instance.myArray.length;

        // TypeError: Member "length" not found or not visible after argument-dependent lookup in function (uint256) constant external returns (uint256)
        // return instance.myArray.length();

        //   TypeError: Wrong argument count for function call: 0 arguments given but expected 1.
        //return instance.myArray().length;
    }
}


texts: truffle deploy live | transaction not mined within 750 seconds

texts:
I'm trying to deploy my smart contract to the live ETH network. I've done the same process on rinkeby and it works fine. However during the block mining phase it times out and gives the error:
" transaction not mined within 750 seconds deployment error"
Is there a way to increase the length of the deployment process? Or disable timeouts? Or make it go faster?
Thanks!


texts: Are there pure virtual functions in Solidity?

texts:
I come from a C++ background. A nice feature in C++ is pure virtual functions which allow one to create an interface that imposes on any derived class to force it to implement a function. For example, these this code:

class A {
public:
    A() {}
    virtual void aFunction(void) { printf("Hello"); }
    virtual void bFunction(void) = 0;
};

class B : public A {
public:
    B() : A() {}
};

does not compile because B does not implement bFunction, but this version of B does compile:

class B : public A {
public:
    B() : A() {}
    virtual void bFunction(void) { printf("B"); }
};

Are these features (inheritance, virtual functions, and especially pure virtual functions) available in Solidity? Is there any discussion to add them?


texts: Remix-ide: how to set “runs” for optimizer at a value different from the default 200?

texts:
As you may know, the default solc optimizer “runs” value is 200.

Apparently remix does not permit to change this value.

Has someone any idea of how to change it?


texts: off chain wallet creation for tipping bot

texts: I'm trying to create a discord/twitch tipping bot specifically for my erc20 project and perhaps adding erc721 tokens as giveaways but I need to do this off chain to reduce gas cost. I can't find any tutorials on off-chain fully custodial wallet creation anywhere, could someone help point me towards the right direction? thank you.


texts: Can a fee in Ether be added to ERC20 Token transfers

texts:
New to Solidity...

Is it possible to have a fee for transfers of an ERC20 Token in Ether? The fee would be 0.000001 Ether per transfer. Each time the ERC20 Token is sent to another user, the fee in Ether would be sent to a contract. Source example of how to transfer the fee in ether would be most helpful.

(note: this question does not pertain to gas fees. This refers to an additional fee in Ether for transfers of an ERC20 Token.)


texts:
I don't know how to mine blocks with Python.
Can I mine blocks with Pyethapp?


texts: Is it possible to create a smart contract which triggerring will be delayed until a special transaction issued by a specific user appears in the chain? If it is possible can data from this transaction be used as an input for the contract?