texts:
I am using geth version1.6.5...Trying to set up Ropsten using the following command...

 geth --networkid=3 --syncmode=fast --cache=1024 console

It shows the following commands

  INFO [06-15|15:54:39] Starting peer-to-peer node               instance=Geth/v1.6.5-stable-cf87713d/linux-amd64/go1.8.1
  INFO [06-15|15:54:39] Allocated cache and file handles         database=/home/toshiba/.ethereum/geth/chaindata cache=1024 handles=1024
  INFO [06-15|15:54:56] Initialised chain configuration          config="{ChainID: 3 Homestead: 0 DAO: <nil> DAOSupport: false EIP150: 0 EIP155: 10 EIP158: 10 Metropolis: <nil> Engine: unknown}"
  INFO [06-15|15:54:56] Disk storage enabled for ethash caches   dir=/home/toshiba/.ethereum/geth/ethash count=3
  INFO [06-15|15:54:56] Disk storage enabled for ethash DAGs     dir=/home/toshiba/.ethash               count=2
  INFO [06-15|15:54:56] Initialising Ethereum protocol           versions="[63 62]" network=3
 INFO [06-15|15:54:56] Loaded most recent local header          number=1121759 hash=bdf4d6…ebcdec td=747686182747507
 INFO [06-15|15:54:56] Loaded most recent local full block      number=0       hash=419410…ca4a2d td=1048576
 INFO [06-15|15:54:56] Loaded most recent local fast block      number=1121676 hash=80f4d5…3ed841 td=747645006524095
 INFO [06-15|15:54:56] Starting P2P networking
 INFO [06-15|15:54:58] UDP listener up                          self=enode://2fc98df1f0e5f3baaa527c2acd579e3d76772681ccc00f4e479a688d519416e003693db537aa37a2aac7fe22ca781f11c8b95654dc960266262edea3b0a99d42@[::]:30303
 INFO [06-15|15:54:58] RLPx listener up                         self=enode://2fc98df1f0e5f3baaa527c2acd579e3d76772681ccc00f4e479a688d519416e003693db537aa37a2aac7fe22ca781f11c8b95654dc960266262edea3b0a99d42@[::]:30303
INFO [06-15|15:54:58] IPC endpoint opened: /home/toshiba/.ethereum/geth.ipc
Welcome to the Geth JavaScript console!

instance: Geth/v1.6.5-stable-cf87713d/linux-amd64/go1.8.1
coinbase: 0x124e0fc135b5137c113d385487b56da143a9b66e
 at block: 0 (Thu, 01 Jan 1970 05:30:00 IST)
datadir: /home/toshiba/.ethereum
modules: admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

While checking the blocknumber using the command
     eth.blockNumber
 it returns zero..since I haven't downloaded any full block...

I am also using the Mist version 0.8.10..I can verify the blocks downloading in Mist too..

Should I able to test my dapps using this Ropsten setup with Mist?

Does it require full node to run dapps??

I have tried by omitting the syncmode from the command,it automatically diverts to fast mode??
so How can I download full node??

Any suggestions please


texts:
During the installation I've got at the end this:

Last 15 lines from /Users/maksim/Library/Logs/Homebrew/parity/02.multirust:

 Compiling serde v0.7.4
 Compiling itertools v0.4.13
 Compiling bytes v0.3.0
 Compiling winapi-build v0.1.1
 Compiling bloomchain v0.1.0
 error: linking with `cc` failed: exit code: 1 note: "cc" "-m64" "-L"
 "/private/tmp/parity-20160607-9932-1o2o3fo/.brew_home/.multirust/toolchains/stable/lib/rustlib/x86_64-apple-darwin/lib"
 "/private/tmp/parity-20160607-9932-1o2o3fo/target/release/build/heapsize-40dd75c58e1708a9/build_script_build.0.o"
 "-o"
 "/private/tmp/parity-20160607-9932-1o2o3fo/target/release/build/heapsize-40dd75c58e1708a9/build_script_build"
 "-Wl,-dead_strip" "-nodefaultlibs" "-L"
 "/private/tmp/parity-20160607-9932-1o2o3fo/target/release/deps" "-L"
 "/private/tmp/parity-20160607-9932-1o2o3fo/target/release/deps" "-L"
 "/private/tmp/parity-20160607-9932-1o2o3fo/.brew_home/.multirust/toolchains/stable/lib/rustlib/x86_64-apple-darwin/lib"
 "/private/tmp/parity-20160607-9932-1o2o3fo/.brew_home/.multirust/toolchains/stable/lib/rustlib/x86_64-apple-darwin/lib/libstd-d16b8f0e.rlib"
 "/private/tmp/parity-20160607-9932-1o2o3fo/.brew_home/.multirust/toolchains/stable/lib/rustlib/x86_64-apple-darwin/lib/libcollections-d16b8f0e.rlib"
 "/private/tmp/parity-20160607-9932-1o2o3fo/.brew_home/.multirust/toolchains/stable/lib/rustlib/x86_64-apple-darwin/lib/librustc_unicode-d16b8f0e.rlib"
 "/private/tmp/parity-20160607-9932-1o2o3fo/.brew_home/.multirust/toolchains/stable/lib/rustlib/x86_64-apple-darwin/lib/librand-d16b8f0e.rlib"
 "/private/tmp/parity-20160607-9932-1o2o3fo/.brew_home/.multirust/toolchains/stable/lib/rustlib/x86_64-apple-darwin/lib/liballoc-d16b8f0e.rlib"
 "/private/tmp/parity-20160607-9932-1o2o3fo/.brew_home/.multirust/toolchains/stable/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-d16b8f0e.rlib"
 "/private/tmp/parity-20160607-9932-1o2o3fo/.brew_home/.multirust/toolchains/stable/lib/rustlib/x86_64-apple-darwin/lib/liblibc-d16b8f0e.rlib"
 "/private/tmp/parity-20160607-9932-1o2o3fo/.brew_home/.multirust/toolchains/stable/lib/rustlib/x86_64-apple-darwin/lib/libcore-d16b8f0e.rlib"
 "-l" "System" "-l" "pthread" "-l" "c" "-l" "m" "-l" "compiler-rt"

 note: ld: entry point (start) undefined.  Usually in crt1.o for architecture x86_64
 clang: error: linker command failed with exit code 1 (use -v to see invocation)

 error: aborting due to previous error
 Build failed, waiting for other jobs to finish...
 error: Could not compile `heapsize`.

 To learn more, run the command again with --verbose.

Before I do --verbose, may be someone already can see what the problem is?

Thanks from not so much experienced Mac user!

Update: During installation according to @Ellis get the following:

maksims-mbp:parity maksim$ brew update && brew install multirust
Already up-to-date.
Warning: multirust-0.8.0 already installed
maksims-mbp:parity maksim$ multirust default stable
multirust: installing toolchain 'stable'
rustup: gpg not available. signatures will not be verified
rustup: downloading manifest for 'stable'
rustup: command failed: curl -s -f -O https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256
rustup: couldn't download checksum file 'https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256'
rustup: downloading manifest for 'stable'
rustup: command failed: curl -s -f -O https://static.rust-lang.org/dist/channel-rust-stable.sha256
rustup: couldn't download checksum file 'https://static.rust-lang.org/dist/channel-rust-stable.sha256'

Any ideas on how to fix it? Does it have something to do with "not having 'gpg' "?


texts: Hacked Ethereum wallet -- What do do with staked tokens?

texts:
My MetaMask wallet was unfortunately hacked and the hacker drained all of my tokens. I've sent some test tokens back to the wallet to check if the hacker had installed a smart contract to automatically remove any tokens but that doesn't seem to be the case. The test tokens are still there.
I have some tokens staked from that address and I'm very worried that when I unstake them and withdraw them to the compromised address, the hacker will take the tokens. Is there any way to circumvent this? For example, could I implement a whitelist so that the unstaked tokens can only be sent to a pre-approved address?
Thanks for your help.
JK


texts:
I'm following the steps in this link to create a truffle project.
I'm using ganache-cli as the ethereum client.

    rajkumar@rajkumar: Ethereum$ mkdir helloworld
    rajkumar@rajkumar: Ethereum$ cd helloworld/
    rajkumar@rajkumar: helloworld$ sudo truffle init

    ✔ Preparing to download
    ✔ Downloading
    ✔ Cleaning up temporary files
    ✔ Setting up box

    Unbox successful. Sweet!

    Commands:

    Compile:        truffle compile
    Migrate:        truffle migrate
    Test contracts: truffle test

    rajkumar@rajkumar: helloworld$ truffle create contract HelloWorld
    rajkumar@rajkumar: helloworld$ sudo truffle create contract HelloWorld

Then I updated the smart contract with the one in here.

    rajkumar@rajkumar: helloworld$ sudo truffle create migration HelloWorld
    rajkumar@rajkumar: helloworld$ sudo truffle migrate --network development
    [sudo] password for rajkumar:

    Compiling your contracts...
    ===========================
    > Compiling ./contracts/HelloWorld.sol
    > Artifacts written to /home/rajkumar/Coding/Ethereum/helloworld/build/contracts
    > Compiled successfully using:
    - solc: 0.5.8+commit.23d335f2.Emscripten.clang

    Network up to date.
    rajkumar@rajkumar: helloworld$ sudo truffle console
    truffle(development)> let instance = await HelloWorld.deployed()
    Thrown:
    Error: HelloWorld has not been deployed to detected network (network/artifact mismatch)
        at processTicksAndRejections (internal/process/task_queues.js:85:5)
        at Function.deployed (/usr/lib/node_modules/truffle/build/webpack:/packages/truffle-contract/lib/contract/constructorMethods.js:61:1)
        at Object.checkNetworkArtifactMatch (/usr/lib/node_modules/truffle/build/webpack:/packages/truffle-contract/lib/utils.js:256:1)
    truffle(development)>

Why I'm getting above error? How can I fix this?


texts: ECASH transaction to the ECH Token Address on Metamask

texts:
I bought some Ecash from etherdelta and transfered to my Metamask wallet but the token address belongs to ECH that'swhy i did'nt get my fund. Is there any possibility to get my fund back?

Thanks in Advance!


texts: Without a block explorer API, can I programmatically determine if an address has a contract deployed at it (eg using Web3 or call to a node)?

texts: Given an address, from a web application I'm attempting to determine if there's a contract deployed at the address. There are some ways to do this with etherscan or other block explorer APIs, but I'm curious if this is possible directly from a node (perhaps from a node with instrumentation or debugging turned on?)


texts: Remix - Solidity IDE - Gas requirements high

