texts:
I try to send erc20 tokens in this way

var Tx = require('ethereumjs-tx');

var Web3 = require('web3')

var web3 = new Web3(new Web3.providers.HttpProvider('https://mainnet.infura.io/v3/2a7d7b55629d44119f069a9239ea96fd'))

// set token source, destination and amount

var myAddress = ""

var toAddress = ""

var amount = web3.utils.toHex(1e16)

// get transaction count, later will used as nonce

web3.eth.getTransactionCount(myAddress).then(function(v){console.log(v); count = v})

var privateKey = new Buffer('privatekey', 'hex')
var abiArray = abiarray
var contractAddress = ''
var contract = new web3.eth.Contract(abiArray, contractAddress, {from: myAddress})
var rawTransaction = {"from":myAddress, "gasPrice":web3.utils.toHex(2 * 1e9),"gasLimit":web3.utils.toHex(210000),"to":contractAddress,"value":"0x0","data":contract.methods.transfer(toAddress, amount).encodeABI(),"nonce":web3.utils.toHex(count)}
var transaction = new Tx(rawTransaction)
transaction.sign(privateKey)
web3.eth.sendSignedTransaction('0x' + transaction.serialize().toString('hex'))
contract.methods.balanceOf(myAddress).call().then(function(balance){console.log(balance)})

but I get an error

var rawTransaction = {"from":myAddress, "gasPrice":web3.utils.toHex(2 * 1e9),"ga
sLimit":web3.utils.toHex(210000),"to":contractAddress,"value":"0x0","data":contr
act.methods.transfer(toAddress, amount).encodeABI(),"nonce":web3.utils.toHex(cou
nt)}

                                                                             ^

ReferenceError: count is not defined

What is the problem?


texts:
I am using the nethereum package in .Net and trying to invoke a smart contract with web3. Initially it was working fine, but suddenly I am getting an error while trying to get the transaction count. This is the code I am using:

var web3 = new Web3("https://rinkeby.infura.io/");

//getting the error from below line.
var txCount = await web3.Eth.Transactions.GetTransactionCount.SendRequestAsync(DefaultAccount, Nethereum.RPC.Eth.DTOs.BlockParameter.CreatePending());

Error message:

Error occurred when trying to send rpc requests(s)
Inner exception: The underlying connection was closed: An unexpected error occurred on a send.

Can anyone help me?


texts: Why does this stuck transaction not appear on etherscan?

texts:
Can anyone help? I have a stuck transaction in my Coinbase Wallet. Its status is marked as "Pending", and this has been the case for about 10 days now.
After doing some research, I've learned that if I create a transaction with the same nonce as the stuck transaction, but with a higher gas fee, the stuck transaction will effectively be cancelled, allowing subsequent transactions to then flow freely. (I have another 3 transactions that are also "Pending", which I believe are not going through due to the jammed transaction).
However, I cannot perform this operation, as there is a problem: When I press "View on block explorer" from within the Coinbase Wallet app, to see it on Etherscan, the Etherscan page that opens just says "Sorry, we are unable to locate this TxnHash". So I cant get the nonce.
I have contacted Coinbase asking them why their wallet app shows a stuck transaction but I can't see that transaction anywhere else, but they seem to be ignoring my messages.
I initialised the transaction from the Rarible web app, and its a transaction to burn an NFT that I minted. (Video format was corrupted).
Does anyone know if there is a legitimate reason for the transaction not showing up on Etherscan, other than the possibility that the Coinbase Wallet app has malfunctioned? And more importantly, how can I get this NFT burning transaction to go through? (Or if not,  perhaps delete it and create a new one?)


texts: how can I make geth.ipc group writable/readable

texts: I'd like geth.ipc to be group writable/readable each time I launch geth via a systemd.service. How is that possible? (as opposed to chmod manually).


texts: How to pass argument/parameter to a payable function of a contract that has been already deployed, via web3 / javascript / truffle?

texts:
I'm wondering how to pass argument to a payable function of a contract that has already been deployed, via web3 / javascript / truffle. For instance, I see the following piece of code at: http://solidity.readthedocs.io/en/develop/contracts.html

pragma solidity ^0.4.0;

contract ClientReceipt {
    event Deposit(
        address indexed _from,
        bytes32 indexed _id,
        uint _value
    );

    function deposit(bytes32 _id) payable {
        // Any call to this function (even deeply nested) can
        // be detected from the JavaScript API by filtering
        // for `Deposit` to be called.
        Deposit(msg.sender, _id, msg.value);
    }
}

But then if I were to interact with this contract via javascript, how would I pass bytes32 _id to function deposit as I send (say) 100 wei to the contract address?? So far, I have tried:

// bytes32 data for "test"
var myData = "0x7465737400000000000000000000000000000000000000000000000000000000";

