texts: Transactions go to an older contract address rather than the present deployed one

texts:
Though I have deployed a new contract but the transactions go to a previously deployed contract in my application. I'm attaching the screenshot of my Remix-ide code and the code for the front end application.I'm newly learning blockchain from this tutorial https://www.youtube.com/watch?v=djRxq7Q7xBk&list=PLsyeobzWxl7oY6tZmnZ5S7yTDxyu4zDW-&index=22 . Please help me out :(

These are the codes to my front file

Your balance:

        <input type="text" id="amount" placeholder="Enter amount here">
        <button id="deposit">Deposit</button>
        <button id="withdraw">Withdraw</button>

This is my app.js file

var contract;

$(document).ready(function(){
    web3=new Web3(web3.currentProvider);

var address='0x74c3847bfb1a0662dcf4c49a88e5001ed076d89c'; //Deployed Contract address
var abi=[
    {
        "constant": false,
        "inputs": [
            {
                "name": "amt",
                "type": "int256"
            }
        ],
        "name": "Deposit",
        "outputs": [],
        "payable": false,
        "stateMutability": "nonpayable",
        "type": "function"
    },
    {
        "constant": false,
        "inputs": [
            {
                "name": "amt",
                "type": "int256"
            }
        ],
        "name": "Withdrawl",
        "outputs": [],
        "payable": false,
        "stateMutability": "nonpayable",
        "type": "function"
    },
    {
        "inputs": [],
        "payable": false,
        "stateMutability": "nonpayable",
        "type": "constructor"
    },
    {
        "constant": true,
        "inputs": [],
        "name": "GetBalance",
        "outputs": [
            {
                "name": "",
                "type": "int256"
            }
        ],
        "payable": false,
        "stateMutability": "view",
        "type": "function"
    }
];

contract=new web3.eth.Contract(abi,address);
contract.methods.GetBalance().call().then(function(bal){
    $('#balance').html(bal);
})

})
//Depositing money
$('#deposit').click(function()
{
    var amt=0;
    amt=parseInt($('#amount').val());

web3.eth.getAccounts().then(function (accounts)
{
    var acc=accounts[0];
    return contract.methods.Deposit(amt).send({ from: acc});
}).then(function(tx){
    console.log(tx);
}).catch(function(tx)
{
    console.log(tx);

})

})
//Withdrawing money
$('#withdraw').click(function()
{
    var amt=0;
    amt=parseInt($('#amount').val());

web3.eth.getAccounts().then(function (accounts)
{
    var acc=accounts[0];
    return contract.methods.Withdrawl(amt).send({ from: acc});
}).then(function(tx){
    console.log(tx);
}).catch(function(tx)
{
    console.log(tx);

})

})

This my front end application and the screenshot of the metamask popup


texts:
I have recently done a fresh install of truffle v2.1.1 as I want to compare this version to the recently updated version.

truffle init

Works as expected.  However, when doing;

truffle migrate --reset

This error is returned;

Could not find expected contract or library in 'ConvertLib.sol': contract or library 'ConvertLib' not found.

Before, I had deleted ConvertLib and MetaCoin to try this with a newly created contract.  However, the error still remains for the Migrations contract and the newly created contract.

I have also tried to modify the deploy_contracts.js to include;

deployer.deploy('.....directory...ConvertLib')

And also modified the initial_migrations.js file;

deployer.deploy('.....directory...Migrations')

Would anybody be able to help as I have created multiple fresh truffle folders to try this on but nothing seems to be helping.  Thanks!


texts: Trying to get DAO tokens back to ETH, nothing works

texts:
Is it too late or something? Have they run out of ETH to give back?

I followed the steps in this question:

How do I convert my The DAO tokens into ethers using the withdrawal contract after the hard fork?

to no avail.  In fact, I've tried every possible way, including waiting for about three days until the blockchain was up to date.  Nothing seems to work.
Also, trying to do a simple transfer between my accounts didn't work.

That was yesterday. I got the latest versions of Mist, Ethereum Wallet, etc. (0.8.5)

First I tried the MyWallet path, pressed the "big red button" and so on, and it gave me transaction hashes, but clicking thos hashes etherbase "couldn't find that transaction".

Then I tried the other way, through the wallet, with the contract functions.  Also didn't work.

I'm not getting any up to date info on this, latest I saw around here was that there was a DDOS attack on ETH, and that's why transactions weren't getting through.

Is that still the case?
If this is not the right place to ask about this, do you know who could I ask instead?

Many thanks.

UPDATE: Today I can see the transactions "happen".  I still didn't get the ETH back, but at least something happens.

UPDATE: It worked! quite impressed.  And through botched transactions, DDOS or whatever it was.  Now trying the extra balance thing in MyWallet, whatever that is.

UPDATE: The extra balance also worked after a few tries.  Steps here:
How do I get a refund for the amount I paid in excess of 1 ether to 100 The DAO tokens

Basically, I followed the steps for the EtherWallet version, and if the transaction didn't appear in the blockchain shortly, or appeared and then failed, I tried again.


texts: How can I get information about last 5-10 transactions in ethereum blockchain?

texts: I want to retrieve information on last 5-10 transaction hash created by a specific function in my smart contract. Is there any way I can get historical transaction hash ?


texts:
I'm trying to use this method:
function test(uint amount) public {
        address(0xf5eA38B6b9644224dA1aECbC1219e8543c0689b2).call(abi.encodeWithSignature("deposit(uint)",amount));
    }

but the transaction gets reverted, this is because the amount is not hashed in some way, and I don't really know to do it, what should I do on the amount?
these are transactions:
-the failed one using the method:
https://bscscan.com/tx/0x7fdd50cee23295ea866baa8961a2105c58162e77125df852a4fc5bf0fad2f507
and this was the input data:
Function: test(uint256 tAmount) ***

MethodID: 0x29e99f07
[0]:  0000000000000000000000000000000000000000000000000000000000000001

-the successfull one directly calling the contract from the site instead of using call inside another smart contract:
https://bscscan.com/tx/0xfd4158766f25761fa5dddb0683c677085a04ea6db05e03794be375a8243d7128
and this was the input data:
Function: deposit(uint256 _amount) ***

MethodID: 0xb6b55f25
[0]:  000000000000000000000000000000000000000000000000005427aedb41a400

do I need to hash amount in someway?


texts: Suggestions on ether wallets for easy use?

texts: Does anyone have any suggestions on ether wallets that provide fast (no syncing required) interface like MyEtherWallet and also easy to navigate for making transactions (without the need to work out how much Gas the user needs to spend)?


texts: Error when migrating contracts using truffle

texts:
When using traffle deploying contracts it gives these errors:
"Migrations" -- Unable to decode sender address from transaction:
Incompatible EIP155-based V 38 and chain id 3.
See the Common parameter of the Transaction constructor to set the chain id....

And my truffle-config.js like this:
 networks: {
development: {
  host: "127.0.0.1",     // Localhost (default: none)
  port: 9545,            // Standard Ethereum port (default: none)
  //gas: 8e6,
  //gasPrice: 20,
  network_id: "5777",       // Any network (default: none)
},

ropsten: {
  provider: () => new HDWalletProvider({
    privateKeys: [testnetPrivateKey],
    providerOrUrl: `https://eth-ropsten.alchemyapi.io/v2/${ropstenAlchemyApiKey}`
  }),
  network_id: 3,       // Ropsten's id
  networkCheckTimeout: 1000000000,
  gas: 4000000,
  confirmations: 1,    // # of confs to wait between deployments. (default: 0)
  timeoutBlocks: 50000,  // # of blocks before a deployment times out  (minimum/default: 50)
  skipDryRun: true     // Skip dry run before migrations? (default: false for public nets )
},

What does these errors mean and how should I configure to prevent that failure? Thanks!


texts: Metamask: Logged into an existing account with seed phrase and changed the password

texts:
I have 2 computers with Metamask installed in Chrome (main computer and backup computer). Both had different accounts.
Now I wanted to use Uniswap with the funds of my backup computer's MetaMask while using my main computer. I entered the seed phrase and in the process also changed the password.
My problem is that I logged myself out of the Metamask on the main computer and I don't have the seed phrase for this one. The password obviously no longer works since the Metamask is now associated with the other account and the changed password.
Is there any way to get access back for the Metamask that was active on the main computer? I know the password and I tried the trick of decrypting the vault, however, it only shows me the seed phrase of the account that is now active in Chrome.
Your help is much appreciated!
Thanks a lot


texts:
I need to consider the natural logarithm of the numbers in my contract. The numbers range from 1 to 10^25.
Does anyone have ideas on how best to implement this?


texts:
I am new to the blockchain and up until now I have managed to deploy contracts and transfer ether through both geth console and node code... I am now trying to figure out how to get the contract that I already deployed and interact with it through both Geth and javascript... I will appreciate any help.

thanks! :)


texts:
I am trying to develop my own small EVM. That is a good way for me to learn more about the bytelevel. I hadn't had any problems with most of the instructions, but there are a few, which I just don't understand. SIGNEXTEND is one of it...

This is how the yellow paper describes the opcode:

I am trying to understand and figure out what is happening here and how this opcode works. I can't find a suitable example, nor a case where I might need this opcode.

Does anyone of you have any examples or an explanation for this opcode?

Thanks in advance.


texts: How do I make my DAPP compatible with MIST?

texts:
I have created a small DAPP and it works fine with a geth rpc node running. However - I want to make it also compatible with the current MIST version (the November developer release)

It seems like there are different options to include the web3 object. I have chosen this one:

// 2. optional use web3 from mist, OR load if outside of mist
  if(typeof web3 === 'undefined')
     web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));

So my assumption is: if the DAPP is loaded within MIST web3 does already exist and is not overwritten.
However - It still does not work and I get a:

Error: Invalid JSON RPC response: ""

So the question is: what are the steps to make a DAPP compatible with MIST?


texts: Are there any web3 libraries for react-native or for android light-client?

texts:
I want to create a chat application using the whisper protocol for android platform
, But I'm trying to use the current web3 package with react-native but I'm unable to use it as web3 package has some node core libraries which can't be used for react native, I also tried the mobile light-client library in android but it doesn't seem to have any apis to interact with whisper other than enabling whisper on the node, Can anyone help me with how can I use whisper in mobile devices??


texts: anyone notice lower share count over the last cpl days on ethpool? i'm humming along at my blazing 25 mh/s speed (lol) and have seen my share count go from ~22/hr to low teens or even ~10/hr lately. is there something going on here?


texts: Can JAXX store a cryptocurrency based on Ethereum?

texts:
Suppose I launch a cryptocurrency named XYZ based on ethereum. Now, does every user of XYZ currency has to download MIST and more importantly the huge blockchain data (even after using --fast data is in GBs)? What can be my alternatives?

The one option is I myself design a light-wallet for them, which I want to but this seems quite complex. (Any help on this will be highly helpful)

Secondly, I was looking with a hope towards other available wallets like JAXX and MyEtherWallet, but not sure whether they allow storing currencies other than the BTC,ETH ,DAO,DSH.


texts: Can be ERC20 token bound to a specific pool of addreses? Is it in this hypothetical centralized matter(if possible) easier to transact?