texts:
Compiled an "Auction contract" and got a warning regarding high gas requirements. Means: cannot run it. Below the lines with comments and that lines I included (//Part 1 Task n Line n).

// CANNOT BE EXECUTED !!! GAS REQUIREMENTS HIGH
function bid(uint _itemId, uint _count) public payable{
    //Part 1 Task 4. Implement the three conditions below.
    //   4.1 If the number of tokens remaining with the bidder is < count of tokens bid, revert
    //   4.2 If there are no tokens remaining with the bidder, revert.
    //   4.3 If the id of the item for which bid is placed, is greater than 2, revert.
    //   Hint: "tokenDetails[msg.sender].remainingTokens" gives the details of the number of tokens remaining with the bidder.
    if (tokenDetails[msg.sender].remainingTokens < _count) return; //Part 1 Task 4 – line 1
    if (_itemId > 2) return;                                       //Part 1 Task 4 – line 2

    //Part 1 Task 5. Decrement the remainingTokens by the number of tokens bid
    //   Hint. "tokenDetails[msg.sender].remainingTokens" should be decremented by "_count".
    (tokenDetails[msg.sender].remainingTokens - _count);           //Part 1 Task 5 – 1 line

    bidders[tokenDetails[msg.sender].personId].remainingTokens= tokenDetails[msg.sender].remainingTokens; //updating the same balance in bidders map.
    Item storage bidItem = items[_itemId];
    for(uint i=0; i<_count;i++) {
        bidItem.itemTokens.push(tokenDetails[msg.sender].personId);
    }
}

Anybody who can help?


texts: Is there any dynamic symbolic execution tool for smart contract

texts:
There is a question (Security analysis tool for Ethereum smart contracts) similar to me, but it presents mostly static analysis tools. I'd like to know if there is any better dynamical analysis tool suitable my application.
Concretely, i wonder if there is any tool can be used to generate  path constrains  from entry point to exploit point and the exploit point is known. Or is there any  open project worth learning?
Please give some suggestions, thanks!


texts: How does token exchange buy and sell ERC20 tokens technically?

texts:
I am new and self studying how ERC20 token and smart contract works.  After reading through some documents and blogs about creating token and ICO smart contracts.  I have questions about how people buy and sell ERC20 tokens through token exchange after successful ICO.

In order to list the token on exchange for trade, I think the token owner must provide token address.  What functions must be included in the token contract?  I am curious how token exchange validate if token contract works with their buy/sell process?

Thanks.


texts: How to work with MythX in a Truffle project to analyze a contract?

texts:
I work with Truffle and Windows Powershell. I have a smart contract. Now, I want to analyze the contract's security with Mythx. For that, I installed pip3 to install MythX CLI after that. Now, I have it. Also, I have a MythX free account to product API key and view the analysis. But, I don't know what command i should give to Powershell to begin the analysis. I read document MythX suggests that. According to that, I enter the followed command after contract migration in Powershell when i am in my project directory (Suppose my contract name is myContract):
mythx analyze --include myContract.sol

But the below message emerges:
INFO: Could not find files for the given pattern(s).

Did i enter the related and right command? How should i work with MythX to analyze myContract?


texts: Eris Solidity Tutorial: How to set the bank?

texts:
In the Eris Solidity tutorial, a system of a Bank and a FundManager contract are developed. In the fund manager constructor

contract Bank {
    [Bank contract details]

    function setOwner(address newOwner) returns (bool res) {
        if (owner != 0x0 && msg.sender != owner){
            return false;
        }
        owner = newOwner;
        return true;
    }
}

contract FundManager {

    address bank;

    // Constructor
    function FundManager(){
        owner = msg.sender;
        bank = new Bank();
        Bank(bank).setOwner(address(this));
    }
}

one sets a reference to a Bank.
When I deploy the contract and mine it in a private net and then check for the bank reference of the FundManager, no reference is found (so I can't deposit, because depositing requires a bank to be set).

Here's how I deploy:

var fm_arg = "fm";
var fm = contract_fm.new(fm_arg,
                    {
                         from: eth.accounts[0],
                         data: compiled_fm.FundManager.code,
                         gas: 1000000
                    }, callback);

I would think, I should now be able to call the bank variable:

> fm.bank
undefined

Why is the bank not set when I construct the FundManager?


texts:
While trying to extract key from keystore file using password, using the library keythereum, I'm getting the error:

aes-128-ctr is not available

I'm using web3 version ^0.19.1.

Ref: https://github.com/ethereumjs/keythereum/issues/73


texts: How do you launch a custom develop blockchain in truffle?

texts:
I am using truffle 5.0.30 and I want to create a development blockchain where I can run and test my contracts. This is the truffle-config.js that I am using:

module.exports = {
  networks: {
    mynet: {
      host: "127.0.0.1",     // Localhost (default: none)
      port: 8547,            // Standard Ethereum port (default: none)
      network_id: "*",       // Any network (default: none)
      gas: 8700000,
      gasLimit: 8900000
    }
  },

  mocha: {
    // timeout: 100000
  },

  // Configure your compilers
  compilers: {
    solc: {
       //version: "0.6.4",    // Fetch exact version from solc-bin (default: truffle's version)
      // docker: true,        // Use "0.5.1" you've installed locally with docker (default: false)
       settings: {          // See the solidity docs for advice about optimization and evmVersion
        optimizer: {
          enabled: true,
          runs: 100
        },
        //evmVersion: "byzantium"
       }
    }
  }
}

When I start the network with the command truffle develop --network mynet I get this output:

Warning: possible unsupported (undocumented in help) command line option: --network
Connected to existing Truffle Develop session at http://127.0.0.1:9545/
truffle(mynet)>

Which indicates that it has created a blockchain with default values instead of using the ones specified in the mynet configuration. How can I force truffle to use the settings in mynet?


texts:
Why are the Rinkeby and Ropsten testnets named after Swedish locations?

I know what they are but am wondering why they were named this way.


texts: How can an ethereum node read a contract call arguments?

texts:
I'm playing around with ethereum and I know that any data sent to a node must be processed by all nodes in the network.

When I look into my geth terminal I don't see any of that data. Is there a way to view this? Specifically I was wondering about looking at the values passed to a public function when it is called


texts: web3.py equivalent to geth console command eth.pendingTransactions

texts:
I'm currently running a geth server and use the geth console for sysadmin stuff, while using web3.py for interfacing with geth programmatically. From the geth console, there is a handy command eth.pendingTransactions that shows all the pending transactions local to my geth server.

A Google search for a similar web3.py command yields some info on Github regarding web3.txpool

Unfortunately, this shows all pending PUBLIC transactions that will be included in the next mainnet block. What I want to see, however, are transactions that are only local to my geth node.

For this use case do I have to code something up myself, or is there a good method I can use?


texts: Function.SendTransactionAsync() What value to pass to the param "value"?

texts:
I am running a private blockchain node using geth as a client and nethereum to interface to a .net application.

In order to mine a function call I am currently using the function Function.SendTransactionAsync() like below:

var transactionHash = await newFunction.SendTransactionAsync(senderAddress, new HexBigInteger(700000), new HexBigInteger(1), parameter1, parameter2, parameter2);

The first HexBigInteger(700000) signifies the gas.
What does the second HexBigInt refer to and how do I determine what value I should pass to it ?


texts: solidity ..which hashing algorithm to use?

texts:
I have tried using many hashing algorithms but there output in solidity doesn't match with the one given in online converters.

Here is my program:-
pragma solidity ^0.4.18;
contract C {
bytes32 public temp;
function hashingsha3 (uint s)   {
temp= sha3(s);
}

    function hashingsha256 (uint s) {
        temp= sha256(s);
    }
     function kec (uint s)   returns  (bytes32 hash){
        temp= keccak256(s);
    }

}

this is the online site to convert

I have read solidity doesn't use the current keccak256 approved by NIST.
But then what does it use that matches any online output?
Any help would be useful.

List of outputs :
Solidity
sha3(12)
0xdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c7

sha256(12)
0xa82872b96246dac512ddf0515f5da862a92ecebebcb92537b6e3e73199694c45

keccak256(12)
0xdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c7

online converter
SHA256(12)
6b51d431df5d7f141cbececcf79edf3dd861c3b4069f0b11661a3eefacbba918

SHA512/256 (12)
d0d0b58b8cad7a27781cb78b3212d8abce1a4eb4192882e703f7f2e1ea5158da

SHA3-256(12)
1a9a118cb653759c3fcb3bd5060e6f9910c8c27008dd11fe4315f4635c9caa98

SHA3-512 (12)
f235c129089233ce3c9c85f1d1554b9cb21952b27e0765bcbcf75d550dd4d2874e546889da5c44db9c066e05e268f4742d672889ff62fb9cb18a3d1b57f00658

Keccak-256 (12)
7f8b6b088b6d74c2852fc86c796dca07b44eed6fb3daf5e6b59f7c364db14528

Thankyou

EDITED:

pragma solidity ^0.4.18;
contract C {
bytes32 public temp;
function hashingsha3 (bytes s)   {
temp= sha3(s);
}
function hashingsha256 (bytes s) {
temp= sha256(s);
}
function kec (bytes s)  {
temp= keccak256(s);
}
}

I changed the code :
but still the outputs now for this are:
Passed as a string in solidity:
sha256(12)
0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

sha3(12)
0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470

keccak256(12)
0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470

enter image description here


texts: Life cycle of ERC-20 token: how to modify token in the future

texts: I am wondering how the life cycle of a ERC20 token operates.  Say at stage 1 an ERC20 token 'anytoken' is created along with a proposed road map of desired future development for 'anytoken'.  After some further development, at stage 2 'anytoken' modifications have been made and are ready for release.  How technically can the new modified smart contract code for 'anytoken' replace the existing one without issuing 'anytoken1'.  Or is the typical method to issue a new token, 'anytoken1' and allow users to convert?


texts: Error encountered bailing. network state unknown. TypeError: contract.detectNetwork is no a fnction

texts:
I used "Zeppelin-solidity" to publish the ERC 721 token and compiled the sample code with truffle. However When migrating with "truffle", the following error occurs. Why?

    Error encountered, bailing. Network state unknown. Review successful transactions manually.
    TypeError: contract.detectNetwork is not a function
    　　at C:\Program Files (x86)\Nodist\bin\node_modules\truffle\build\webpack:\~\truffle-deployer\src\actions\deploy.js:6:1
    　　at C:\Program Files (x86)\Nodist\bin\node_modules\truffle\build\webpack:\~\truffle-deployer\src\deferredchain.js:20:1
    　　at

I am using truffle v4.1.7 solidity v0.4.23

Thanking you in advance


texts: Sending ether from one contract to another, with a parameter

texts:
Similar code to this works in other contracts, but not this one. I'm getting a gas error: "errored: Error: gas required exceeds allowance or always failing transaction".

I've narrowed it down to the line causing the problem. What is wrong with this call, and is there any way to get a more descriptive error?

contract GuessTheRandomNumberChallenge {
    uint8 answer;

    function GuessTheRandomNumberChallenge() public payable {
        require(msg.value == 1 ether);
    }

    function guess(uint8 n) public payable {
        require(msg.value == 1 ether);

        //do stuff
    }
}

GuessTheRandomNumberChallenge public handle;

constructor() public payable {
    handle = GuessTheRandomNumberChallenge(0x123123mycontractaddress);
}

function check() public {
    handle.guess.value(1 ether)(83); //PROBLEM LINE
}


texts: Mining - One card gets a lot of incorrect shares even with stock BIOS

texts:
Just picked up a Sapphire Nitro+ 580 4GB, and after BIOS modding it was kicking out incorrect shares constantly.  I went back to the stock BIOS and with a modest memory overclock it's still getting one every 5 minutes or so while also getting some accepted shares.

It's got Hynix memory and 78% ASIC quality.  The rig is three 480s, a 570, and this 580 mining on nanopool, and it's very stable.  None of the other cards get incorrect shares that I've ever seen.

Is this card simply a lemon?


texts:
I'm using a contract as a template, of sorts, such that it is not deployed immediately with the rest of my contracts, but may be instantiated (multiple times) by a "contract factory," call it the Manager. So, for example, some contract or user calls a function Manager.createNewContract(data), which then creates a new Contract and saves its address in an array for further use....like this:

contract C { ... }

contract Manager {
    address[] contracts;

    constructor() { ... }

    function createNewContract(...) {
        C c = new C(...);
        contracts.push(address(c));
    }
}

Now, I'd like to impose the restriction that only the Manager may create a new C, and that C should throw if any other address attempts to instantiate, like the onlyOwner modifier from the Ownable contract (open-zeppelin). Is there any way to do this? I'm thinking something like a permissions contract that is inherited by C, but then each C gets its own copy so there's no central governing system. If anything needs to be clarified, let me know.


texts:
Running a private net and the logs are fine:

I0617 09:25:22.463133 node/node.go:298] IPC endpoint opened: /home/roland/privethnet/geth.ipc

but attaching does not work:

geth --ipcpath ~/privethnet/geth.ipc attach
Fatal: Unable to attach to geth: dial unix /home/roland/.ethereum/geth.ipc: connect: no such file or directory

What could be wrong?


texts: Why does the wallet contract convert addresses to integers?

texts:
In the multiowned part of the wallet contract, owners are stored in a uint array, such as in line 59 in the constructor. Here is a relevant excerpt:

contract multiowned {

  // METHODS

  function multiowned(address[] _owners, uint _required) {
    m_numOwners = _owners.length + 1;
    m_owners[1] = uint(msg.sender);
    m_ownerIndex[uint(msg.sender)] = 1;
    for (uint i = 0; i < _owners.length; ++i)
    {
      m_owners[2 + i] = uint(_owners[i]);
      m_ownerIndex[uint(_owners[i])] = 2 + i;
    }
    m_required = _required;
  }

  // FIELDS

  uint[256] m_owners;
  mapping(uint => uint) m_ownerIndex;
  // why not address[] m_owners and mapping(address => uint) m_ownerIndex ?
}

Why not store them in address-type variables? Is there a special reason for this? Does it make the storage lighter?

Thanks,


texts: Does ETH store a block tree (all connecting blocks) or only active chain?

texts: Specifically I am interested in core-geth repository. Does it store a Block Tree (thus on single height it may store multiple blocks), or it stores only single (active) Chain (thus, on single height it may store single block)?


texts:
Need help please- there is no "create" button on the remix- why? look at the attached image.
what should i do, to get the "create"

Thanks a lot for your support


texts: Listing NFT on OpenSea via JS API: Failed to extract transfer calldata Error 400

texts:
I am trying to use the OpenSea JavaScript API in order to list NFTs for sale automatically. I can't seem to figure out why I keep getting the error Error: API Error 400: ['Failed to extract transfer calldata']. Perhaps I have not entered some data correctly? My code is adapted from this example.
SOURCE
const opensea = require("opensea-js");
const OpenSeaPort = opensea.OpenSeaPort;
const Network = opensea.Network;
const MnemonicWalletSubprovider = require("@0x/subproviders")
  .MnemonicWalletSubprovider;
const RPCSubprovider = require("web3-provider-engine/subproviders/rpc");
const Web3ProviderEngine = require("web3-provider-engine");

const MNEMONIC = "SECRET ...";
const NODE_API_KEY = "FROM INFURA";
const isInfura = true;
//const FACTORY_CONTRACT_ADDRESS = process.env.FACTORY_CONTRACT_ADDRESS;
const NFT_CONTRACT_ADDRESS = "0x495f947276749Ce646f68AC8c248420045cb7b5e";
const OWNER_ADDRESS = "0x3eb8eea9565418281f4cae934dd69e7ff2bb5949";
const NETWORK = "mainnet";
const API_KEY = process.env.API_KEY || ""; // API key is optional but useful if you're doing a high volume of requests.

const BASE_DERIVATION_PATH = `44'/60'/0'/0`;

const mnemonicWalletSubprovider = new MnemonicWalletSubprovider({
  mnemonic: MNEMONIC,
  baseDerivationPath: BASE_DERIVATION_PATH,
});
const network =
  NETWORK === "mainnet" || NETWORK === "live" ? "mainnet" : "rinkeby";
const infuraRpcSubprovider = new RPCSubprovider({
  rpcUrl: isInfura
    ? "https://" + network + ".infura.io/v3/" + NODE_API_KEY
    : "https://eth-" + network + ".alchemyapi.io/v2/" + NODE_API_KEY,
});

const providerEngine = new Web3ProviderEngine();
providerEngine.addProvider(mnemonicWalletSubprovider);
providerEngine.addProvider(infuraRpcSubprovider);
providerEngine.start();

const seaport = new OpenSeaPort(
  providerEngine,
  {
    networkName:
      NETWORK === "mainnet" || NETWORK === "live"
        ? Network.Main
        : Network.Rinkeby,
    apiKey: API_KEY,
  },
  (arg) => console.log(arg)
);

exports.helloWorld = async (req, res) => {
  // Example: simple fixed-price sale of an item owned by a user.
  console.log("Auctioning an item for a fixed price...");

  try {
    const fixedPriceSellOrder = await seaport.createSellOrder({
      asset: {
        tokenId: "28370143653034713195993216915191765879963367987017833025925208213530804748289",
        tokenAddress: NFT_CONTRACT_ADDRESS,
      },
      startAmount: 0.1,
      expirationTime: 0,
      accountAddress: OWNER_ADDRESS,
    });
    console.log(
      `Successfully created a fixed-price sell order! ${fixedPriceSellOrder.asset.openseaLink}\n`
    );
  }
  catch (error) {
    console.log("ERROR",error);
  }

};

FULL LOGS

WHERE I GOT DATA

ASSET URL


texts: Add Custom Network(BNB) in Meta Mask Using web3

texts: I am trying to add Binance Main and test net Network through web3 js. I don't want that user to setup it manually. Did you guys any idea about that how to handle it?


texts:
I read with interest the status of the light client protocol.

However, I do not see addressed anywhere I can find how to implement a system where I don't have to trust any one single node such as a light client.  My assumption is, given enough money at stake, that any single node could be hacked and lie to its RPC clients that transactions have been mined, when in fact they have not.  In fact it could proxy through just the ether to its own addresses on the real blockchain, if sophisticated enough.

I thought I could use JSON-RPC to talk to a random sample of validation nodes in the network, but my understanding is JSON-RPC is not considered secure and the JSON-RPC ports aren't open to anyone who wishes to talk to a node.

So it sounds like I have to fire up my own set of distributed nodes (probably just light client nodes) if I want to avoid trusting any single node.  I can then verify that a transaction has mined and enough time has blocks have been mined without uncles to be confident the transaction is widely accepted.

The current development of the light client is with go-ethereum (geth).   Will that build of geth have JSON-RPC built into it?

Am I missing something here?  How do I avoid trusting any one single node?  Does this require setting up my own redundant system of validation nodes?

My eventual goal is to verify the system is trustworthy, automatically, from a nodejs implementation.  As little human intervention as possible.


texts: Error: The contract code couldn't be stored, please check your gas amount or exceed gas limit

texts:
I keep getting the error please check your gas amount or exceed gas limit.

The truffle config file

module.exports = {
    networks: {
        development: {
            host: 'localhost',
            port: 8545,
            network_id: '*', // Match any network id,
            gas: 4712388,
            gasPrice: 65000000000,
        },
        solc: {
            optimizer: {
                enabled: true,
                runs: 200,
            },
        },
    },
};

Error displaying on console while migrating - truffle migrate and I am running in ganache-cli client and even truffle develop throws the same error

Using network 'development'.

Running migration: 1_initial_migration.js
  Replacing Migrations...
  ... 0x3d291bb6431ee53a9fa794b750c39cd08939a4136b69f228287b26326f261990
  Migrations: 0xa936288081412d5f6dbfbb7e8c15526c3a51b47b
Saving successful migration to network...
  ... 0x124e61a2327c00a9cc478c81f169fdd2568bf38eeb5dba4deb8677ddbf324744
Saving artifacts...
Running migration: 2_application_migration.js
  Deploying Applications...
  ... 0x40e181355f93e1b0fb6e99137d5a87160b5c6b22061b9703718708918d6d8184
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: The contract code couldn't be stored, please check your gas amount.
    at Object.callback (/Users/ajainvivek/.nvm/versions/node/v8.9.4/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/contract.js:147:1)
    at /Users/ajainvivek/.nvm/versions/node/v8.9.4/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/method.js:142:1
    at /Users/ajainvivek/.nvm/versions/node/v8.9.4/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/requestmanager.js:89:1
    at /Users/ajainvivek/.nvm/versions/node/v8.9.4/lib/node_modules/truffle/build/webpack:/~/truffle-migrate/index.js:225:1
    at /Users/ajainvivek/.nvm/versions/node/v8.9.4/lib/node_modules/truffle/build/webpack:/~/truffle-provider/wrapper.js:134:1
    at XMLHttpRequest.request.onreadystatechange (/Users/ajainvivek/.nvm/versions/node/v8.9.4/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/httpprovider.js:128:1)
    at XMLHttpRequestEventTarget.dispatchEvent (/Users/ajainvivek/.nvm/versions/node/v8.9.4/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:64:1)
    at XMLHttpRequest._setReadyState (/Users/ajainvivek/.nvm/versions/node/v8.9.4/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:354:1)
    at XMLHttpRequest._onHttpResponseEnd (/Users/ajainvivek/.nvm/versions/node/v8.9.4/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:509:1)
    at IncomingMessage.<anonymous> (/Users/ajainvivek/.nvm/versions/node/v8.9.4/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:469:1)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1055:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

Can someone please help here. Its terribly annoying.


texts: Adding proxy behind enode geth ethereum private network(Failed RLPx handshake)

texts:
I am trying to configure ngnix proxy behind geth. I have assinged a dns name to proxy. If I call xyz.com--it will internally redirect to IP:8000(in which JSON RPC is running) This part is working fine. Another DNS is abc.com---which will point to IP:30301(which is the enode discovery port TCP). While adding this peer through the proxy URL its not adding. I am getting the following error. What am I missing? Is my approach correct?

TRACE[09-04|05:32:21.135] Starting p2p dial                        id=61adbcb1d3a8ec9e ip=3.236.107.224 flag=staticdial
INFO [09-04|05:32:21.135] Looking for peers                        peercount=0 tried=1 static=1
TRACE[09-04|05:32:21.137] Failed RLPx handshake                    addr=3.236.107.224:80 conn=staticdial         err="unexpected EOF"


texts: How to setup constantinople fork for private ethereum chain

texts:
I am trying to add the constantinople fork to my private net with is running on geth. I have updated to latest geth, geth 1.8.23.

I have stopped my current geth node running and have chnged the genesis file by adding constantinople block as below in config file

  "config": {
          "chainId": 56312,
          "homesteadBlock": 0,
          "eip155Block": 0,
          "eip158Block": 0,     "constantinopleBlock": 16275,     "byzantiumBlock": 0
      }

However, when I try to init the geth with new config, O am getting below error

Fatal: Failed to write genesis block: mismatching Constantinople fork block in database (have <nil>, want 16275, rewindto 16274)

Could someone help me to add constantinople fork to my private net.


texts: javascript local sign and sendRawTransaction to remote node

texts:
In order to use Web3 provided by MyEtherAPI, I need to locally sign a transaction, since myetherapi supports only eth_sendRawTransaction.

I found a good source to do so on github, unfortunately it is inactive since 2 years ago. Any idea if there is an active project serving the same purpose?


texts: Need to access/send to Ethereum wallet on web page

texts:
I'm looking for a good, simple, effective PHP toolkit to access Ethereum wallets. I am designing a page where participants can contribute Ethereum towards a final goal. I want the page to not just say "Donations come to this address:" but to be more interactive, i.e. "At this point, X ETH has been donated to the project, of which Y ETH remains unspent. The rest is spent in the following breakdown: " followed by a manually generated breakdown of withdraws and for what purpose.
That's the best way to do this?
Thanks!


texts: Approving tokens from original contract, how would you do it?

texts:
I need to create a general approval for a transferFrom function for an exchange or general contract if you will. I've tried many ways in solidity to reference the old contract, including using tx.origin to try and get metamask to recognize what I'm doing. While metamask does recognize the interaction with the original contract, it fails to see what token I'm trying to transfer.

interface tokenToTransfer {
    function approve(address spender, uint256 value) external;
}

contract Exchange {
    tokenToTransfer public transferToken;

function approve(address tokenAddress, uint256 approvedeposit) public returns (bool) {
        transferToken = tokenToTransfer(tx.origin);
        transferToken.approve(address(this), approvedeposit);
}

So I've gone with a web3 option by loading the contract abi, but this is impractical since I have to load it via etherscan api.

await yourcontract.methods.approve("contractabi", 1000000).send({from: accounts[0]});

Is there a better way? Am I missing something? Or is the only way to call an approve function only through the native contract due to the restrictions placed by solidity on contract development?


texts: Received DeclarationError when calling other contracts file name and its function

texts:
So I created 2 contracts where the first one will be the app logic contract and the other one is the database contract. So I tried to "truffle compile" my contract but receive DeclarationError.
here is the sample code of my modifier function
modifier requireRegisteredAirlines()
{
    require(flightSuretyData.checkAirlineRegistered(msg.sender) == true, "Caller is not registered Airline");                                       //calling the registered airline from data contract
    _;
}

So the flightSuretyData is my database smart contract in the same folder. and the checkAirlineRegistered is the function in that contract.  down here is the error I received

Did I leave anything?


texts:
I am trying  to make an hd wallet based on nodejs. So to have a secure wallet I have created wallet in my offline machine

const hdkey = require('ethereumjs-wallet/hdkey');
const bip39 = require('bip39');
var seed = bip39.mnemonicToSeed('my_mnemonic', 'my_password');
var chain = hdkey.fromMasterSeed(seed);
var xpub = chain.publicExtendedKey();
var xpriv = chain.privateExtendedKey();

Than using xpub I am generating addresses for users.

const wallet = require('ethereumjs-wallet');
const hdkey = require('ethereumjs-wallet/hdkey');
const _____ = require('dotenv').config();

const generate = async (index) => {

    const xpub = process.env.ETH_XPUB;

    const hdk = hdkey.fromExtendedKey(xpub);

    index = index || 0;

    const child = hdk.deriveChild(index);
    const w = wallet.fromExtendedPublicKey(child.publicExtendedKey());

    return w.getAddressString();
};
generate().then(v => {
    console.log(v);
}).catch(error => {
    console.log(error);
});

Ok, now I want to send coins from these addreses to my own address using extended private key - xpriv

const ethTx = require('ethereumjs-tx');
const Web3 = require('web3');

const web3 = new Web3(
    new Web3.providers.HttpProvider('http://localhost:8545')
);

//Verify connection is successful
web3.eth.net.isListening()
    .then(() => console.log('is connected'))
    .catch(e => console.log('Wow. Something went wrong'));

const params = {
    nonce: 0,
    to: '0x4584158529818ef77D1142bEeb0b6648BD8eDb2f',
    value: '0.1',
    gasPrice: 5000000000,
    gasLimit: 21000,
    chainId: 3
};
const privKey = new Buffer('xprv9s21ZrQH143K36eJpjZxNPYbNjzzUMvqLSG6P6Sex1unL8meREsNkcMNRw4ntv3WjJ2tJJX3CrdxkCJdyo7zLnjqdFppov2BAvY4iXYuMCY','base64');
const tx = new ethTx(params);

//Signing the transaction with the correct private key
tx.sign(privKey); //ERROR HERE

const serializedTx = tx.serialize();
Web3.eth.sendSignedTransaction(
    `0x${serializedTx.toString('hex')}`,
    (error, result) => {
        if (error) { console.log(`Error: ${error}`); }
        else { console.log(`Result: ${result}`); }
    }
);

When trying to sign I am getting an error that the private key is invalid. Waht private key I need to use to sign transactions.


texts: I would like to know if the mauve paper is still actual or it is better to rely on the sharding FAQ and Proof of stake FAQ or on other sources?


texts: Trouble deploying Ethereum contract to live network (Truffle)

texts:
When trying to deploy to the Ethereum main net I am getting the error:

  Deploying Migrations...
  ... undefined

  Error encountered, bailing.
  Network state unknown. Review successful transactions manually.

  Error:
  insufficient funds for gas * price + value

However, I am able to deploy it to Rinkeby fine and definitely have enough funds.

I am running my ethereum node on an AWS EC2 instance and then I ssh into that instance to try to compile and deploy.

My truffle.js:

live: {
      host: "localhost",
      port: 8545,
      network_id: 1,
      gas: 4700000,
      gasLimit: 2000000000,
      from: "ACCOUNT_NUMBER"
    }


texts: I want to deploy my IERC20 Contract and I need few questions

texts:
If the contract is using IERC20 can I deploy it on BSC? If yes, should I do something else or simply deploy it via Remix?

When I want to deploy my contract I see those options here. What should I choose?

What should I do in order to have those 2 addresses on the "holders" section on BSCscan after I deploy the contract

How do I renounce to ownership? Do I only need to sell all of my coins in order to do this?


texts: The question is about the node, is the node functionality enough in fast synchronization for the functioning of a centralized exchange? Or is it necessary to download a node in full synchronization?


texts: How can I find out what had been sent in the Hex Data?

texts:
I am using MetaMask to send a token from one account to another.

In two different transactions, one with Optional Hex data and the other one doesn't has.

When I got geth and use the follow commands:

eth.getTransactionReceipt(<tx hash>)
eth.getTransaction(<tx hash>)
eth.getBlock(<block no>)

They all looks identical in length. I am wondering where does the additional hex data had gone to?


texts: Transaction Hash after deploying contract with Web3.py too long

texts:
I managed to successfully deploy a contract using Web3.py to the Ethereum Ropsten network using this bit of code

def deploy(self):
    instance = self.w3.eth.contract(abi=self.abi, bytecode=self.bin)

    construct_txn = instance.constructor().buildTransaction({
        'from': self.pub,
        'value': 10,
        'gas': 1000000,
        'gasPrice': w3.eth.gasPrice,
        'nonce': self.w3.eth.getTransactionCount(self.pub),
    })

    signed = self.acct.signTransaction(construct_txn)
    tx_hash = self.w3.eth.sendRawTransaction(signed.rawTransaction)
    print(tx_hash.hex())

I then take the transaction hash, and pass it to this function to create a contract instance I can play around with using Python

def contract_in_concise_mode(contract_address):
    # Contract instance in concise mode
    abi = contract_interface['abi']
    contract_instance = w3.eth.contract(address=contract_address, abi=abi, ContractFactoryClass=ConciseContract)
    return contract_instance

But I am getting this error

web3.exceptions.InvalidAddress: ('Address must be 20 bytes, as a hex string with a 0x prefix', '0xa ....... 49')


texts: How to initialize storage for smart contracts in the genesis block


texts: What is the reason for make a wallet with 1 token during ICO?

texts:
Because of my inexperience, I don't understand why (I guess for security reasons) contract owner of a crowdsale split its tokens over several owners, one of them with a 1 token only.

For example Skraps has developed its ICO contract here with a total supply tokens of 110M divided as below:

1st owner 109,499,999
2nd owner 500,000
3rd owner 1

  The ICO itself is a common ERC20 contract.

What's the reason behind that owner who hold 1 token?


texts:
I started to learn solidity and want to code something, but I'm struggling with simple call function to contract.
Can you point me out what I'm doing wrong?

Here is simple gits: https://gist.github.com/xaxes/0da37b5c2585445d571526db42110eb3

My problem is when I'm trying to set int value in the contract and then get it, 0 is always returned.


texts: How ERC20 Token balance are recovered during Ethereum chain rolling-back

texts:
My Answer:

Ok, the problem is really with Ganache ... If I use geth, everything is alright.

... ... sorry for your time ...

---------------- The Original Question --------------------

My understanding is that ERC20 Token balances are stored in the storage trie which will change over time. Also, token.balanceOf(accountHash, {}, blockNumber) seems to return only the most recent balance no matter what that blockNumber is. I am wondering if the Ethereum chain rolls back and then grows along a new chain, how are ERC20 token balances treated?

I want to clarify a bit regarding the Rollback here. Consider a simplified chain with only 8 blocks, labeled by the order they are appended to the chain, (not the block number which defines the height of block.)

# blocks are labeled by the order they are added to the chain
               /--[6]<--[7]<--[8]
              /
[1]<--[2]<--[3]<--[4]<--[5]

Say there are transactions about a token (ERC20) in all these blocks.

When [5] is added to chain, it is in the longest chain and token.balanceOf['0xAA'] gives me balance1.

Now assume [6][7][8] are appended to [3], this branch becomes the longest, and all transactions in [4] and [5] become invalid.

Now assume I want to be safe so I only care about balance of a ERC20 token (not ETH) at the (N-4)th block. How can I get this balance.

I did my search and the only way is to use etherscan's API, which is not ok for heavy use. There are other people here and there asking similar questions and I totally feel their frustration.

Thank you.

Update on Apr 5.

I want to give more details about my attempts so far.

1) I am using Ubuntu 16.04 and geth 1.8.2-stable.

2) I started with running Ganache, the app with graphical UI.