ClientReceipt.deployed().then(function(instance) {
    instance.deposit.sendTransaction(myData, {value: 100, from: myAccount, to: instance.address});
    ...

ClientReceipt.deployed().then(function(instance) {
    instance.deposit(myData, {value: 100, from: myAccount, to: instance.address});
    ...

ClientReceipt.deployed().then(function(instance) {
    instance.sendTransaction(myData, {value: 100, from: myAccount, to: instance.address});
    ...

Is this where {data: myData} might be relevant perhaps?? If so, then how do things change if the function took multiple parameters, e.g. if it were function deposit(bytes32 _id, uint n, bool m)?? How would you be passing parameters while simultaneously sending 100 wei to the contract?? Thanks a lot!


texts:
One of the tutorials in crypto zombies mentions about external function.

contract KittyInterface {
  function getKitty(uint256 _id) external view returns (
    bool isGestating,
    bool isReady,
    uint256 cooldownIndex,
    uint256 nextActionAt,
    uint256 siringWithId,
    uint256 birthTime,
    uint256 matronId,
    uint256 sireId,
    uint256 generation,
    uint256 genes
  );
}

contract ZombieFeeding is ZombieFactory {

  KittyInterface kittyContract;

  function setKittyContractAddress(address _address) external onlyOwner {
    kittyContract = KittyInterface(_address);
  }

Here, setKittyContractAddress is used to change the address in case of emergency. Why does it have to be declared as external?

because it sounds like you have to deploy another contract just to change kitty contract address.

ex:

contract ZombieFeedingInterface {
  function setKittyContractAddress(address _address) external;
}

contract Test {
    address zfAddress = 0x......;
    ZombieFeeding zombieFeeding = ZombieFeedingInterface(zfAddress);

    function changeKittyContractAddress(address _address) private onlyOwner {
        zombieFeeding.setKittyContractAddress(_address);
    }
}

and also create a separate html page (UI) to pass new address to this function.

Isn't setKittyContractAddress better to be declared as internal or private, so the owner doesn't have to create another contract and thus can handle it easily with the existing contract?

What's the benefit of external in this case?


texts: How Will Ethereum Differ From The Linux Foundation Blockchain?

texts: What are some crucial advantages/disadvantages to both, and what factors will affect user adoption? Finally, in what ways will they one day work together?


texts: How can we verify BGLS aggregate signatures in Solidity?

texts:
BGLS [1] is an aggregate signature scheme by Boneh et al., that allows aggregation of signatures on n different messages from n different signers. What I want to achieve is to verify such signatures in a smart contract.

Verification of a single signature (a BLS signature) is done through checking equality e(g1, σ) == e(v, h), where:

e : G1 x G2 -> GT is a bilinear pairing/mapping
g1 is a generator of G1
σ is the signature
v is the public key of the signer
h is the hash of the signed message

Using the new precompiled contract bn256Pairing introduced in Byzantium (and also bn256Add and bn256ScalarMul), we can check the equality and verify the signature.

Problem:
Now, to verify an aggregate signature, we need to compute:
e(g1, σ) == product of e(vi, hi) for all signers i
where vi and hi are the public key and hashed message of signer i.

This seems to be more difficult as we must actually calculate the pairings en multiply them before checking the equality. However, the precompiled contract only allows for checking equality. Also, I found an implementation on GitHub (Project-Arda/bgls-on-evm [2]), but it only seems capable of verifying single signatures.

Question:
Does anyone have a suggestion on how to verify this aggregate signature in Solidity?

Note: BGLS is originally not compatible with the type 3 pairings that are supported by Ethereum, but the scheme can be modified as suggested by Chatterjee et al. [3].

References:

[1]: https://link.springer.com/chapter/10.1007%2F3-540-39200-9_26
[2]: https://github.com/Project-Arda/bgls-on-evm
[3]: https://link.springer.com/article/10.1007/s10623-009-9334-7

Update (8 July 2018):

An example of how I verify BLS and BGLS signatures in Solidity is found at https://gist.github.com/BjornvdLaan/ca6dd4e3993e1ef392f363ec27fe74c4


texts: Why in sharded chain, a validator in shard "A" cannot verify correctness of historical transactions in shard "B"?

texts:
In this article about the sharded blockchains, (Link to article) we read:

  The core idea in sharded blockchains is that most participants
  operating or using the network cannot validate blocks in all the
  shards. As such, whenever any participant needs to interact with a
  particular shard they generally cannot download and validate the
  entire history of the shard.

What reason does cause that a validator in shard A cannot download and validate the correctness of the entire history of the shard B ?

From my point of view, that validator is able to download the entire historical transactions in any arbitrary shard (exactly similar to a non-sharded blockchain) and then verify the history of all transactions by tracing each transaction.

What is the problem? (Where typically all the shards use the same consensus algorithms and all of them have the same block structure.)


texts: using solidity to verify ECDSA signature from external key pair

texts:
say a user has an external public key (unrelated to ethereum address). they use the private key associated with this public key to sign sha3(message) via ECDSA. the message, public key and signature are submitted to a contract. is there a simple way to use solidity to verify the signature? ecrecover returns an address.

i've tried to look for an answer to this but it seems like prior applications have been verifying signatures of ethereum addresses with ecrecover.

EDIT: i suppose i could convert the public key to an address using the following steps (from Steve Waldman):

1.Start with the public key bytes (a bytestring of length 64)

2.Of that public key, take the Keccak-256 hash used ubiquitously by Ethereum (make sure you get that right, as the ultimately standardized SHA3-256 hash differs). You should now have a bytestring of length 32.

3.Drop the first 12 bytes. You should now have a bytestring of length 20, the Ethereum address associated with your public key.

would it be functional to convert the external public key to an ethereum address with solidity then check that address against the result of ecrecover() to determine if the signature is valid?


texts:
I am busy teaching myself how to write smart contracts in solidity.

pragma solidity 0.4.13;

I am writing a simple toggle state method and this is how I would do it in PHP:

function toggleActiveState()
    public
    isCreator()
    returns (bool)
    {
        active = !active;
        logMessage('State has been updated', 0);
        return true;
    }

The above, however,  does not seem to work.

Would it be better to write it as:

function toggleActiveState()
    public
    isCreator()
    returns (bool)
    {
        if (active)
        {
           active = false;
        } else {
           active = true;
        }
        logMessage('State has been updated', 0);
        return true;
    }

thanks!


texts: Calling contract constructor with arguments

texts:
I want to call the constructor of my contract which accepts address as a parameter,

below is the contract code:

pragma solidity ^0.4.4;

    contract Relay {
        address public currentVersion;
        address public owner;

        function Relay(address initAddr){
            currentVersion = initAddr;
            owner = msg.sender;
        }

        function update(address newAddress){
            if(msg.sender != owner) throw;
            currentVersion = newAddress;
        }

        function(){
            if(!currentVersion.delegatecall(msg.data)) throw;
        }
    }

I am trying to call the constructor in this contract from JavaScript using web3.js

below is the code I am using for that

var myContract = new web3.eth.Relay("0x87d8cc2aa5230e5d2f1a54b84366ea433da4bafd",abi, contractAddress, {
    from: web3.eth.coinbase,gasPrice: 200000000 });

but it shows error that

  Uncaught TypeError: web3.eth.Relay is not a constructor

If I follow the normal contract object creation method ie.

var contract = web3.eth.contract(abi).at(contractAddress);

it works fine but this one not able to accept any parameter,
Can any one suggest any method to do this.
I have already found some answers about this here and here also but not useful for me.


texts: How to access state of the contract per transaction event?

texts:
I've a contract which has a price attribute. Price goes up with each transaction.

contract MyContract{
    uint256 public price;

    .... other methods
}

For transaction I receive following event data in a callback:

{ address: '0xa6....................',
  blockNumber: 15655,
  transactionHash: '0xb..........................',
  transactionIndex: 1,
  blockHash: '0xca........................',
  logIndex: 0,
  removed: false,
  event: 'Transfer',
  args:
   { from: '0x3dc..................',
     to: '0x64b...................',
     amount: 1
    }

}

Is there a way I could obtain the price of the contract, at a specific transaction using above event data(which has already happened)?


texts: How to get Ropsten Revival testnet eth without mining

texts:
I've synchronized my testnet node to Ropsten Revival tesntet as shown here: https://github.com/ethereum/ropsten

However, I have no testnet eth to play with it. I tried mining, but no lack. Is there any faucet or something that can be used to obtained Ropsten Revival testnet ether?

Thank you.


texts: How to connect your react ethereum project with MetaMask wallet?

texts:
I am developing a ReactJs blockchain application on ethereum network. How can I use MetaMask Wallet instead of local ganache account.

import web3 from 'Web3';
const web3 = new Web3("localurl");


texts: Smart contracts work when deployed with Remix, but not Web3j

texts:
I have a web3j call to a smart contract ecrecover() function and I need to pass the V value. However I'm unsure as to how to convert the V value to a BigInteger.

Web3j:

aVerifier.verify("Kieran", "Hughes", signature.getV(), signature.getR(), signature.getS()).send();

signature.getV() is not accepted here as it is of the type Byte and must be BigInteger.

Problem solved:

Remix handles basic user input. Web3j requires conversion of Byte to BigInteger

BigInteger.valueOf(signature.getV())


texts: Am I locked to one solc version for upgradeable smart contracts?

texts:
I want to use delegatecall to make my contracts upgradeable.
Is it true that variable layout may break if I change the solc version and therefore I should use the same Solidity version for all future versions of my contract?


texts: Cannot convert undefined or null to object after compile

texts:
My smart contract project has been initialised with oz init and I have a single contract. After running oz compile I get an error saying Cannot convert undefined or null to object
complete output of oz compile:
✖ Compiling contracts with solc 0.8.4 (commit.c7e474f2)
Cannot convert undefined or null to object

It is not a compilation error. If there is a compilation problem, this will be shown in the expected way.
In order to segregate the sources of error, I have created an empty project with just one contract.
environment

MacOS Big Sur 11.2.3 (20D91)
node v14.13.0
npm 6.14.7

The folder content is:

.openzeppelin

project.json

contracts

token.sol

networks.js
node_modules
package-lock.json
package.json

project.json
{
  "manifestVersion": "2.2",
  "contracts": {},
  "dependencies": {},
  "name": "net2u-token",
  "version": "1.0.0",
  "compiler": {
    "compilerSettings": {
      "optimizer": {}
    },
    "typechain": {
      "enabled": false
    }
  },
  "telemetryOptIn": true
}

package.json
{
  "name": "token",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "oz compile && mocha --exit --recursive test"
  },
  "author": "",
  "license": "MIT",
  "devDependencies": {
    "@openzeppelin/cli": "^2.8.2",
    "@openzeppelin/contracts": "^4.1.0"
  }
}

token.sol
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract Net4uToken is Ownable, ERC20 {
    constructor (string memory name_, string memory symbol_) ERC20(name_, symbol_) Ownable() {}
}

networks.js
module.exports = {
  networks: {
    development: {
      protocol: 'http',
      host: 'localhost',
      port: 8545,
      gas: 5000000,
      gasPrice: 5e9,
      networkId: '*',
    },
  },
};


texts: How to test a contract which needs the address of a previously deployed contract first?

texts:
I am having trouble with my JS tests for a Contract which depends on the deployment of another Contract first.

Contract A needs to be deployed, then pass it's address to Contract B.

I have already been able to migrate successfully, but still trying to get the tests to pass.

How do I fix my JS tests and instantiate/deploy properly?

Here is my test code:

beforeEach(async function() {
        let tx = await ContractA.deployed();
        contractB = await ContractB.deployed(tx.address);
    });

Deployment script:

module.exports = function(deployer) {
    deployer.deploy(ContractA).then(function() {
        deployer.deploy(ContractB, ContractA.address);
    });
};

Receiving this error:

Error: ContractB has not been deployed to detected network (network/artifact mismatch)


texts: Import a contract hosted on a testnet from it's address

texts:
I have a smart contract that imports another, and I'm wondering how to deploy them to a testnet.

Right now, one contract imports the other locally;

import "./firstContract.sol"

contract secondContract is firstContract {
...
}

What would I chance the import "./firstContract.sol" line to once the first contract is deployed to a testnet via remix, and I want to deploy the second contract?

I found some documentation on it but it doesn't quite have what I'm looking for.


texts: Sending Ether to a self destructed contract?

texts: Just out of interest, is the ETH lost forever in this scenario?


texts:
Most of tutorials I found in the net were either too old or using old frameworks and development tools. I am talking specifically for building end to end DApps. Would you recommend some recent tutorials and frameworks for that?
Though my understanding of Ethereum Dapps is still limited, what do you think of the approach of building  a Dapp where the interaction with smart contracts happens in a server backend (like using Node.js) vs directly in a browser which then requires an ethereum client and the user's desktop?


texts: How to fix checksum mismatch in downloaded node for Ethereum Wallet?

texts:
I attempted to update Ethereum Wallet to 1.8.2 and was given an error:

Checksum mismatch in downloaded node!
MD5: 308...
Please install the geth node version 1.8.2 manually

So I went to https://ethereum.github.io/go-ethereum/downloads/ and downloaded geth 1.8.2 for windows.
However during the installation I received the message

PATH not updated, original length 1916 > 1024

I can no longer get Ethereum Wallet to run. Any solutions would be greatly appreciated.

Edit: I am also having the exact same problem with Mist.


texts: Does ETH and ETC uses the same network ID?

texts:
Can someone tell me what happen after the hardfork (due to DAO attack)? There are 2 ethereum cryptos after the fork, so there should be 2 different network. Are they using the same network ID? How do they differentiate themselves?

Apology if I am asking something basic. Appreciate if someone can point me to some Ethereum ecosystem primer...


texts: A solidity 0.5.x function to convert adress-string to ethereum address

texts:
I'm looking for a Solidity 0.5.x compatible function to convert a string with and address like "0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe" into a real address.

I did use this function:

function stringToAddress(string memory _a) public pure returns (address) {
        bytes memory tmp = bytes(_a);
        uint160 iaddr = 0;
        uint160 b1;
        uint160 b2;
        for (uint i = 2; i < 2+2*20; i += 2) {
            iaddr *= 256;
            b1 = uint160(tmp[i]);
            b2 = uint160(tmp[i+1]);
            if ((b1 >= 97)&&(b1 <= 102)) b1 -= 87;
            else if ((b1 >= 48)&&(b1 <= 57)) b1 -= 48;
            if ((b2 >= 97)&&(b2 <= 102)) b2 -= 87;
            else if ((b2 >= 48)&&(b2 <= 57)) b2 -= 48;
            iaddr += (b1*16+b2);
        }
        return address(iaddr);
    }

However this gives me these errors:

VehicleRegistry1.sol:266:18: TypeError: Explicit type conversion not allowed
from "bytes1" to "uint160".
            b1 = uint160(tmp[i]);
                 ^-------------^
VehicleRegistry1.sol:267:18: TypeError: Explicit type conversion not allowed from "bytes1" to "uint160".
            b2 = uint160(tmp[i+1]);
                 ^---------------^


texts:
After peering 2 nodes i am now trying to send ether to the other node but i am getting the below error :

eth.sendTransaction({from: eth.coinbase, to: "0xc7d0aa54e81d394e4b9e9dce74508bc75a66fdb5", value: web3.toWei(10, “ether”)})
(anonymous): Line 1:114 Unexpected token ILLEGAL

(and 5 more errors after this one)

Can you please help ?

Regards
Shibu


texts: How to import and compile contracts of different versions solidity

texts:
How to import and compile contracts of different versions using solidity in remix?
When I import a contract I get this error:

ParserError: Source file requires different compiler version (current
compiler is 0.8.3+commit.8d00100c.Emscripten.clang) - note that
nightly builds are considered to be strictly less than the released
version -->
https://github.com/ConsenSysMesh/openzeppelin-solidity/blob/master/contracts/math/SafeMath.sol:1:1:
| 1 | pragma solidity ^0.4.23; |

I am importing a contract from open zepplin. The contract is MathSafe and it uses pragma solidity 0.4.23;. My local contract uses 0.8.3.
This is how my code looks like on remix:
// SPDX-License-Identifier: MIT

pragma solidity >=0.4.23 <0.9.0;

import "https://github.com/ConsenSysMesh/openzeppelin-solidity/blob/master/contracts/math/SafeMath.sol";

contract StakingToken is ERC20, Ownable{
    using SafeMath for uint256;

    constructor(){}

    function addNumber(uint256 number) public view returns(uint256) {
        return number.add(5);
    }
}


texts:
Want to create my own public network with pre-funded account, can any one point out the optimise, secure configuration for spanning node for Test and  Main net ?

To be more specific for Test Net I need
- Genesis.json
- Toml file with all  necessary configuration

and for main net
- Genesis.json
- Toml file with all  necessary configuration


texts: Loop with upper bound of iterations / loop variant

texts:
Is it possible somehow to create a loop that solidity will recognize as having an upper bound of iterations for gas estimations?

Something like a loop variant in Eiffel (https://www.eiffel.org/doc/eiffel/ET-_Instructions#Loop_invariants_and_variants).

Currently I get infinite gas estimate whenever I have a for loop in my code.


texts: How to test contract with multiple accounts / addresses in truffle?

texts:
I want to test my truffle contract with multiple msg.sender addresses. Like "the first user sell token, the second user buys this token". For one address I simply write something like contract.buy.value(10 wei)();. But where I could get another address and how to send money from him?

I write my tests on solidity, not on javascript.


texts: How can I receive ETH at Mist sent from other wallet

texts:
I want to receive ETH in my Mist account to test ETH transfer. But it doesn't work well so far.
I tried to send ETH to my Mist account from other bitcoin and ETH transfer service. but I cannot receive ETH account on Mist. and account deposit still zero for several days. How can I receive ETH on my Mist.

Do I need some action on Mist??


texts:
I have the following code in AuthorTokens.sol:
    Files files;

    // ...

    function mintAuthor(address _owner) external {
        require(msg.sender == files, "System function");
        uint256 _id = _sellerToToken(_owner);
        balances[_id][_owner] = 10**digitsConstant;
        TransferSingle(msg.sender, 0, _owner, _id, 10**digitsConstant);
    }

This function should be called by the contract Files.sol, when a new "author" is added.
So, I have a mutual dependency of two contracts: Files and AuthorTokens. How to deal with this? Should I set both contracts to point to addresses of each other?
I could combine the two contracts into one but Files is ERC-20 and AuthorTokens is ERC-1155.
So, what to do?


texts: what does the "12 confirmations" mean in the mist when sending transactions?

texts: as shown in the picture, once a transaction is sent to the network waiting for confirmation, this "of 12 confirmations" appears, what does this "12 confirmations" really mean?


texts: How feasible it to combine Proof of Work and Proof of Elapsed time consensus to create a custom blockchain?

texts:
I wonder if it feasible to create your own custom consensus by combining Proof of Work and Proof of Elapsed time?

How would I approach it? Any tools or frameworks to build it?

I appreciate all the comments.


texts: My monetha tokens dissapeared from myetherwallet - please help!

texts:
I recently bought Monetha(MTH) tokens and transferred them to my wallet (mytherwallet.com). Within few minutes i saw a transaction where in my tokens were transferred to another address.

Here is the transaction 0x5962a49c229d343814b77c6d6b929ef2c22de626711d5f10861eaf926793b77a

The address it was transferred to
0x9ee24f7ef4c6ff9c0b681af178d763d5eca70968

Is there anyway I can get them back?


texts:
How can I say for each unique address of an array do something?

I'm calling a function which adds an address to an array every time it is called. I would preferably not want to add another identical address to the same array if it already exists within, is this possible to check for?

 else, how can I work around this when calling functions that loops through the particular array? because it basically applies the action to the same address x amount of times that it is present in the array per function call.


texts:
By which I can connect the ethereum live network.

web3 = Web3(HTTPProvider('http://192.168.3.48:8045'))

Here I want to put a ethereum live network .


texts: What is the difference between a private key, password, brain wallet, recovery passphrase, and wallet?

texts: What is the difference between a private key, password, brain wallet, recovery passphrase, and wallet, if any? Is there any connection between these?


texts: Paying for gas (when the SC is executed) with money stored in a SC

texts:
I am starting to program my first real contract and would like to ask if it is possible to do this (something like an auction):
Someone deploys a contract. Participants pay for that auction to run (money that is stored in the contract). Then, after X time, the contract is executed. This execution is paid for with the money that was stored in the contract. Therefore, if there is not enough money, the execution will fail (and the participants will have to put more money next time).
P.S: I am also trying to prevent a participant from registering twice in the auction (or not registering if he doesn't have enough Ether). Should I store their addresses and check them every time a new participant registers?
Thanks in advance!


texts: Token contract: emits Transfer event two times with half value each time, what is the purpose?

texts:
I stumbled across one contract which emits Transfer event two times:
https://etherscan.io/address/0x9dacdbaacff26b233bc6f969f57c61aa0742d4df#code
function batchSend(address[] memory _tos, uint _value) public payable returns (bool) {
    require (msg.sender == owner);
    uint total = _value * _tos.length;
    require(balanceOf[msg.sender] >= total);
    balanceOf[msg.sender] -= total;
    for (uint i = 0; i < _tos.length; i++) {
        address _to = _tos[i];
        balanceOf[_to] += _value;
        emit Transfer(msg.sender, _to, _value/2);
        emit Transfer(msg.sender, _to, _value/2);
    }
    return true;
}

Does somebody have any ideas what is the purpose to call the Transfer event two times with half a value each time?


texts: What's the real value in using BlockApps Strato?

texts:
I installed the extension to Visual Studio 2015 to provide development support to smart contracts written in Solidity.

When discovering how to use this extension, and it's value, it became clear it uses a BlockApps KeyServer. This lead me to wonder why..and in answering that question I began to wonder what is the value of using BlockApps Strato over setting up your own Ethereum private net (for dev/testing); which only takes 5 minutes; compiling the contracts and using the Ethereum Wallet to test them etc.

So, I'm puzzled as to what the value-add of BlockApps Strato actually is as it doesn't appear difficult to write and deploy smart contarcts on Ethereum directly?

I don't get what BlockApps Strato actually brings to the party. I must be missing something; hence the question...


texts: How was the recursive call vulnerability attack conducted via proposal #59 when there were no Yes votes?

texts:
From Which split proposal was used to mount the recursive call vulnerability attack on The DAO?, proposal #59 is very likely the vector uses by the attacker to hack 3,641,694.241898506 Ether ($59,578,117.80) (from Is there any way to determine how long it took for the DAO attacker to deploy the attack?).
From my understanding only individuals voting Yes on the split proposals to be able to withdraw ETH from The DAO (see How to withdraw Ether from The DAO?).
Also from Deconstructing theDAO Attack: A Brief Code Tour:

The mechanism for doing so is to create a split proposal. Split proposals take 7 days to 'mature' and get participants in. Any participants voting "yes" in the split will be given the right to call splitDAO.
splitDAO will create the DAO child contract if it doesn't exist, send the ether controlled by the splitters into the childDAO, pay out any accrued 'reward' pro-rata to the splitters, and return. At least, that's the plan.

And from DAO.report you can see that no one voted Yes to proposal #59:

You can see the same information for proposal #59 in Which split proposal was used to mount the recursive call vulnerability attack on The DAO?.
From the source code for splitDAO(...) (from EtherScan.io - The DAO) there is a restriction !p.votedYes[msg.sender] that throws an error if the splitDAO(...) function call was called by a caller who has not voted Yes:
    function splitDAO(
        uint _proposalID,
        address _newCurator
    ) noEther onlyTokenholders returns (bool _success) {

        Proposal p = proposals[_proposalID];

        // Sanity check

        if (now < p.votingDeadline  // has the voting deadline arrived?
            //The request for a split expires XX days after the voting deadline
            || now > p.votingDeadline + splitExecutionPeriod
            // Does the new Curator address match?
            || p.recipient != _newCurator
            // Is it a new curator proposal?
            || !p.newCurator
            // Have you voted for this split?
            || !p.votedYes[msg.sender]
            // Did you already vote on another proposal?
            || (blocked[msg.sender] != _proposalID && blocked[msg.sender] != 0) )  {

            throw;
        }

So, how was the attacker able to drain the ETH from The DAO when they did not vote Yes on proposal #59?
Was there another vector that was employed by the attacker?


texts: Is there a way to add just BNB to the LP without adding the token as well? To balance the price a little?

texts:
So I manage a project which in my humble opinion has massive potential and a really good community.
The problem is I didn't add much liquidity (only 2 BNB when making the coin) and people have sold off tanking the price. The problem isn't here though, the problem is that not long after it appeared that there were no BNB in my Liquidity pool and I've no idea why. Surely the LP should always exist and allow us to continue to trade?
Also, how much of the tokens supply should I be adding to the original LP when I add LP? I'm asking this because I'm left with a random wallet that has about 50% of the tokens and I thought that this would be where the supply would be coming from to feed into the LP as people buy more and more. Is it wise for me to send the tokens to the LP? And does anybody know if there's a way to do this?
The problem is I started this project on my own and I'm the only dev. I have an amazing community and I don't want to let them down at this stage. Thanks for any help I get


texts: Upgradable Smart Contracts - Is there consensus between shareholders when upgrades occur?

texts:
It seems that upgradable smart contracts are the new wave of the future seemingly for the all the right reasons.  How does this work for the "hello world" smart contract where two users make a bet on the weather in 2 months being above some temp, and they agree on an oracle for the temp data.  What if this is made into an upgradable contact and the temperature oracle is upgraded?

Do all players in the contract get notified, or is it up to the parties of the contract to keep reviewing the contract code? If the contract was updated, and the $ awarded to the winner, what if the loser didn't know the temperature source was upgraded?  Is this scenario even possible?


texts: How is this account able to consistently get her/his transactions with zero gas price mined?

texts:
This account https://etherscan.io/address/0xbe7cd41e060cdb07c548d6c65f1d786e43f1c392 is able to keep sending transactions with zero gas price and they are mined. If I try to do the same, my transactions will get stuck forever.

Example: https://etherscan.io/tx/0x13dd2fbbf9d403001623a6f90ab66ccd585832f14e38401806fa7d1e1f7f9013

How is this being done?


texts: Get contract's owner address without openzeppelin Ownable

texts:
I want to know if Ethereum stores the contract's deployer address by default.
I know Ownable Library which stores owner's address in a storage variable. I want to know if Ethereum blockchain stores this address too in deployment transaction.
If so, how can i access this information from truffle tests ?
Thanks a lot


texts: Selling NFT's, buyer calls minting function, how to call transfer function?

texts:
I'm implementing a dApp to sell NFT's. I want the buyer to call the function on my smart contract to mint the NFT so that they pay for the gas fees. However it seems like they can't then transfer that NFT to themselves, is that correct?
How then can i call the transfer function so that they then get ownership of the token. Do i need to call the transfer function from my own address?
I was hoping to avoid that to 1) not pay gas fees and 2) not have to worry about managing nonce's in my application (as there can be concurrent calls to my app).
Is this the only way or is there a way around me having to call the function from my own account and incur the 2 above mentioned issues?


texts: Import in Solidity.. Does it affect the Gas?

texts:
If I have 3 contracts.. Contract C imports contract B which imports Contract A...
Contract A is first deployed, then B, then C..

Contact B is created from within Contract A

and Contract C is created from within Contract B

Does this mean that Contract C needs the largest Gas as it imports from B and A? Contract B and C are the same type but A is different ..

I need an explanation to know if importing a code to another contract affects the gas consumption or not ...

For instance is it better to have one contract that other contracts only import from so like one parent and many children

or to have a contract that imports from another contract which imports from another one and so on.. like a chain .. will the last contract in the chain have all the code from the others ?


texts: Chain ID set to 1(provided 15) while creating private net using Geth

texts:
[{
  "difficulty" : "0x20000",
  "extraData"  : "",
  "gasLimit"   : "0x8000000",
  "alloc": {},
  "config": {
        "chainId": 15,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0
    }
}]

this is my genesis.json file & as mention chainid is 15.


texts:
I am trying to execute the following code:

pragma solidity ^0.5.1;

contract contractA {
    function blah(int x, int y) public payable {}
}
contract contractB {
   function invokeContractA() {
      address a = contractA.address(this);
      uint ValueToSend = 1234;
      a.blah.value(ValueToSend)(2, 3);
   }
}

I was getting following error in the ocde:

  browser/callMethod.sol:7:31: ParserError: Expected identifier but got
  'address' address a = contractA.address(this); ^-----^

After searching from ethereum.stackexchange, I found the solution and now my contract B looks like this:

    contract contractB {
    function invokeContractA(address _addA) public  {
        contractA a = contractA(_addA);
        uint ValueToSend = 1234;
        a.blah.value(ValueToSend)(2, 3);
    }
}

Now I am getting following error on remix ide:

  browser/callMethod.sol:4:19: Warning: Unused function parameter.
  Remove or comment out the variable name to silence this warning.
  function blah(int x, int y) public payable {} ^---^

Some body please guide me.

Zulfi.


texts: How to mimic abi.encodeWithSignature in web3?

texts:
I have  the following function that I would like to test.
    function createPlanet(bytes memory _data) public returns (address) {
        emit ProxyCreated(planetImplementation);
        emit TestBytes(_data);
        address proxy = deployMinimal(planetImplementation, _data);
        return proxy;
    }

The function works correctly when I call it from a different contract, here is the funciton call and the initialize function that it is calling:
            address _address = pm.createPlanet(
                abi.encodeWithSignature(
                    'initialize(address,address,address,address,uint256,uint256)',
                    address(TS),
                    address(solar),
                    address(fhr),
                    address(sats),
                    yield,
                    _id
                )
            );

    function initialize(
        address _treasury,
        address _solar,
        address _fhr,
        address _sats,
        uint256 _yield,
        uint256 _tokenId
    ) public {
        tokenId = _tokenId;
        yield = _yield;
        minHold = 14 days;

        solar = ISolar(_solar);
        fhr = IFHR(_fhr);
        sats = ISat(_sats);
        ts = ITreasury(_treasury);
    }

This all works as intended, I am struggling to replicate this in my tests with web3. The proxy contract is deployed with the correct address but none of the parameters in the initialize function are ever set.
Here is my test:
           const treasury = await treasuryAddress();
            const solar = await solarAddress();
            const sat = await satAddress();
            const fhr = await fhrAddress();

            const signature = web3.eth.abi.encodeFunctionCall(
                {
                    name: 'initialize',
                    type: 'function',
                    inputs: [
                        {
                            type: 'address',
                            name: '_treasury'
                        },
                        {
                            type: 'address',
                            name: '_solar'
                        },
                        {
                            type: 'address',
                            name: '_fhr'
                        },
                        {
                            type: 'address',
                            name: '_sats'
                        },
                        {
                            type: 'uint256',
                            name: '_yield'
                        },
                        {
                            type: 'uint256',
                            name: '_tokenId'
                        }
                    ]
                },
                [treasury, solar, sat, fhr, 100, 1]
            );
            const receipt = await createPlanet(signature, Owner);

            const proxyAddress = receipt.logs[0].args.proxy;

            const proxyYield = await getYield(proxyAddress, Owner);

            assert.equal(proxyYield.toString(), 100);

The contract works and I can get yield when it is deployed from within another contract so I am assuming it is because of abi.encodeFunctionCall maybe not beinging correctly formatted or something along those line?
MORE INFO:
CreatePlanet Function:
import { PlanetManagerC } from '../_utils/artifacts';
export async function createPlanet(signedCall, from) {
    const PlanetManager = await PlanetManagerC.deployed();
    return await PlanetManager.createPlanet(signedCall, { from });
}

GetYield Function:
import { PlanetC } from '../_utils/artifacts';
export async function getYield(planet, from) {
    const Planet = await PlanetC.at(planet);
    return await Planet.yield.call({ from });
}


texts: Cannot connect to parity JSONRPC from local machine

texts:
Here is my parity config:

[rpc]
disable = false
port = 8545
interface = "all"
cors = ["*"]
apis = ["web3", "eth", "pubsub", "net", "parity", "parity_pubsub", "traces", "rpc", "shh", "shh_pubsub"]
hosts = ["none"]

[footprint]
tracing="on"
pruning="fast"
pruning_memory=100000

For some reason, my connection is always refused when I try and connect to the RPC API like so:

curl --data '{"method":"trace_replayBlockTransactions","params":["0x2ed119",["trace"]],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST http://localhost:8545

What am I missing here? I thought this would be fairly straightforward...


texts: i am new to this, can someone steal my erc20 token with the Function approve()

texts:
I have been using yield Farming (YFValue) and I noticed when I accept the contract via MetaMask.
I set faming 500 USDT but in the contract the input was:
Function: approve(address _spender, uint256 _value)

MethodID: 0x095ea7b3
[0]:  000000000000000000000000c2d55ce14a8e04aef9b6bcfd105079b63c6a0ac8
[1]:  000000000000000000000000000000000000314dc6448d932ae0a456589c0000

when I decode it via Etherscan it said:
    _value  uint256 999999999999999000000000000000000

My question is: does this mean that _spender can take more the 500 USDT? If not can he repeatedly take 500 USDT every time and how to cancel it?
thank you in advance
The transaction is as follows: https://etherscan.io/tx/0xa10306c12bbb1a3e9c81936879ef919105c4e38262da483943eb9026347e2f75


texts: How do Crowdsale online wallets work without the need of a client?

texts:
Most of the Crowdsale websites have a signup/login page where the user has a wallet and several options of purchasing tokens. Options usually include Bitcoin, Ether and Wire Transfer. No MetaMask or other client is required to interact with the crowdsale website.

My educated guess is that this is a Dapp, not much different that Truffle's MetaCoin example, with an Ethereum Client Docker container hosted on a server to interact with the Crowdsale contract through Web3.js in the server-side. I also guess that they use BTC-Relay to accept Bitcoin. However, I can't wrap my mind around the details.

Please include technical details if you can. Thank you in advance!


texts:
I'm currently testing events that include numeric values:

const level = new BN(1);
truffleAssert.eventEmitted(tx, 'EventName', {level});

As you can see, the level variable is a BN, and holds the correct value, I've already checked that. However two BN objects seem not to be equal when comparing through eventEmitted.

I know I can do it in the following way:

const level = new BN(1);
truffleAssert.eventEmitted(tx, 'EventName', e => e.level.toString() === level.toString());

However this second way is less intuitive, longer to write, harder to maintain and definitely much dirtier.

Do you guys know if there's a workaround to make this work using objects rather than filter functions?


texts: Is there an online database that maps functions with their signature?

texts: I have already seen a site with all the functions of solidity with its signature, but do not remember its url, I'm looking for it.


texts: Tool to find addresses owning a specific set of tokens

texts:
Does a tool (similar to etherscan or nansen) exist to identify addresses, which own a specific set of ERC20 tokens?
I.e. Being able to find an array of addresses owning both the token $rook and $mta.


texts: Running Migrate in Truffle does not work

texts:
I have been using Remix for developing my dapp but decided I should use Truffle to make things a little more robust and professional. I have truffle and ganache installed. I run

truffle migrate

and get the following results:

The Ganache output looks like this:

The migration script looks like:

var Collateral = artifacts.require('Collateral');

module.exports = function(deployer) {
  deployer.deploy(Collateral);
};

This contract is one of many contracts in the file DirectLending.SOL which is stored in the contracts directory.

My understanding of truffle migrate is that so long as the contract file is in the contracts directory, it will be compiled and the contract should be findable by truffle.

I also tried to create a single file collateral.sol with just the Collateral contract in it and that also did not work.

Can anyone please help me?

Thanks!

Phil


texts: not able to assign address to a public property using web3

texts:
while everything is working fine when working on remix ide but on truffle its not updaing value of a property (player2)

i am also returning that address value and its returning as it should be. but not updating in contract;

app.js

joinGame: function() {
    App.contracts.TicTacToe.deployed().then(function(instance) {
        instance.joinGame.call()
        .then(function(res) {
          console.log(res);
          $('#joinBtn').hide();
        });
    });
  },

tictactoe.sol

function joinGame() public payable returns(address) {
     //require(msg.value > 0, 'value should be more than 0');
        require(msg.sender != player1, 'both player cant be same');
        player2 = msg.sender;
        player2Escrow = 100; // need to update this with msg.value;
        return player2;
    }

although i am returning address from which i am calling as player2 (only when calling join function) but stil while fetching player2 value is 0x0

pls help.


texts: How do oracle services work under the hood?

texts:
I have read many questions about oracle services, but I do not understand  how they work.
Often I read answers like this: https://ethereum.stackexchange.com/a/9825/5892

  Smart contract can not access an external environment...

But how do "Oraclize" or "RealityKeys" work, and how can I build My own oracle service on a public blockchain?


texts: Is distribution of an Ethereum blockchain necessary?

texts:
Background
I downloaded the Ethereum wallet client software and when opening, it downloads the entire blockchain of 4 million+ blocks which takes up several GB of storage.
This is fine for me, but might not be fine for other users who I'd like to make use of a private blockchain. They might not have the patience or storage space for this and since I only need for them to use it for certain transactions, they don't need to be a fully-functional node.
Question
Can the blockchain itself be hosted centrally and then just grant client access for making transactions?
Of course, the miners would still be distributed, they would just be adding blocks to a centralized chain.
Thanks in advance.


texts: Transaction works or fails depending on the destination address

texts:
I was trying to make a deal with another user and he sent me this address:
0xb1f4c727afa220eec5d218399eb443662ab2610e
But when I tried to do the transfer I received this error
TypeError: Transaction had invalid fields: {'to': '0xb1f4c727afa220eec5d218399eb443662ab2610e'}

Then I tried with another address and it worked. Then the user sent me a different address and it failed as well
TypeError: Transaction had invalid fields: {'to': '0xd33e044a3b60ab3a1c0b07ffe97a2a7fdf03d3f2'}

All other wallets I have tried to transfer to worked, except the two wallets sent by the user. This is the code for the transaction:
    tx = dict(nonce=w3.eth.getTransactionCount(sourceAddress),
                gasPrice = gasPrice, gas = 21000,
                to = destAddress,
                value=w3.toWei(value,'ether'))
    print("\n", tx, "\n")
    privateKey = input("enter " + sourceName + " private key to confirm: ")
    signed_txn = w3.eth.account.signTransaction(tx,privateKey)
    w3.eth.sendRawTransaction(signed_txn.rawTransaction)

And this are what the transaction look like just before signing them (as printed in the console)
Worked
 {'nonce': 3, 'gasPrice': 42000000000, 'gas': 21000,
'to': '0x2bc6a086303F9F4A785daC94C0FC9a5A5Ada7a9c', 'value': 100000000000000000}

Failed
 {'nonce': 3, 'gasPrice': 10000000000, 'gas': 21000,
'to': '0xb1f4c727afa220eec5d218399eb443662ab2610e', 'value': 139031000000000000}

Failed
{'nonce': 4, 'gasPrice': 43000000000, 'gas': 21000,
'to': '0xd33e044a3b60ab3a1c0b07ffe97a2a7fdf03d3f2', 'value': 139031000000000000}

Worked
 {'nonce': 4, 'gasPrice': 42000000000, 'gas': 21000,
'to': '0x37482CBd05dd0B6557014ec9DFEEB380a522131d', 'value': 150000000000000000}

It could be the way I'm copying and pasting the address from telegram to the console, but the truth is in every case I am hardcoding the addresses in the source code. And, of course, the failing addresses do exist in etherscan.io
I'm really clueless...
Thank you.


texts:
I'm using web3J version 3.0.0-alpha4 and hit following problem. When I sign the same raw message (it's simply string like "TEST" for now) I get different signatures using web3js i web3j. The signature from web3js is valid (and web3j is not), I test it using solidity ecrecover function. It's worth to mention that hashes as you can see in the snippets are the same.

Java snippet:

String privateKey1 = "7196933fe363871920c59be78aa5c478bf6e6271532db5d0ce3b090518f91f03";
Credentials credentials = Credentials.create(privateKey1);
String testString = "\u0019Ethereum Signed Message:\n"+"TEST".length()+"TEST";
Sign.SignatureData signatureData = Sign.signMessage(testString.getBytes(), credentials.getEcKeyPair());
System.out.println("R: "+Numeric.toHexString(signatureData.getR()));
System.out.println("S: "+Numeric.toHexString(signatureData.getS()));
System.out.println("V: "+signatureData.getV());

Java result:

R: 0x9aae2a66c2c4b3d12f36ce26b59024b6deadcb8ac51f4bd14188feaec15b6c2f
S: 0x53037c38b48243e2bb852d7f857ccc2c24c1bb1c1842bb30f0bea555c995a626
V: 28

JS snippet:

hash = web3.sha3('TEST');
sig = web3.eth.sign(web3.eth.accounts[0], hash);
r = "0x"+sig.substr(2,64);
s = "0x"+sig.substr(66,64)
v = parseInt(sig.substr(130,2))+27;

JS result (testRPC 4.1.3 console):

truffle(development)> r
'0x95c8ab63220d912e878d5178f042c7199cade577e39adc00745cf5fdbef0adb0'
truffle(development)> s
'0x61b0bac1eee0cec838e9e7a934df3b6431e0b786ecff772d4ea3b39fc50f9a32'
truffle(development)> v
28

From the Ethereum documentation I started add "\u0019Ethereum Signed Message:\n"+"TEST".length() to the message, but it still didn't resolve the difference.


texts: How can I call TX Timestamp info via Web3.JS

texts: How can I call the timestamp information of the pending tx datas I tried everything I could not.?


texts: all these ICOs tokens offers to finance new startups are under ethereum technology?

texts:
or they start their own blockchain on any new ICO?

If the answer is that they can be both, what are the advantages of every approach?

Thanks in advance


texts: How to accept Bitcoin for Ether based Token ITS? Want to understand easiest way to handle

texts:
We are planning to launch Initial Token Sale for our amazing startup. We are planning to accept Ether and Bitcoin with Ethereum based smart contracts. So, we are just looking forward to have standard way (which is easy for investors) of implementation, that allow us to accept bitcoins as well.

Major challenge with us that with Ether transfer we are immediately showing tokens as balance for Investor's Ethereum Address. Something similar possible with Bitcoins ? If not what is the standard way other startups are following to ease the process, if require we can change our contract conditions accordingly.

Thanks in advance for any help or suggestion.


texts: If I create a filter with the same parameters twice in a row, I get different filter IDs. Is the ID deterministic? If so, how is it generated?


texts: XOR bytes32 (from web3.sha3) in Javascript

texts:
How can I perform bitwise operations with a bytes32 object in Javascript? This might seem like a general Javascript question but since this is quite common practice to obfuscate input values in a smart contract I post it here. I obtain the bytes32 as follows in Javascript:

var v1 = 'blabla';
var v2 = 'bla'
var h1 = web3.sha3(v1);
var h2 = web3.sha3(v2);
var clientHash = h1 | h2;

Unfortunately clientHash is always equal to zero - I assume because h1 and h2 are actually strings (but that remains the same even when casting it to int). In the smart contract (Solidity) I calculate the analog scenario as follows:

function testHash(bytes32 h1, bytes32 h2) constant returns (bytes32 b) {
      b = h1 ^ h2;
    }

Background: For studying purposes I am working on a rock paper scissor game on Ethereum. Of course in a secure game I would obfuscate a users choice, with a second secret random input. The combined hash of both inputs should be calculated on the client and only then sent to the smart contract. When both players have commited their choices, both players send their plaintext to the smart contract and the winner gets the pot. This is my solidity code in detail (the first part of which I would like to move to the client (JS)).


texts: Remix + Ganache - Cannot call one contract from another

texts:
I have an innocent looking contracts that work painlessly in Remix. Test contract can easily call Another if I use JavaScript VM in Remix.

I also have ganache-cli running on port 7454. If I connect Remix to ganache-cli, each of these contracts work well individually. But I cant call Another from Test. Remix console says transact to Test.send errored: VM Exception while processing transaction: revert

My contracts look like:

pragma solidity 0.4.25;

contract Another {
    uint public balance;
    function sendToAnother() public {
        balance += 10;
    }
}

contract Test {
    function send(address another) public {
        Another(another).sendToAnother();
    }
}

One suspicion I have is - am I picking up the address of the Another contract correctly? I am copying it from Remix's Deployed Contracts tab.

Edit: Odd enough, it works well on Ropsten Test Network! Could it have to do something with running out of gas. Unlikely, since remix shows around 100 Ether on the account.

Submitted a Bug to Ganache trufflesuite/ganache-core


texts: How to set the size of a globally available array in the constructor?

texts:
I have an ERC721 contract. In the constructor, X NFTs are minted with X being passed as an argument to the constructor. I need to keep track of various things for each NFT, such as the price. The price would need to be an array of uints with slots equal to x, i.e.

uint[x] public prices;

But I need prices to be available to other functions in the future. If I just define the variable in the constructor, it will not be a global variable. But if I defined it outside the constructor or any other function, I am unable to define the size at a time after contract deployment.

Wat do?


texts: Error: The contract code couldn't be stored, please check your gas amount. Modified truffle.js not solving the problem

texts:
My smart contract could not deploy successfully, it contain 400 line. My truffle.js was configure to

module.exports = {
     // See <http://truffleframework.com/docs/advanced/configuration>
     // to customize your Truffle configuration!
     networks: {
          ganache: {
               host: "localhost",
               port: 7545,
               network_id: "*" // Match any network id
          },
          devops:{
            host:"localhost",
            port:8545,
            network_id:"4224",
            gas: 4700000        }
     }
};

But my smart contract is successful deploy in ganache but when comes to private blockchain it had error.
May i know any limit size of smart contract to allow deploy to private blockchain?? and what is the way to check my size of my smart contract did it exceed the limit??


texts:
All these transactions happened within the single block:

Source: https://etherscan.io/defi?q=0x8a40c222996f9f3431f63bf80244c36822060f12#dextracker
Right now it is still possible to get to the initial transactions, after some time Etherscan will not probably limit to the last 10000 transactions or so.
So here is transaction on top 2000 GWEI: https://etherscan.io/tx/0x62dd2e053fefb5a857a3869391fab0b9ba8f474347bf2b26269138e3fec52292

And here is transaction on the bottom 2000 GWEI too: https://etherscan.io/tx/0x7582b5ac833e80c30baeb2f7e8fd0233c42f978a8b8f319871267e78f4b7032b

Both were mined in the the same block, both had the same gas price. One massively in the profit. One hardly profitable.
What decides about the position in the block?

Gas price?
First to be seen by the miner?
Some other factors?

Bonus question: Is 2000 GWEI some hardcoded number, noticed loads of guys using specifically that amount?


texts: fail for read ethereum node base on leveldb.py

texts:
I installed leveldb base on python3.6.but when I using leveldb.LevelDB import path for files to be read.
a error occered

"leveldb.LevelDBError: Corruption: 3 missing files; e.g.: D:/downloads_by_geth/chain/geth/nodes/000244.sst"

this is my code

db = leveldb.LevelDB('D:/downloads_by_geth/chain/geth/nodes')

this is folder "nodes"

I want know the file of ".sst" where from and how to read file of ".ldb"?

hope someone help me


texts:
Setting up a public variable creates a default getter function, eg
`string[] public MyArray = ["E1", "3", "7"];`

Entering a value outside of the valid values of 0, 1, or 2 returns something like this:
call to setter_ex.MyArray 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.
If I create a getter function I can add a 'requires' for error checking; eg.
`function getElement(uint _element) public view returns(string memory ArrayString){
    require((_element >= 0) && (_element < MyArray.length),"error invalid entry");
    return MyArray[_element];
}`

This returns the desired error message.
call to setter_ex.getElement errored: VM error: revert. revert The transaction has been reverted to the initial state. Reason provided by the contract: "error invalid entry". Debug the transaction to get more information.
Is it possible to do any kind of error checking in conjunction with the default getter to see if the entered value is valid that is similar to the 'requires'?


texts: Do I have to create a MEW wallet to transfer ETH from Metamask to Trezor?

texts: I have a Metamask wallet with ETH in it. I want to move these ETH to my Trezor. It appears that Trezor will only accept ETH via MEW. Do I need to create a MEW wallet and move everything in two steps, first from Metamask to MEW and then from MEW to Trezor?


texts: I am receiving a internal error Json-rpc error

texts: So i recently installed a "custom rpc" on metamask which is gochain, and it has been working fine, recently i tried to do a token swap of wrapped omi and did it wrong by sending omi to the ethereum main net in metamask from the custom gochain wallet in metamask which has the same wallet address. Since then i have been receiving a transaction error "internal json-rpc error" only when i try to send out of the gochain wallet on metamask, any idea on how to solve this issue? Please let me know, i have already reset the wallet multiple times, and also the gas limits and no luck.


texts: Move Parity Wallet Large Blockchain files to another drive (Windows)

texts:
Running Parity filled up my C Drive, as I also had a Myst wallet there as well. I don't remember if the install program asked for the place to store the files.

If I move these files to another drive, how do I reconfigure Parity to tell it where the files are now? I checked the settings tab, and don't see any options. I checked in c:\Program Files\Ethcore\Parity and only see 3 .exe's and an .ico files.

By running WinDirStats (to find out why my disk was full), I found the huge files at c:\users\myname\Local\Parity\Ethereum\chains\ethereum\db (then a few more folders deeper).


texts:
cont from first question

I get this error upon keying geth attach ipc:\.\pipe\geth.ipc.

Fatal: Unable to attach to remote geth: Timed out waiting for pipe '\\.\pipe\geth.ipc' to come available

what exactly is this error and what should I do to attach geth?


texts:
I had some small amount of ether remaining in one of my accounts so I decided to send everything to the DAO. But the contract execution failed with an exception - out of gas. I was trying to investigate why this happened only to find out strange gas cost on the last instruction in this vm trace:

http://etherscan.io/vmtrace?txhash=0x72db0d1d7e3494a94ca410ddbb3b0a9c64ace95bcfdac878f413d651778ba576

Can anyone please help me understand what happened?


texts: window.ethereum.on event listener -- disconnect metamask

texts:
Does anyone have any luck with the window.ethereum.on('disconnect', error => console.log(error)) event listener??
I have tried using it and check to see if window.ethereum is still connected after creating the listener... and yes it is still connected. I want to be able to disconnect my metamask onClick of a button, but i'm not sure I am doing it correctly.
How do I trigger the disconnect event listener?


texts:
I forgot my password and also my private key, but i have my keystore and also the address.
Please help me.


texts: How to check if a transaction has completed correctly or has been rejected by some assert check

texts:
We have developed a simple Smart Contract which offers this following public transaction method:

function bid(uint256 _userCode, uint256 _amount) public {

        assert(_userCode> 0);
        assert(_amount> 0);

        winningBid.userCode= _userCode;
        winningBid.amount= _amount;

        var bidData= Bid(_userCode, _amount);
        bids.push(bidData);
    }

We are sending the transaction using this Nethereum code:

var result = bidFunction.SendTransactionAndWaitForReceiptAsync(address, gas, balance, null, userCode, amount).Result;

The method invocation does not throw any exception, even passing 0 to the userCode that, if you take a look to the Smart Contract, should trigger the assert and stop the method execution.

How could we check if a transaction has completed correctly or has been rejected by some assert check?


texts: for this question, I want to know what's the command line that can combine two strings together, like "string a = string b + string c", but it seems that "+" is not compatible with the smart contract


texts: Geth + Web3 | web3.eth.getAccounts() returns undefined

texts:
I have follow this SO answer for sending ERC20 tokens from 1 address to another. I am running into an issue where I am receiving an error that my from address is invalid

Error: Error: WalletMiddleware - Invalid "from" address.

The from address works just fine when I use the web3 function contract.balanceOf, so I am not sure why it says my address is invalid

Here is my code:

 contract.transfer(
    '0x002FaCf5B2e8441c7ECb4eb6dCfD9C7b46320c97', //toaddress
    web3.toWei(1, "ether"),      //send 1 token
    {
        from:'0xb8fd65fc6919c5b97453eaba6b895144597985b2' //fromaddress
    }, function(err, transactionHash)
    {
        if(!err)
        {
            console.log(transactionHash);
        }
        else
        {
            console.log(err);
        }
    }
);


texts: Ethereum and bullying and possible coersion to delete by third parties

texts:
I am new to Ethereum.

I want to use Ethereum to allow the voice of a number of oppressed groups I have knowledge of to be:

voiced
spread
accessible from anywhere and unhidden
anonymously contributed
made permanent and forever undeletable

I would like to know, given the network technology used to implement Ethereum, if a bullying our financially influential party in the future ordeals that all information be deleted, can they force Ethereum programmers to change the technology so that some stuff is actually permanently deleted? Are there legally opposing constraints?


texts: Ethereum Wallet Contract with two owners can't transfer ETH

texts:
I set second owner for contract with ETH and dailly limit for transfers. I can transfer ETH under this limit. But large quantity transfer (to DAO contract) is not work. One owner (my first account in the wallet) click Send transaction and... nothing.

"After a few minutes at most, a “confirmation pending” transaction should be at the top" Alexandre Van de Sande wrote on www.ethereum.org. But it's not any button appear for second owner confirmation in Mist.
I think I must execute some contract function, mabe "Confirm"? But "h" parameter is not clear for me. I tried to write first transaction hash to this field, I tried some other functions like "remove owner"... but not successfully.

Maybe the problem is both owners in one wallet? My ETH is freezing becuase of this experiment with second owner :) And I don't know what to do.


texts: Can I use my Ethereum accounts on different computers?

texts: I'm used to synchronize my data on different machines. Depending on the data I use Git, Dropbox or Syncthing. Is this possible with Ethereum accounts, too?


texts: Losing ERC20 token without trace on etherscan

texts:
I would like to know if there is a way to take a token from an account without letting a trace on etherscan ?
I recently swapped some ETHs for a Base Protocol token and i got around 2940 BASE in the end, but when i tried to swap them again after a few hours, i only found 2307 on my balance.
Here is a screenshot of the token transactions


texts: Geth IPC endpoint unavailable after upgrading from 1.3.5 to 1.4.10

texts:
This question is somewhat related to this one. Following the suggestion in the comments from this one, I upgraded geth to v1.4.10 and launched it and launched it on a private net:

geth --datadir "data_dir" --mine --minerthreads 3 --networkid 13 --rpcapi eth,web3,personal --rpc --maxpeers 0

which outputs:

I0728 04:00:12.289151 ethdb/database.go:82] Alloted 128MB cache and 1024 file handles to data_dir/chaindata
I0728 04:00:12.397333 ethdb/database.go:169] closed data_dir/chaindata
I0728 04:00:12.414075 ethdb/database.go:82] Alloted 128MB cache and 1024 file handles to data_dir/chaindata
I0728 04:00:12.493681 eth/backend.go:621] upgrading db log bloom bins
I0728 04:00:12.494120 eth/backend.go:629] upgrade completed in 451.405µs
I0728 04:00:12.494465 ethdb/database.go:82] Alloted 16MB cache and 16 file handles to data_dir/dapp
I0728 04:00:12.513689 eth/backend.go:172] Protocol Versions: [63 62], Network Id: 13
I0728 04:00:12.513976 eth/backend.go:201] Blockchain DB Version: 3
I0728 04:00:12.515930 core/blockchain.go:206] Last header: #0 [23812aaa…] TD=256
I0728 04:00:12.516065 core/blockchain.go:207] Last block: #0 [23812aaa…] TD=256
I0728 04:00:12.516132 core/blockchain.go:208] Fast block: #0 [23812aaa…] TD=256
I0728 04:00:12.519883 p2p/server.go:313] Starting Server
I0728 04:00:15.109229 p2p/discover/udp.go:217] Listening, enode://449870522cf99663f642a60e84e191ca30af45c5fa0c6fbb199d8967dd268f7c3c09a8fb42720a84c0bb8a984a31d01b4255f5d56f0c6eb98b498f111c52c7bb@[::]:30303
I0728 04:00:15.111252 eth/backend.go:454] Automatic pregeneration of ethash DAG ON (ethash dir: /home/user/.ethash)
I0728 04:00:15.111370 p2p/server.go:556] Listening on [::]:30303
I0728 04:00:15.112044 eth/backend.go:461] checking DAG (ethash dir: /home/user/.ethash)
I0728 04:00:15.151132 node/node.go:296] IPC endpoint opened: data_dir/geth.ipc
I0728 04:00:15.195940 node/node.go:366] HTTP endpoint opened: http://localhost:8545
I0728 04:00:15.196123 miner/miner.go:119] Starting mining operation (CPU=1 TOT=2)
I0728 04:00:15.197119 miner/worker.go:573] commit new work on block 1 with 0 txs & 0 uncles. Took 863.195µs
I0728 04:00:15.197251 ethash.go:259] Generating DAG for epoch 0 (size 1073739904) (0000000000000000000000000000000000000000000000000000000000000000)
I0728 04:00:17.619117 ethash.go:276] Done generating DAG for epoch 0, it took 2.421872731s
I0728 04:01:27.849348 miner/worker.go:339]   Mined block (#1 / 40857370). Wait 5 blocks for confirmation
I0728 04:01:27.850663 miner/worker.go:573] commit new work on block 2 with 0 txs & 0 uncles. Took 1.087017ms
I0728 04:01:27.851682 miner/worker.go:573] commit new work on block 2 with 0 txs & 0 uncles. Took 805.394µs
I0728 04:01:31.725157 miner/worker.go:339]   Mined block (#2 / 9c48d944). Wait 5 blocks for confirmation
I0728 04:01:31.725710 miner/worker.go:573] commit new work on block 3 with 0 txs & 0 uncles. Took 388.348µs