texts:
Trust is not in Q here. only technicals
Imagine banquet of a company, where guests get a one purpose event wallet with tokens. One wallet(organizer) can charge (guests). Tokens wont work with "Outsiders" wallets.
My question is pointed towards the possible use of tokens in private events, where blockchain technology(if its allowed by architecture) is used, but in a small group and in a centralized manner for a certain specific pool of wallets.
Can be in this scenario transaction preapproved in a direction towards organizer?(Organizer scans guests wallet qcode and transaction happens and organizer pays gas, guests have literally only Qcodes on memmorable items – silvercoins released only for the purpose of the event)
So basicaly I would like to be able to charge paper wallets, and locking them for the token only, without them needing gas. Puting into attention, that with other type of compatible funds it would be dangerous.


texts: MIX IDE on MacOS El Capitan. How To Install, step by step please?

texts: So I've been scouring the web trying to find a way to install MIX IDE and start developing dapps. But wherever I look, the steps seem to be outdated or contradict another site's steps. Now I'm very new to Ethereum and creating dapps, so if anyone could help a newbie out it would be much appreciated.


texts: How to send ether to an 'empty' contract

texts:
I have two smart contracts. A caller and a receiver.
My caller code looks like so:
// SPDX-License-Identifier: G.P.L 3.0

pragma solidity 0.8.3;

contract Caller {
    event Response(bool success, bytes data);

    function testCallFoo(address payable _addr) public payable {
        // You can send ether and specify a custom gas amount
        (bool success, bytes memory data) = _addr.call{value: msg.value, gas: 50000}(
            abi.encodeWithSignature("foo(string,uint256)", "call foo", 123)
        );

        emit Response(success, data);
    }

    function testNotThere(address payable _addr) public payable {
        // You can send ether and specify a custom gas amount
        (bool success, bytes memory data) = _addr.call{value: msg.value, gas: 50000}("");

        emit Response(success, data);
    }

}

and my receiver code looks like so:
contract Receiver {
    // 'empty' with no code inside it.
}

How can I send ether to the receiver contract? Is it possible? If no, why? Yet the contract is an address on the blockchain?
What is the minimum code required to send ether to a contract?
I am asking all this to understand what it takes for a contract to be able to receive ether.


texts: What would it take to migrate from one smart contract platform to another?

texts:
If one wants to migrate from one platform, e.g. Ethereum, to another one, e.g. NEO or EOS, then what steps must be taken.

As per my understanding, the following steps would be needed at high level but I am not sure how the second and third one can be done. May be I missed some other important steps too so feel free to add those.

Migrate/re-code the existing smart contracts as per new platform, e.g. from Solidity in Ethereum to C# in NEO or C++ in EOS.
Migrate the existing blockchain data (accounts, balances and everything else stored on the chain) from previous one to the new one.
Make sure the data on target blockchain platform is correctly associated as it was in source blockchain.

Also, what happens to the data on source blockchain after migration is done and there is no plan to use it in future?


texts: Does anyone know what are the most popular web3 providers online? (Or is Infura the only one?)


texts:
How can I build parity as a stable version from source?

git clone https://github.com/paritytech/parity
cd parity
cargo build --release

gives me

version Parity/v1.9.0-unstable-51e6e0b4b-20171230/x86_64-linux-gnu/rustc1.22.1

which is unstable and

git checkout tags/v1.7.11

gives me this version:

version Parity/v1.7.11-unstable-a5ed4cfc4-20171228/x86_64-linux-gnu/rustc1.22.1

which is unstable as well. How can I build the stable version from source (latest should be 1.7.11)


texts: How to get a pending filter only for a contract

texts:
I would like to do the equivalent of:

  pendingEvent = web3.eth.filter('pending');

but only for a specific contract:

  pendingContractEvent = myContractInstance.allEvents('pending');

or more specifically:

  pendingContractEvent = myContractInstance.myEvent('pending');

When I do this, I get the event only when the transaction is included in a block (like 'latest').


texts: Addresses in paths of State Patricia Trie

texts:
Every block header has 3 patricia trees. In State Patricia Trie, the paths are the sha3 of the ethereum addresses, and the value for any particular address is encoded with RLP.

But, what addresses are in the paths of the State Patricia Trie of a given block? All Ethereum addresses or only those mentioned in the transactions of that particular blocks?

I hope I was clear enough.

Thank you.


texts: How to refund investors in an unsuccessful ICO

texts:
I'm trying create a smart contract that allows customers to refund there ethereums if the pre-order of the token is unsuccessful.

Is it possible to create a function in the contract to be used by the investors for refunding, so that the gas is for the refund transaction is payed by the investors. And if so how can one achieve that.

The main goal is to have a refund build into the smart contract but to avoid the creator of the ICO to pay a lot of fees for refunding.


texts: Error while creating the contract with ethereum in the initial tx

texts: I get this error when I try to create the contract with some ETH, but if I just click create without sending ether the contract is correctly deployed.


texts: how to remove unused test accounts from Metamask

texts:
i use metamask chrome extension with testRPC to do my testing

now metamask have over 20 dead accounts just sitting there in the list

my question how to you clear loose unused test accounts from Metamask


texts: The quickest method to receive new blocks

texts:
Please excuse my lack of knowledge on some aspects of how Ethereum works.

I'm creating a DAPP that uses web3 to communicate with the blockchain. I have the need to receive events from a certain contract as soon as they happen. What is the best method to use? Specifically, what is the most reliable method that can handle the event as close to the time it was sent as possible.

I've been using Infura nodes so far but they do not support event calls.
My alternative now is to run a local ethereum node (geth).
Will this be the optimal approach in terms of receiving events quickly?

What are the important considerations that would come in to play here?  does network speed, number of peers etc. have a great a effect?


texts: Can the primary node be fixed in Raft and IBFT?

texts:
I am doing an experiment to see the effect of a compromised primary node on the performance of Quorum for Raft and IBFT. Is there any way I can fix a node to be the minter or the primary node so that I can change its code to do malicious stuff.
Thanks,


texts:
consider the following solidity pseudo-code:

contract Test{

  bytes ar;

  function set_a(bytes val) external{

  //(1) ar = val;

 //(2) for (uint i=0;i < val.length;i++) ar[i] = val[i];

   }
}

Question: Which one the above two approaches is recommended (1 or 2)?


texts:
I want to set up an Ethereum LIGHT Wallet (because I mainly don't want to keep the system running for a week or so to get the blockchain on my computer) on my Windows7 system. Therefore I found a posting on Reddit but can't discuss the topic there because I've got insufficient rights to post there ...

So mainly I've started "geth.exe" with the parameter "-light" which gave me this output here:

  INFO [08-24|01:03:14] Starting peer-to-peer node
  instance=Geth/v1.6.5-stable-cf87713d/windows-amd64/go1.8.3
  INFO [08-24|01:03:14] Allocated cache and file handles
  database=C:\Users\Wini\AppData\Roaming\Ethereum\geth\lightchaindata
  cache=128 handles=1024
  INFO [08-24|01:03:14] Initialised chain
  configuration config="{ChainID: 1 Homestead: 1150000 DAO: 1920000
  DAOSupport: true EIP150: 2463000 EIP155: 2675000 EIP158: 2675000
  Metropolis: 9223372036854775807 Engine: ethash}"
  INFO [08-24|01:03:14]
  Disk storage enabled for ethash caches
  dir=C:\Users\Wini\AppData\Roaming\Ethereum\geth\ethash count=3 INFO
  [08-24|01:03:14] Disk storage enabled for ethash DAGs
  dir=C:\Users\Wini\AppData\Ethash count=2 INFO [08-24|01:03:14] Added
  trusted CHT for mainnet INFO [08-24|01:03:14] Loaded most recent local
  header number=0 hash=d4e567.cb8fa3 td=17179869184 INFO
  [08-24|01:03:14] Starting P2P networking WARN [08-24|01:03:14] Light
  client mode is an experimental feature INFO [08-24|01:03:14] RLPx
  listener up
  self="enode://877f41f91d435bd9f8cf921c499fbf08387da1a8cfa1b63c09dbc8b272535f10d3843c1f6ed35516ca18213b1110dad0c1b43f5d7f2fde04121eee1385d652bd@[::]:30303?discport=0"
  INFO [08-24|01:03:14] IPC endpoint opened: .\pipe\geth.ipc 2017/08/24
  01:03:16 ssdp: got unexpected search target result "upnp:rootdevice"
  2017/08/24 01:03:16 ssdp: got unexpected search target result
  "uuid:2f402f80-da50-11e1-9b23-0017881a3b22" 2017/08/24 01:03:16 ssdp:
  got unexpected search target result
  "urn:schemas-upnp-org:device:basic:1" 2017/08/24 01:03:16 ssdp: got
  unexpected search target result "upnp:rootdevice" 2017/08/24 01:03:16
  ssdp: got unexpected search target result
  "uuid:2f402f80-da50-11e1-9b23-0017881a3b22" 2017/08/24 01:03:16 ssdp:
  got unexpected search target result
  "urn:schemas-upnp-org:device:basic:1"

Don't know if there is already something wrong? After this I was starting the "ethereum wallet.exe" with the parameters "-node-light", then the splash screen is showing and the message "Looking for peers...." is shown. That's it - nothing more happens. Can someone tell what I'm doing wrong?


texts: How to Accept an ERC-20 token as Payment for a Product?

texts:
First of all, this question was asked before here: Accepting ERC-20 Tokens as payment but I want to see if a better way has been developed to accept ERC-20 for payment, so I'm asking again. To summarize the previous post, you change the payment slightly to make it unique. If I am forced to implement it this way, I would probably keep an incrementing variable "order id", and for each sale, increment the variable and add that amount of wei to the token amount. Then to match a sale to a payment, I just find the transaction with the last n significant digits that match that order id.
This is undesirable because 1. it messes with bookkeeping and 2. it's a kludge. There has to be a better way.
The other possibility I have come up with is, my ERC-20 token also implements EIP-1363 and has an approveAndCall(address callee, uint256 amount,bytes extradata) method that approves an amount and calls onApprovalReceived(address owner, uint256 value, bytes memory extradata) on a contract that could then, transfer the tokens to itself, and record the extradata bytes into storage along with the amount, which would serve as proof the order id was paid.
My questions are 1. in the last two years has a better way of accepting ERC-20 been come up with than the previous post's solution? 2. Or is my proposed solution sane?


texts: Accessing to a dynamically sized array value in a contract

texts:
I'm trying I have this contract:

pragma solidity ^0.4.2;

contract ArrayContract {
    address  _owner;
    uint256[] array;

    function ArrayContract (){
        _owner = msg.sender;
    array.push(1);
    array.push(2);
    array.push(3);
    }
}

So like many others I am trying to access data by using the RPC message 'getStorageAt'.

When I try to access the array field (field 1) I have as response the number 3. It makes sense. Is the size of the array.

So, taking in account other posts (
How do I get the storage indices/keys?
web3.eth.getStorageAt for mapping
) And taking in account the documentation:

https://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage

I try to call the RPC with the parameter keccak256(1) (The result of this calculation is the hash:
0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6
)

So I have something as

web3.getStorageAt('account', 'c89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6', 'latest');

And the result still empty (0x000....00).

=======
I also tried, without any success, with the following indexes:

index = keccak256(1 . 1) (the position of the array in the contract and the first position of the array)

index = keccak256(keccak256(1).keccak256(1))

=======

I'm starting to suspect that this does not work. Does anybody can point me to a solution to this problem??

Thanks a lot :)

================ EDITION ========================

Hi all. I finally came back to this issue.
After implementing the needed stuff for my platform (I am not using javascript but smalltalk), I am able to generate the hash needed for accessing the getStorageAt message with the proper encoding.
Using this same example, the slot related with this code is the number 1. According to the documentation, I should get the content of the array by executing:

web3.getStorageAt('account', 'b10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6', 'latest');

The result given by the GETH RPC service to this line is: 0000000000000000000000000000000000000000000000000000000000000001

That happens to be the first element in the array. (I checked with other orders to be sure, and it is in fact the first element of the array)

Then, the next related question is, how do i fetch the next elements? According to the documentation, this call should return the entire array.

Just as a test, I tried to access each element using the mapping fashion
using different encodings of unsigned integer for the index of the element in the array:

index = keccak256(ENC ElementID . ENC SlotID)

index = keccak256(uint8 1 . uint128 1)

...

index = keccak256(uint128 1 . uint128 1)

index = keccak256(uint256 1 . uint128 1)

Without any kind of success.

Do you have any clue about what I am missing?
Thanks a lot!

Santiago


texts: ERC721 Metadata Creation (Newbie Question)

texts:
Complete newbie here so thanks in advance for tolerating the ignorance that follows.

Working on creating a little card game to learn solidity and have reached the part where I need to assign metadata to the token.

I understand that the tokenURI should point to a json file/object on my web server that is formatted to the standard. So, for token 6 it would be something like:  "http://mycardgame.com/cards/6".

I also understand how I could use a variable like baseURI to store all but the "6", get the 6 when the token is minted, and put them together to form the entire URI.

What I have no earthly idea on is how to create that "6" json on the server so the URI points to a valid thing.

I imagine it's something either fairly complicated or ridiculously easy to do, otherwise at least one of the many ERC721 tutorials would have covered more than just setting the tokenURI in the contract. I'd bet complicated over easy.

So, where should I start looking to learn what I'll need to do? Not looking for a quick handout, willing to do the work of actually learning.


texts: Testing of 2 Smart Contracts using Truffle

texts:
I'm writing 2 smart contracts: one is a satellite of the other. That is contract A is calling contract B. When I migrate in truffle all is OK, but when I try to run the tests it is not working. Is there any syntax or config file to modify to make it work?

The below is the migrations file used

var One = artifacts.require("./LoanDataStorage");
var Two = artifacts.require("./LoanBusinessLogic");

module.exports = (deployer, network) => {
  deployer.deploy(One).then(function() {
    return deployer.deploy(Two, One.address)
  });
};


texts: Proof Of Authority Consensus and one authority getting hacked

texts:
What could happen if an authority (validator) gets hacked in a PoA consensus?

Would it be able to block the system as it won't be able to mine its block?


texts:
I followed this tutorial to set up a private chain with PoA some days ago.
And I run a PoA chain successfully.
But today I restart my server.
And I can't start (or get into?) the PoA chain which I set up with command
parity --config node0.toml. I think it because I restart my server and the authority has changed...
The error information is:
Loading config file from node0.toml
2017-06-26 16:29:00  Starting Parity/v1.6.8-beta-c396229-20170608/x86_64-linux-gnu/rustc1.17.0
2017-06-26 16:29:00  State DB configuration: fast
2017-06-26 16:29:00  Operating mode: active
Consensus signer account not found for the current chain. You can create an account via RPC, UI or `parity account new --chain HyperAlbum-chain.json --keys-path /tmp/parity/node0/keys`.

And my node0.toml is:
[parity]
chain = "HyperAlbum-chain.json"
base_path = "/tmp/parity/node0"
[network]
port = 30300
[rpc]
port = 8540
apis = ["web3", "eth", "net", "personal", "parity", "parity_set", "traces", "rpc", "parity_accounts"]
interface = "10.4.20.69"
[ui]
port = 8180
[dapps]
port = 8080
[account]
password = ["node.pwds"]
[mining]
engine_signer = "0x00525DBE671740a5F943Cd49a3e7f7D46075B07e"
reseal_on_txs = "none"

So how to get into a PoA chain again if I restart it? Or maybe I can't restart the parity?
Thanks a lot. :)


texts: "Augur" vs. "Oraclize" : What is the main difference?

texts:
Can we say that "Augur" is a decentralized Oracle against "Oraclize" as a centralized model?

I mean can we consider Augur as a decentralized Oracle and on the other hand, Oraclize as a centralized model? I say this based on this article: LINK. Since in Augur there is a consensus between a group of distributed data carriers. (I am not totally sure about that.)

Form Augur white paper:

  Augur is a trustless, decentralized oracle and platform for prediction
  markets. The outcomes of Augur’s prediction markets are chosen by
  users that hold Augur’s native Reputation token, who stake their
  tokens on the actual observed outcome and, in return, receive
  settlement fees from the markets.

And does it mean that Augur is used only for the "market prediction" ?


texts:
When I read event logs like this:

myContract.getPastEvents('myEventLogName', {
    fromBlock: 0,
    toBlock: 'latest'
})
.then(function(events){
    console.log(events) // same results as the optional callback above
});

I get the following message at the end:

  ... 8 more items ]

How can I read really ALL event logs?


texts: Should Try-Catch error handling be avoided for security?

texts: What implications can it have to the security of a function if the content of it is wrapped into try-catch statements?


texts: How do I check transaction status using go-ethereum simulated back-end?

texts:
Using the go-ethereum simulated backend, I would like to:

1) Instantly commit a transaction so that it either succeeds or reverts in a given simulated blockchain.

So far I'm using sim.Commit() to trigger this.

2) Verify whether the transaction succeeded or reverted. Is there an API available to help with this?

I've noticed there is a TransactionByHash() function that does return an isPending variable, however, this variable only indicates whether the transaction is part of the pending pool and is not correlated with success or failure.

I have the transaction hash and the simulated back-end object available.


texts: call contract function signed on client side web3.js 1.0

texts:
I don't think the web3.js 1.0 docs cover this.

I found this post. but the answer seems outdated.
How to properly create a raw transaction and sign it using web3 in browser

I'd like to use web3.js 1.0 the future is now.

what i have so far:

var web3 = new Web3('https://ropsten.infura.io/<top secret>');
var abi = <abi things>
var address = <contract address>
var myContract = new web3.eth.Contract(abi,address);
myContract.methods.getmessage().call().then(console.log);


texts: Does A Contract Still Exist On The Blockchain After Gas Depletion?

texts:
From what I understand, a contract will still exist on the blockchain after it's associated account has been depleted of gas. However, the contract will no longer be executed by the EVM until more "fuel" is associated with said contract.

Does a contract still exist on the blockchain after gas has been depleted?


texts:
what mistake did I make?

pragma solidity ^0.4.0;

contract Getter_check {
   uint public data = 50;
   function f() constant returns (uint r)
   {
       r = data;
   }
}

pragma solidity ^0.4.0;

import "./Getter_check.sol";

contract Getter is Getter_check {
    function getval() constant returns(uint getter_value, uint r)
    {
        var obj = new Getter_check();
        getter_value = obj.data();
        r = obj.f();
    }
}

When I call getval() my expected output is:

50
50

But the output of the code is:

5.239....36e+76
1.721....12e+76


texts: Interact with smart contract via web3j API for Java application

texts:
I'm having some confusion about communication between java application and smart contract. In my scenario, I have 2 geth clients Node1(http://localhost:8545) Node2(http://localhost:8546). A java application1 deploy a smart contract through Node1. I have another java application2 wants to interact with the smart contract(call a function) through Node2; however, java application2 have no information about the smart contract(function name,...), so it is impossible to use the wrapper. How can my application2 interact with the smart contract while I only know about a smart contract address. Is there any geth command to get the ABI detail that I can use from java application2 Or I need to create a seperate P2P network between application1 and application2 for sending ABI.
Regards,
EM


texts:
I want to access the balance of contract(i.e.  0x552F3AfaA0394632f4aEfa9E923fA3e2bbDAF5FE) and its totalSupply(state variable). I could access the balancec of this contract , but why I could not call its function i.e. getTotalSupply() I have following code;

async function myContractAddress() {
    myContAddr = '0x552F3AfaA0394632f4aEfa9E923fA3e2bbDAF5FE';
    web3.eth.getBalance(myContAddr).then(console.log);
    tokens = await myContAddr.methods.getTotalSupply().call();
    tokens = tokens.toString(10);
    console.log("Toten supply is : ",tokens);

  }
  myContractAddress();

here is my error;

(node:6028) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'getTotalSupply' of undefined
    at myContractAddress (C:\Users\jj\Desktop\temp\deploy.js:36:39)
    at C:\Users\jj\Desktop\temp\deploy.js:26:1
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:6028) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This
error originated either by throwing inside of an async function without a catch
block, or by rejecting a promise which was not handled with .catch(). (rejectio
 id: 1)
(node:6028) [DEP0018] DeprecationWarning: Unhandled promise rejections are depr
cated. In the future, promise rejections that are not handled will terminate th
 Node.js process with a non-zero exit code.
0 // actually this is my contract balance , which have shown


texts: I sent some tokens from my metamask wallet to a kucoin wallet and etherscan shows a successful transaction but the token is still in my mm wallet?

texts:
Transaction: https://etherscan.io/tx/0xf01a483906e8216d578bb9c396c18379a27191030ebd6048f1f1de3508f6ef9c
Source wallet: 0x7ecd10abff8f43a20a66e9f80777b4665a95b56f (Metamask)
Destination wallet: 0x616d96936e685aa0519f57156c4929b648ff8029 (kucoin)
The transaction shows the tokens were transferred from A to B @ 23:30 on 03/04/21 but the tokens still show in my Metamask wallet and not in my kucoin wallet. There also seems to be no trace of the transaction in my Metamask wallet activities anymore?
Can anyone please explain to me what's going on??


texts: Transaction from non-miner node is not getting mined sometimes

texts:
I have a private Ethereum network containing 2 nodes,NodeA and NodeB.
When I initiate a sendTransaction from NodeA(non-mining node) to deploy Ethereum contract using JSON-RPC, the transaction hash is returned.
Then I initiate NodeB(mining node) to start mining.
But sometimes, the transaction receipt is not obtained. And the transaction remains in pending Transactions.
Then if I start mining on NodeA, then the transaction Receipt is obtained.
And the transaction is success.
Why is it happening like this?? Any help would be appreciated


texts: As of 2018 Sept 21st. When is the scheduled Casper Proof of Stake expected to arrive?

texts: Where can one find updates on Casper POS? I hear its been constantly delayed. When is it expected to arrive? And is there an alpha/beta state where one can test it out now?