3) My token is almost the same as the one in the official doc https://ethereum.org/token.

4) I deployed the token using eth.accounts[0] in geth (ganache generates 10 accounts with each holding 100 initial ETH for me)

$ geth attach http://localhost:8545

var tokenABI = [...];
var tokenFactory = eth.conract(tokenABI);
var byteCode = "0x" + "606..."

var token = tokenFactory.new(
    100,
    "TestCoin",
    "TSC",
    {
        from: eth.accounts[0],  // owner
        data: byteCode,
        gas: 4700000
    }, function(e, contract) {});

5) I did the following transactions:

// 3 ETH transactions
eth.sendTransaction({from: eth.accounts[0], to: eth.accounts[1], value: web3.toWei(5, "ether") });
eth.sendTransaction({from: eth.accounts[1], to: eth.accounts[2], value: web3.toWei(3, "ether") });
eth.sendTransaction({from: eth.accounts[2], to: eth.accounts[3], value: web3.toWei(1, "ether") });

// 3 token transfers
token.transfer(eth.accounts[1], web3.toWei(5, 'ether'), { from: eth.accounts[0] }, function(err, contract) {})
token.transfer(eth.accounts[2], web3.toWei(3, 'ether'), { from: eth.accounts[1] })
token.transfer(eth.accounts[3], web3.toWei(1, 'ether'), { from: eth.accounts[2] })