When I try to connect to the IPC in data_dir/geth.ipc I get the error:

Fatal: Unable to attach to remote geth: invalid endpoint

Connecting to the IPC endpoint is done by running:

geth --ipcpath "data_dir/geth.ipc" attach

How is it possible to connect to the geth IPC endpoint in geth (> 1.4.xx)?


texts:
In my project I'm using a Clone Factory:
https://github.com/optionality/clone-factory/tree/master/contracts

function createClone(address target) external returns (address result) {
    bytes20 targetBytes = bytes20(target);
    assembly {
      let clone := mload(0x40)
      mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
      mstore(add(clone, 0x14), targetBytes)
      mstore(add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
      result := create(0, clone, 0x37)
    }
    addr = result;
}

It works for contracts without constructor or contracts with empty constructors.

Here is a constructor for most of my contracts:

constructor(
    bytes32 pRegistryGroupName,
    bytes32 pRegistryName
)
    internal
{
    m_RegistrableData.registryGroupName = pRegistryGroupName;
    m_RegistrableData.registryName = pRegistryName;
}

When I clone my contract, as expected, the new one doesn't contain group name nor name.

I would like to have it like:

function createClone(address target, bytes32 groupName, bytes32 name)

How can I do that?

Also I'm curious what are these addresses and what they represent, why they look like that:
    0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000
    0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000


texts: Cannot connect to KeyServer for contract deployment from Visual Studio

texts:
I am following the instructions from (https://medium.com/@ConsenSys/solidity-integration-with-visual-studio-8bdab2ff8a74#.k2y18h96h) to use the solidity extension (version 1.1.4.0) through Visual Studio.

I am not able to deploy the sample contract and I get the following error:

  key server not available

  Error Text Below
   Deployment to http://localhost:8000/ started!
   User used for deployment: testuser
   User found: []
   Please check if keyserver is running. If keyserver is running and deploy is failing due to insufficient gas, delete the user folder on key server and a new user will automatically be created

Also, while I was starting the initializing the bloc application using the command bloc init, I did not get the confirmation that the keyserver is listen. After running the block init the command simply moves to the next line without any error or confirmation.

Both the things could be related, but not sure. Help please.


texts: How to get total tether supply on Ethereum from BigQuery dataset

texts:
I've noticed that the numbers for Totaly supply of Tethers seem to diverge on the official Tether transparency page and the Etherscan block explorer, and I want to find a way to get the correct number.

At the time of writing the difference is:

etherscan.io tether token tracker: $3,338,120,254.587539
official tether webpage: $3,278,120,254.58

Obviously just one of this values is correct, so I tried to confirm either value with the following query on the publicly available Big Query ethereum dataset:

SELECT
  sum(cast (value as numeric))
FROM
  `bigquery-public-data`.crypto_ethereum.token_transfers
WHERE
  block_number > 6000000
  AND token_address = '0xdac17f958d2ee523a2206206994597c13d831ec7'
  AND from_address = '0xc6cde7c39eb2f0f0095f41570af89efc2c1ea828'
  AND to_address = '0x5754284f345afc66a98fbb0a0afe71e0f007b949';

Where I assumed that the from_address must be the minting address '0xc6cde7c39eb2f0f0095f41570af89efc2c1ea828' and the to_address must be the tether treasury address '0x5754284f345afc66a98fbb0a0afe71e0f007b949'. Both found on Etherscan.
This query returned $3,180,008,005.642000 which is at the same level of precision as Etherscan token tracker, but is obviously not the same as either of two sources.

Do you know of a way to confirm the total supply of tether using the big query dataset? Perhaps some of my assumptions about minting or treasury addresses are wrong? I'd like to get as close as possible to the correct number, because it would be really interesting to monitor the real supply of tether in the coming months. And we should know the real number.


texts: Which database(s) do the ethereum clients use and why?

texts:
Ethereum clients (such as geth, eth, pyethapp, ethereumj, and ethereumH) download the Ethereum blockchain from their peers and then store a copy of it locally, presumably indexed within some sort of database for efficient lookup and retrieval.  Other uses for databases within the clients may include storage of the state, tracking of peers, etc.

Which databases are used by the respective clients, and for what reasons have they been selected?


texts: testrpc throws when I set a state variable to 0

texts:
Any idea why calling set() on this contract throws base fee exceeds gas limit when executed on testrpc 6.0.3 via Remix IDE?

/* Calling set() works fine on javascriptVM, fails on testrpc/ganache-cli 6.0.3 */
pragma solidity ^0.4.18;

contract Test {

  uint public counter = 1;

  function set() public  {
      counter = 0;
  }

}

See this bug report as well.


texts:
Where can I find a description (preferably a diagram like below) showing the block structure in an Ethereum blockchain?

Credits: Wikipedia


texts: How to get new transaction coming by address in my waller by json rpc

texts:
First !! sorry about english language.

I'm newbies dev for ethereum json rpc.
I'm hard to find and i don't understand how to use json rpc for check new transaction coming by my address.??  (i want to get txid if another address send ETH to me)

Please tutorial step by step for check transaction in my wallet address ??

I'm try to use eth_newFilter, eth_getFilterChanges don't working (i'm don't understand)

example if my ethereum address = 0xc6486939a78021ff30b428b52c12fc5315d84136
how to check coming transaction to this address.


texts:
This is a practical question. I am developing an application in Solidity with Remix. One thing that takes a lot of time is that when I make changes in the code, I then have to compile it in Remix and then copy and paste the ABIs into my Java front-end.

My question is whether there is a way to make that process more automated? Can you link the HTML page to the ABI source to make the process run more smoothly? It is not a major problem but it definitely does slow things down when developing.

Thanks!


texts: Exploring and Analyzing the Ethereum blockchain

texts:
I would like to explore the data inside of the Ethereum blockchain. All transactions and contracts of the Ethereum Blockchain are stored there. So it's an interesting open dataset and I'd like to get some insights out of it. But I am not entirely sure how can I access this data. Inside ~/.ethereum/chaindata (Linux) I can see the files containing the blockchain but unlike the keys they cannot be explored easily. What kind of encoding does it have? What are the best technical tools (like databases) to work with it (in a non-interactive way)?

I don't really think using a website to explore certain transactions or contract code like what you can do on https://www.etherchain.org/ is the best solution. But instead I want to explore the (whole) data first and do a classical exploratory data analysis, so that later I can focus on certain parts I want to explore.

Suggestions about how to work with this data, about its format and how to manipulate it are welcome.


texts: Multiple Array[] along with mapping handling

texts:
This code is running but when the same user makes a bid then the bid is being replaced from the first bid and event is printing twice the same record.

I want that one address make a bid and for his 2nd bid code record both of his bids along with his address.

Please suggest the rectification.

Thanks

My Code for Bidding Contract:

pragma solidity ^0.4.25;

contract bidding {
  address[] private bidderAccts;

  struct bidStruct {
    uint  bid;
  }
  mapping (address => bidStruct) biddersMap;

  event totalAccounts(address, uint );

  function setBidders(address _address , uint _bid)  public {
    bidStruct a = biddersMap[_address];
    a.bid = _bid;
    bidderAccts.push(_address) - 1 ;
  }

  function getBidders(address _address) view public returns(uint) {
    return biddersMap[_address].bid;
  }

  function countBidders() view public returns (uint) {
    return bidderAccts.length;
  }

  function allBidders() public  {
    for (uint i = 0; i < bidderAccts.length; i++) {
      emit totalAccounts(bidderAccts[i],biddersMap[bidderAccts[i]].bid);
    }
  }
}


texts: Where can I get feedback on how to improve my smart contract?

texts:
I built a fairly simple contract lottery that gives 20% of all proceedings to Give Directly, my favorite charity organization. I'd like to have someone who know what (s)he's doing to have a look at my code and help me polish it. Is there a community/slack/forum for that?

Here's the lottery:
https://github.com/CrazybutSolid/ethereum-lottery

Thanks


texts:
i'm working on to the morden testnet and using a nodejs application i wrote (using ethereumjs-util, ethereumjs-tx) i'm trying to push a raw tx on to the testnet.

I've tested GETH "eth.sendRawTransaction" without success, it keeps saying there is no balance or no account installed, even if i'm pushing a raw tx.. there is no point on checking the presence of balance or wallet/account, anyway i installed eth.

I've got an ethereum node backed by "eth", currently synced.
I'm using Geth and ethconsole to interface to the eth process via ipc/rpc.

I'm using my NodeJS app just to sign the TX, than i manually push the raw tx using geth or ethconsole, but the TX is not sent.

> eth.sendRawTransaction('f87a831001888504a817c800830493e09454a25919a915bbaeb58a96679428f80d733af89392313030303030303030303030303030303030801ca0ecd622603d87d290b7440a8a03413d865dd67783e90cde0ef33d3f5752888ffda031adeee357777c7c39f3edb8920c91aec0cced05ad429d8aa4be627604bd820b');

> "0x42fbb8e551be1aaefd6d768d7798467d7978e3d06e0dd3db20f88e5b14387328"

> eth.getTransaction("0x42fbb8e551be1aaefd6d768d7798467d7978e3d06e0dd3db20f88e5b14387328")

> null


texts: "Out of gas" error trying to claim EOS tokens

texts:
I participated in eos token distribution few hours back and got the token too. However not able to claim the allocated token.  Tried three time, it gave error "Warning! Error encountered during contract execution [Out of gas] ", so lost money on gas thrice.Appreciate any help to claim the token. Here are the transaction #
0x6e3d9b211feda395b939297db06b3d12df70e25ced4c0d5212f5cf06bccdf161
0x83934785d7817a7f06f01449728d8c2889e1bb815e690bcfc36d8db16858231f
0xf8f12936029cdebf1604523bd35a56dc965c4c3d1a2e4a913e65b2549b123c57

Thanks


texts: Default account is not reflected in Web3 instance created from injected current provider

texts:
According to the MetaMask docs the recommended way to access the web3 is by creating a new instance of the Web3 class by passing the window.web3.currentProvider, which is injected by the MetaMask extension, to it's constructor:

const Web3 = require('web3');

const web3 = new Web3(window.web3.currentProvider);

However, when instantiated this way, the web3.eth.defaultAccount property is null and when I change accounts in the extension, the current account is not reflected in the Web3 instance.

On contrary, when I use the Web3 instance, which is injected directly, it works perfectly fine. I can access the web3.eth.defaultAccount right away and it's updated dynamically when I change current account in the extension:

const web3 = window.web3;

Why is that and how do I implement the correct integration with MetaMask?

MetaMask version: 3.12.1
web3 version: 0.19.0


texts:
In the interactive JavaScript console of geth, I have added some JS snippets(filters) through the loadScript() command and I need to remove/stop executing those filters. Is there any way to do this without restarting the geth instance?

I have the following filters loaded. None of them contain a watch function:

  A filter to mine only when there are pending transactions.
  A filter to check if a transaction was directed to a specific account and print some details.

Is there a way to identify and start/stop these filters?


texts: Transaction send through metamask with all parameter correct is not included in block in private network.


texts: Issue Deploying Contract LinkedIn Course - Ethereum: Building Blockchain Decentralized Apps (DApps)

texts:
I'm completely new to Ethereum Smart Contracts. I'm following the course on LinkedIn [Ethereum: Building Blockchain Decentralized Apps (DApps)].

I've been able to compile the smart contract as per tutorial but I am unable to Miigrate it to my test server.

I get the following error:

PS C:\Users\xxxx\desktop\contracts> truffle migrate development

Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.

Starting migrations...
======================
> Network name:    'development'
> Network id:      5777
> Block gas limit: 0x6691b7

2_deploy_contracts.js
=====================
Error: SyntaxError: Unexpected token {
    at Object.run (C:\Users\xxxx\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-migrate\index.js:92:1)
    at processTicksAndRejections (internal/process/task_queues.js:89:5)
Truffle v5.0.21 (core: 5.0.21)
Node v12.4.0

I'm running on Windows 10

As instructed on LinkedIn. Truffle config is:

module.exports = {
  networks: {
    development: {
      host: "127.0.0.1",
      port: 9545,
      network_id: "*"
    }
  }
}

And script for deploying the contract is:

var ApprovalContract = artifacts.require("ApprovalContract");

module.exports = funtion(deployer) {
  deployer.deploy(ApprovalContract);
}

Thanks


texts:
I wonder if there is an equivalent to bitcoind's getrawtransaction, i.e., a command to dump a raw transaction in hex format, given its hash id.

I am working preferably in geth.


texts: segmenting random number space in distributed mining

texts:
I always wanted to ask: can random number space be segmented in mining?

Right now, the random numbers everyone generates are from 0 to 1. These numbers are repeated on all 100,000 nodes of Ethereum netowrk and it is a waste of computing resources.

So, can we segment it ? For example, lets say some miners would generate numbers from 0 to 0.001, other miners the next range , from 0.001 to 0.002, and so on...

By segmenting random numbers we would not repeat the same random number on all nodes, and the mining would be much more efficient. The mining pool would be the authority to assign every miner its own random number range.

Why mining pools are not working this way? Because segmenting random number space is a very simple task, but I am not sure if it will work since I don't know how exactly the DAG generation algorithm works.


texts:
I don’t understand how is it possible that every 15 seconds (block time) 2 ETH are created but it takes 62.8 days to mine 1 ETH and 125.6 days to solve 1 block mining solo. Where can I find more information to clarify?
Sorry in advance for the super noob question, didn’t know where else to ask but I got very confused with this info.
Source: www.coinwarz.com/mining/ethereum/calculator


texts: How can I compare the current time (i.e. now) to the time a certain block was mined

texts: I want to compare the time that is currently is (using block.timestamp) to a timestamp of a previous block during which the user received a token. That is I want to compare the time a user would transfer the token to the time that they had previously received the token.


texts: Is it possible to use "Oraclize" on a testnets such as "Ropsten" or "Kovan" or "Rinkeby" or even local blockchain such as "TestRPC"?

texts: Is it possible to use Oraclize on a testnet such as "Ropsten" or "Kovan" or "Rinkeby" or even local blockchain such as "TestRPC" ?


texts: No suitable peers available on main with light client

texts:
I have a Ethereum node running in light mode. When I was developing on Rinkeby, everything was running fine, but as soon as I changed to mainnet, I began to have issues with "no suitable peers available". I'm getting that a lot now.

As far as I understand I need to connect to a full node (peer) to send transactions to the blockchain, but do you guys know any good way to ensure a solid connection to mainnet blockchain?


texts: miner.start() is returning null and mining is not getting started

texts:
I want to develop a dapp and deploy on geth. I have installed geth and mist wallet. Now, when I am starting miner.start(1) to make some ethers for account. It is showing me null and no ether is getting generated. I have geth running on 1 terminal window, Mist wallet opened and geth console running on 2nd terminal window. I am following a tutorial on youtube and in that miner.start(2) returns true and mining starts within no time. Please help how I can generate ether for my private network.

My genesis.json is

{
  "alloc": {
  "0x0000000000000000000000000000000000000001": {"balance": "111111111"},
  "0x0000000000000000000000000000000000000002": {"balance": "222222222"}
  },
  "config": {
        "chainId": 15,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0
    },
  "coinbase"   : "0x0000000000000000000000000000000000000000",
  "difficulty" : "0x20000",
  "extraData"  : "",
  "gasLimit"   : "0x2fefd8",
  "nonce"      : "0x0000000000000042",
  "mixhash"    : "0x0000000000000000000000000000000000000000000000000000000000000000",
  "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
  "timestamp"  : "0x00"
}

Please help in how to solve miner.start() issue.


texts: Is it possible to reissue the same token symbol after ICO?

texts:
newbie's here.
For instance, I'm creating a token with symbol "TEST".
In the contract I'm saying that I can sell only 10000 TESTs. Running an ICO, selling this token. But I've got a mistake in my papers. I'm realizing that I need to sell 10000 TESTs more in order to successfully launch my business. What my options are? Is it possible to save tradable symbol TEST with same bids and asks on the exchange and issure more tokens?


texts: Loading multiple truffle artifacts from a single sol file

texts:
Big picture: How do I get multiple contract instances from a single sol file using truffle-contract?

I have two Contracts in my .sol file  (it's more of a contract factory)

const artifacts = require('../build/contracts/Contract.json');
const contract = require('truffle-contract');
const MyContract = contract(artifacts);

How do create an instance of the 2nd contract using truffle-contract?
when i'm testing in mocha i can do

const SecondContract = artifacts.require("SecondContract");

but for some reason in truffle exec i get

TypeError: artifacts.require is not a function


texts: problem with sending ethers on ropsten network

texts:
I am trying to send ethers from one address to another address on the ropsten network but I get the message "undefined".
Here is my code:
web3.eth.getTransactionCount(account1, (error, txCount) => {
    //build a transaction object
    const txObject = {
        nonce: web3.utils.toHex(txCount),
        to: account2,
        value: web3.utils.toHex(web3.utils.toWei('0.3', 'ether')),
        gasLimit: web3.utils.toHex(21000),
        gasPrice: web3.utils.toHex(web3.utils.toWei('10', 'gwei'))

    }

    //console.log(txObject)

    //sign transaction with private key of sender
    const tx = new Tx(txObject)
    tx.sign(privateKey1)

    //serialize the transaction
    const serializedTransaction = tx.serialize()
    const raw ='0x' + serializedTransaction.toString('hex')

    //broadcast transaction to the network
    web3.eth.sendSignedTransaction(raw, (error, txHash) => {
        console.log(txHash)
    })

})

Thank you for your help
Take care
Pierre


texts: How to sign a simple transfer TX with digitalbitbox python api

texts:
I'm trying to sign a simple transfer transaction using digitalbitbox's python api (see here and code snippet below).

I send the following json to the HW wallet api:

Sending: {"sign":{"data":[{"keypath":"m/1/1/1/0", "hash":"f2243e10c5c4f4ca1ba2f4cac89e5996ede01c101c8f510440a027b5faaf96a7"}]}}

The signed TX hash returned by the HW wallet is:

0653b763d72e0dc39624310f88b1bda611e94611c5f79ad75132d4305f25dc2c3aac17c3c94a519fbc7da3b9c898a7fae26c68d49d13b604ea8a7ceaad0f1da9

However, when pasting this into etherscan I receive the following error:

Error! Unable to broadcast Tx : {"jsonrpc":"2.0","id":1,"error":{"code":-32000,"message":"rlp: expected input list for types.txdata"}}

I was expecting too see some error message like insufficient funds, but it seems like my encoding is wrong.

Does anybody know why this isn't working?

import sys
from dbb_utils import *
import time
import rlp

try:
    password = 'password'
    openHid()

    # Start up options - factory reset; initial password setting
    if 0:
        hid_send_encrypt('{"reset":"__ERASE__"}', password)
        hid_send_plain('{"password":"' + password + '"}')
        sys.exit()

    import ethereum
    from ethereum.transactions import Transaction
    import hashlib

    # Create test TX
    testTx = Transaction(nonce=5, gasprice=24000000000, startgas=21000, to=int("0xfc5d975c3738b1eed1f072d72912bea31f9d1eb1", 16), value=1, data="")
    rawTx = ethereum.utils.encode_hex(ethereum.utils.sha3(rlp.encode(testTx))) #hashlib.sha256(rlp.encode(testTx)).hexdigest()
    message = '{"sign":{"data":[{"keypath":"m/1/1/1/0", "hash": "' + rawTx + '"}]}}'

    # Send a JSON command
    response = hid_send_encrypt(message, password)
    print(response)
    print("*"*40)
    cmd = '{"sign":""}'
    response = hid_send_encrypt(message, password)
    print(response)

except IOError as ex:
    print(ex)
except(KeyboardInterrupt, SystemExit):
    print("Exiting code")

dbb_hid.close()


texts: How many ethereum blocks are mined in a day?End and Startblock specification

texts: there is a function in many ico contracts that allow people to adjust their allow purchase and disable purchase functions according to the current block height, basically a function that opens an ICO and closes it due to block height, but how do the contract deployers know how many blocks are mined everyday? Doesn't this change every week? How do they know to the exact minute when their ICO will end and when it will start?


texts: Sending parameters via the transaction Object

texts:
This works just fine:

myContractObject.doSomething(i, function(err, result) {
    if (err) {
      console.log(err)
    } else {
     doSomethingElse(result)
    }
})

However, this doesn't:

  const params = myContractObject.doSomething.getData(i)
  const transactionObject = {from: account, data: params}
  myContractObject.doSomething(transactionObject, function(err, result) {
    if (err) {
      console.log(err)
    } else {
     doSomethingElse(result)
    }
  })

Here's what params looks like: 0xd1656c170000000000000000000000000000000000000000000000000000000000000000.

And here's what transactionObject looks like: Object { from: "0x518f5defef41e5b9baed8c9fabc392dd5…", data: "0xd1656c170000000000000000000000000…" }

Here's the relevant section of the ABI of the contract:

{
  "constant": true,
  "inputs": [
    {
      "name": "_index",
      "type": "uint256"
    }
  ],
  "name": "doSomething",
  "outputs": [
    {
      "name": "",
      "type": "string"
    }
  ],
  "payable": false,
  "type": "function"
}

Am I misunderstanding the transactionObject? The data: section of sendTransaction is for specifying parameters to the contract method call, right?

I'm trying to set up a transaction handler function for a dApp I'm developing. That function needs to take a variable number of parameters; hence, my attempt at setting up the parameters in a transactionObject. Help!


texts:
I have a question, what if I have a simple contract that has a  public function "give something to this adress" and that will be called from a website

I will put it on-chain but will not verify it nor publish the abi or source code...

So, is there a way someone can decode the bytecode generated for my contract? Is there any way they can generate their own abi? And the last question: Can someone access the abi that I use on my webpage?


texts:
is there any thing connect to whisper(web3.shh) protocol in react-native.
How to connect REACT-NATIVE with whisper ethereum protocol using GETH or any light Client or API


texts: Transaction posted in “internal transactions” how do I add it to my wallet?

texts: I transferred ETH from bitbuy to my ledger without realizing ledger did not support contracts. The transaction is posted on ether scan in internal transactions. I’ve contacted bitbuy and ledger both say they can’t help me. It says it was sent to my wallet successfully but isn’t reflected in the balance is there a way to recover it ? https://etherscan.io/tx/0x9be39b1a0c565625d44c4765a34f4f1c9bf50a3daf044f58dfb7922a1f9856d5


texts: Contract not stored and out of gas in migration at Truffle ganache

texts:
I am facing this issue regularly while trying to migrate bunch of contracts but it get failed because of this issue . I am running over testrpc , i tried lot of recommendations over stack exchange and github issues but all are failed. I tried by increasing gas limit(800000) in truffle.js also but it didn't work.

Full error message -

(node:14587) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: The contract code couldn't be stored, please check your gas amount.
(node:14587) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Environment:
Node v8.0.1
Truffle v4.0.1 (core: 4.0.1)
Solidity v0.4.18 (solc-js)
EthereumJS TestRPC v4.1.3 (ganache-core: 1.1.3)

Can anybody suggest me possible solution of that? Thanks in Advance.


texts:
I am beginner in solidity programming, I am trying to write my first contract. I am trying to store a piece of land (which is array of coordinates) against a person. I am having trouble storing the coordinates, How do I store geolocations in contracts? My data looks like this-

[
 [88.07945251464845,22.74733761475462], //each pair is a point on map
 [88.47633361816406,22.751136986888394],
 [88.4886932373047,22.56738007346293],
 [88.0986785888672,22.484926579266755],
 [88.07945251464845,22.74733761475462]
]

I have created a struct called coordinate -

struct coordinate {
        bytes32 lat;
        bytes32 long;
    }

I have no idea how to store a collection coordinate struct, I am using solidity version ^0.4.0, and the documentation says we can't use array of structs in this version of solidity. Also how do I pass geolocation array to my constructor?


texts: OpenEthereum Freezer (move ancient data to HDD)?

texts: Go Ethereum 1.9 has a nice feature to move ancient data "to the freezer". Does OpenEthereum provide the same feature?


texts: How we store end user details when we create ICO based ethereum DAPP?

texts:
I am new to ethereum blockchain.I want to create ICO based ERC20 token selling DAPP(Decentralized Application). I have created and deployed smart contract on ethereum private blockchain network and public blockchain network.

I want to design front-end so that end user can participate in the token sale.

I have some query regarding this.

I used truffle to create, deploy and test smart contracts. It is a totally decentralized system. So, How I store end user details in database. Which tools or framework used which help I integrate  smart contract(solidity) back-end and fronted(user interface)

Is python web3.py library is successful to integrate ethereum solidity with python django  ?

How I use web3.py library to connect solidity code with python?

It might be a silly question but here I want to understand this concept more deeply.

Please help to clear my above query.

Thanks