texts: Out of gas runtime error (Gas limit > Gas usage)

texts:
I'm using remix to test out a particular contract method (both using the Javascript VM and a local blockchain via Ganache), and get this error for a specific contract method:

function withdrawAll() public payable {
    _totalSupply -= balances[msg.sender];
    balances[msg.sender] = 0;

    Withdrawal(msg.sender, this.balance);

    msg.sender.transfer(this.balance);
}

Using the debugger I see that the execution stops on the balances[msg.sender] = 0 line. The blockchain tells me that 27211 gas was a used, and that there is a Runtime error: out of gas.

Like I mention in the subject though – I provide a gas allowance much larger than this using remix, so I have no idea how to avoid this error. I have also played around with different gas allowances (both smaller and larger).


texts: UniswapV2Router02.addLiquidity false Transaction mined but execution failed

texts:
The two tokens have been approve to the router contract, but they always fail when the addLiquidity method is called. "false Transaction mined but execution failed" is displayed in remix.
Transaction hash：
https://kovan.etherscan.io/tx/0x918668d3b0218cf8861b48a5b763ad5ffdd1cb35b4629a0ce44886141a2bbe0d


texts: How to get a token pair's uniswap trade history?

texts:
What I am trying to do is this :-
Given an pair (say DAI/ETH pair), i want to display the latest 10-15 trades (buy, sell, add to pool and remove from pool) and also display a graph of price for that pair.
How can i get the relevent data using uniswap js sdk/api?


texts: oo7-parity How to deploy a contract with initialization code

texts:
Following the tutorial here, I know how to use oo7-parity to deploy a new contract. https://github.com/paritytech/parity/wiki/Tutorial-Part-9