For the token, I expect the ending balance to be

account 0: 95
account 1: 2
account 2: 2
account 3: 1

My eth.blockNumber shows 7 blocks, which is correct (3 eth transfer, 1 contract creating, 3 token transfer). Any balance of account 3 is definitely less than 1 in ealier blocks. However, the following command returns 1 ether (in unit of Wei) for me:

> token.balanceOf(eth.accounts[3], 0, function(err, res) {console.log(err, res};)
null 1000000000000000000
undefined

No matter how I change that number, from 0 to 7, I always get the same output.

BTW, I have no trouble retrieving ETH holding in earlier blocks. This only happens with the Token.  One thing I did notice is that my eth.syncing returns false, maybe because I am using Ganache?


texts: I need to convert TRX to USD in solidity for a project. Earlier I used Chainlink's AggregatorV3Interface for BNB to USD. But there is no resource for TRX there. Any help would be appreciated.


texts: Batch generating raw transactions nonce problem

texts:
I'd like to batch generate a large number of transactions for one account and sign them in a more secure environment.
Ideally I would create a queue of unsigned transactions (here in my understanding I need to add a nonce), then my "signer" process which has no direct connection to an ethereum node would sign them, and put the resulting raw transactions in the "ready for propagation" queue.
Problem is how to get the correct nonces. Ethereum allows up to 64 pending transactions but apparently web3.eth.getTransactionCount(.., "pending"); does not work and then I have an number of raw transaction in the queue.
And than if any of transactions bounces, the whole queue's nonces will be invalid
So how would I keep track on current nonce? Or is my workflow flawed and unfeasible?


texts:
I am using arab letters in bytes32 data stored in a smart contract, when reading the data and converting to utf-8 with web3.toUtf8() i get errors like unknown utf character or Invalid continuation byte and Invalid byte index

If this is the case, how do I fix it?

EDIT

This is the code i am using right now ( i fixed it ) :

contractInstance.insertPerson(
        web3.fromUtf8(web3.fromDecimal(i+2*i)),
        jsonObj["email"]?jsonObj["email"]:"",
        web3.fromUtf8(jsonObj["FIRST_NAME"]),
        web3.fromUtf8(jsonObj["LAST_NAME"]),
...

this is the code i was using (the one that does not show correct letters):

contractInstance.insertPerson(
        web3.fromUtf8(web3.fromDecimal(i+2*i)),
        jsonObj["email"]?jsonObj["email"]:"",
        jsonObj["FIRST_NAME"],
        jsonObj["LAST_NAME"],
...


texts: How to use my created token, a coin, on my created smart contract?

texts:
I´m want to create a cryptcoin, and index its value to the value of a company.

So If the user contribute with my service, he will be rewarded with my coin. First, this coin wont have any value, but if the company grows, it gains value.

The part I did not understand, is How to use my created coin in the contracts I´ve made? I created a contract to pay rewards, and a coin token contract, using the samples. What´s the next steps?


texts: When we get the execution result of the smart contract, has this result been verified by the entire network?

texts:
When we get the execution result of a function in the smart contract, has this result been verified by the entire network? In other words, when the user obtains the execution result of the smart contract function, whether the result of the function has been verified by other nodes.
Hope you can give me some help, thanks!


texts: UnimplementedFeatureError: Nested dynamic arrays not implemented here

texts:
pragma solidity ^0.4.0;

// delete an array of names
contract ArrayDelete {
string[] names;

function main() returns (string[]) {
   names.push("Jones");
   names.push("Ama");
   names.push("Emeka");
   names.push("Owo");
   names.push("Lulu");

   delete names[0];
   return names;
 }
}

Any ideas why this error occurs? None of the answers on similar questions was helpful in fixing this.


texts: Ethereum Bridge - WARN log with contract myid was triggered, but it was already seen before, skipping event

texts:
I am using ganache desktop application with nodejs where, I need to fetch values from API via ethereum-bridge.

Following is contract code -

pragma solidity ^0.4.4;

import "./usingOraclize.sol";

contract BondRegister is usingOraclize {

uint public energy;

event Log(string text);

function BondRegister() {

 Log("Contract created");
 OAR = OraclizeAddrResolverI(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475);
}

function getCall() payable returns(bool success) {

 oraclize_query("URL", "json(https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD).USD");
}

function __callback(bytes32 _myid,string result) {

if (msg.sender != oraclize_cbAddress()) {
     Log("thrown error");
     throw;
 }
Log("Entered callback function");
Log(result);
energy = parseInt(result, 2);

}

function getenergy() returns (uint) {
return energy;
}
}

In ethereum-bridge console I'm getting a warning that event is skipped.

 node bridge -H localhost:7545 -a 5

 Please wait...
 [2018-02-20T03:21:51.031Z] INFO you are running ethereum-bridge - version: 0.5.5
 [2018-02-20T03:21:51.033Z] INFO saving logs to: ./bridge.log
 [2018-02-20T03:21:51.034Z] INFO using active mode
 [2018-02-20T03:21:51.034Z] INFO Connecting to eth node
 http://localhost:7545
 [2018-02-20T03:21:53.953Z] INFO connected to node type EthereumJS TestRPC/v2.0.2/ethereum-js
 [2018-02-20T03:21:54.857Z] WARN Using 0x2932b7a2355d6fecc4b5c0b6bd44cc31df247a2e to query contracts on your blockchain, make sure it is unlocked and do not use the same address to deploy your contracts
 [2018-02-20T03:21:55.087Z] INFO deploying the oraclize connector contract...
 [2018-02-20T03:22:06.056Z] INFO connector deployed to: 0x2fcea879fdc9fe5e90394faf0ca644a1749d0ad6
 [2018-02-20T03:22:06.299Z] INFO deploying the address resolver with a deterministic address...
 [2018-02-20T03:22:30.183Z] INFO address resolver (OAR) deployed to: 0x6f485c8bf6fc43ea212e93bbf8ce046c7f1cb475
 [2018-02-20T03:22:30.184Z] INFO updating connector pricing...
 [2018-02-20T03:22:42.308Z] INFO successfully deployed all contracts
 [2018-02-20T03:22:42.349Z] INFO instance configuration file saved to /home/kottackal/Downloads/ethereumbridge/ethereum-bridge-master/config/instance/oracle_instance_20180220T085242.json

Please add this line to your contract constructor:

OAR = OraclizeAddrResolverI(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475);

[2018-02-20T03:22:42.363Z] WARN re-org block listen is disabled while using TestRPC
[2018-02-20T03:22:42.363Z] WARN if you are running a test suit with Truffle and TestRPC or your chain is reset often please use the --dev mode
[2018-02-20T03:22:42.364Z] INFO Listening @ 0x2fcea879fdc9fe5e90394faf0ca644a1749d0ad6 (Oraclize Connector)

(Ctrl+C to exit)

[2018-02-20T03:26:32.709Z] WARN log with contract myid: 0x1e84508fa52c2d976ef07fe21f02446249a23e0a0b20eeaee263fa309b9c7e49 was triggered, but it was already seen before, skipping event...


texts: Open source wallet code for custom ethereum private token

texts:
I have a client who has decided to make a custom token on ethereum, run in a private setup - ie. not on the mainnet or any of the testnets.
Is their any open source wallet code available which we can simply use to listen in on our private Blockchain and create/manage accounts like in Mist.

I understand Mist/Ethereum Wallet is itself an option (wherein we connect to our private Blockchain instead), however we are looking for a more simple, bare-bones wallet code which we can use for our custom token alone.


texts:
I'm trying to test a contract that wrote and compiled, and I need to use another deployed contract to test it. I am writing a test for a specific contract and trying to invoke another deployed contract:

contract('Vault', accounts => {
  it('should be able to see the other contract.', async () => {
    const instance = await Vault.deployed()
    const owner = await instance.admin.call()
    assert.equal(owner, accounts[0], `contract owner was not ${accounts[0]}`)
    console.log(await HumanStandardTokenFactory.deployed())
})

which should work, but it I get the error:

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

I am using the new truffle develop command instead of TestRPC. When I run migrate, I can see the addresses of all the contracts being populated properly. I installed the contract through EthPM. In the truffle console I can even type:

truffle(develop)> HumanStandardTokenFactory.deployed().then(instance => console.log(instance.address))
0x82d50ad3c1091866e258fd0f1a7cc9674609d254

I'm thinking this has something to do with the "clean-room" environment, but everyone else seems to have gotten past this issue. My migration file is as follows:

const Vault = artifacts.require('./Vault.sol')
const HumanStandardTokenFactory = artifacts.require(
  'tokens/HumanStandardTokenFactory'
)

module.exports = function (deployer) {
  deployer.deploy(HumanStandardTokenFactory)
  deployer.deploy(Vault)
}

Is there any way I can get the deployed version of this contract into my tests?


texts: How to deploy a contract with Truffle and MetaMask

texts:
How do I deploy a contract with MetaMask & truffle-contract? Currently if I want to deploy a contract with truffle-contract I'll have the following code.

var web3 = new Web3(new
Web3.providers.HttpProvider("http://localhost:8545"));
var provider = new Web3.providers.HttpProvider("http://localhost:8545");
var MyContract = contract(Contract);

MyContract.defaults({
    from: '0x...',
    gas: 4712388,
    gasPrice: 1000000000
})

MyContract.setProvider(provider);

However, when you deploy initialize with MetaMask you what do you set as the provider? Is it window.web3?

if (typeof window.web3 !== 'undefined') {
        window.web3 = new Web3(window.web3.currentProvider);
    } else {
        console.log('No web3? You should consider trying MetaMask!')
        window.web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
    }

    MyContract = contract(Contract);
    MyContract.setProvider(window.web3);
    const account = window.web3.eth.accounts;

    MyContract.defaults({
        from: account,
        gas: 4712388,
        gasPrice: 1000000000
    })


texts:
I've created a contract called "Name" which I've deployed to the testnet. this function just register some text for the user and display it back.

My contract is:

contract Name is mortal{

    mapping(address=>string) public text;
    string public test;

    function register(string _text){
        text[msg.sender]    = _text;
    }
}

I want to interact with this contract using a proxy contract:

contract Proxy is mortal {

    address watch_addr  = 0xEB1e2c19bd833b7f33F9bd0325B74802DF187935;
    address user_addr   = msg.sender;

    function register(){
        watch_addr.call(bytes4(sha3("register()")))
    }
}

(To save you from reading unnecessary code I've omitted the Mortal contract with its suicide function)

Now, calling the other function is not a problem using:

watch_addr.call(bytes4(sha3("register()")))

The problem is giving it arguments.

First, I can't parse an arguments with my proxy contract.
Second, I'm afraid that even if I was able to hard code the proxy call:

watch_addr.call(bytes4(sha3("register("This text is hard codded")")))

and get my original contract to accept it and insert it into a variable, the address of that variable (msg.sender) will be the (msg.sender) of the proxy contract, and not the address of the user who uses this proxy contract.

I think I'm missing something about the way it suppose to work, any idea?


texts: Gigabyte radeon rx580 gaming 4GB, low mhs problem (17mhs stock / 22mhs bios mod)

texts:
I have big problem with my Gigabyte radeon rx580 gaming 4GB when I getting on stock settings only 17mhs and when I try all settings, drivers… same like on https://www.youtube.com/watch?v=xCSuON1fvZ0 I got only 22mhs, I am running on windows 7, can it have different with windows 10 ?
My hardware is
Motherboard - Asus prime H270-PLUS
RAM - DDR4 4gb 2 400 MHz
GPU - Gigabyte radeon rx580 gaming 4GB


texts:
I am following instructions in: http://swarm-guide.readthedocs.io/en/latest/installation.html and when i run this command : go get github.com/ethereum/go-ethereum , it shows me an error .
Anyone has an idea why ?


texts: How to give opening and closing time for contract in remix

texts:
I have implemented a timed crowdsale contract and it's constructor is like this:

function NeoCrowdsale(uint256 _openingTime, uint256 _closingTime) public {
    require(_openingTime >= now);
    require(_closingTime >= _openingTime);

    openingTime = _openingTime;
    closingTime = _closingTime;
}

I need to deploy it to ropsten using remix, while creating it, I have to pass the opening and closing time, this is the screenshot where I need to specify it:

I'm just wondering the format to enter time in it along date, can anyone help me with this? If I want to deploy it on 31 march 2018 at 10:00 am

Thanks, any help will be appreciated !


texts: Creating account. How to use Keystore file

texts:
I'm currently creating an account and I just got my keystore file. I'm curious as to how I use this if my account is lost or I lost my password.

Do I have to use any of the text in the file or do I just use the file itself?

If I do have to use text in the file which set of number/letters and I using, its a little difficult to decode.


texts: How do I create a multisignature wallet?

texts: I couldn't find a good way of doing it. https://wallet.gnosis.io appears to be broken. It was giving javascript errors in the console.


texts: I want to learn blockchain technologies.If i want to develop a simple application in blockchain what are the technologies should be learnt. anyone can explain the flow of the learning.


texts: Struct containing array containing array initialization problem

texts:
I am trying write a contract like below.

pragma solidity ^0.4.9;

/* Contract accepting ethers during 10 minutes */
contract Trading {

    address receivingAccount;
    uint deadline;

    struct Asset {
        string name;
        uint price;
        uint barcode;
    }

    struct Stock {
        Asset asset;
        uint count;
    }

    struct Vendor {
        string name;
        address account;
        Stock[] stocks;
    }

    Asset[] assets;
    Vendor[] vendors;

    /*  at initialization, setup the owner */
    function Trading(address _vendor0, address _vendor1) {
        // create 2 assets
        assets.push(Asset("Asset0", 12, 1234));
        Asset memory asset1 = Asset("Asset1", 34, 5678);
        assets.push(asset1);

        // create 2 vendors
        Vendor memory vendor0 = Vendor("Vendor0", _vendor0, new Stock[](5));
        Vendor memory vendor1 = Vendor("Vendor1", _vendor1, new Stock[](5));

        // add assets to the stock of vendor0
        vendor0.stocks[0] = Stock(assets[0], 2);
        vendor0.stocks[1] = Stock(assets[1], 2);
        vendors.push(vendor0);

        // add assets to the stock of vendor1
        vendor1.stocks[0] = Stock(assets[0], 1);
        vendor1.stocks[1] = Stock(assets[1], 1);

        // set the deadline as 10 minutes
        deadline = now + 10 * 1 minutes;
    }

    function listAssetBarcodes() constant returns (uint[]) {
        uint[] memory barcodes = new uint[](assets.length);
        for (uint i=0; i<assets.length; i++) {
            barcodes[i] = assets[i].barcode;
        }
        return barcodes;
    }

    modifier afterDeadline() { if (now >= deadline) _; }

    /* checks if the time limit has been reached and ends the contract */
    function dispose() afterDeadline {
        suicide(receivingAccount);
    }
}

However, when I add the statement vendors.push(vendor0); to the constructor (as above) I am having the following compilation error from the online compiler:

  Unimplemented feature (/src/libsolidity/codegen/ArrayUtils.cpp:215):
  Copying of type struct Trading.Stock memory[] memory to storage not
  yet supported.

Can anyone help me how can I use the arrays in Solidity properly? Or is there a list or vector like structure we can use or we are obligated to use arrays for the moment?


texts: mist "Error: Cannot find module index.js" on ubuntu

texts:
I just did snap install mist on Ubuntu 18.04.4, when I run mist:
bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
module.js:538
    throw err;
    ^

Error: Cannot find module '/home/me/dist/server/index.js'
    at Function.Module._resolveFilename (module.js:536:15)
    at Function.Module._load (module.js:466:25)
    at Function.Module.runMain (module.js:676:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3

How do I fix this?


texts:
I want my smart contract to lock funds for 100 years. Somebody may use it to lock funds for even more time.
Will 2^64 "markets" (anyone can create a new consecutively numbered market) be enough to be sure of no overflow during that time?
Ethereum may become much faster in the future.
So, should I use 2^64 or 2^128 maximum number of "markets"?


texts: How to select a different Metamask address when using Uniswap?

texts: I want to use Uniswap with my hardware wallet. So I go into my Metamask wallet, connect to my hardware wallet, I see my coin balance, then I open Uniswap. The trouble is that Uniswap is showing an empty address for my Metamask wallet instead of the hardware wallet address with my coin balance. How may I get Uniswap to look instead at the hardware wallet address that I connected to Metamask, please?


texts: mint method usage in ERC721 token implementation

texts: What does the internal method call _mint(msg.sender, tokenId) really do in the background when used with ERC721 token implementation?


texts: Crypto currency or DAO (or both) to support a growing franchise business

texts:
The information on the Ethereum site is clear and well formed, I am probably slow at getting it...

I want to issue a new crypto currency (named HoC) for our business to support a franchise model. However, after visiting the site I am not sure whether I need the Crypto-Currency or the DAO or perhaps both?

Currently, our team builds a tool and uses it to build mobile apps for clients. Our vision is to found more teams that will use the same tool in a franchise model, meaning a small percentage from each team's income will be payed for the services of supplying the tool and clients.

The crypto-currency is meant to serve the project in different ways:

Incentive for the teams
Each new team will receive a fixed amount which will be divided monthly (cliff + vesting). This may increase commitment for the project.
Create an inter-team economy
Buying / selling / good-will-tips within the project's members.
Special Rewards Allow the core team to give special bonuses to clients, teams or helpers.
Allow voting rights Team members can vote on different issues regarding the project, the tool's development etc. Each member's voting weight is proportional to his or her holdings.

A schematic drawing of the business' long-term vision (2017):

It seems articles 1-3 can be done on top of Ethereum with the CryptoCurrency code while 4 requires DAO. Which way should I go?

Status note: I have downloaded the wallet and started mining Ether on the Testing environment.


texts: Interact with smart contract via tx offline signing - possible?

texts:
In MyCrypto/MEW you can send an offline tx by signing it offline and broadcasting it online. Can I also somehow interact with a smart contract in the same manner (eg. the kyber network contract)?

Doesen't matter if I would have to do this via  MyCrypto/MEW or GETH, I just would like to know if there's a possiblity and how I can do it.


texts: How can I claim a refund from a failed ICO (Watertech)

texts: My questions is about claiming a refund from a failed ICO. The ICO in question is WaterTech and the token is WATR


texts:
Using go-ethereum iOS framework I'm trying to create a new transaction. Using GethNewTransaction i get an error (Use of unresolved identifier GethNewTransaction).

An example is found here: https://github.com/ethereum/go-ethereum/wiki/Mobile:-Account-management

// Create a new account to sign transactions with
var error: NSError?
let signer = try! ks?.newAccount("Signer password")

let to    = GethNewAddressFromHex("0x0000000000000000000000000000000000000000", &error)
let tx    = GethNewTransaction(1, to, GethNewBigInt(0),
GethNewBigInt(0), GethNewBigInt(0), nil) // Random empty transaction
let chain = GethNewBigInt(1) // Chain identifier of the main net

My code:

// Create a new account to sign transactions with
var error: NSError?
var signer: GEGethAccount?; try! ks?.newAccount("Signer password", ret0_: &signer)

var to: GEGethAddress?; GEGethNewAddressFromHex("0x0000000000000000000000000000000000000000", &to, &error)
let tx = GethNewTransaction(1, to, GEGethNewBigInt(0), GEGethNewBigInt(0), GEGethNewBigInt(0), nil) // Random empty transaction
let chain = GEGethNewBigInt(1) // Chain identifier of the main net

This line is wrong:

let tx = GethNewTransaction(1, to, GEGethNewBigInt(0), GEGethNewBigInt(0), GEGethNewBigInt(0), nil) // Random empty transaction

How do i write this line to create a new transaction?


texts: What token address do I use if I want to sell an ERC20 token on a different exchange? Its original address or its address on the other exchange

texts:
I really need help with this one to avoid logic errors.
I am on the Kovan testnet.
I bought 4 units of DAI token on Uniswap exchange(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D) for 0.111 Ether and tried to sell it on the same exchange; it worked fine.
Then I bought 4 units of DAI token on Uniswap exchange and tried to sell it on Kyber Exchange(0x692f391bCc85cefCe8C237C01e1f636BbD70EA4D); but it failed.
To buy DAI token on Uniswap, I passed it the Uniswap DAI token address(0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa) and to sell the purchased DAI tokens on Kyber exchange, I passed it the address of the Kyber DAI token(0xFf795577d9AC8bD7D90Ee22b6C1703490b6512FD)
Since this didn't work , I decided that Kyber Exchange must want the original address of the DAI tokens on Uniswap, so I passed it instead. It worked.
Though it worked, I am wary of logic errors and I want to be sure:
Question:
To sell a Uniswap DAI token on Kyber Exchange, do I pass the Uniswap DAI token address to the kyber exchange or do I use the Kyber DAI token address.
Also, am I allowed to sell across exchanges on testnets like kovan?
Do forgive the naïveté of the question, but I have been quite bothered by it.
Thanks a lot.


texts: Guidance on creating new token with value tied to fiat currency & fixed increases in price (newbie)

texts:
I would like to create a new token, but I'm a complete newbie when it comes to Ethereum and cryptocurrencies/blockchain in general.  I'm also not a programmer.

My goal is to create a fixed number of tokens.  Every time a token is bought the following things should happen:

The token's price/value doubles.  Ideally, I would like to tie the price to the USD or another fiat currency.

The payment is distributed to multiple parties.  For example, the current value is $100.  When it is bought for $200 75% goes to the seller and 25% goes to the original token creator.

If possible, the buyer will have the option to be listed publicly as the current owner or remain anonymous.

Thanks in advance for any guidance on how I can accomplish this!


texts: Is the entire ethereum blockchain stored on my machine?

texts:
Blockchain n00b here with a background in software development using traditional data storage (SQL) and app runtimes.

I realize that this question may have already been answered, but I am having trouble wrapping my head around blockchain in general so I want to ask this question very plainly for the benefit of my simple brain and perhaps the brains of others:

When I install Ethereum on my machine, does the entire blockchain (including all transactions ever made on Ethereum and their embedded data) get downloaded to my machine?

I think this is how it works, but I have downloaded about half the blockchain so far and it looks like only a couple of gigabytes. How is this possible? Seems like we would be in petabyte range.

It's incredible technology and I hope someone will help me understand it in simple terms (pretend you are answering a 5 year old ;).

FOLLOW UP QUESTION: Can the chain be queried? For example, if I sold products via smart contracts, could I have an account management tool that queries my local chain for all of my transactions?

Thanks in advance!


texts: What are the Minimum Requirements for a Quroum node?

texts:
I am planning to run a Quorum (Ethereum fork) blockchain on my business. I was wondering if quorum node will run on a Raspberry Pi 3 Model B+.

Raspberri Specs:

Broadcom BCM2837B0, Cortex-A53 (ARMv8) 64-bit SoC @ 1.4GHz
1GB LPDDR2 SDRAM
Raspbian Stretch (Debian version 9)
64GB Micro SD (should be enough I guess)


texts:
https://notes.ethereum.org/SCIg8AH5SA-O4C1G1LYZHQ?view#

Active state means every single block produced on PoS main chain.

Crystallized state occurs every 100th block.

Only Crystallized state consists of information about validators:

# List of active validators
active_validators': [ValidatorRecord],
# List of joined but not yet inducted validators
'queued_validators': [ValidatorRecord],
# List of removed validators pending withdrawal
'exited_validators': [ValidatorRecord]

Does this mean that a validator can join and leave the network only the during Crystallized state (which means only every 100th block)?


texts: "Dropped & Replaced" tx - what should I do?

texts:
I requested a USDT withdrawal from Bilaxy exchange to my Binance USDT (ERC20) account.
However, on etherscan, the transaction shows as "Dropped & Replaced".
Do you guys think I shhould I contact Bilaxy and ask them to resend it?
The Ethereum seems to be really slow and expensive at the moment??!


texts:
Would it be possible for Ethereum to merge with another coin? If so, how would that work?

I ask because GoChain is another infrastructure project which is Ethereum compatible and solves its TPS problem, albeit with less decentralization. Hence, I think it would be interesting if both projects could combine forces.

I understand that this is an open-ended question with no specific definition for what it means to merge.  Any insight is greatly appreciated!


texts: Why is it required to know the function selector in a smart contract to call the function?

texts:
I understand what a function selector is and how it is computed:

  The first four bytes of the call data for a function call specifies
  the function to be called. It is the first (left, high-order in
  big-endian) four bytes of the Keccak-256 (SHA-3) hash of the signature
  of the function.

However, I fail to see why knowing the selector is important as far as calling the function is concerned. For a loadable dynamic library (.so on Linux, .dll on Windows), a list of callable symbols are imported which serves as the entry points to external clients. Isn't there anything like that in EVM bytecode? If not, how does the EVM locate the method given the function selector? Don't the functions exist as separate entities in the compiled bytecode?


texts: How to use latest web3 version from metamask?

texts:
Im new to web3 and Im using following code to connect my UI to web3.

// Modern dapp browsers...
    if (window.ethereum) {
        window.web3 = new Web3(ethereum);
        try {
            // Request account access if needed
            console.log("window.ethereum");
            ethereum.enable();
        } catch (error) {
            // User denied account access...
        }
    }
    // Legacy dapp browsers...
    else if (window.web3) {
        window.web3 = new Web3(web3.currentProvider);
        console.log("window.currentProvider");
        // Acccounts always exposed

    }
    // Non-dapp browsers...
    else {
        console.log('Non-Ethereum browser detected. You should consider trying MetaMask!');
    }

    console.log("version");
    var version = web3.version;
    console.log(version);

The output of console is this, which means it is using 0.20.3 version of web3.

who is actually injecting this version? If metamask is injecting then why it is not injecting the latest version which is 1.0.0-beta.

P.S: metamask version is 6.0.1


texts: Pass arrays to solidity's function from truffle

texts:
I am getting ALERT: Transaction Error. Exception thrown in contract code in metamask when calling addBet function from truffle. The function works without any errors when called from remix. The function also works from truffle if I change the code and pass individual values instead of arrays. Is it really possible to pass arrays to a solidity function from truffle?

In browser console I see this

MetaMask - RPC Error: Error: [ethjs-rpc] rpc error with payload {"id":779020742217,"jsonrpc":"2.0","params":["0xf901ad0c8504a817c800836170d4949d70edd4e3647f2ec9a3b5abce637854b650fe1b80b901440c7bf290000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9cffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffce000000000000000000000000000000000000000000000000000000000000001047656f72676961207673204d69616d6900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000747656f726769610000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000054d69616d69000000000000000000000000000000000000000000000000000000822d46a0c2291f4adb451dae0cdfc07076a0af766c061bf9c7ffa56750bb36c7057d10f5a03920df81d72cd6a838664ff8d01eaebb6e51ae07a83b477d74ed03e51905d5cb"],"method":"eth_sendRawTransaction"} [object Object]
uncaught exception: Object

Betting.sol

pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;

contract Betting {

    struct Bet{
        uint betId;
        string question;
        BetStatus betStatus;
        mapping(uint => MoneyLineDatum) moneyLineData;
        uint lengthMoneyLineData;
    }

    struct MoneyLineDatum{
        string option;
        int value;
    }

    address public owner = msg.sender;

    mapping(uint => Bet) public bets;
    uint public lengthBets;
    enum BetStatus {Open, Closed}

    constructor() public{
        string[2] memory options = ["Gator", "Miami"];
        int[2] memory values = [int(200), -100];
        addBet("Gator vs Miami", options, values);

        options = ["Gator", "Georgia"];
        values = [int(200), -150];
        addBet("Gator vs Georgia", options, values);
    }

    modifier onlyBy(address account){
        require(msg.sender == account, "Unauthorised Access");
        _;
    }

    function addNewEmptyBet() public{
        Bet memory bet;
        bets[lengthBets] = bet;
    }

    function addBet(string memory question, string[2] memory options, int[2] memory values) public onlyBy(owner){
        addNewEmptyBet();
        Bet storage bet = bets[lengthBets];
        bet.betId = lengthBets;
        bet.question = question;
        bet.betStatus = BetStatus.Open;
        lengthBets+=1;
        for(uint i=0; i<options.length; i++){
            bet.moneyLineData[i] = MoneyLineDatum(options[i], values[i]);
        }
        bet.lengthMoneyLineData+=options.length;
    }

    function getLengthMoneyLineData(uint betId) public view returns(uint){
        return bets[betId].lengthMoneyLineData;
    }

    function getMoneyLineData(uint betId, uint idx) public view returns(string memory, int){
        MoneyLineDatum storage moneyLineDatum = bets[betId].moneyLineData[idx];
        return (moneyLineDatum.option, moneyLineDatum.value);
    }
}

Snippet from app.js

App.contracts.Betting.deployed().then(function(_instance){
    return _instance.addBet(question, options, values, {from: App.account});
}).then(function(){
    console.log("Bet has been added");
});

options and values are arrays each of size 2 with datatypes string[] and int[] respectively

Any help would be greatly appreciated! Thank you!


texts:
I've been running geth 1.9.21-stable-0287d548 in Ubuntu 20.04 (VPS with 2CPU, 8G RAM, and 400G SSD) for close to 24 hours.
geth is run in default fast sync mode --
geth --http --http.addr 0.0.0.0 --datadir /mnt/goethereum

It seems to be stepping back-and-forth around the last 100ish blocks --
$ geth attach http://localhost:8545
> eth.syncing.highestBlock - eth.syncing.currentBlock
192
> eth.syncing.highestBlock - eth.syncing.currentBlock
72
> eth.syncing.highestBlock - eth.syncing.currentBlock
74
> eth.syncing.highestBlock - eth.syncing.currentBlock
108
> eth.syncing.highestBlock - eth.syncing.currentBlock
124
> eth.syncing.highestBlock - eth.syncing.currentBlock
65
> eth.syncing.highestBlock - eth.syncing.currentBlock
72
> eth.syncing.highestBlock - eth.syncing.currentBlock
95
> eth.syncing
{
  currentBlock: 10943724,
  highestBlock: 10943830,
  knownStates: 369296404,
  pulledStates: 369063841,
  startingBlock: 10941014
}

I don't find anything useful in the geth log --
Sep 27 16:33:33 geth-mainnet geth[541]: INFO [09-27|16:33:33.849] Imported new block headers               count=1    elapsed=33.211ms    number=10943558 hash="f6e7e1…9cc02f" age=1m7s
Sep 27 16:33:34 geth-mainnet geth[541]: INFO [09-27|16:33:34.186] Imported new state entries               count=384  elapsed="158.345µs" processed=364890530 pending=103974 trieretry=0    coderetry=0 duplicate=749 unexpected=5371
Sep 27 16:33:42 geth-mainnet geth[541]: INFO [09-27|16:33:42.965] Imported new block headers               count=1    elapsed=32.726ms    number=10943559 hash="56b61c…4b4f50"
Sep 27 16:33:43 geth-mainnet geth[541]: INFO [09-27|16:33:43.224] Imported new state entries               count=384  elapsed="2.403µs"   processed=364890914 pending=104364 trieretry=0    coderetry=0 duplicate=749 unexpected=5371
Sep 27 16:33:52 geth-mainnet geth[541]: INFO [09-27|16:33:52.320] Imported new state entries               count=384  elapsed="3.086µs"   processed=364891298 pending=104749 trieretry=0    coderetry=0 duplicate=749 unexpected=5371
Sep 27 16:33:55 geth-mainnet geth[541]: INFO [09-27|16:33:55.005] Imported new block headers               count=1    elapsed=23.788ms    number=10943560 hash="4fe922…a04038"
Sep 27 16:33:58 geth-mainnet geth[541]: INFO [09-27|16:33:58.038] Imported new block headers               count=1    elapsed=15.386ms    number=10943561 hash="efe84b…6ec63f"

What's wrong here and how can I sync to the head?
P.S. Close to 10 hours after geth start, there was a drastic downturn in CPU, disk, and network usage --


texts: How to track a transaction? (exchanger -> MetaMask)

texts:
Yesterday i sent some ether from my bitstamp account to an address I've created on MetaMask/Chrome.

Bitstamp tells transaction done:

Transaction ID (TXID): 0xef7b75aa80f2124b89a83c609f23d8a8cd4d66f5e429879146f16fdb5ce2a530

Etherscan gives status "1":

  https://api.etherscan.io/api?module=transaction&action=getstatus&txhash=0xef7b75aa80f2124b89a83c609f23d8a8cd4d66f5e429879146f16fdb5ce2a530

status  "1"
message "OK"
result
isError "0"
errDescription  ""

But my MetaMask account did not receive anything!
Address: 0xE05175635921B08B4124421788029A938ea24A1E

Etherscan shows no transaction for it.
Where are the ethers?

Thx a lot for any tipp ...


texts:
I'm currently attempting to solve the Coinflip challenge by Ethernaut and I have trouble understanding the following line of code (after ==):

bool side = coinFlip == 1 ? true : false;

I can't seem to find any documentation on the syntax.


texts: how are the exploited smart contracts fixed

texts: We have seen many defi hacks taking place one thing i don't understand is how the bug in contract fixed given that smart contracts are immutable. Is it somehow related to delegate call or interfaces.please provide a detailed answer. Eg the furocombo hack, Cream finance flash loan hack etc


texts: Why can't I send ETH? (Mist 0.7.2 OSX Yosemite)

texts:
My account has thousands of ETH in it, but MIST says this:
"We can't estimate your gas usage properly, as you need at least 1 ether in your account."

My Mist and geth are all updated to the latest versions.
Also my node always syncs to the latest block when opening Mist, but once Mist is open it stops syncing.


texts: How to return entire uint storage array in function? (solidity ^v0.5.12) Auto-generated function returns only first element

texts:
pragma solidity ^0.5.12;
contract sample {
 mapping(address => uint256[12]) fruits;
 function getfruit(address addr) public view returns (uint256[] storage fr) { //line 3
  return (fruits[addr]);
 }
}

Look at the above code. Here firstly since fruits is public, getfruit() should not be even required. But the auto-generated fruits() only returns index 0 (only the first element) but I want all.
Now as far as function is concerned, it gives error when I use 'storage' in line 3. Now if I make it memory , I tried the following code but still throws error saying 'TypeError: Type uint256[12] is not implicitly convertible to uint256[] memory' (which sounds reasonable, but then how do I get the array)?

pragma solidity ^0.5.12;
contract sample {
 mapping(address => uint256[12]) fruits;
 function getfruit(address addr) public view returns (uint256[] storage fr) { //line 3
  uint256[] memory veggies = new uint256[] (12);
  veggies = fruits[addr];
  return (veggies);
 }
}


texts: How Can Call High Gas Price Value in Go Ethereum Node via Web3

texts:
Hello ethereum node default value to gas price avarage. how can i calculate high gas with web3. I need get instantly call the high gas value.
my current code
let gas = Math.floor(parseFloat(this.web3.utils.fromWei(await this.web3ws.eth.getGasPrice(), 'gwei')));


texts: zeppelin-solidity: WhyHasNoEther contract prevent accidental loss of Ether

texts:
I am writing smart contract. I am looking for Zeppelin with many helpful methods. But there is one contract that I don't understand named HasNoEther.

pragma solidity ^0.4.18;

import "./Ownable.sol";

/**
 * @title Contracts that should not own Ether
 * @author Remco Bloemen <remco@2π.com>
 * @dev This tries to block incoming ether to prevent accidental loss of Ether. Should Ether end up
 * in the contract, it will allow the owner to reclaim this ether.
 * @notice Ether can still be send to this contract by:
 * calling functions labeled `payable`
 * `selfdestruct(contract_address)`
 * mining directly to the contract address
*/
contract HasNoEther is Ownable {

  /**
  * @dev Constructor that rejects incoming Ether
  * @dev The `payable` flag is added so we can access `msg.value` without compiler warning. If we
  * leave out payable, then Solidity will allow inheriting contracts to implement a payable
  * constructor. By doing it this way we prevent a payable constructor from working. Alternatively
  * we could use assembly to access msg.value.
  */
  function HasNoEther() public payable {
    require(msg.value == 0);
  }

  /**
   * @dev Disallows direct send by settings a default function without the `payable` flag.
   */
  function() external {
  }

  /**
   * @dev Transfer all Ether held by the contract to the owner.
   */
  function reclaimEther() external onlyOwner {
    assert(owner.send(this.balance));
  }
}

In the document:

  This tries to block incoming ether to prevent accidental loss of
  Ether. Should Ether end up in the contract, it will allow the owner to
  reclaim this ether.

I don't understand why block incoming ether to prevent accidental loss of Ether. (because I think it is vice versa that we should block outcoming ether). Second question is: Whey this contract write this fallback function, we can prevent all incoming ether.

Thanks


texts: Web browser (Chrome and firefox) is able to connect with ganache but not able to connect with local ethereum (geth)node

texts:
Firefox browser is able to connect with ganache and I am able to execute DAPP using browser. However, I am not able to connect with local geth client using web browser. Geth node is all ready up same as ganache. I am getting following error message on firefox -

Error: Invalid JSON RPC response: ""


texts: Why is not Metamask invoked in my user interface?

texts:
I'm running a private Ethereum blockchain on my computer.
I've installed Metamask on my chrome as well.

I can create an account on metamask, and then interact with my smart contract deployed on my private blockchain.  It works fine. Also, everything works fine when I use remix to interact with my smart contract on my private blockchain.

I'm designing my own local HTML file. My HTML file can interact with the smart contract, in the sense that it can read the contract's state.

But when I want to call a function that changes the contract state, I get this error on my HTML file:

Uncaught Error: unknown account
at Object.InvalidResponse (web3.min.js:1)
at s.send (web3.min.js:1)
at _.e [as sendTransaction] (web3.min.js:1)
at c.sendTransaction (web3.min.js:1)
at register_std_num (tt.html:413) // this is the function (in my contract) I want to call
at HTMLButtonElement.onclick (tt.html:20)

Also, I have tried both:

 myContract.register_std_num.sendTransaction(stud_num,{from: "0x333333",gas:4200000});

and

myContract.register_std_num(stud_num,{from: "0x333333",gas:4200000});

where "0x333333" is the address I have created in Metamask.

Note that when I click the related button in the HTML file, MetamasK is not invoked.

Question: Which part am I missing? Is there anything else I need to do?

Please note that, in my HTML file, if I use an account I have created in geth, then I unlock the account and send the same transaction with that account, I can see that the transaction is sent to the blockchain.  But as I said above, it does not work with the account I have created in Metamask.


texts:
how can I pass a parameter to an access modifier both in Solidity and Web3.
Let's assume I have the following code:

modifier passwordRequired(string _pw){
  require(keccak256(_pw) == keccak256("topSecret"));
  _;
}

function doSomething(unit _param) public passwortRequired(_pw){
  ...
}

How can I call function doSomething and pass a string to the access modifier?


texts:
On or about May 23 I created  Jaxx V1.2 wallet on my iPhone and successfully made two deposits of ether. Several days ago I performed a "pair-restore" on a Jaxx wallet I had downloaded on my iMac. Thereafter my two ether deposits in my iPhone wallet disappeared. How do I recuperate my ether? In any response kindly bear in mind that my knowledge in this area is very limited.

I should perhaps add that the mnemonic belonging to my iPhone Jaxx wallet was identical to the one offered during my iMac pair-restore action.


texts: I created a contract with a payable function but the ether is stored in the contract I am looking for a way to transfer the ether to another address


texts: Is there any architectural difference between Lightning and Raiden?

texts: Lightning and Raiden are payment channel networks for Bitcoin and Ethereum respectively. Is there any difference between these projects in terms of architecture, or is Raiden simply an Ethereum implementation of Lightning?


texts: redirect to html page in truffle 'app.js'

texts:
For pet-Dapp http://truffleframework.com/tutorials/pet-shop , I created a new html page which displays adopted pets. Method I followed is :

app.js

 App = {
 web3Provider: null,
 contracts: {},

init: function() {
// Load pets.
$.getJSON('../pets.json', function(data) {
  var petsRow = $('#petsRow');
  var petTemplate = $('#petTemplate');

  for (i = 0; i < data.length; i ++) {
    petTemplate.find('.panel-title').text(data[i].name);
    petTemplate.find('img').attr('src', data[i].picture);
    petTemplate.find('.pet-breed').text(data[i].breed);
    petTemplate.find('.pet-age').text(data[i].age);
    petTemplate.find('.pet-location').text(data[i].location);
    petTemplate.find('.btn-adopt').attr('data-id', data[i].id);

    petsRow.append(petTemplate.html());
  }
});

 return App.bindEvents();
},

 bindEvents: function() {
    $(document).on('click', '.btn-list', App.listAdopt); //Button in index.html for rendering to list.html page
    $(document).on('click', '.btn-listlist', App.listfun); //Button in list.html page for displaying adopted pets.
    $(document).on('click', '.btn-home', App.homepage);//Button in list.html for rendering to index.html
 },

 homepage: function(){
    window.location.href ="../index.html";
   },

 listAdopt: function(){
   window.location.href = "../list.html";
    },

 listfun: function(adopters, account){

  //Code to display adopted pets in list.html
   }

 };

$(function() {
 $(window).load(function() {
 console.log('Inside window Load function');
 App.init();
 });
 });

So once it is redirected to 'list.html' it gives a blank page and on clicking a button will perform an event and display adopted pets.

When page is rendered to 'list.html', app.js is loaded again from App.init() since I have specified the script in 'list.html' and 'index.html'.I need same js file on each html page.

Is there any other way by which adopted pets could be displayed in 'list.html' once page is loaded.


texts:
I am confused with the following sentence in the Solidity documentation:

During the execution of the fallback function, the contract can only rely on the “gas stipend” it is passed (2300 gas) being available to it at that time.

My post is a continuation of this one. This post has an answer which says

The 'stipend' applies to internal sends from one smart contract to another. Because send has no way to specify the gas amount, (whereas call does), Solidity imposes a maximum amount of gas (i.e. 2300).
Because the OP's transaction was not an internal contract-to-contract send the 2300 stipend did not apply and the transaction went through.

So, what does "internal" mean?
Suppose I (as an EOA) sign a transaction TX1 and broadcast it. This TX1 executes a function foo within a contract A which transfers, say ethers, to another contract B.
contract contractA
{
  //...
  function foo() external
  {
     //...
     contractB.transfer(1 ether);
  }
  //...
}

Is contractB.transfer(1 ether); internal call? My guess it is external call because it calls on another contract.
What is the meaning of stipend if transactions always have gas limit set by sender? When, in what cases, does this damn 'stipend' apply?
Could someone please provide a piece of code or describe a scenario when 2300 stipend is not enough, and when we set gasLimit which is enough to execute transfer function?


texts: string memory[3] memory is not implicitly convertible to expected type bytes32[] storage ref


texts: Smart contract : wrong code or race condition?

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

struct Bid {
           uint256 userCode;
           uint256 amount;
           }

Bid public winningBid;
Bid[] public bids;

function bidAmount(uint256 _userCode, uint256 _amount) public {

        assert(_userCode> 0);
        assert(_amount> 0);
        assert(_amount > winningBid.amount + winningBid.amount * (5/100));

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

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

The bidAmount method checks if the bid is valid verifying if the amount is bigger than the amount of the current winning bid plus a mandatory amount step (winningBid.amount * (5/100)) ; if the check is verified, the winning bid becomes the current winning bid and a new bid is pushed in the bids list.

How is it possible that we've been able to store in ethereum a bidding list like this?

22/01/2018 11:51 13.500,00 MrX
22/01/2018 11:51 13.440,00 MrY
22/01/2018 11:49 12.800,00 MrZ

MrX bid violates the Smart Contract check:

assert(_amount > winningBid.amount + winningBid.amount * (5/100));

It looks like a "race condition" where MrX and MrY biddings were both done just checking the validity on MrZ bid.
What we expected is to have one of the two biddings fails for assert violation.

To the best of my knowledge, contract executions are serialised within a block and are not performed in parallel.
Is it simply bad coding or a race condition?


texts: Is there one IDE that can be used to run a DApp ? I have the backend (solidity) and trying to build the front-end for it.(So the IDE should help me to build the front-end side as well as run the entire DApp with solidity )


texts:
I have setup a local node using geth and fast sync.
I use it in combination of ganache to simulate transaction after forking from mainnet. However, I am not satisfied with the performance. Only a few eth_call to my node (through ganache) can very fastly result in more than 1s to perform my whole simulation. I need my whole simulation to take less than 50ms, which I thought possible since everything is running locally.
All the calls are made through websockets. My node is running on a NVME SSD and Ryzen 7 processor. All the geth parameters are set to defaut.
Is there any thing I can do to speed up geth ? Might it be from the hardware or software ?


texts: Possible to sign offline transactions with Geth?

texts:
I'd like to set up a cold storage wallet that has the ability to create and sign transactions offline. It seems both Icebox and ethkey has this functionality, but I'd prefer to have the option to easily move the keys into Mist at a future date, without importing the raw private key.

So, naturally that brings me to Geth. This post shows it's possible to sign arbitrary data with an RPC call, but what about an entire transaction? Is there a specific method for this, or is it just a matter of throwing in the correct raw data?

Any help would be appreciated. Thanks!


texts: How to retrieve holdings by address by token?

texts:
One can find on etherscan, for any token, the list of holdings by address.

I would like to retrieve this info programmatically. Does the etherscan API enable us to do this?

If not, what is a good way of getting this info?


texts: What are effective and secure ways of shuffling a deck of cards in a contract?

texts:
We want to write a card game in Ethereum.  What are effective and secure ways of shuffling a deck of cards in a contract, and dealing them to players?  It needs to be done in a way so that no one can determine each other's cards and what the shuffled deck is, by examining the open source contract code and shuffling transactions which are all on the public Ethereum blockchain.

If this isn't possible in a contract, what approaches are possible?