deploy () {
    let tx = bonds.deployContract(CounterCode, CounterABI);

The example contract Counter has no contract constructor, so it can be deployed with only contract byte code and ABI.

However, suppose a contract has a constructor function and initialization variables like the following one, how should I put the variable (_greeting) in the bonds.deployContract function?

contract greeter{
    string greeting;
    function greeter(string _greeting) public {
        greeting = _greeting;
    }
}


texts: How to return array from struct using drizzle?

texts:
So I have been wondering how to return an array from a struct in drizzle, I can make multiple calls using web3, but it is kinda complex and would like a simpler approach. A simplified contract is listed below, the function to add new files is removed.

contract FileList {

   /// @dev struct that contains unique link to image (via IPFS), serial Id, and timestamp
   struct File {
      uint256 id;
      string ipfshash;
      bytes32 filename;
      bytes32[5] tags;
      address owner;
      uint256 timestamp;
   }
   uint256 public constant maxAmountOfFiles = 1000;
   // Owner => files
   mapping(address => File[maxAmountOfFiles]) public files;
   // Owner => last files id
   mapping(address => uint256) public lastIds;
   // consider mapping hash to set of tags

   /// @dev return the tags for a specific file
   /// @param owner --- address of person who uploaded the file
   /// @param _index --- the file desired, (first file uploaded, second , etc ...)
   function getFileTags(address owner, uint256 _index) external view returns (bytes32[5]) {
       return files[owner][_index].tags;
  }

}

To grab the table from the front-end

let table = []
this.drizzle.contracts.FileList.methods.lastIds(this.state.fileOwnerAddress).call()
.then((lastIds) => {
    // eslint-disable-line no-loop-func
   for (let i = 0; i < lastIds; i++) {
     this.drizzle.contracts.FileList.methods.files(this.state.fileOwnerAddress,i).call()
     .then((fileItem) => {
       // add file item to table, missing tags
       fileItem.filename = this.drizzle.web3.utils.hexToUtf8(fileItem.filename)
       fileItem.timestamp = this.timeConverter(fileItem.timestamp)
       /** Can't return bytes from struct array, maybe split this into into another loop?. */
       this.drizzle.contracts.FileList.methods.getFileTags(this.state.fileOwnerAddress,i).call()
       .then((tags) => {
          // console.log(tags)
          // convert all non 0 bytes tag fields to hex
          for (var j=0; j < 5; j++) {
            if (tags[j] !== '0x0000000000000000000000000000000000000000000000000000000000000000') {
              // console.log(tags[j])
              tags[j] = this.drizzle.web3.utils.hexToUtf8(tags[j])
            } else {
              // console.log(tags[j])
              tags[j] = 'N/A'
            }
          }
          fileItem.tags = tags
          console.log(tags)
       })
       // console.log(fileItem)
       // add fileItem to table
       table.push(fileItem)
     });
   }

If anyone can give suggestions on how to improve my code or somehow load this data in drizzle (right now the bytes32 array is not being returned), that would be appreciated


texts: Does any reverting instruction (assert, require, revert, throw, etc) undo ETH transfer?

texts:
I have code which transfer the ether to another address. And below that, I have require() condition will be failing. so will that execute the ether transfer or it will not transfer?

function ethTransfer(){

  someAddress.transfer(amount);

  require((1==5), 'error');   // ever reverting!!!

}

Any idea will be helpful. Thanks


texts: i am searching for public available datasets from projects, in which the blockchain technology would be "useful". For example projects like supply chainys or trading (e.g. in the energy market). I couldn't find anything, but maybe somone here knows more?


texts: Why does ethereum JSON RPC encode bytes as hex?

texts: Why not use base64 since it would be more compact?


texts:
After executing the requestRandomness  function
function getRandomNumber(uint256 userProvidedSeed) public returns (bytes32 requestId) {
    require(LINK.balanceOf(address(this)) >= fee, "Not enough LINK - fill contract with faucet");
    return requestRandomness(keyHash, fee, userProvidedSeed);
}

it returns the requestId by default but does it also return randomness to be used as an argument in the fulfillRandomness function?
function fulfillRandomness(bytes32 requestId, uint256 randomness) internal override {
    randomResult = randomness;
}

Or do I pass in any random number as an argument for fulfillRandomness function?


texts: Withdrawing Ether to another Wallet Problem

texts:
I'm trying to write something like ICO projects do and I got this problem when it comes to withdraw the ether in the contract's balance to my wallet.

function withdrawal () public payable
{
    address bank = 0x...... ;
    address myAddress = this;
    require(myAddress.balance >= 1000000000000000);
    bank.transfer(address(this).balance);

   }

When the contract has ether in it, nothing happens. It doesn't even try to send it. So I'm wondering what I am doing wrong, or if there is a better way to do it. Thanks in advance guys, appreciate every answer.


texts: Why transactions not confirmed when sent by node not fully synced?

texts:
I'm using Mist wallet, and the local geth node is about several thousand blocks behind the head, can I make transactions in this case?

I'm asking because I did send a transaction and it wasn't confirmed for over 12 hours. Is it because I can't send transactions before the node is fully synced up, or because the fee is too low and no miners want to include it?

I used the default value in the fee slider at then, it was about 0.006 ETH, I thought that was enough.

I'm not sure is it even propagated to the network and how can I check this?


texts:
It's only 12 English words. If you figure 11 bits/word, that's only 132 bits.

That doesn't seem to be close to enough bits to re-create a lost wallet.

What am I missing here? How does this work?


texts:
I'm trying to figure out if anyone has separated out the Ethereum VM for experimentation. It would be interesting to play with the interface to the EVM for smart contract testing without all of the other trappings of Ethereum.

Has anyone done this?


texts: buying crypto kittie TxReceipt Status: Fail

texts:
I'm confused about the following. I'm trying to buy a crypto kittie which price is 0.0038 ETH. On myetherwaller the following window is shown.

"Amount send in most cases you should leave this to 0"
Isn't the reason why the transaction fails is because im not sending the 0.0038 ETH to pay for the kittie? When I click on generate transaction im transfer to Metamask

But as shown in the image above in the amount is set to 0, shouldn't it be the price of the crypto kittie? Ain't this the reason why the transaction gives a status of fail?

https://etherscan.io/tx/0x912e248489d056b427d39f69b3d5d3221b262624dc6b0c0f0faa4936dd82f24b

If in myetherwallet the amount send should be set to zero shouldn't I be able to update the amount send in metamask? What to I need to do to buy the crypto kittie?


texts: Solidity: Function state mutability warning

texts:
I am testing some compiler options with solcjs and solc and I am just coding basic outlines of contracts. I am getting warning Function state mutability can be restricted to view, has anyone any comments?

root@ubuntu-s-2vcpu-4gb-lon1-01:/geth/mybc/geth# more AddressContract.sol
pragma solidity ^0.4.19;

contract AddressContract {
    string private myAddress;
    function getAddress() public returns (string) {
        return myAddress;
   }
}

root@ubuntu-s-2vcpu-4gb-lon1-01:/geth/mybc/geth# vi AddressContract.sol
root@ubuntu-s-2vcpu-4gb-lon1-01:/geth/mybc/geth# solcjs --bin
AddressContract.sol
AddressContract.sol:5:1: Warning: Function state mutability can be
restricted to view
function getAddress() public returns (string) {
^
Spanning multiple lines.

 root@ubuntu-s-2vcpu-4gb-lon1-01:/geth/mybc/geth#


texts:
Can anybody explain relations or formulas between share difficulty, target and hashrate?

Thank you.


texts: Web3.js/1.0: How to wait/loop until new event show up like watch()?

texts:
On Web3.js/1.0 there is no watch() function for the contracts to retrieve events.

I have followed the following guide, web3.eth.Contract - Events - getPastEvents - example, and answer to retrieve emitted events.

event.watch(...) used to wait until a new event shows up and does not move on to the next instruction till watch is stopped.

In the following example if there is no event in between fromBlock and toBlock: 'latest' it returns [] and stops waiting for new events to show up right away, which was not case on when we are using watch().

Example-1 getPastEvents():

myContractInstance.getPastEvents('LogJob', {
    filter: {clusterAddress: [web3.eth.defaultAccount]},
    fromBlock: 1899162,
    toBlock: 'latest'
}, function(error, event){ console.log(event); });

Example-2 events.LogJob from web3.py guide: returns undefined

myContractInstance.events.LogJob({
    filter: {clusterAddress: [web3.eth.defaultAccount]},
fromBlock: 1899162
}, function(error, event){ console.log(event); })
    .on('data', function(event){
        console.log(event); // same results as the optional callback above
    })
    .on('changed', function(event){
        // remove event from local database
    })
    .on('error', console.error);

[Q] Is there any way to apply same approach like watch(); where if there is no event in between given fromBlock and toBlock: 'latest', then continue to watch and do not jump on to the next instruction.

Basically if an event returns [];  I want the process keep watching new upcoming blocks and complete watching until the new event is emitted. Only solution comes to my mind is to make this call every 2 seconds until filter does not return [].


texts: How to execute a constructor from an inherited contract that takes arguments, from within the constructor of a child contract?

texts:
I'm looking over the Bancor Smart Token code and noticed that when the SmartToken constructor is called in place of where modifiers usually go there is a declaration of the ERC20Token constructor function ERC20Token(_name, _symbol, _decimals)

I can't seem to find any documentation or posts about this, however I'm guessing this is how you would specify which constructors should be called from parent contracts that a child might inherit?

I was able to get the same effects by changing the smart token contract declaration from contract SmartToken is ISmartToken, Owned, ERC20Token, TokenHolder
to
contract SmartToken is ISmartToken, Owned, ERC20Token("some name", "some symbol", 18), TokenHolder

Smart Token Constructor Function:

function SmartToken(string _name, string _symbol, uint8 _decimals)
    ERC20Token(_name, _symbol, _decimals)
{
    NewSmartToken(address(this));
}

ERC20 Token Constructor Function:

function ERC20Token(string _name, string _symbol, uint8 _decimals) {
    require(bytes(_name).length > 0 && bytes(_symbol).length > 0); // validate input

    name = _name;
    symbol = _symbol;
    decimals = _decimals;
}


texts:
I'm using Geth Objective-C API on ios and would like to start the node with RPC protocol enabled.

Is it possible and if yes how?


texts: what is the lowest gas price that clients (Geth / Parity) relay

texts:
I read here that nodes (at least Geth) only relay transactions that have a gas price above some limit. What is that default limit currently?

As also mentioned there it is probably not zero as that would be a huge DDoS risk. On the other hand I see some 0 gas price tx being mined. Does that mean those tx are being created by the miner themselves or are they being relayed by some nodes that manually lowered the limit?


texts: Method to verify an address nonce within a contract?

texts:
Hey I'm looking for a simple way to verify that a certain address has executed x number of transactions?

I noticed that this can be accomplished by having them deploy some contract and verifying that the resulting contract address matches x nonce, but I'd like to accomplish this without the address signing anything.


texts:
I'm trying to integrate web3 into a website which uses Django.

This snippet of code is not working

  <script type="text/javascript">
      document.getElementById("Mining").innerText = "Test";
      var Web3 = require('web3');
      var web3 = new Web3();
      web3.setProvider(new web3.providers.HttpProvider("http://146.169.45.149:9002"));
      var mining = web3.eth.mining;
  </script>
</body>

When I place the line document.getElementById("Mining").innerText = "Test"; under the var web3 = require('web3'); it stops working, so I'm guessing the problem should be there.

I've included both scripts for web3

<!-- web3 scripts -->
<script type = "text/javascript" src="/static/poll/web3-light.js"></script>
<script type = "text/javascript" src="/static/poll/bignumber.js"></script>

Thanks.


texts: What is the correct geth ipc path usage from nodejs console?

texts:
I cant connect my nodejs console to my geth node via ipc. I'm doing something wrong but cant figure it out. Also I cant find my ipc files anywhere.

Using geth v1.6.6

I start my private network default geth node and see the IPC path as below.

INFO [08-18|10:01:49] IPC endpoint opened: \\.\pipe\geth.ipc

this is from another node. The path to the ipc doesn't even exist. Do I have to create it manually?

INFO [08-18|10:13:41] IPC endpoint opened: \\.\pipe\C:\Users\myuser/Library/Ethereum/mynode1/geth.ipc

I start the nodejs console and type the following;

var web3=require('ethereum.js')
var client = require('net')
web3.setProvider(new web3.providers.IpcProvider('ipc:.geth.ipc', client);

All I get is ....

Below works fine for RPC

web3.setProvider(new web3.providers.HttpProvider("http://someip:8545"));

The path C:\Users\myuser\AppData\Roaming\Ethereum is empty


texts:
So I was trying to dive into the polkadot paper by Gavin Wood, co-founder of Ethereum and founder of Parity. But it seems to be too advanced for my current level of understanding. In layman's terms what exactly is polkadot?

Here is the link to the paper.


texts: Solidity's keccak256 hash doesn't match WEB3 keccak hash

texts:
TL;DR: I have a method in a contract to calculate a keccak256 hash, and I'm trying to replicate it in Web3, but the hashes don't match. My problem is very similar to the one in this question, but the answers there didn't help me. It could be an encoding issue, but I'm not sure how to fix it.

I was trying to hash three parameters like this:
pragma solidity >=0.7.0 <0.9.0;
contract Test {
    function makeHash(uint intValue, string calldata strValue) public view returns (bytes32) {
        bytes32 myHash = keccak256(abi.encode(intValue, strValue, msg.sender));
        return myHash;
    }
}

Calling makeHash(1, 'test1') for this address 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4 returns 0x94822408407fb535100a4152f8709ed58507e1b3dfd32798d25051065f680d64
In Web3, I tried to concatenate the values in a string (I realize this is wrong now, but also not sure how to do it in web3): web3.utils.keccak256("1test10x5B38Da6a701c568545dCfcB03FcB875f56beddC4") returns 0xcd347147b43e04263a58ca2b6d0f0aa8a3e0b00bd02c0e9bbee008aad68b1bf0
From this answer I also tried this method:
web3.utils.soliditySha3(
    { type: 'uint', value: 1 },
    { type: 'string', value: 'test1' },
    { type: 'address', value: '0x5B38Da6a701c568545dCfcB03FcB875f56beddC4' }
)

it returns 0x0aca86dcfc0a652e35268737960c05e51eb03dbfc4c175fd3ca094a2e99e180c

Since all the methods returned different hashes I decided to test to hash just the string in both contract and web3, but even then they generate different hashes.
bytes32 myHash = keccak256(abi.encode(strValue));

Using the line aboce in the contract, calling makeHash('test1') returns 0xf5e2ed7011d2249ef10becf6f745e4b900ab43c0dc529b97d308f25bb36416d0
However in web3 all those methods returned the same hash:
web3.utils.keccak256("test1")
web3.utils.sha3Raw('test1')
web3.utils.sha3('test1')
web3.utils.soliditySha3('test1')
web3.utils.soliditySha3Raw('test1')
// Tried encoding
web3.utils.sha3('test1', {encoding: 'String'})
web3.utils.sha3('test1', {encoding: 'hex'})
web3.utils.sha3('test1', {encoding: 'string'})
// Tried converting to hex
web3.utils.soliditySha3Raw(web3.utils.asciiToHex('test1'))
web3.utils.keccak256(web3.utils.asciiToHex('test1'))
// Tried from this answer https://ethereum.stackexchange.com/a/74082/68459
web3.utils.soliditySha3({ type: 'string', value: 'test1' })

They all return 0x6d255fc3390ee6b41191da315958b7d6a1e5b17904cc7683558f98acc57977b4

Also, decided to try to replicate abi.encode in web3 by using web3.eth.abi.encodeParameter(String, 'test1') but it always returns an error:
    if (type.match(paramTypeBytesArray) || type.match(paramTypeNumberArray)) {
             ^
Uncaught TypeError: type.match is not a function
    at ABICoder.formatParam (..\truffle\build\webpack:\node_modules\web3-eth-abi\src\index.js:255:1)
    at ..\truffle\build\webpack:\node_modules\web3-eth-abi\src\index.js:117:1
    at Array.map (<anonymous>)
    at ABICoder.encodeParameters (..\truffle\build\webpack:\node_modules\web3-eth-abi\src\index.js:105:1)
    at ABICoder.encodeParameter (..\truffle\build\webpack:\node_modules\web3-eth-abi\src\index.js:88:1)
    at evalmachine.<anonymous>:0:14
    at sigintHandlersWrap (vm.js:274:15)
    at Script.runInContext (vm.js:128:14)
    at runScript (..\truffle\build\webpack:\packages\core\lib\console.js:270:1)
    at Console.interpret (..\truffle\build\webpack:\packages\core\lib\console.js:285:1)
    at bound (domain.js:426:14)
    at REPLServer.runBound [as eval] (domain.js:439:12)
    at REPLServer.onLine (repl.js:760:10)
    at REPLServer.emit (events.js:315:20)
    at REPLServer.EventEmitter.emit (domain.js:482:12)
    at REPLServer.Interface._onLine (readline.js:329:10)
    at REPLServer.Interface._line (readline.js:658:8)
    at REPLServer.Interface._ttyWrite (readline.js:999:14)
    at REPLServer.self._ttyWrite (repl.js:851:9)
    at ReadStream.onkeypress (readline.js:205:10)
    at ReadStream.emit (events.js:315:20)
    at ReadStream.EventEmitter.emit (domain.js:482:12)


texts: Token migration and IDEX smart contract problem

texts:
During a recent token migration from token A to token B, a large number of token A were held by a number of people in an IDEX address (where it was ready to trade). The IDEX address is part of a smart contract that allows people to trade, deposit and withdraw, without IDEX having control over user funds.

When the new token B was minted, however, it was sent to all the addresses of token A holders, including the IDEX smart contract address. Whilst most holders of token A have access to their new token B, users holding their funds on IDEX have discovered that they cannot access the new token B. And since IDEX do not have control over the deposits and withdrawals to this address they claim that they cannot access any of the token B either.

Does anyone know if there is likely to be a solution to this, either on the part of the minting people (Consensys) or IDEX or the token holders themselves?

Many thanks!


texts: How to allow delegatecall only from specific contract?

texts:
I have a token contract, when transfer is called it calls other contract's transfer with data. Other contract checks msg.sender and allows only the first contract to pass and performs some important job with the address sent from the parameter.

I heard that delegatecall is gas cheaper. If I change the code to delegatecall I can't get properly msg.sender because it changes caller from contract to the user wallet address. In that case I can't check if the other contract is called only by the first one and this allows attacker to call the other contract without the first one and that leads to one giant glitch.

Is it possible to make delegatecall callable only by specific contract?

Here is a chunk of the code. The reason of splitting this to two contract is that the other contract is large and it's much more than a mere token. The first one is just a basic token with call in transfer.

First contract:

function transferWorker(
    address pFrom,
    address pTo,
    uint pValue
)
    private
{
    require(pTo != address(0));
    balances[pFrom] = balances[pFrom].sub(pValue);
    balances[pTo] = balances[pTo].add(pValue);
    otherContract.processTransfer(pFrom, pTo, pValue);
    emit Transfer(pFrom, pTo, pValue);
}

Other contract:

function processTransfer(
    address pAddressFrom,
    address pAddressTo,
    uint pValue
)
    external
{
    require(msg.sender == allowedAddress);
    transferWorker(
        pAddressFrom,
        pAddressTo,
        pValue
    );
}

function transferWorker(
    address pFrom,
    address pTo,
    uint pValue
)
    private
{
    require(msg.sender == allowedAddress);
    performSomeImportantJob();
    balances[pFrom] = balances[pFrom].sub(pValue);
    balances[pTo] = balances[pTo].add(pValue);
}


texts: Solidity .send() doesn't create a separate transaction?

texts:
I am new to Ethereum and I deployed a contract in Ganache which has a function like this:

function withdraw(uint256 amount) public payable returns(bool) {
    require(accounts[msg.sender].balance >= amount);
    accounts[msg.sender].balance -= amount;
    bool r = msg.sender.send(amount);
    if (!r){
        accounts[msg.sender].balance += amount;
    }
    return r;
}

Then, I use Truffle console to send transactions calling function withdraw.
I expected there should be two transactions: one is calling function withdraw and another is the contract sending ether to the sender, which is a result of msg.sender.send(amount).

But I only got one transaction in Ganache which about calling function withdraw.

Am I understanding <address>.send() wrong?


texts: If a function is called with a certain gas amount, will msg.value == amount of gas sent?

texts: My function needs gas to fulfill a transaction, but I don't want people accidentally sending Ether to it.


texts: Query Ethereum Blockchain for functions return value of a Specified Smart Contract

texts:
I want to get smart contract functions return value sent by a specified smart contract within a range of blocks.
I found a [manual] working method to achieve this:

async function getTxsByAccount(contractAddress) {
  // get current block number
  let blockNumber = await web3.eth.getBlockNumber();
  // get block data
  let block = await web3.eth.getBlock(blockNumber, true);
  // loop through each transaction
  block.transactions.forEach(tx => {
    // filter out transactions for a specific smart contract
    console.log((tx.to));
    if (contractAddress == tx.to) {
      console.log(tx);
    }
  });
}

getTxsByAccount('contractAddress');

However, this method is filtering if first getting block data and filtering transactions for a specified smart contract. It may become tedious with large block range. Furthermore, it requires additional processing to get returned values of functions because it only gives a transaction input.
I also found another method from web3 API, 'call' method:

web3.eth.call({
    to: "0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe", // contract address
    data: "0xc6888fa10000000000000000000000000000000000000000000000000000000000000003"
})
.then(console.log);

> "0x000000000000000000000000000000000000000000000000000000000000000a"

By using this method, I can directly search for data sent by a specified smart contract without any filtering. But the API says:

  Executes a message call transaction, which is directly executed in the VM of the node, but never mined into the blockchain.

That means we can only get the data for the transactions which are never mined into the blockchain. However, in my case transactions are already mined to the blockchain.

I would rephrase my question as: is there any direct method to get a smart contract (a specific smart contract) functions return value? or is it possible to use the call method to achieve this? Thanks


texts: Securely integrating a light wallet into a dapp -- Thoughts?

texts:
I asked a leading L2 provider whether their solution would include key management to break out of the external signing paradigm (2-factor auth, browser extensions, hardware wallets etc.).  His response was this:

hey Zach!!! :slight_smile: Totally agree - Eliminating browser
extensions / etc will be huge! Our approach for handling this is
actually pretty minimalistic. We are working extremely hard to provide
all of the same APIs and tools that we have on Ethereum main-chain.
The reason for this is because we want to make sure that all of the
great work on meta-transactions, burner wallets, etc can be seamlessly
utilized on [redacted]. So instead of us building the tools, we're building
support for the awesome existing (/soon to exist) tools!
That said, my personal opinion on how these tools will integrate is
that we will see light-weight wallets which are integrated directly
into applications that provide the key-signing / backup functionality.

I've seen in-browser wallets before, but they've all been for proof of concepts and demo apps advertising "no security guarantees". How could such a scheme be done securely? Alternatively what are some challenges that would need to be overcome?


texts: Transactions are not mining for accounts created by Nethereum.Accounts.Account method but works for accounts created by web3.Personal.NewAccount

texts:
Transactions are not mining & in pending state for long time, for transactions with accounts created using Nethereum.Accounts.Account(privateKey).
But mining works for accounts created using web3.Personal.NewAccount.SendRequestAsync("password").

I am using below method to initiate transaction.
web3.TransactionManager.SendTransactionAsync(new TransactionInput(data.ToHexUTF8(), addressTo, senderAddress, gas, value))

I am running ethereum on my local environment with 1 node.


texts:
Do you know how Xenon smart contract accomplished sending token to multiple ETH addresses at once like in this transaction: https://etherscan.io/tx/0xb017eadfd9732efc93238ba12e2c52500dda0f2a7ede66f91f15fb2f702c1760

Thanks,

Dan


texts: Remix reverting when passing ether value

texts:
I am trying to pass ether from one contract to another in remix, but it is throwing error and reverts, when I create "EtherTransferFrom" contract with value other than 0. Can you kindly check and help?

https://github.com/willitscale/learning-solidity/blob/master/tutorial-14/EtherTransfer.sol


texts: can ERC20 token implements private transfers functions

texts:
I know Golem Network Token is not implementing the approve() allowance() and transferFrom() functions. Thus, GNT is partially compliant to ERC20 standard.

I would like to go futher, and implement the transfer() function as private().

This way, it would be impossible for the token holders to freely trade it (it would only be possible using a custom mechanism -- see below), but still possible to see the token in wallets.

Sample code would look like this:

contract CustomToken is ERC20 {

    public symbol = “TEST”
    public totalSupply = X;
    public balanceOf...

    //function approve() -- not implemented
    //function transferFrom() -- not implemented

    // first step: check that the caller is KYC
    function placeOrderBuy(int _amountToken, int _maxPrice ) external payable
            returns(bool success);

    // first step: check that the caller is KYC
    function placeOrderSell(int _amountToken, int _minPrice ) external
            payable returns(bool success);

    //run automatically every month, and transfer the tokens function
    executeOrders() private returns(float newPrice);

    // triggers Transfer event
    transfer(address _to, uint _value) private returns(bool success);
}

Would this be accepted as a partially compliant ERC20, like GNT is? Would wallets accept it?
I believe the above contract is working, but maybe there are some problems I didn't think of? What do you think?
if ERC20 is out of the table, I could just remove the transfer() function too, and implement the token transfer within the executeOrders() functions, right?

Thanks!


texts: What will happen to the gas block limit after Casper?

texts: Is there any reason to believe it'll go up or down significantly?


texts:
a couple of days ago, I tried to used the axs token on uniswap and suddenly they disappeared from metamask and my account balance says 0 on etherscan?? I can still see the transaction on etherscan where i bought them 125 day ago en no transaction of them leaving my account?? please advise on what might have happened I have 518.959843162754895838 tokens .. are they stolen and if so... how did that happen? please help!!
transaction of the buy
https://etherscan.io/tx/0xe266613cec6454c3108cf4265f0d9ea1df020fbf1aaee44a806eff77103ca322
token balance
https://etherscan.io/token/0xf5d669627376ebd411e34b98f19c868c8aba5ada?a=0x9dbbc8873fab0b3533a3f432799a19ae656c3af5#tokenAnalytics


texts: Where can you find the block's coinbase transaction using web3js?

texts: I have noticed that the coinbase award for the block is not contained in the list of transactions retuned by e.g web3.eth.getBlock. Nor is it contained in its own field. I cannot even find an incoming transaction on the miners account on etherscan.  I need to be able to look up each blocks coinbase award- any ideas how to do this using web3.js


texts:
I am a Junior JS Dev, new to Ethereum. I am trying to test this Dapp ( Ballot ) locally, have all the pre-reqs ready, but not sure how to open it from the mist browser.

Will appreciate any help.


texts: Solidity Language: Fractional Percentage Numbers:

texts:
I have following function, I'm trying to put a rate which is supposed to be a fractional number e.g. 0.5, 1.5, 3.7 or similar - Everytime I attempt to do so, the rate truncates - How can I fix this? is this a remix bug?

 function tokenTransferTwo(address _recipient, uint256 _amount, uint256 _rate) external onlyOwner returns (bool) {
        require(_recipient != address(0));
        require(_amount <= balances[msg.sender]);

        tokensReceived[_recipient] = _amount;
          tokenBalance[_recipient] = _amount;
                  rate[_recipient] = (_rate * 10) / 100; //SafeMath don't work either
        receivedTokens[_recipient] = true;

        balances[msg.sender] = balances[msg.sender].sub(_amount);
        balances[_recipient] = balances[_recipient].add(_amount);

        emit TokensTransferred(msg.sender, _recipient, _amount, rate[_recipient]);
        return true;


texts: In ETH ICO smart contracts, Is it normal to lock out an entire wallet or set coins?

texts:
I've recently participated in an ICO [icon] that completely locked my icon [myetherwallet]. Because I didn't complete the KYC, I know I shouldn't have the coins. However, because I was still interested in the ICON coins I purchased them on the open market and deposited them into the same myetherwallet. And as a result the myetherwallet is showing a balance of both the "dead" coins and the ones I purcahsed. The wallet doesn't allow me to transfer anything. I am just wondering if this is normal protocol in smart contract programming -- that is, to lock out an entire wallet. Can smart contracts be modified in these situations? Can this be resolve when the ERC20 coins are converted into mainnet coins? Several other people on different forums seems to be in similar situations. I've contacted ICON staff but I don't think they'll do much.

Thank you in advance

Cheers


texts: Understanding the state transition function

texts:
In Bitcoin, one has to refer to the UTXO as input,if you want to spend bitcoins. There are no accounts or a world state.
Since Ethereum uses accountmodel, does one refer to the state transition function if one wants to spend Ethers?
If Alice wants to send 5 Ether to Bob, she has to prove, that she has at least 5 Ether. Does she do this by refering to the state transition function? How does one know that Alice has these 5 Ethers?

Or does the state transition function come into play when a transation already is executed. How does the state transition function work in Ethereum, when Alice wants so send 5 Ether to Bob ?
I read the white and yellow paper and did not get a proper answer for my question.


texts:
var web3 =  new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
web3.eth.getBalance(address)

throws an error:

  Invalid JSON RPC response: ""

while address is some existing valid address.

geth is running.

What could possibly cause that?


texts:
Environment, Ubuntu 18.04:

bs@dharma ~/Schau $ geth version
Geth
Version: 1.9.3-stable
Git Commit: cfbb969da803d4cc92e1a64fc1b3c06db299b564
Architecture: amd64
Protocol Versions: [63]
Network Id: 1
Go Version: go1.11.5
Operating System: linux
GOPATH=/home/bs/go/bin
GOROOT=/home/bs/go

I am running on a private chain (I'm just experimenting :-).   I'm testing this smart contract:

pragma solidity ^0.5.0;

contract Doubler {
    function execute(int a) public pure returns(int) {
        return a + a;
    }
}

I compile with:

solc -o target --bin --abi Doubler.sol

I embed the Doubler.bin and Doubler.abi in a javascript:

var doublerFactory = web3.eth.contract([{"constant":true,"inputs":[{"internalType":"int256","name":"a","type":"int256"}],"name":"execute","outputs":[{"internalType":"int256","name":"ok","type":"int256"}],"payable":false,"stateMutability":"pure","type":"function"}]);
var doublerCompiled = "0x6080604052348015600f57600080fd5b5060ad8061001e6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063a04d2faf14602d575b600080fd5b605660048036036020811015604157600080fd5b8101908080359060200190929190505050606c565b6040518082815260200191505060405180910390f35b6000818201905091905056fea265627a7a72315820e98e8a5d85a2c5f21ce56899d6eadc9b93fadf694dba07ba2efbd43c8735b94664736f6c634300050b0032";

var doubler = doublerFactory.new({from:web3.eth.accounts[0],data:doublerCompiled,gas:200000}, function(e, contract) {
    if (e) {
        console.error(e);
        return;
    }

    if (!contract.address) {
        console.log("Contract transaction send: TransactionHash: " + contract.transactionHash + " waiting to be mined...");
    } else {
        console.log("Contract mined! Address: " + contract.address);
    }
})

I run geth, and in the console I unlock my account and start the miner:

personal.unlockAccount("account", "password", 0)
miner.start()

Then I paste the above javascript into the console and after a while I see the messages:

Contract transaction send: TransactionHash: 0x7c24585dbd5d2c9757ad5b40cf0180a699dc52563b86c2a8a74db27cc84bb507 waiting to be mined...
Contract mined! Address: 0x04e44901ff037a2d859ca9bbaa05595cec611daa

Now, if I run my method:

doubler.execute(4)

... in this case I'd expect the return value to be 8.  But I get -- a red 0.
No matter the arguments, the return is always a red 0.

I also tried calls such as:

doublerFactory.at("0x04e44901ff037a2d859ca9bbaa05595cec611daa").execute(4)

Still, a big red 0 back.

I suppose that the color (red) denotes some kind of error.  But what kind of error.   I don't know what I am doing wrong.
Is it the invocation of the method?   Or is the method wrong / flawed?


texts: I wanna compute sha256 in Solidity Assembly for hash of getting bytes slice.


texts: How can I use Internet to carry out transactions that I do from geth console?

texts:
I have read RPC communications from Internet can be forwarded to geth console. But I have no hint on How? How can I use rpc port to carry out transactions over Internet that I performed using geth console.
Is there any way I can access my account, carry out transactions from a web browser?
PS: I know there are security issues related to it, and using this is not safe.


texts: Meaning of accounts[0], accounts[1], accounts[2] etc. in DApp in Solidity?

texts:
I was recently viewing a DApp on GitHub. It had the following in .sol, and test.js respectively.
    address contractOwner;
    address withdrawWallet;

    function contractName(address _contractOwner, address _withdrawWallet) {
        require(_contractOwner != address(0));
        require(_withdrawWallet != address(0));

        contractOwner = _contractOwner;
        withdrawWallet = _withdrawWallet;
    }

  contract('contractName', function(accounts) {
  const owner = accounts[0]; // this is the account we deploy as owner, see 2_deploy_contracts.js
  const withdrawWallet = accounts[1];
  const account1 = accounts[2];
  const account2 = accounts[3];

  web3.eth.sendTransaction({from:owner, to:account1, value: 10000000000000000000 }, function(err, r) { /* NOP */ });

  it("should have correct constants by default", function() {
    let CN;
    return contractName.new(owner, withdrawWallet)
      .then(function(instance) {
        CN = instance;

        return CN.weiProductPrice.call();
      })
      .then(function(wpp) {
        assert.equal(weiProductPrice, wpp.toNumber());
        return CN.productPerPage.call();
      })
      .then(function(ppp) {
        assert.equal(productPerPage, ppp.toNumber());
      });
  });

2_deploy_contracts.js contains
  // We deploy the contract with the owner being the first address from accounts
  const owner = accounts[0];
  if (network == "live") {
    const withdrawWallet = "0x00010dB ... legit wallet address";
    deployer.deploy(contractName, owner, withdrawWallet);
    return;
  }

What do accounts[0], accounts[1], accounts[2], accounts[3] mean ? Are they supposed to indicate that the user has to assign values, or do they have a specific meaning? They aren't defined anywhere in the project.
Thank you.


texts: Bug? Config error? geth error: admin.addPeer is unsuccessful

texts:
I am trying to get a few nodes to talk to each other over a private network - two Parity and then add in one geth.  Two of them talk just fine, but their enodes are in the chain spec file (Parity.)

The geth node isn't connecting.

When I use the js console, I get:

> admin.addPeer("enode://3.......@<ip>:<port>")
true

So that looks good.  But then when I test, it goes like this:

> admin.peers

[]

And that's much less good.

Any ideas?  Is there something I need to do to tell geth to connect to this private network other than give it the initial "init" parameters?


texts: How will tokens like ERC20s work with sharding?

texts:
If the token contract is made now on what will be the main chain, but long term it is desired for the application to run within a shard, will the tokens ever be able to be sent there?

The map of addresses to balances could hold an address within the shards address space and give them an allowance. But for the contract within the shard to withdraw the tokens it would have to interact with the contract on the main chain, will that be possible?

Is the solution to add functionality to the token contract before it is created on the main chain now which allows it to be destroyed, then at some point in the future copying it and all its state to a shard and destroying it on the main chain so they can actually be used?


texts: Set 2 peers in 1 computer (windows), admin.addPeers return ture, but net.peerCount return 0

texts:
I am trying to set 2 peer in 1 computer(win 10).

As I saw some question like what I am asking, I init 2 client with same genesis.json, and open 2 cmd for console.

the 1st cmd runs:

geth --networkid 1000 --nodiscover --port 30303 --datadir C:\bc\geth\client\00 --rpc --rpcapi net,eth,web3,personal --rpcaddr 127.0.0.1 --ipcdisable console

the 2nd cmd runs:

geth --networkid 1001 --nodiscover --port 30304 --datadir C:\bc\geth\client\01 --rpc --rpcapi net,eth,web3,personal --rpcaddr 127.0.0.1 --rpcport 8546 --ipcdisable console

then I try to add peer in 2nd console:

admin.addPeer("enode://e0e5b8211d7ad85414dd54298ed1c9d96476611f19548652efadb6af5dbf714ef6bd7d5830e1bcfcc441c223e37e65d9c897697ced6a556307cae5970f8c195c@127.0.0.1:30303?discport=0")

It show "true", but when I check the peers with admin.peers, get "[]", net.peerCount return 0.


texts: geth testnet struck at block number 638910

texts:
I am using geth, initially blocks I am having are continuously behind what I can see at https://testnet.etherscan.io/. I am using ubuntu, and I start ethereum by giving the command :geth --testnet console

If I give miner.start() command on the console it is mining and I am getting the mining reward as well. But the output of eth.blockNumber is behind the latest block mined on https://testnet.etherscan.io/

Moreover my coinbase address is 0x78ca58da3b0b4d518aeafd846568dcd5286c1cf7, if I search for this account number, there is no transactions and ether balance is zero, where as eth.getBalance(eth.accounts[0]).toNumber() on geth console show the output as 6.680659680388181e+21.

Edit: Now I am struck at block number 638910, and getting the message
"I0306 10:22:38.903148 eth/downloader/downloader.go:723] Peer bf7ecea3f90155d9 [hs 0.00/s, bs 0.00/s, rs 0.00/s, ss 0.00/s, miss    0, rtt 20s]: potential rewrite attack: #548910 [00000000…] <= #548910 limit"

Not able to understand the issue? please guide.


texts: problem with constructor parameter in rawtransaction

texts:
I am using remix and ganache to test out my contract. The contract deploys successfully, however, I do not see the state variables initialized with the constructor parameters when I look at the deployed contract in remix... will appreciate any feedback on what is wrong with the following setup

    let rawTx = {
        from: runENV.acctAddr,
        nonce: runENV.web3.toHex(runENV.web3.eth.getTransactionCount(runENV.acctAddr)),
        gasLimit:30000000,
        //gasPrice: runENV.web3.toHex(20000000000),
        data: runENV.bin,
        arguments: ["param1", ["one", "two", "three"]],
    }

    let transaction = new tx(rawTx);
    transaction.sign(runENV.privateKeyBuffer);

    let serialzedTx = transaction.serialize().toString('hex');

    runENV.web3.eth.sendRawTransaction( '0x' + serialzedTx, (err, res) => {
            if(err) {
                console.log(`Error in deploying new record on bchain - ${err}`);
            } else {
                console.log(`record contract deployed successfully ${res}`);
            }
        }
    );


texts: How do I calculate trading volume of a particular contract?

texts:
Let's take Saturna as an example.
I want to know what was trading volume in 1 minute time buckets.


texts: Can I make a delegatecall to a Solidity contract that is compiled with a higher compiler version?

texts:
Lets say that I have the contracts A and B.
A needs to make a delegatecall to B.
A is (for some reason) compiled with a compiler version that is lower than B's compiler version.
Can I safely assume that A is still going to make the proper delegatecall to B and without any errors, complaints or security risks ?


texts:
These two lines compile:

uint8[5] foo = [0,0,0,0,0];
int[5] foo = [1,0,0,0,0];

My question is, why do the following two lines not compile and how can I fix them?

int[5] foo = [1,-1,0,0,0];

  Error: Unable to deduce common type for array elements

int8[5] foo = [0,0,0,0,0];

  Error: Type uint8[5] memory is not implicitly convertible to expected type int8[5] storage ref.

I assume inlining numbers only works with uint?

Solidity Version 0.3.2-9e36bdda


texts: Alternatives to listen Events contract with web3.py?

texts:
I'm facing some issue/bug on web3.py, I need to listen my event contract, but event logs are always empty. I know the following issue on Ganach-CLI but may be there is other alternative. I already tried the three followings solutions and no one works, have [] as output...
The new method with web3.py v4 :
my_filter = mycontract.events.<event_name>.createFilter({'fromBlock':0,'to':'latest'})
my_filter.get_all_entries()

The old method :
my_filter = mycontract.eventFilter('EventName',{'fromBlock':0,'toBlock':'latest'})
my_filter.get_all_entries()

And finally tried to build my own filter :
event_hexa = w3.sha3(text='EventTest(address indexed _seller, string indexed)').hex()

event_filter = w3.eth.filter({
'fromBlock':0,
'toBlock':'latest',
'address': mycontract_address,
'topics':[str(event_hexa)]
})

event_filter.get_all_entries()

So I would like to know if there are other way to listen events ? May be I missed out on something.
Or may be there is other test net provider than Ganach where feature to listen event is working ?
Thanks for the help !


texts: Mobile app to sign tx of another app (similar to Metamask in browser)?

texts:
I am looking at an architecture of a native (this is given!) iOS app which I want to integrate with an external wallet. For web apps we have the beloved Metamask which takes care of signing txs. Since there doesn't seem to be a proper mobile Ethereum library yet, I was wondering if I could use an external wallet (e.g. status) for signing transactions. Ideally I imagine this as follows:

my native app provides UI and at some point needs to send transaction to invoke non-constant smart contract function call.
my native app formats the raw transaction (that's already a pain that I'd not want to have to bother with)
my native app asks some wallet to please sign the transaction
similar to Metamask in browser, the wallet app pops up, asks for confirmation of the user and sends the signed tx back and/or already broadcasts it.

Is status/jaxx or any other mobile wallet already able to do the above? If not, what's the closest I could get to (today)?


texts: List of all smart contract based attacks?

texts: Do you know of a list/blog/webiste with all attacks that occurred against smart contracts?


texts: Does anyone know how to install BLOCKBENCH: A Framework for Analyzing Private Blockchains.?


texts: How to detect compiler version given only Solidity Source Code

texts: I've collected some random smart contracts from the internet, many of them do not specify compiler version using pragma in their source code. Is there any way or any tool that can help me identify the version of a smart contract given only the source code? Want to automate the experiment without manually figuring out which compiler a contract needs.


texts: Extremely low token supply after token created on Tokenfactory via Metamask

texts:
I used the parameters in the picture below to create a token for our organization, but instead of showing the desired token supply of 1000000000 & 18 decimals (similar to, say, the MDT token for instance), I'm seeing an extremely small supply - so small that it's showing as 0.000 tokens in many wallets, even for the person with 99.9990% of our supply: https://etherscan.io/token/0xfe385a02137339c1670845b353eea4753a05652a#balances

How can this issue be addressed? Is there a problem with Tokenfactory? Should I create a new token and just say 0 decimals instead, to avoid this issue? Can this apparent issue be fixed without creating a new token? Thank you!


texts: I have written a javascript code for compiling the solidity code but it's showing error

texts:
I was trying to compile my contract using solc compiler but it returning me some errors. I will place my solidity code along with the error that I am getting here. Please help me out to sort this error out asap if possible.

This is the solidity code that I am using:

pragma solidity ^0.4.17;
contract Maxsupply {
    string public message;
    function Maxsupply(string newMessage) public{
        message = newMessage;
    }
    function setmessage(string _message) public{
        message = _message;
    }
}

This is the code that I have written in javascript for compiling the contract:

const path = require('path');
const fs = require('fs');
const solc = require('solc');
const inboxPath = path.resolve(__dirname,'contracts','message.sol');
const source = fs.readFileSync(inboxPath,'utf8');
console.log(solc.compile(source,1));

Error:

(node:1091) V8:
/Users/saitejakuruva/Documents/Inbox/node_modules/solc/soljson.js:3
Invalid asm.js: Invalid member of stdlib


texts: Warning! Error encountered during contract execution [Bad jump destination] while depositing on etherdelta

texts:
I have been trying to deposit a token on etherdelta from myetherwallet wallet but I keep getting this error

Warning! Error encountered during contract execution [Bad jump destination]

Here are some screenshots

Please I really need help I have set gas price to 20, Then 5 and then 4 Still it fails. Please any help is appreciated, I have lost more than $10 trying to do this. Thank you in advance


texts: How to get transaction Status and data regarding that transaction in web3js?

texts:
I have a Dapp where user can buy and send ERC20 token whose bussiness login written in Smart contract..Now when someone buy the token, how do I know in web3 that how much token they've bought and what was their addresss..I intend to use events which was working fine on metamask but not on trust wallet and I want it to be worked on trust wallet..so is there any alternative for events, where I can get the token buyer and the quantity he bought..
Whenever I do transaction, it returns transaction id in return, how do I store that txn Id to use it to be later?? There will be a lot of transactions I guess, so how can I do it safely for the particular address and get it working...


texts: Estimating days with block solving frequency: sanity check

texts:
The current block is 710908. If 212 blocks are solved per hour, then 30 days from now, we should roughly be at block 863548:

710908 + (30 * 24 * 212) = 863548

But... that's a lot bigger than 710908! Has block solving sped up? If not, that means ETH is only (710908 / 24 / 212) = 139.72 days old.

What am I missing here?


texts:
I was trying to connect to my node via IPC using web3_ipc. But i got hit by:

 You tried to send "eth_getBalance" synchronously. Synchronous requests are not supported by the IPC provider.

My code is as:

var web3_extended = require('web3_ipc');
var path = require('path');
var absolutePath =  path.relative('./','/home/pr.singh/.ethereum/geth.ipc');
var options = {
  host : absolutePath,
  // host: 'http://10.10.23.139:8013',
  ipc : true,
  personal: true,
  admin: true,
  debug: false
};

var web3 = web3_extended.create(options);

exports.checkBalance = function(req, res) {
    var bal = req.body.balance;
                var accountBalance=web3.eth.getBalance(bal).toNumber();
                console.log(accountBalance);
}

If I connect using rpc, everything works good but while connecting via IPC , I am getting error. Any help?


texts: Using "owner = msg.sender" in a non-constructor function or in a declaration statement?

texts:
Will it be a problem to use :

 owner = msg.sender;

statement in a non-constructor function?

What if instead of writing the above code in a function, we initialize the owner at the time of declaration like this in a state variable:

address private owner = msg.sender;

Some body please guide me.

Zulfi.


texts:
I am using eth_subscribe to subscribe to specific transactions, specifying an address filter. When using infura provider, I receive logs 5 to 10 seconds after the transaction was mined. Is there any way I can reduce this latency?
Thanks


texts: Why creating a private variable and a getter instead of just creating a public variable in solidity?

texts:
I want to implement a contract like the
ERC20Detailed.sol
example from open Zeppelin:

My question: why setting a private variable and then, creating a getter for the same variable when the solidity compiler can automatically create the getter for a public variable ?

According to Solidity: private vs public variables it seams there is no advantage of doing that.

Am I missing something ?


texts: How to filter indexed events and watch callback return value using Web3.py

texts:
For example, I have an event where using clusterAddress as key, I want to find the other arguments (storageID, desc, etc.), only having the clusterAddress indexed.

I added the indexed keyword for the clusterAddress argument.

event LogJob(address indexed clusterAddress,
             string jobKey,
             uint index,
             uint8 storageID,
             string desc
     );

Later, should the following approach work under Web3.py (following this answer) or should I do something else to capture the indexed argument variable using Web3.py?

   def print_message(received_message): #{
      print(received_message)
      received_messages.append(received_message)
   #}

   blockReadFrom = 1899690;
   myFilter = eBlocBroker.events.LogJob.createFilter(
       fromBlock=blockReadFrom,
       argument_filters={'clusterAddress': '0x4e4a0750350796164D8DefC442a712B7557BF282'}
   )
   print(myFilter.get_all_entries())

  received_messages = []
  myFilter.watch(print_message) # Error occurs: AttributeError: 'LogFilter' object has no attribute 'watch'

Overall, I want to filter all the events using web3.py by passing the indexed argument. When I try to watch the LogFilter (like Watch callback return value Web3.js); I have receive following error: AttributeError: 'LogFilter' object has no attribute 'watch'

=> How to get all the events with the passed argument? After that if possible how could I watch the upcoming new emitted events?


texts: Increasing maximum contract size with geth

texts: I want to deploy a large contract on my own test chain and circumvent EIP170's contract size limit of 24576 Byte. Ganache has --allowUnlimitedContractSize for this. Is the same possible with geth?


texts: Can I get the raw transaction using Nethereum?

texts:
How do I get a raw transaction for a transaction on the blockchain using web3/Nethereum?

An example of a raw transaction can be seen here:
https://etherscan.io/getRawTx?tx=0x3866bd52ab1273b9b014e81f981fb35e6b1ec3254514e09c604921ecc17a6ad6


texts: Error when trying to return string mapping value

texts:
I am still learning the best way to use mappings and how to access mapped elements. I understand how they work, but I tried to write some simple code to map an ID to a name. It works fine except for the most important part, returning the name. Here is the code:

pragma solidity ^0.4.18;

contract A {
    string public name;

    function A(string _name) public {
        name = _name;
    }

    function getName() public view returns (string) {
        return name;
    }
}

contract handleArray {
    uint public arrIndex;

    mapping(uint => address) testArray;

    function handleArray() public {
        arrIndex = 0;
    }

    function newEntry(address _newA) public {
        testArray[arrIndex] = A(_newA);
        arrIndex++;
    }

    function returnEntry(uint _index) public returns (string) {
        return A(testArray[_index]).getName();
    }
}

So if I leave out returnEntry, I can run everything. I can map new A's to an incremented ID. However, returnEntry does not compile in Remix. I get the error

  Return argument type inaccessible dynamic type is not implicitly
  convertible to expected type (type of first return variable (string
  memory).

I would appreciate any help. Thanks.


texts:
While using EthereumJ: SocketException or leveldb.DBException are thrown:

  leveldb.DBException: IO error: /data/bitgo/database/state/549361.ldb: Too many open files


texts: Is it possible to install geth as a Windows service and connect to it using the Wallet?

texts:
I have had limited success running geth as a Windows Service. I have used NSSM to install it as a Service and it will start. However, when I open a Command Window and attempt to use "geth attach" I always receive "Fatal: Unable to attach to remote geth: Access is denied." as my result.

I can run geth manually from one Command Window and use "geth attach" from a separate Command Window and it will attach successfully.

Does anyone know how if there are additional commands I can put in the service start-up to open up access?

EDIT: it looks like I am actually suffering from a well-known issue: "system service session isolation in NT6+" if anyone knows how to overcome this, please reply.


texts:
I've noticed that when a contract factory creates a new contract with the 'new' keyword, the transaction costs an absurd amount of gas as if it were deploying the contract for the first time.
I don't understand why such a high gas cost, if the contract has been deployed before and the code is already 'in the blockchain' then why does it need to deploy the whole code again.
Here's an example:
    pragma solidity >=0.4.22 <0.6.0;

    contract OwnedToken {
        // `TokenCreator` is a contract type that is defined below.
        // It is fine to reference it as long as it is not used
        // to create a new contract.
        TokenCreator creator;
        address owner;
        bytes32 name;

        // This is the constructor which registers the
        // creator and the assigned name.
        constructor(bytes32 _name) public {
            // State variables are accessed via their name
            // and not via e.g. `this.owner`. Functions can
            // be accessed directly or through `this.f`,
            // but the latter provides an external view
            // to the function. Especially in the constructor,
            // you should not access functions externally,
            // because the function does not exist yet.
            // See the next section for details.
            owner = msg.sender;

            // We do an explicit type conversion from `address`
            // to `TokenCreator` and assume that the type of
            // the calling contract is `TokenCreator`, there is
            // no real way to check that.
            creator = TokenCreator(msg.sender);
            name = _name;
        }

        function changeName(bytes32 newName) public {
            // Only the creator can alter the name --
            // the comparison is possible since contracts
            // are explicitly convertible to addresses.
            if (msg.sender == address(creator))
                name = newName;
        }

        function transfer(address newOwner) public {
            // Only the current owner can transfer the token.
            if (msg.sender != owner) return;

            // We ask the creator contract if the transfer
            // should proceed by using a function of the
            // `TokenCreator` contract defined below. If
            // the call fails (e.g. due to out-of-gas),
            // the execution also fails here.
            if (creator.isTokenTransferOK(owner, newOwner))
                owner = newOwner;
        }
    }

    contract TokenCreator {
        function createToken(bytes32 name)
           public
           returns (OwnedToken tokenAddress)
        {
            // Create a new `Token` contract and return its address.
            // From the JavaScript side, the return type is
            // `address`, as this is the closest type available in
            // the ABI.
            return new OwnedToken(name);
        }

        function changeName(OwnedToken tokenAddress, bytes32 name) public {
            // Again, the external type of `tokenAddress` is
            // simply `address`.
            tokenAddress.changeName(name);
        }

        // Perform checks to determine if transferring a token to the
        // `OwnedToken` contract should proceed
        function isTokenTransferOK(address currentOwner, address newOwner)
            public
            pure
            returns (bool ok)
        {
            // Check an arbitrary condition to see if transfer should proceed
            return keccak256(abi.encodePacked(currentOwner, newOwner))[0] == 0x7f;
        }
    }

The 'createToken' function of the TokenCreator contract, creates an object of the OwnedToken contract. But why does it cost as much to call the function as does deploying the OwnedToken contract, if the code is always the same?
Thank you.