texts: Transfer ownership of a contract to another contract (and back)

texts:
I have a contract WidgetMaker that uses Zeppelin-Solidity Ownable to ensure that only the owner of the contract can execute SendWidget.

At present, the contract is owned by my own wallet address and I have a web3 app that lets me execute this function no problem.

I want to migrate from this setup to one where the function SendWidget can be called by another contract WidgetManager. This needs to be the same deployed instance of WidgetMaker, so I will need to transfer ownership to the new contract.

Transferring ownership is no problem as this is already taken care of by OpenZeppelin code. I have two questions:

1) How do I securely deploy WidgetManager to allow it to call the SendWidget function on the current deployed instance of WidgetMaker?

2) Is there a safe way to add a function to WidgetManager that would allow it to pass the ownership back to me, or to another contract in the future if I wanted to upgrade the system while still keeping the same deployed instance of WidgetMaker?


texts: If Uniswap's domain goes down, how can we remove our tokens from a Liquidity pool manually without a front end interface?

texts: Let's assume Uniswap's domain and front end interface is taken down. How can I as a user manually remove my tokens from a liquidity pool? What do I need and todo?


texts: truffle/web3 event listeners returns nothing

texts:
We have an event being triggered in a contract and our listeners on the client cant receive the return value.

https://gist.github.com/stupeters187/9529b54fe0d48ee606ad06ced6b16031

Update: metamask version 3.12.1 fixed the problem


texts: Solidity contract functions not returning correctly with Truffle, but working on Remix

texts:
I'm testing my contracts using Truffle, but my functions are not returning the correct uint, despite doing so when testing in Remix. This is my Test.js code:

var EventContract = artifacts.require("./EventContract.sol");
contract ('EventContract', function (accounts){
it("account1 purchases 4 tickets from ticketContract, which had 10 tickets to start with at a cost of 2", function(){
    var event;
    var account1 = accounts[0];

    return EventContract.deployed()
    .then(function(instance){
      event = instance;
        return event.buyTicketsFromContract.call(account1, 2, {from: account1, value: 4});
    })
    .then (function (success){
      console.log("purchased from contract with success: " + success);
      assert.equal(true, success, "bought 2 tickets for 4 ether");
      return event.getContractTicketBalance.call();
    })
    .then (function(contractBalance){
      console.log(contractBalance.toNumber());
// Fails here
      assert.equal(8, contractBalance.toNumber(), "contract ticket balance is not 8");
      return event.getTicketBalance.call(account1);
    })
    .then (function(accountBalance){
      assert.equal(2, accountBalance.toNumber(), "account balance is not 2");
    })
    ;
  })
  ;

It fails because the contract ticket balance is 10 (initial amount), not 8. When using the same functions on Remix, the values returned are correct.


texts: How to create an account from a Spring MVC project

texts:
I am working on Ethereum blockchian.
I have create a login page using Spring MVC 4 and it is connected to MySQL DB.
Now I want to assign coinbase to the successful registration of the user.

My Idea :: user is directed to register page(Spring-jsp) where he fills all details in the field (name, email_id,contact,country,PASSWORD,CONFIRM PASSWORD) , when user clicks on "create user"(register) method like web3.eth.personal.newAccount(PASSWORD) should be invoked and geth should create a coinbase for this particular user registration.

When I get the coinbase generated for this particular registration I'll map it in DB for next user login.

How to tackle this solution using Spring MVC 4.
Source code is a big welcome.
I have not started implementing it yet, just have setup the application that registers user and holds the details with password in db and for next login it checks for password and username match in database successful login vl take to a Form.


texts: How do investors get refund when `RefundableCrowdsale` does not reach its goal?

texts:
Question regarding RefundableCrowdsale of OpenZeppelin. When its goal isn't reached, how do investors get refund?

By calling the claimRefund() method? How do they call the method??


texts: How to Setup a Private Network in Hyperledger Besu?

texts: I am looking for steps to configure hyperledger besu client for a private network of say 5 nodes.


texts: Costs in gas of changing the value of a variable

texts:
Maybe a little bit weird question, but can the amount of gas, when:

SSTORE

is used(for changing an existing variable), be lesser than 5000 gas? If no, are there discussions in community to reduce these costs?


texts: Hi i am getting error msg.value non-payable

texts:
I had this function
function enter() {
  if (msg.value >10 finney) {

  uint amount=msg.value;
  uint payout;

but i am getting error:

ballot.sol:56:9: Warning: "msg.value" used in non-payable function. Do you want to add the "payable" modifier to this function?
if (msg.value >10 finney) {

anyone can help me? Thanks you in advance.


texts: Why does listing NFTs cost more than bidding on NFTs?

texts:
In the link below are current gas fees for doing contract interactions on two popular NFT platforms

https://gas.metasync.app/

Why does it cost so much more to list an NFT for sale ($150)  than it does to place bids on NFTs that are in auction ($50)? A detailed explanation on data usage on the blockchain comparing these two different contract interactions would be really helpful.
And do the NFT platforms insert some sort of hidden commission inside of these two different smart contracts somehow, or is really purely gas fee only? By inspecting a platform's smart contract, how can we tell?


texts: How to store a function return in a variable?

texts:
I want to create a dynamic JSONpath in an Oraclize query. For that I wrote a function that concentrates three strings (_a = "json(http...",_b = some variable ,_c = ")].Number") to one. Calling the function and getting the concentrated string as a return works fine. How can I now use my concentrated string in the Oraclize query as a variable ?

function strConcat()public view returns (string){

bytes memory _ba = bytes(_a);
bytes memory _bb = bytes(_b);
bytes memory _bc = bytes(_c);

string memory abc = new string(_ba.length + _bb.length + _bc.length);
bytes memory babc = bytes(abc);
uint k = 0;

for (uint i = 0; i < _ba.length; i++) babc[k++] = _ba[i];
for (i = 0; i < _bb.length; i++) babc[k++] = _bb[i];
for (i = 0; i < _bc.length; i++) babc[k++] = _bc[i];
return string(babc);
}

Now I want to bring the function return in an Oraclize query to create a dynamic query:

function update() payable {
newOraclizeQuery("Oraclize query was sent...");
oraclize_query('URL', **return** );
}


texts: Is it possible for an interaction between two contracts be interfered with by another contract?

texts:
For example:

1.Contract A makes a call to contract B to retrieve a state value from B

2.Contract A then uses the data provided by contract B to create modified value

3.Contract A sends the derived value back to contract B as an updated state

Is it possible for another contract C to call into contract B between step 1 and step 3, potentially changing the state without the knowledge of contract A, while B is effectively idle in between the end of step 1 and the beginning od step 3?

If this is not possible, why not? What provides this security?

If this is possible, I would assume that a Mutex of some kind could be used by A to lock the state of B until step 3 was complete. Is this the best practice for this situation?


texts: How to deploy dependent contracts on MainNet using geth?

texts:
Suppose I have a contract A that depends on a contract B and an interface I.

contract B {
 ...
}

interface I {
 ...
}

contract A is B {
  I objectSample;
  ...
}

On a standard deployment where A is not dependent on any other contract, interface or library, I'd do something like this:

var contractA_Model = eth.contract(contractA_ABI)
var contractA_DeployTx = {from: eth.coinbase, data: contractA_Bytecode, gas: ...}
var contractA_Deploy = contractA_Model.new(..., contractA_DeployTx)

On the scenario I mentioned above, what would I have to do to deploy an instance of A?


texts: How w3.eth.filter('latest').get_new_entries() works exactly?

texts:
I try to monitor new transactions.

from web3.auto import w3
import time

l = w3.eth.filter('latest')

while True:
  ts = time.time()
  ll = l.get_new_entries()
  for i in ll:
      print('===== Block hash:  ', i.hex())
      block_hash = i.hex()
      block = w3.eth.getBlock(block_hash, full_transactions=True)
      transactions = block['transactions']
      print('===== Block Number: ', block['number'])
      for tx in transactions:
         print(ts, '   From wallet: ', tx['from'])
         print(ts, '   Value ETH: ', tx['value'])

The result for Ropsten test network was:

===== Block hash:   0x0297b09d64f5db2df68cf8dca56323bd6c021306fb9227e1a668b79155819bee
===== Block Number:  2081162
1548529910.8412573    From wallet:  0xFF8705243e84B8DAD8b0A25B7c76CFa48456e4D5
1548529910.8412573    Value ETH:  100000000000000000
1548529910.8412573    From wallet:  0x8eD3077e18D536d38d31c379e4f407540275876E
1548529910.8412573    Value ETH:  200000000000000000
1548529910.8412573    From wallet:  0xeDc3fbcf9F7F0E9dFD2Fc31bD8ad9BA1DD632322
1548529910.8412573    Value ETH:  0
1548529910.8412573    From wallet:  0xeDc3fbcf9F7F0E9dFD2Fc31bD8ad9BA1DD632322
1548529910.8412573    Value ETH:  0
1548529910.8412573    From wallet:  0xE49aEAaC12e3323d675669A3Da2ED018a7929a0B
1548529910.8412573    Value ETH:  0
===== Block hash:   0x2102996c79e7a599eb3ca0b9d13276c135193413128d95266d1b8ad503cd5cfe
===== Block Number:  2081163
1548529910.9399285    From wallet:  0x77F71e7C2Be802cc7f531d177647E07163c9c756
1548529910.9399285    Value ETH:  0

If latest block

  2081163

then my first loop

  While True:

gives me several transactions

  1548529910.9399285    From wallet:  0x77F71e7C2Be802cc7f531d177647E07163c9c756
  1548529910.9399285    Value ETH:  0

if this block is not closed by miners, then my second loop while True gives me next transactions from this block?

Or

l = w3.eth.filter('latest')
ll = l.get_new_entries()

works only after latest block closed by miners?


texts: How does EIP 1337 guarantee full payments of subscriptions without holding all the funds in escrow?

texts:
I'm struggling to find out how the EIP 1337 makes sure that the subscriber holds enough funds to pay for the (whole) subscription without holdings the whole amount of the funds in escrow?

Does someone has an answer (not the Github)?

Thanks for your answer in advance.

Best


texts: How to deploy a contract with inputs by using JSON-RPC?

texts:
I can deploy a simple contract without any input by using JSON-RPC, like:

curl -X POST --data '{"jsonrpc":"2.0","method":"eth_sendTransaction","params":[{"from":"sender's address","code":"compiled contract"}],"id":67}' localhost:8545

However, I have no idea how to deploy other contracts which has inputs.
Could you please show me a demo how to deploy a contract which has inputs by using JSON-RPC? Thanks a lot.


texts:
I am trying to make trades on 1inch and frequently get an error that reads Fail with error 'Min return not reached'.
My gas prices are set very high because I need these trades to be as fast as possible.
An example:
https://etherscan.io/tx/0x8039dafe89764890903fbaf7deddcccd92935cf4e09ff346319280a67c1940e0
Does anyone know what this means and how to fix it?


texts: Why does not Ethereum allow removing all entries from a mapping, like clear() in Python

texts: Is it common that dictionaries like mapping(uint => uint) foo; cannot be cleared with something like clear()? What is the reason deleting mappings aren't allowed in Ethereum?


texts:
I managed to setup a private blockchain and send whisper messages between my clients. Now, i want to accomplish the very same thing over either the mainnet or one of the testnets.

But it seems that no node i ever connect to in any of the networks has ssh enabled. My messages are not coming through.

Does anyone know of a working example of whisper messages delivered through the main- or one of the testnets?

I'm using geth for my experiment, if thats of any value


texts: Ropsten contract doesn't send anything when calling with this.balance after initialized with eth

texts:
This was my code:

contract Oust {
    address kingdom = 0x344d65e66a9c4f8d7911bf7433b509d6daac9bc0;
  function Oust() public payable {

  }

  function take() public {

      kingdom.call.value(this.balance);
  }

I initialized it with 1.5 eth on Ropsten, but when calling "take", the transction is made with 0 value}

instead of 1.5:

https://ropsten.etherscan.io/address/0x31ee35d188c3f7ced8c4af85de55392e3946a705


texts: Truffle Framework "Block-scoped declarations not yet supported outside strict mode"

texts:
I have tried to install and use the Truffle Framework through npm on Elementary OS (Ubuntu distribution). There where no obvious issues with the installation but when running any command e.g. "truffle init" or "truffle unbox metacoin" I get the error:

/usr/local/lib/node_modules/truffle/build/cli.bundled.js:64601
!function(e,t){ true?module.exports=t():"function"==typeof define&&define.amd?define("ganache",[],t):"object"==typeof exports?exports.ganache=t():e.ganache=t()}(global,function(){return function(e){var t={};function a(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,a),r.l=!0,r.exports}return a.m=e,a.c=t,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},a.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a.w={},a(a.s=1222)}([function(e,t,a){try{var n=a(1);if("function"!=typeof n.inherits)throw"";e.exports=n.inherits}catch(t){e.exports=a(1208)}},function(e,t){e.exports=__webpack_require__(3)},function(e,t){e.exports=__webpack_require__(0)},function(e,t

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Function.Module.runMain (module.js:442:10)
at startup (node.js:136:18)
at node.js:966:3

I assume this is some sort of compatibility issue with ES5/6. But I am unsure as to why this would happen with a fresh install.


texts: Cannot make subscribe newBlockHeaders work

texts:
I'm doing this to get all blocks from the network:

var web3 = new Web3();
web3.setProvider(new Web3.providers.IpcProvider("...", net));
web3.eth.subscribe('newBlockHeaders', function (err, result) {
    ...
}).on('data', function (blockHeader) {
    ...
});

but callbacks are never called (except when I shutdown Geth)

Using web3 1.0 and latest Geth on Windows and Linux.

Also tried with web sockets without luck. Is there something else I can try?

Thanks.


texts:
contract NotifyContract { //address at 0x971A46e7C16D2bBEd2167460961D86Dc3715EE32
    address public userAddr;
    byte public types;
    function notify(byte tokenByte,address userAddr_){
        types=tokenByte;
        userAddr=userAddr_;
    }
}

//

contract Set {
    bool public ret;
    address public tokenAddr;
    address public userAddr;
    function Set(address tokenAddr_,address userAddr_){
        tokenAddr=tokenAddr_;
        userAddr=userAddr_;
    }
    function call1(byte bb){
        ret=tokenAddr.call("notify",bb,userAddr);   //1 not valid
    }
    function call2(byte bb){
        tokenAddr.call(bytes4(sha3("notify(byte,address)")),bb,userAddr);//2 not valid
    }
    function call3(byte bb){
        NotifyContract c=NotifyContract(tokenAddr);// valid
        c.notify(bb,userAddr);
    }
}

At first, I create the NotifyContract contract, then I create the Set contract and pass the NotifyContract address and other userAddr_, but the function call is not valid. NotifyContract do not have the changed value? only 3 is valid. Is there something wrong?


texts:
i'm deploying a smart contract which contains several functions as well as properties. The ABI looks as follows:

[ { constant: false,
   inputs: [Array],
   name: 'vote',
   outputs: [],
   payable: false,
   stateMutability: 'nonpayable',
   type: 'function' },
 { constant: true,
   inputs: [Array],
   name: 'options',
   outputs: [Array],
   payable: false,
   stateMutability: 'view',
   type: 'function' },
 { constant: true,
   inputs: [Array],
   name: 'voters',
   outputs: [Array],
   payable: false,
   stateMutability: 'view',
   type: 'function' },
 { constant: true,
   inputs: [],
   name: 'option_amount',
   outputs: [Array],
   payable: false,
   stateMutability: 'view',
   type: 'function' },
 { constant: false,
   inputs: [Array],
   name: 'addOption',
   outputs: [],
   payable: false,
   stateMutability: 'nonpayable',
   type: 'function' },
 { inputs: [],
   payable: false,
   stateMutability: 'nonpayable',
   type: 'constructor' },
 { anonymous: false,
   inputs: [Array],
   name: 'votedEvent',
   type: 'event' } ]

I just want to obtain the values of the properties and call some functions. However, i cannot find the right way.
So far i tried (all lead to one error or another):

contractInstance.options.call((err, res) => console.log(err, res))

Error: Invalid number of arguments to Solidity function

contractInstance.addOption('Meeting on Saturday.')

Error: invalid address

contractInstance.methods.options().call().then(console.log)

TypeError: Cannot read property 'options' of undefined

    var result = contractInstance.vote(0, {from: web3.eth.accounts[1], gas: 5500000}).call((error, result) => {
    console.log(result);
});

Error: VM Exception while processing transaction: revert

I am using JavaScript and web3.js (0.20.2).
How do i create the contractInstance?

function deployContract(compiledContract, contractName, callback){
contractABI = getContractABI(compiledContract)
newContract = web3.eth.contract(contractABI)
byteCode = compiledContract.contracts[':'+contractName].bytecode
deployedContract = newContract.new([],{
    data: byteCode,
    from: web3.eth.accounts[0],
    gas: 4700000
}, function (e, contract){
      console.log(e);
      if (typeof contract.address !== 'undefined') {
          console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash);
            callback(newContract, contract.address)
      }
  });
}


texts: Does a token-transfer always have a value of zero?

texts:
Usually a token-transfer has a (ETH) value of zero and the amount is encoded in the input-data payload. Some projects even distinguish between normal and other transfers by checking for zero:

https://github.com/trezor/trezor-mcu/blob/master/firmware/ethereum.c#L341

The question is: is it enforced somewhere? Otherwise e.g. in the TREZOR example someone could hide a token-transfer by sending some ETH with it ..


texts: Eris Industries tutorial: Call contract object from other contract

texts:
In the Eris Industries tutorial, they present a banking and fund management contract system.

The FundManager controls the bank contract. I don't understand the following line from the deposit function used to check if the function call was successful:

bool success = Bank(bank).deposit.value(msg.value)(msg.sender);

Why Bank(bank) and what is it? The FundManager has an address bank attribute, instantiated by the constructor.

So, essentially, my question is:

Bank(bank): Get a reference object of type `Bank` at address `bank`
Bank(bank).deposit: call the `deposit` function on that object
Bank(bank).deposit.value(msg.value): What is happening here and what is returned?
Bank(bank).deposit.value(msg.value)(msg.sender): What is happening here?


texts: Why is a failed transaction included in the blockchain as a "failed transaction"

texts: According to this highest upvoted answer, "but still include it in the blockchain as a "failed transaction"... What is meant by the term "gas"?


texts:
I am trying to create a smart contract using the but it is showing warning message in a string

"Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
        uint256 initialSupply,
"


texts: How to resolve the function payable issue in ERC20?

texts:
pragma solidity ^0.6.6;

import "./ERCI20.sol";
import "./newERC20.sol";

   contract timeLock is ERCI20, newERC20 {

     address payable sender = msg.sender;
     address payable benificiary = 0x41194f140110F1D0C5DcE0e2Ef3fC385a38F319b;
     uint256 value = 5;
     uint256 releaseTime;

   function setReleaseTime(uint8 _days) external {
     releaseTime = now + _days * 1 days;
    }
   function release() public payable returns(uint256){
   //  require(block.timestamp >= releaseTime, "Time Error!");
     require((msg.sender).balance > value, "Sender Amount Error");
     require(benificiary != address(0), "Benificiary Address Error");

     //  msg.sender.transfer(value);
       emit Transfer(sender, benificiary, value);
       return (msg.sender).balance;
   }

}


texts: How does this 4-line labyrinth contract work?

texts:
contract Labyrinth {

  uint entropy;

  function getRandomNumber() public returns (uint) {
    entropy ^= uint(blockhash(entropy % block.number));
    return entropy;
  }

}

I found this weird gist online for generating random numbers. Please remember that, despite the code's comments (which i just removed), generating random numbers on-chain is insecure for values more than 2.5 ETH.

The blockhash function is supposed to accept inputs from 0 to 256, right...  I guess I am just wondering how the above function works, if entropy is a really big number, divided by block.number (another really big number), There's no guarantee the modulo will be less than 256? or is there?

Here's another question i just asked on this: What is the "^=" operator? . I did assume that's what the ^= operator did, but figured I must be misunderstanding it because the rest of the contract doesn't make sense.

Here's the contract source: https://gist.github.com/resilience-me/69d605844973df694c613ba71439a6fa


texts: eWASM vs PWASM: Are they complete independent? If so, in what ways are they different?

texts:
Understanding that eWASM is more like EVM 2.0 by replacing EVM with a subset of WASM instructions set.. What is the motivation of the PWASM project from Parity?

Notes:
https://medium.com/paritytech/why-we-believe-in-wasm-as-the-base-layer-of-decentralised-application-development-6196b8e3977e
https://github.com/aj07/design/commit/9d8ffee36f3b6c0fd4eb841c47183e4147c650b3

EDIT: https://youtu.be/_Nuw-hYjW64?t=1687
They are trying to achieve very similar things. But there is no official collaboration whatsoever at the moment.


texts: Remix - Contract creation initialization returns data with length of more than 24576 bytes. The deployment will likely fails). What can be done?

texts:
I get the following error when deploying my contract in Remix:

Contract creation initialization returns data with length of more than 24576 bytes. The deployment will likely fails.
More info: eip-170

The contract is divided to 2 contracts. A with 250 lines and B (B is A) with 500 lines. I also created a library and exported some of my functions to this library. I am currently uploading to Javascript VM environment. Worth noting that when I make the Enable Optimization checkbox on the Compile tab valid, it still doesn't work. I have a couple of questions:

1) How can I check the size of the data in Remix? I get an error that it is over 24kb, how can I check how much is it exactly?

2) What is causing this? Is this related to the length of the code or the amount of gas that is executed? If it's the gas, how come when I add a lot more gas to the gas limit in the Run tab in remix it still gives me the same error.

3) Any common ways to decrease the size of the data so I could actually deploy it?

Thanks


texts: What is the meaning of "Gas Used" on ethgasstation.info?

texts:
It's rather confusing cos when I googled "gas used" I don't get any exact result, NOT even from ethgasstation.info and most people are talking about transaction price, gas limit, etc.

So, does "gas used" mean gas limit represented in Gwei? Like 21,000 gas limit or is it the average gas used per transaction?


texts: Parity signer new-token unable to parity on the CLI

texts:
I had issues during the install and re installed the account.
It is asking for parity signer new-token that clearly needs to be entered o the command line.
This is installed on OSX, I can see the .parity folder but nothing of note in there. If I run a command such as parity -h (help) or any variation it is clearly not installed. Where is the CLI command run from?


texts: How do I get configuration variables (such as gasPrice) in a truffle test?

texts:
I learned from this answer that truffle configures gasPrice in truffle.js, defaulting to 100000000000.

I'd like to use gasPrice in a test, without hardcoding the raw number.  Is there any way to retrieve truffle's configuration variables?


texts: Using Oracle we can call scheduled functions. But is it possible to cancel scheduled function? I mean, for example, if I scheduled an function that updates something in my contract in 10 minutes but in 5 minutes I changed my mind, I don't need update something. In this case, can I cancel scheduled function?


texts: How can I store and read data from Etherum blockchain?

texts:
I'm doing a project and I want to store some basic information on Etherum, for example:
Name, ID, Height, Weight.
How can I store this on the blockchain and after that be availble to read it.
I read this How can I store data in ethereum blockchain                  and it says that I would need to create a contract and deploy it on the blockchain.

How can I do this? I only find tutorials of programming smart contracts for sending/recieving coins.


texts:
I was thinking about situation where for example NSA would want to gain control over significant portion of Ethereum network.

How much would it cost to for example create mining pool that would be able to perform 51% attack?
Could they use some existing infrastructure? For example https://en.wikipedia.org/wiki/Titan_(supercomputer) - I picked this one as it was top result for supercomputer gpu on google..

If you look at Utah data center NSA was OK with spending 1.5 billion dollars on some kind of data center that we don't know that much about.


texts: Ethereum client - minimum for sending transaction

texts:
Requirement:

Reliably send Ethereum transactions
Be connected to main nodes directly (speed)

Limitations:

Disk size (20-40 GB)

Given this, what is the recommended configuration to run an ethereum node?

geth --fast Takes too much space. So does parity --pruning fast.
geth --light only connects to light clients and therefore is not entirely reliable.

geth --warp Gets you to a point where you can send transactions in a few GBs of space but the blockchain does keep syncing and eventually takes too much space.

Suggestions? What is actually required for an ethereum node to send transactions?


texts:
i have this contract: https://0bin.net/paste/HELe1bA6#57cIhOxKhJDpqh56tzBb9SYzsh4MraWkbL+2AslB5Nc
How can I do a foreach in mapping _balances ?
I need to share the balance with everyone who has the token, I think about doing it in foreach, but if you have another better option, please talk


texts: Initialize function is not invoked during deployment of upgradeable contract

texts:
This is initialize function of my upgradeable contract
contract MyContract is
     Initializable,
     ERC20PresetMinterPauserUpgradeable,
     OwnableUpgradeable
{
    function initialize(string memory _name, string memory _symbol)
        public
        override
        initializer
    {
        emit ContractInitStarted(_name, _symbol, msg.sender, block.timestamp);
        __ERC20PresetMinterPauser_init(_name, _symbol);
        __Ownable_init_unchained();
        _mint(msg.sender, 500000000 ether);
        emit ContractInitEnded(_name, _symbol, msg.sender, block.timestamp);
    }
}

This is 2_deploy_contracts.js
const MyContract  = artifacts.require("./MyContract .sol");

const { deployProxy } = require("@openzeppelin/truffle-upgrades");

module.exports = async function (deployer) {
  await deployProxy(MyContract , ["MyContract  1.0", "TenX"], { deployer, initializer: "initialize" });
};

npx truffle deploy --network rinkeby

Initialize function is never invoked.
Events not triggered
symbol, name, and totalSupply are empty
Perhaps, I must look into AdminUpgradeabilityProxy
But not sure
Those are contracts in etherscan:
My address:
https://rinkeby.etherscan.io/address/0x860fa46f170a87df44d7bb867aa4a5d2813127c1
Last 4 transactions for contracts:
https://rinkeby.etherscan.io/address/0x6f8dc56c88112cdaedee8610bdb5caf601c145de
AdminUpgradeabilityProxy:
https://rinkeby.etherscan.io/address/0xe97ef53dd413729425317a768a0ba425831c5107
ProxyAdmin:
https://rinkeby.etherscan.io/address/0x857411020c5e2b540fdd6c5ed0a4faeb678ef280
Implementation:
https://rinkeby.etherscan.io/address/0x2e4cd3fd7ed77a278d118b95e4bef5b7079367da
Token:
https://rinkeby.etherscan.io/token/0xe97ef53dd413729425317a768a0ba425831c5107


texts: When a smart contract is deployed, is its source code publicly viewable?

texts:
When a smart contract is deployed to the blockchain, is the source code then publicly viewable to all participants? For example, what you see here in Etherchain. I am aware that there are some contracts in there with source code provided as no, but I just want to confirm.

Thanks in advance!


texts: Infura - Signing transactions in a multi-user application

texts:
I hope this question is not a duplicate. Since I'm using Infura as a full node, I need to send raw transactions by signing them.

In a multi-user application how would my application on the server-side sign transactions on the respective user's behalf. Saving every user's private key sounds unsafe. Would appreciate any concrete examples or sample source code on how to do this. TIA.


texts: Fail with error 'TransferHelper: TRANSFER_FROM_FAILED' when transfer to other wallet

texts:
I was able to make a first transaction since I needed to send my tokens to DxSale, I need to send a small amount to DxSale, I am trying from Metamask but now it does not allow me to make any transactions, they all fail.
This is the contract: https://bscscan.com/address/0x3bc4d18ad49641ef1c626e17e742a33bbf7c4dc1

This is the Hash: https://bscscan.com/tx/0x69803a5806b07867dc65da379fa19bb412950f7dea65fe0d4e78c2ada77cff79


texts: Ethereum out of gas, will it be returned?

texts:
I sent some ether from my Nano Ledger S yesterday to Bittrex and it says the transaction ran out of gas. Will I receive these funds back or are they gone forever? Was an entire eth this happened with.

TXHash:  0x27bfcf895eff84b898971e30a7ec4e6f251b19de6d292a6e26bcd729ea78c6ce


texts: How do I write to (invoke) a contract with arguments from Ethereum Wallet?

texts:
I'm trying to use the BirthdayGift contract within Ethereum Wallet, and am not seeing how to do so. The UI was hidden and with help from Christopher I expanded the window to see the UI for invoking the contract. The problem is I cannot set the two inputs before running it. They are shown in the Read section but I expected them to be editable, and possibly in the Write section.

I am not attached to this contract, I just want to write to some contract from Ethereum Wallet.


texts: How do I get the number of elements in a mapping?

texts: Is there a way for me to get the total number of elements in a mapping in Solidity?


texts:
around 2018-04-14 I opened an eth wallet, which I am positive was with MetaMask. I have found a file on my computer that contains a 29 word seed phrase. I saved this file and labeled it "Do not delete, eth seed phrase". My issue is that no provider seems to have a 29 word seed phrase.
I've tried everything I can at this point to try and recover the seed phrase by other means like my AppData folder but I cant find anything helpful.
Is there any way I can make use of this seed phrase I saved? Maybe with an older version of MetaMask or some other provider which uses that long of a phrase? Can I convert the longer phrase into a shorter one?
Thanks for the help :)


texts: How could I return 'gasUsed' inside populus?

texts:
I am using populus to experiment my contract. I want to return only gasUsed for my transaction but it returns complete summary of the transaction.

[Q] How could I obtain only gasUsed value or should I retrieve that value by trimming the string from the output.

test.py:

   def test_linkedlist(web3, accounts, chain, unmigrated_chain):
       my_contract       = unmigrated_chain.get_contract('Receipt');
       set_txn_hash     = my_contract.transact().push( 10, 20, 32 );
       receipt_txn_hash = unmigrated_chain.wait.for_receipt(set_txn_hash)

       print( receipt_txn_hash ); || print( web3.eth.getTransactionReceipt("0x1139cca78666519a834cf40670faa4f01324a04f0ec4e6072863bf4812598a5f") ); #both give the same output.

Output:

tests/test_greeter.py No handlers could be found for logger "testrpc.rpc"
/usr/local/lib/python2.7/site-packages/secp256k1/__init__.py:228: UserWarning: implicit cast from 'char *' to a different pointer type: will be forbidden in the future (check that the types are as you expect; use an explicit ffi.cast() if they are correct)
  self.ctx, res_compressed, outlen, self.public_key, compflag)
{'contractAddress': None, 'cumulativeGasUsed': 114325, 'logs': [],
'blockHash': u'0xda17ffe52e074957420554fbf2e3fb86d1ff81db989c6bb50d22a88850ee9495',
 'transactionHash': u'0x1139cca78666519a834cf40670faa4f01324a04f0ec4e6072863bf4812598a5f',
'blockNumber': 4, 'transactionIndex': 0, 'gasUsed': 114325}

I want to return only: 114325 ___________________________^

Thank you for your valuable time and help.


texts:
Alethone finished synchronizations, the clircles were all full grey and green, then it started hashing showing numbers around 20. However, nothing is added and it shows zero wei.

I did that for a week, then upgraded ans it is still the same...

Any idea what is wrong?

Thx


texts:
I purchased some FunFair tokens today and sent them to MyEtherWallet. I now want to send those tokens back to an exchange and don't have any Ether in my account. I had no idea I needed 0.001 Ethereum to send a few bucks of tokens out of MyEtherWallet. The tokens aren't even worth 0.001 Ethereum.

Any help on what I can do would be really appreciated.

Thank you.


texts: What is the best practice of a Dapp development mixed with Python/Django?

texts:
I've written and tested the Smart Contracts in Truffle, and now want to develop a front-end and a small back-end for my Dapp. So far, I preferred MVP frameworks, particularly Django. Therefore, what is the best practice of setting up a small back-end on Python with MongoDB (to store texts and images) by using Django and linking it to the Ethereum network?
I'm having a hard time to building the architecture of how everything will be glued together...


texts: I started mining two months ago and within about two weeks of starting I ramped up to 5 GPUs.  My first 3 payouts occurred about every 10 days, but the last two have taken 12 days and now the portal shows 14 days until the next payout.  My reported hashrate has not changed.  I assumed that as difficulty increased hashrate would decrease and it would take longer to payout.  But since my hashrate is the same I'm not sure why my payout is different.  Is the cause the increase in difficulty?  Thanks.


texts: Best Resource for Intense Solidity Coding (In May 2018)

texts:
Learning Solidity seems like it's constantly in flux. Some code I had written previously is no longer cool (example: declaring the contract name in the function is no longer bueno!)

As of right now, where would a Pretty Good Code Writer (get it?) go to have a boot camp, intense, trial by fire, shame you if you suck, course?

Currently, I've only found the following (my comments on them included).

https://ivanontech.teachable.com/p/blockchain-fundamentals
Ivan is a funny dude and passionate about the technology so this might be a win. But it hasn't started yet. Plus this looks a little elementary. I'm a HARD CORE wannabe -- I know what a hash is, I know what a variable is, I know the difference between "integer" and "Boolean", I can write if- and/OR statements)

https://www.udemy.com/blockchain-developer
This one has been around for awhile.  I know this because I enrolled in it in mid 2017. It's done a decent job of keeping up, but honestly these poor guys are only getting a couple bucks an enrollment... It costs $9.99 to enroll!! That's outragous! I wouldn't be inspired to keep it up to date. If I were to recommend one, this would be it, but again it lacks the passionate "here is our course, do it or you suck!" attitude.

https://blockgeeks.com/guides/solidity/
This one turns up #1 on google searches but it just lists off a bunch of examples. I know this sounds ridiculous, but I'd rather spend money, get some dude to give me some web exercises, and then publicly humiliate me when I don't do them.

https://learnxinyminutes.com/docs/solidity/
This seems more like a cure for insomnia than something I could actually learn from. However it does come highly recommended by Google and if I weren't typing this while being poisoned by a bartender, then this might actually be useful.

Okay but seriously (as if any of you were not taking this seriously to begin with!). Where can I go to spend like $100, and get an intense course that kicks my brain around? There are all kinds of javascript courses like this as well as other languages.

Business idea for someone? Customer number 1 is waiting to signup!


texts: Are there any raffle smart contracts and platforms for NFTs?

texts: Instead of smart contracts that do auctions, is there any website or DApp that facilitates smart contracts for raffles? For example, a number of participants submit an entry payment, and the smart contract randomly selects one of the entrants as the winner whose money is taken, at which point the other participants are refunded their entries


texts:
How can I check simplest way am I synced with blockchain? When I executed geth attach command and typed in:

100 * eth.syncing.currentBlock / eth.syncing.highestBlock

The outcome sounds about 99.99335...

For an hour I'm waiting on the same block which is not equal to highest block. Should I still wait or am I already synced an I'm able to start mining?


texts: How does Etherscan know the uncompiled contents of contracts?

texts: How is possible for Etherscan to know the Solidity source code of contracts such as this one https://etherscan.io/address/0xab7c74abc0c4d48d1bdad5dcb26153fc8780f83e#code? They wouldn't be able to reconstruct it from the compiled code that's in the blockchain?


texts: Increase gas limit to allow larget contracts to be deployed

texts:
I'm working on a private blockchain and I found out that I cannot deploy a contract larger than 34Kb which is pretty limiting for me. For comparision, cryptokitties are 40-47Kb so I cannot even deploy digital kitties!

Here is part of my chains.json that corresponds to the gas limits:

  "params": {
    "maximumExtraDataSize": "0x20",
    "minGasLimit": "0x1388",
    "networkID": "0x2323",
    "gasLimitBoundDivisor": "0x400"
  },
  "genesis": {
    "seal": {
      "authorityRound": {
        "step": "0x0",
        "signature": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
      }
    },
    "difficulty": "0x20000",
    "gasLimit": "0x165A0BC00"
  },

If I understand that correctly I have a limit 0x165A0BC00 which seems to be pretty big and non-limiting. However, in practice it doesn't work.

How can I enhance network settings to make it possible to upload contracts up to 50-60Kb? I currently send 4600000 gas for every transaction.

Error when I'm trying to supply more gas:

  Message: Nethereum.JsonRpc.Client.RpcResponseException : Transaction
  cost exceeds current gas limit. Limit: 4700000, got: 46000000. Try
  decreasing supplied gas.

When I'm supply regular amount of gas

  Message: Nethereum.RPC.Eth.Exceptions.ContractDeploymentException : Code not deployed succesfully


texts: How to do approve and transferFrom for Ether?

texts:
With regular ERC20 tokens we have method approve(to, amount) and so I can approve to someone to take specified amount of my tokens later with transferFrom(from, to, amount).

Is there any way to approve Ether to be taken from my account?


texts: Verify the ownership of an ethereum account

texts:
I have built a web game where users can purchase virtual items for their avatar with tokens obtained during an ICO.

What is the best solution for delivering the items to the correct web game user? I can imagine 4 solutions (1A2A, 1A2B, 1B2A and 1B2B) that all require an off-chain backend component.

1A) off-chain backend with own Ethereum account generation

the web game backend creates an ethereum account when a user signs up and connects the private key to his account.
the user can then send ETH to this new address to 'top up'.

1B) off-chain backend without own Ethereum account generation

During signup the user has to register a wallet id with his off-chain web game account. He receives a random challenge, then needs to sign it (somehow) and submit the address, the signed message and the signature in a webform to the backend where the signature is verified.
Upon successful verification, the wallet id is added to the web game account of the logged-in user.
The user can henceforth 'top up' his web game account by paying from his registered account to the web game account address (same address for all users).

2A) on-chain frontend (dapp)

Purchases are done by sending ItemTokens together with item ids to the web game's smart contract on Ethereum (for example from a 3rd party wallet)
The smart contract checks whether the type and amount of items add up to the total value of the transaction and then either rejects the transaction or...
accepts the transaction and writes item amount and type into the smart contract state (as item inventory)
the web game frontend checks the blockchain, calculates the web game token balance for the logged-in user and makes items available in the game as they appear on the blockchain.

2B) off-chain frontend

The web game backend periodically keeps track of blockchain payments (they're public) and updates the user's web game balance accordingly.
purchases are done in the web app UI, and the cost is subtracted in the web game backend, and items are made available.

My questions:

Are these processes correct, implementable and safe?
are there other, better or different purchase processes possible
Is there a way a wallet can be safely connected with a user account entirely without the use of an off-chain backend (and also without browser extensions such as metamask)?


texts:
I created a VM instance on Microsoft Azure using its Go Ethereum template. The node is running and syncing. However it does not allow me to access remotely. I ran geth attach on my local computer and got the following error:

  Fatal: Failed to start the JavaScript console: api modules: Post http://104.201.38.85:8545: dial tcp 104.201.38.85:8545: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

My parameters are geth --rpc --rpcaddr 0.0.0.0 --rpcport 8545. This should allow external access. I also checked security group and the inbound port 8545 is open. What is the reason that I cannot connect?


texts: I am newbie here,I need some help in retrieving one particular use using a userid, how do we do that as per below code?

texts:
struct Rider{
    //address riderAddr;
    uint rider_Id;
    bytes32 Rname;
    bool set;
}

mapping(address => Rider) public riders;

function registerRider(address _riderAddr, uint _riderId, bytes32 _riderName) public {
    Rider storage rider = riders[_riderAddr];
    //Already registered or not!
    require(!rider.set);
    //store rider data record
    riders[_riderAddr] = Rider({
        rider_Id: _riderId,
        Rname: _riderName,
        set: true
    });
}


texts: Same functionality, new contract for new usage?

texts: When different people use the same contract functionality, do they send to the same contract address? Or do they create their own new copies of the contract at a different address? If they use the same address, how does the network distinguish the different parallel usages?


texts: Is there anywhere an access to crowdsale data gathered in a similar way as this kicsktarter data -- https://webrobots.io/kickstarter-datasets/ ?


texts: I created a wallet contract, sent ether to it and now cannot send to another account

texts: While experimenting. I creating a wallet contract. Here is the address: https://etherscan.io/address/0xC23501aB1E8E5C5EDB0fFA83C5A4DcFb9c31a355 I sent some ether to it. Now I want to send the ether from the wallet contract to a different account. I go to send, I input amount, check the gas, when I press send. The amount shows 0. I think I did something wrong with the creation of the wallet contract in Mist.


texts: How can you check if a `string` is empty in Solidity

texts:
How can you check if a type string is empty in Solidity?

For instance this would work when testing if a string was initialized to have no characters:

string public emptyStringTest = '';

or when you would like to test if a mapping(bytes32 => string) has a key that is initialized.

mapping(bytes32 => string) emptyStringTest;


texts: Solidity: Not able to call super function in trufffle test may be because of modifier defined

texts:
When I am testing my class with truffle test ./test/testinheritance.js I am getting an error. "Error: VM Exception while processing transaction: revert".

It seems to be error related to the condition that a function setHeir must be called by owner.
I am not sure how to set/get/check owner in test script so that I can test the contract.
Please help me to test this contract via script.
The test script is

The test script is

var DormantAssetFactory = artifacts.require("./DormantAssetFactory.sol");
var DormantAsset = artifacts.require("./DormantAsset.sol");
var dormantAssetAddress = null;

contract('DormantAssetFactory', function (accounts) {
  it("Let's call Heir function contract", async function () {
    var dormant_asset_factory = await DormantAssetFactory.deployed();
      (await dormant_asset_factory.newDormantAsset());
    //now get the Address of first contrac /This is not correct way but to show error
      dormantAssetAddress =
      (await dormant_asset_factory.getDormantAssetAt(0));

      var contractInstance = DormantAsset.at(dormantAssetAddress); //get contract at address
      //Call function of parent of current contract
//      console.log(contractInstance);
      var result =
      (await contractInstance.setHeir(accounts[1]));
      //Just temp conditions
    assert.equal(1, 1, "Yes we called setHeir");
  });

    });

    Factory class is  DormantAsstFactory

pragma solidity ^0.4.18;
import './DormantAsset.sol';
contract DormantAssetFactory {
  // index of created DormantAsset contracts
  address[] public dormantAssets;
  uint256 public _heartbeatTimeout =1000000;
  function getContractCount()     public    constant    returns(uint contractCount)
  {
    return dormantAssets.length;
  }
  // deploy a new contract
  function newDormantAsset()    public     returns(address _newDormantAssetContract)
  {
    DormantAsset c = new DormantAsset(_heartbeatTimeout);
    dormantAssets.push(c);
    return c;
  }

    }

This contract created inside factory and it is inherited from this contract
https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/ownership/Heritable.sol

Contract Class is

pragma solidity ^0.4.18;
import 'zeppelin-solidity/contracts/ownership/Heritable.sol';
contract DormantAsset  is Heritable {
  event Sent(address indexed payee, uint256 amount, uint256 balance);
  event Received(address indexed payer, uint256 amount, uint256 balance);
  function DormantAsset(uint256 _heartbeatTimeout) Heritable(_heartbeatTimeout) public {}
  function () public payable {
    Received(msg.sender, msg.value, this.balance);
  }
  function sendTo(address payee, uint256 amount) public onlyOwner {
    require(payee != 0 && payee != address(this));
    require(amount > 0);
    payee.transfer(amount);
    Sent(payee, amount, this.balance);
  }

    }


texts:
When I create the child class object and try to access value of msg.sender from parent class it always comes 0. Can anyone please help me in this? Below is the sample code:

contract Test1 is Test2 {

    constructor() Test2() {}
}

contract Test2
{
    address testVal;
    constructor()
            {testVal= msg.sender;    }

   function getMSGSender() view returns ( address) {
     return testVal;
   }
}


texts: What do I have to do to call this events to be display on the web page?

texts:
How do I call showLottery to display on my webpage?

Front-End

class App extends React.Component {

  state = {
    address: '',
    lottery: '',
    events: '',
  }

  async componentDidMount() {

    await window.ethereum.enable()
    this.w3 = new Web3(window.ethereum)
    const address = (await this.w3.eth.getAccounts())[0]
    this.setState({ address })

    this.contract = new this.w3.eth.Contract([
      {
        "constant": false,
        "inputs": [],
        "name": "implement",
        "outputs": [],
        "payable": false,
        "stateMutability": "nonpayable",
        "type": "function"
      },
      {
        "anonymous": false,
        "inputs": [
          {
            "indexed": false,
            "name": "_lottery",
            "type": "uint256"
          }
        ],
        "name": "showLottery",
        "type": "event"
      },
      {
        "constant": true,
        "inputs": [],
        "name": "num",
        "outputs": [
          {
            "name": "",
            "type": "uint256"
          }
        ],
        "payable": false,
        "stateMutability": "view",
        "type": "function"
      }
    ], "0xF666108e057d5CA30a962eEf43Ef25ff52b70364")

    const lottery = await this.contract.methods.num().call()
    this.setState({lottery})

  }

  async randLottery() {
    await this.contract.methods.implement().send({from : (await this.w3.eth.getAccounts())[0]});
  }

  render() {
    return (

Address KUU: {this.state.address}

        <button onClick={this.randLottery.bind(this)}>Rand</button>

Lottery Number: {this.state.lottery}

History Number: {this.state.events}

    );
  }
}

Smart Contract

contract testRand {

    uint256 public num;

    event showLottery(uint256 _lottery);

    function rand() private view returns (uint256) {
       return uint256(keccak256(abi.encodePacked(block.difficulty, block.timestamp, now , block.coinbase)))%(10**6);
    }

    function implement() public {
        num = rand();
        emit showLottery(num);
    }

}


texts: Invalid JSON RPC response: {"id":6,"jsonrpc":"2.0"}

texts:
I'm following this tutorial
 https://medium.com/@ConsenSys/a-101-noob-intro-to-programming-smart-contracts-on-ethereum-695d15c1dab4

I have downloaded the code from github repo.
I'm using ganache as a client
when I do truffle deploy

i get that rpc erreur


texts: Indexed arguments can't be retrieved, why?

texts:
Indexed arguments will not be stored themselves. You can only search
  for the values, but it is impossible to retrieve the values
  themselves.

This is a quote from the following docs:

http://solidity.readthedocs.io/en/develop/contracts.html?highlight=topic#events

What does this mean? If I have the log object I can see the topics thus can see the indexed values..

i.e. this is an example log object, I can see the topics here: (topics = indexed arguments)

{'logIndex': 0, 'transactionIndex': 0, 'transactionHash': HexBytes('0x473921c06e0dc928bb81455406f0436489ffabbb51f3be079b9709ddb132e933'),
'blockHash': HexBytes('0x8973f427b65c73d7fc9ead31219046bca9ec8ee82f8126d0441f3a99fa6856df'), 'blockNumber': 9, 'address': '0x345cA3e014Aaf5dcA488057592ee47305D9B3e10', 'data': '0x0000000000000000000000000000000000000000000000000000000000000001',
'topics': [HexBytes('0x6a0adf17eb20399b431dc509145e9448c952cb299ead47af739fed7289c553f5'), HexBytes('0x000000000000000000000000627306090abab3a6e1400e9345bc60c78a8bef57'), HexBytes('0x000000000000000000000000f17f52151ebef6c7334fad080c5704d77216b732')], 'type': 'mined'}


texts: If I modularise a contract into two contracts, and inherit one of them instead using a monolithic approach, will the deployment costs be larger with two contracts or is the cost the same as with the monolithic approach?


texts:
I am trying to compile the create op code example in here Create new contract via .call(). But it fails:

execute.sol:17:19: Error: Identifier not found.
            jumpi(invalidJumpLabel,iszero(extcodesize(addr)))

Looks like invalidJumpLabel mysteriously disappeared from the solidity docs from 0.4.9 to 0.4.10. Couldn't find anything in the solidity git history referencing such changes. Any idea how I can get that contract compiling with the same functionality? Is there a new label other than invalidJumpLabel I can use?


texts: Can I call mapping as arguments of function?

texts:
I'd like to call mapping as arguments of function. I've tried the following code, but it returned the error. Could I call mapping as arguments as a function?

mapping ( uint256 => mapping (bytes32 => bytes32)) public users;

function add( uint256 id, bytes32[] list, mapping ( uint256 => mapping (bytes32 => bytes32) table){
    for( var i=0; i< list.length; i++ ){
        table[id][list[i]] = list[i];
    }
}

  Error: Type is required to live outside storage.
      function add( uint256 id, bytes32[] list, mapping ( uint256 => mapping (bytes32 => bytes32)) table){
                                                   ^------------------------------------------------------^ Error:
  Internal type is not allowed for public or external functions.
      function add( uint256 id, bytes32[] kv_list, mapping ( uint256 => mapping (bytes32 => bytes32)) table){


texts: Which open source ethereum blockchain explorer is the best for private chain?

texts:
I have got eth-net-stats deployed with my private ethereum chain, but apparently it's far from being a real blockchain explorer.
Are there any good open source blockchain explorers for private ethereum exists?
Which one do you think is the best?
Thank you!


texts: ERC-20 token like rewards points: earn and lose them

texts:
I'm developing a point system and I'd like to do it with ERC-20 tokens...
All clear for me to "distribute the points/tokens" to wallet addresses that perform certain tasks, but then, my business rule, also have "penalty", where wallet address should loose points/tokens...
How can I achieve this? When I distribute a token, it cannot be "removed" from a third party address..
Right?
What would you do?
Thank you


texts:
I seem to have trouble finding good resources demonstrating how to set up conditionals with the correct syntax.  I thought I had it right, but this code does not work.  I used other examples of conditionals as a guide and am not sure what I missed here.

function changeTruckStatus(address _address) onlyMember public {
    if (truckowners[truckAddrIndex[_address]].active == true) {
        truckowners[truckAddrIndex[_address]].active == false;
    } else {
       (truckowners[truckAddrIndex[_address]].active == true);
    }
}


texts: can a running blockchain fork from PoW to PoA?

texts: can a running public blockchain hard fork from PoW to PoA?


texts: Linter Error: `assert(this.f.address == address(this));`

texts:
While learning solidity, I copy-pasted this code from: https://docs.soliditylang.org/en/v0.8.4/types.html
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.6.4 <0.9.0;

contract Example {
    function f() public payable returns (bytes4) {
        assert(this.f.address == address(this));
        return this.f.selector;
    }

    function g() public {
        this.f{gas: 10, value: 800}();
    }
}

Linter: Parse error: extraneous input ')' expecting ';' [undefined]

I'm using VSCode, with solidity version: 0.0.113, and solc version: 0.8.4+commit.c7e474f2.Darwin.appleclang
In Remix, I don't see this error (with same solc version):

What is this error and how can I fix it?


texts:
So I'm new to this and trying to create contract to store Medical data.
Is there a preferred limit to store data on the blockchain?
And all of my function's gas requirement is over the limit. Is if because of the larger records? I have tried making smaller structures but still have same warnings.


texts: Is a PoW-based Ethereum private chain a permissioned blockchain?

texts: If I creat a ethereum private chain through geth. Is the Ethereum private chain a permissioned blockchain?


texts: How to print transaction details like block number and other input parameters on front end?

texts:
My problem :
I want to show transaction details like block hash , block no and input parameters.
but it was showing that metamask does not support callback. our function is not waiting till transaction got mined and it enters into else part.
how to solve it?

<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>

    <link rel="stylesheet" type="text/css" href="../script/main.css">

INSTAFER

APPROVE

        Address to be approved
        <input id="address" type="text">

         Maximum Amount
        <input id="amount" type="number">

        <button id="approve" style="height:50px;width:200px">Approve now</button>
        <input type="button" style="height:50px;width:200px" id="homebutton" value="Home" onClick="location.href='../index.html'" >


texts: How to make sure the transaction is not included in uncle block

texts:
If a transaction is included in the uncle block, neither the sender would be deducted nor the receiver would gain, is that right?

Most clients or platforms use 12 confirmations, how would this makes sense? From my understanding, confirmation is the latest block height number minus transaction block height. Then as the main chain grows, the confirmation would eventually reach 12, is that right? For example, the uncle block height is 10000, the main block height would eventually be above 10012.


texts:
The contract intends to create a set of tasks dynamically, eg: tasks can be added(There is no need for deletion.)
Some tasks will be related by a variable within the struct called smart contract
Each of this task should be assigned to every user that calls update.
Finally The smart contract will have a function to iterate through all the addresses that have called update.

So far I have managed to be able to create tasks on command, and I can edit variables. I how ever have not managed to set it up so that each user owns its own array. Currently when I call get task, I just get the latest one created so I messes up somewhere else too, though I cant seem to find where.

So I have to be missing something. Any pointers are appreciated.

/**
 * @title Ownable
 * @dev The Ownable contract has an owner address, and provides basic authorization control
 * functions, this simplifies the implementation of "user permissions".
 */
pragma solidity ^0.4.25;

contract Owned {

    address public owner;

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

  /// @notice modifies any function it gets attached to, only allows the owner of the smart contract to execute the function
  modifier onlyOwner(){
    require(msg.sender == owner);
    _;
  }
}

///The contract intends to create a set of tasks dynamically, eg: tasks can be added(There is no need for deletion.)
///Some tasks will be related by a variable within the struct called smart contract
///Each of this task should be assigned to every user that calls update.
///Finally The smart contract will have a function to iterate through all the addresses that have called update.

contract taskListContract is Owned {
    address public receiver;

    struct task {
        string iName;
        uint16 taskId;
        address smartContract;
        bool iValue;
    }

    uint taskCount;
    mapping(address => task) taskList;
    task[] taskArray;

    function addTask(string name, uint16 id, address code) external onlyOwner{
        receiver = msg.sender;
        task memory tasknew = task(name, id ,code, false);
        taskList[receiver] = tasknew;
        taskArray.push(tasknew);
        taskCount++;
    }

    function updateUserTask(bool _value) public{
        task storage individualUser =taskList[receiver];
        individualUser.iValue = _value;
    }

/**                 TODO
 *  update all the users at the same time
 *  0xe3b819b9d1356bbbce0000ee1251d04d8bce60a1
 *
 *  function updateAllUserTasks() public{
 *      receiver = msg.sender;
 *      userTaskList(receiver)
 *
 *  }
 */

    function countItemList() public constant returns (uint count)  {
        return taskCount;
    }

    function removeTask() external onlyOwner {
        delete taskList[msg.sender];
        taskCount--;
    }

    function getTask() public constant returns (string iName, bool iValue, uint count)  {
        return (taskList[msg.sender].iName, taskList[msg.sender].iValue, taskCount);
    }
}


texts: I am running am ethereum node and I'd like to calculate the exchange rate of any token into USD, without using any external API. How do i accomplish this?


texts:
I noticed the decimal of usdt is 6. That means the constructor parameter is 6 for decimal.
How do I deal with it in ethers.js?


texts: Example .eth domains that actually resolve to a website, or act as a store front?

texts:
.eth domains act as address masks for wallets, and can also resolve to decentralized websites. Despite all the clamor to buy .eth domain names, I have not seen a single website with the suffix .eth that works. I'm using Opera for smart phone
could anyone link to a functioning .eth website? especially interested in seeing one that solicits payments or acts as an e-commerce store front.
We all know what the most popular .com address is, but what is the most visited .eth site?


texts:
Trying to write a quick function to withdraw ETH from my contract - it's not working.
Here's the code:
function withdrawEntireBalance() payable external {
    require(msg.sender == contractOwner, "ERROR! Only Contract's owner may call!");

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

When I say it's not working I don't mean that it's throwing errors. On that contrary: it compiles perfectly, it runs - it's just plain not doing what it's supposed to be doing. It does nothing.
I also created a getContractBalance() function just so I can query the Contract and make sure it actually has some ETH in its balance:
function getContractBalance() external returns(uint256 theBalance) {
    return address(this).balance;
}

This function works perfectly well and I'm able to verify with 100% certainly that the Contract does indeed have ETH in its balance when I'm trying to withdraw that balance.
Here's a sample output:
'getContractBalance' result is: 14700000000000000
I also tried some alternative code for the withdrawEntireBalance() function - after having read all sorts of posts re security issues and minimum gas costs increasing (potentially causing the traditional transfer() and send() methods normally used for this sort of operation to fail) - it didn't work either. I'm including it here anyway so you can see what I'v gone through:
    // Alternative code:
    (bool success, ) = msg.sender.call.value(address(this).balance)("");

    require(success, "ERROR!!!! 'withdrawEntireBalance()' - Transfer failed.");

Any ideas what's going on here?
=================
UPDATE:
As requested, here's how I'm calling my withdrawEntireBalance() method in my javascript code:
cashOut: function() {
    console.log("\n\n=================\n==> in 'cashOut()'!");

    var cashoutYo = jsApp.appContractInstance.methods.withdrawEntireBalance().call({from: jsApp.defaultAccount},
      function(error, result) {
        if (!error) {
          console.log("Back in 'withdrawEntireBalance'!!!  No ERRORS!!!");
          // jsApp.contractOwner = result;
          console.log("CashOut result is: " + result);
          console.log("CashOut result KEYS = " + Object.keys(result));
          console.log("CashOut result VALUES = " + Object.values(result));
        }
        else {
          console.log("ERROR!!! from 'withdrawEntireBalance()' -->\n" + error);
          console.log("Error KEYS = " + Object.keys(error));
          console.log("Error VALUES = " + Object.values(error));
        }
      });

    console.log("\n\n=================\n==>EXITING 'withdrawEntireBalance()'!");
  }


texts: How much gas and gasPrice to set when signing a transaction?

texts:
const params = {
    to: '0xdbC0d76Fb1f2399b618FB29922dBC5cf763dd3d7',
    from: dbDeposit.depositAddress,
    value: balance,
    gas: 2000000,
    gasPrice: '234567897654321',
    nonce: 0
  };
  console.log(params);
  return web3.eth.signTransaction(params, myPrivateKey);

That's my code and I'm actually unsure as to how much gas and gasPrice to set. I understand that gasPrice is sort of an upper limit and gas is how much miners get to keep?

So how do I go about figuring out how much of each?


texts:
I am little confuse in the concept of Gas Estimation and price. When i add new user i get popup through metamask for the transaction amount and gas used which is totally fine.

I checked my code in the remix. When i see details the function which are purely reading data or returning the array length of user also use some Gas estimation like function name "totalInvestorInvestment" and "totalLoans". Where as "totalInvestedAmountInLoan" has gas estimate of Infinite its because I am using "For" loop.

1) So how this Gas estimation work as i read that reading data in blockchain is free, so if its free how that Gas usage is paid by the function "totalInvestorInvestment" and "totalLoans"?

2) And is there any limit for the usage of Gas in reading data which is free?

3) Is it good practice to use for loop? To avoid large data set i am also storing the indexes in array and using for loop on that array.


texts: How to make Ethereum storage more efficient?

texts:
I have coded the contract -

pragma solidity ^0.4.18;

contract CollegeAdmin {
    uint public studentAge=18;
    uint public studentIncome=15000;
    uint public studentScore=4;
    uint public studentAttendance=96;
    event changedAge(uint age);

    function setAge(uint age) public {
        studentAge = age;
        changedAge(age);
    }

}

And in testing I find -

  eth.getStorageAt(con.address,0)
      "0x000000000000000000000000000000000000000000000000000000000000005a"
  eth.getStorageAt(con.address,1)
      "0x0000000000000000000000000000000000000000000000000000000000003a98"
  eth.getStorageAt(con.address,2)
      "0x0000000000000000000000000000000000000000000000000000000000000004"
  eth.getStorageAt(con.address,3)
      "0x0000000000000000000000000000000000000000000000000000000000000060"
  eth.getStorageAt(con.address,4)
      "0x0000000000000000000000000000000000000000000000000000000000000000"

There is obviously a lot of wasted storage. Is there a way to avoid so much waste. Is this a matter of coding structs or coding different types of integer?

I want to eliminate storing so many leading zeros in the storage.


texts:
I'm trying to return a dynamic array of structs created on the fly from storage data, similar to how we return ViewModel from DB data in MVC. What is the best way of doing it in Solidity?

Tried creating a dynamic memory array, but couldn't use push.
Tried creating a dynamic storage array, but it said, Uninitialized storage pointer.
If I declare the output array on the contract level, it won't let me push, because it would modify the array.


texts: How to Set the gas limit for the Genesis.json in a Private chain?

texts: I want to know on what  basis the gas limit is set I have some of the contracts to be implemented in a private which for which i used a genesis block with gas limit 2100000 , but while deploying the contract using truffle it showed me gas limit exceeds


texts: rinkeby faucet unsupported service error

texts: I pasted the url of the facebook post and when I selected the amount of ether then this message is shown.


texts: web3 on react-native : Error: Returned error: insufficient funds for gas * price + value

texts:
using web3@1.0.0-beta.33 and react-native@0.59.10, because latest web3 have install issue on react-native, after deep research 1.0.0-beta.33 is suitable on react-native
const web3 = new Web3("https://mainnet.infura.io:443");
var count = await web3.eth.getTransactionCount(this.state.selectedWallet.publicaddress);
var contractdata = new web3.eth.Contract(abiArray, SensitiveInfo.tokencontract);
var rawTransaction = {
    "from": this.state.selectedWallet.publicaddress,
    "nonce": count,
    "gasPrice": 4500000000,
    "gas": web3.utils.toHex("519990"),
    "gasLimit":web3.utils.toHex("519990"),
    "to": SensitiveInfo.tokencontract,
    "value": "0x0",
    "data": contractdata.methods.transfer(this.state.recipientaddress,web3.utils.toWei('1', 'ether')).encodeABI(),
    "chainId": 0x01
};
var privKey = new Buffer(this.state.selectedWallet.privatekey,'hex');
var tx = new Tx(rawTransaction);
tx.sign(privKey);
var serializedTx = tx.serialize();
web3.eth.sendSignedTransaction('0x' + serializedTx.toString('hex'), (err, hash) =>{
  if (!err) //SUCCESS
      console.log(hash);
  else
      console.log(err);
});

}
Note

the same code base use in web are work, but web3@1.2.1
I can very confirmed the from address have enough token and gas
have do research said change all hex to number, like gas , gasLimit, value and chainId


texts: Truffle - Error: Invalid number of arguments to Solidity function

texts:
I am trying to run a test with truffle.

But I am getting an error:

Error: Invalid number of arguments to Solidity function

My contract looks like this:

pragma solidity ^0.4.0;

contract Leontest1 {
    uint flight_number;
    uint day_number;
    string low_no = "This is a low flight number";

    function Leontest1() {
     //contructor
    }

    function low_numbers (uint flight_number) returns (string) {
        if (flight_number > 6) {low_no = "This is not a low flight number";} else {low_no = low_no;}
        return low_no;

    }
}

And my test.js looks like this:

var Leontest1 = artifacts.require("./Leontest1.sol");

contract('Leontest1:low_numbers', function(accounts) {
  it("should assert true", async function() {
    const contract = await Leontest1.deployed();
    await contract.low_numbers(5);
    const result = await contract.low_numbers.call();
    assert.equal(result,"This is a low flight number");

  });
});

Can someone help me please?

I am using Truffle v4.1.7

Thanks in advance,


texts:
is it possible to get the private key of ethereum wallet using web3js?

I want to encrypt data using the ethererum keys?


texts: Statelessness vs statefulness - what is the difference? Comparison Bitcoin's vs. Ethereum's states

texts:
I now read multiple times about bitcoin, that it is a stateless system and that because of that bitcoin simple-purpose computations or programs can be executed at anytime and independent from any data.
In contrast to that Ethereum is often referenced to as a stateful system, where transaction can depend on data not only included within a transaction (a further comparison to bitcoin).
In the end I do not get why this is the case, because if I'm sending money within a bitcoin transaction I'm also depending on the bitcoin blockchain's state, so that my transaction will be successful.
I would appreciate everybody's help to clarify that difference. Furthermore I would look forward if somebody could explain it in the context of using Smart Contracts.


texts:
I am wondering if there's a website that provides the price of the standard gas limit (21000 Gas, transaction cost for sending ETH) in ETH unit.

I checked Ether.Fund site, but it provides the gas price in BTC and is based on ether pre-sale rate.


texts: Is smart contract data valid if i access the contract data in ethereum node which is not synced?

texts:
Is smart contract data valid if i access the contract data in ethereum node which is not synced yet to latest block?

EDIT: By valid, i meant, consider this scenario: if i have a the smart contract with data (lets say variable x=10 ). i have stopped syncing node. Some other party has changed the data in smart contract ( x=20). now without syncing if i try to access x in smart contract.. will the value of x be 10 or 20


texts: Does --nodekey work with geth or just bootnode?

texts:
In the options for geth I see --nodekey listed but I can't seem to get it to (re)generate an enode url when starting a full node. When starting a bootnode this works for me as expected.

So should geth --nodkey=key.txt" be (re)generating the same enode like I'm expecting or does that only work with bootnode --nodkey=key.txt?


texts: Can I execute a contract function by sending a regular transaction to the contract?

texts: I'd like to accept regular transactions to a contract and record a mapping address -> value. Is it possible to achieve it?


texts:
Hey can someone help me figure out why this function returns 0, when I call it? The function doesn't throw any errors when I send a transaction to it, but the Ether isn't sent and the variables aren't set.

    function payout() returns (uint) {
       if (projectPaid) {return 3; }
       projectPaid = true;
       if (!msg.sender.send(amountRaised)) {
        projectPaid = false;
        return 4;
      }
    return 5;
    }

Here is the web3/truffle call

  var projectToFund = document.getElementById("payout").value;
  var thisProject = Project.at(projectToFund);
  thisProject.payout.call({from: account, gas:200000}).then(function(_result) {
    console.log(_result.valueOf());


texts: What's the value of `this` inside a library function when called via a delegatecall?

texts:
Imagine a contract C that makes a delegatecall to a library L.

C -> L

What's the value of this inside L:  address(C) or address(L) ?

If now that L makes a normal call to another contract D.

C -> L -> D

What's the value ofmsg.sender inside D: address(C) or address(L) ?


texts: What is the timestamp of a confirmed transaction based on?

texts: Specifically, if we look at any transaction on the Ethereum blockchain, is the TimeStamp based on when the transaction is generated (like when you click generate transaction on MEW), or is it based on when the transaction was successfully sent from whatever node generated that transaction?


texts: Any ideas how to recover my 400 UNI drop from an old instadapp mcd vault smart contract?

texts:
I apologize for having to post this again because my lack of reputation but maybe I can reword it better this time.
My ETH address:
0x34A2860bbbA761ae27005799b02D3DbD8b4b5fEb
Old InstadApp MCD Vault Smart Contract:
0xc653461d3D4c6AD53c16ebE16fa07f820e115139
as you can see on etherscan the MCD Volt smart contract has 400 UNI ERC tokens within the wallet https://etherscan.io/address/0xc653461d3D4c6AD53c16ebE16fa07f820e115139
Linked for convenience. I've tried connecting the owner wallet of the smart contract with web3 connection through etherscan but I can't figure out what I could possibly try to write and execute in the smart contract to get that UNI to a different address, any address at all. Perhaps there's a way I can find the private key some how?
It's completely useless just sitting in there, I would happily pay someone a bounty if they could help me figure out how to get it into my possession. Because how I see it is I don't own it currently anyway so I have nothing to lose only gain and I would love to share the wealth if we could accomplish this.
Thank you.


texts: Can Proof of Stake (PoS) improve the number of Transactions per Second?

texts:
Currently Ethereum is using Proof of Work (PoW). From my understanding there is a limit of time between blocks for two reasons:

Part of that time between blocks represents the time to solve the PoW puzzle. It is kept at a certain value in order to provide a reasonable entry barrier to the blockchain.
The second reason for some time between blocks is for the blockchain network to have time to distribute all messages

If we move to PoS, essentially the first reason is not of importance anymore. Does that mean that we can have smaller times between blocks?

Also lets say we have a private blockchain with a small number of miners next to each other in a datacenter. Does that mean that we could have a very small time between blocks since the miners will distribute the information very fast between them?


texts: Solidity: querying array data by address

texts:
I have a contract that registers user's attended universities. The data structure is the following:

struct University {
    string name; // name of the university
    address addr; // address of the poster
}

Uni[] private unis;

Then, I have the following mapping:

mapping (uint256 => address) idToPoster;

The contract functionality works when I want to query the struct data according to the Id of the post, but since every address can create several records, what would be the best way to get all the posts by a certain address querying by that address?


texts: I'm having a private test network. I mined more than 20k ether and equally distributed to all my account. Today when I opened geth and found all the ethers except in first account disappeared. Can any know what causes this? and how to recover ether. Thank you.


texts:
I have the following scenario:  Contract A is created.   Contract MASTER will validate Contract A (may make a few changes to state variables of Contract A) and lock it from any further changes.  Contract A will only be available for viewing purposes only.

Is this scenario possible.  If yes, what would be the best way to execute this? Thanks.


texts: How to mine with Ethminer with parity enode

texts: I am a totally newbie in minning, a got and old nvdia gpu, parity fully synced and ethminer installed, windows 10, created two accounts with parity, but i dont know how to mine with ethminer and how to attach the parity enode to it...


texts: Why public keys are not used directly as account addresses?

texts:
I understand that addresses are hashes of the public keys.  But why?  What is the rationale behind this design decision?

And why 160 bits?  Why not just use the hash directly?  Is 160-bit guaranteed to be sufficient in the future for compatibility and security?


texts: I can't execute transaction from Dapp: Nounce too low

texts:
I'am trying to use go-ethereum on my local network:
I have configured a 5-node quorum network on my local machine and I'am building  Dapp.
I created smart contract and generated go bindings.
When I deploy the smart contract everything works but when Iexecute transactions I get in the node logs :

    Discarding invalid transaction           hash=905402…9e0048 err="nonce too low"

When I connect from remix to my local node, I don't have the problem and everything works fine.
Do anyone have an idea about the problem


texts: Changing the amount Ether sent out by a function?

texts:
So I recently started smart contract development (not my first time coding I have some experience in Java) and I created a basic contract called Allowance.sol. The problem occurs when I try to change the set ETH value in the smart contract after it's been deployed, I have been able to change the address it gives the ETH too and the owner but not the value or the time, is there any way I can do this?

pragma solidity ^0.4.21;

import "./Ownable.sol";

    contract Allowance is Ownable{
        uint AllowanceWeek = 0.01 ether;
        address ledger;
        uint32 coolDownTime = 1 weeks;
        uint32 overflow;
        uint32 weekCooldown;

        modifier onlyLedgerOrOwner{
            require(msg.sender == ledger || msg.sender == owner);
            _;
        }

        function _triggerCooldown()internal onlyOwner{
          weekCooldown = uint32(now + coolDownTime);
      }

        function () public payable{

        }

        function _changeCoolDownTime(uint32 _CoolDownTime) external onlyOwner{
            coolDownTime = _CoolDownTime;
        }

        function withdraw() external payable onlyLedgerOrOwner {
            require(now >= weekCooldown);
            require(this.balance >= AllowanceWeek);
            ledger.transfer(AllowanceWeek);
            _triggerCooldown();
            overflow = uint32(this.balance - (AllowanceWeek * 76));
            if(overflow > 0){
                msg.sender.transfer(overflow);
            }
      }

      function _setAllowance(uint _Allowance) external onlyOwner{
          AllowanceWeek = _Allowance;
      }

      function _changeAddress(address _Address) external onlyOwner{
          ledger = _Address;
      }

      function transferOwnership (address newOwner) onlyOwner{
        require(newOwner != address(0));
        OwnershipTransferred(owner, newOwner);
        owner = newOwner;
    }
    }


texts:
Question: Is it possible to create a smart contract for fair exchange and investment: user1 sends ether to a smart contract which will multiply the amount by 2 and send it to user2. When user2 receives ether multiplied by 2, he should send some of these ether to user1.

Thanks in advance for your help.


texts: How can a Smart Contract ask informations to a node?

texts:
I need to code something quite complex compared to my experience.
Just for academic purpose, I'm supposed to have a lightweight blockchain that connects a group of nodes; in this blockchain every node ask and send informations to each other through a smart contract.
By ignoring the problem of how to set up this kind of blockchain, my only duty is to program a test code for the smart contract and the Client (using Python) that will be run by every node.
My problems start when i have to ask informations to a node from the smart contract:
Let's suppose that our contract has a function "getDataFrom(address)" which can be called by a node when he needs to get specific data from another node.
How will this code be structured? The only thing that comes to my mind is to make a transaction from the smart contract to the address, but even in this case how much ETH should be used? Then, if this approach is correct, i think that in the Client code there will be a function that handles a received transaction and then calls a "returnData(data)" from the smart contract, right?
I don't know if that's correct or not, so please i'd be very grateful if someone can help me. Another thing i wanted to ask, is if exists some way to make the Client functions usable from the Smart Contract without sending a generic transaction, i think that this would stop all of my problems.


texts: How to set sealers in genesis block extradata for a Clique PoA network?


texts: how can we set auto transfer of my tokens to the wallet which transferred me ethers

texts:
Okay so I have deployed my contract to network, and my wallet or account via which I deployed it contains all my tokens of the newly created contract. I dont want to list my token anywhere since since only people who are in my app/website can purchase my tokens that's the business logic. so how could I obtain an automated process that if someone say wallet address 0xXYZ... transfers 0.001 eth to my wallet (plus gas) . Consider my token name Test is eqvivalent to 0.0001 eth so what i want is automatically transfer 9 (since 10 Test Token = 0.001 eth and assuming my gas on this transfer would be 0.0001 eth which is equal to 1 Test so 10 - 1 = 9 Test is to be transferred) Test tokens to 0xXYZ wallet. I can do this manually when I see the transfer in my wallet but I want this to be automated , i.e. the user is buying my token automatically.
ERC20 based contract / token

I am new to this domain so I am not sure if this is possible or is this is allowed. I tried to find a lot but didnt find anything like this.
Thanks in advance


texts: Write uints as bytes to create one larger bytes

texts:
I would like to take three uints and essentially concatenate them together as one bytes variable.  What's the simplest way I can do that?  I've seen many posts about people writing full-blown code to merge two bytes together.  And that's great, but in my case, if I want to merge 3, I'd have to call that merge function twice which seems inefficient.

I'm familiar with this method which essentially converts a uint to a byte in the simplest way possible.

function toBytes(uint256 x) returns (bytes b) {
    b = new bytes(32);
    assembly { mstore(add(b, 32), x) }
}

I feel like I should be able to apply this technique to what I'm trying to do.  But I haven't been able to figure out how.  This method is basically taking one single uint and viewing it as a bytes, which is exactly what I want.  Except I would like to say "the first x bytes belong to this uint, and the second x bytes belong to that uint, and the third x bytes belong to this last uint.

Edit:
Here's what I have so far. The following code generates this result.  Now I just need to figure out how to remove all the extra 0's I do not want.

0x00000000000000000000000000000000000000000000000000000000deadbeefdeadbeefdeadbeef

function testStuff(
    uint256 x1, // 3735928559 -> "0xdeadbeef"
    uint256 x2, // 3735928559 -> "0xdeadbeef"
    uint256 x3 // 3735928559 -> "0xdeadbeef"
    ) public returns (bytes memory b)
{
    b = new bytes(40);
    assembly
    {
        mstore(add(b, 40), x1)
        mstore(add(b, 36), x2)
        mstore(add(b, 32), x3)
    }
}

I want to end up with exactly

0xdeadbeefdeadbeefdeadbeef

I'm not sure if this is the right way to do this.  But I'm basically using an expanded bytes object of size greater than 32 so I have enough space to lay out each uint as a byte.  Based on the size I set them next to each other.  But now I end up with all this extra space that I need to remove.


texts: Contract that converts ERC20 token into a new ERC223 according to specific exchange rate

texts: I did some research but I couldn't find anything so specific. I would like users that own a specific ERC20 token to be able to use it to buy an ERC223 token generated by a contract according to specific exchange rate. The ERC20 token should then get stuck in the contract and nobody should be able to withdraw it. Basically we want to convert 1000 old ERC20 tokens into 1 ERC223 new tokens. Thanks.


texts:
I have a contract :

pragma solidity ^0.4.2;

import "Owned.sol";
contract SGBFactory is Owned {

    event SGBUpdate(uint sbgID, bool isCreated, string message); // isCreated = true means created, else means deleted

    string public ownerType;

    struct SGB {
        uint id;
        string latitude;
        string longitude;
        uint minBal; // should be in Wei since Solidity doesn't support floating points as of now
        string ownerType;
        uint capacity; //should also be in grams due to the same reasons as above
        address owner;
        uint fixedUnitCostPerTransaction;
    }

    SGB[] public sgbCollection;

    function SGBCreator() {
        ownerType = "COMMUNITY";
    }

    function addSGB(
        string lat,
        string lon,
        uint minBalReq,
        uint maxCapacity,
        address ownerAccount,
        uint fixedCost
    ) onlyOwner {
        uint sgbID = sgbCollection.length++; //note the postfix operator here
        sgbCollection[sgbID] = SGB(sgbID, lat, lon, minBalReq, ownerType, maxCapacity, ownerAccount, fixedCost);
          // fire up an event here
        SGBUpdate(sgbID,true, "A new SGB is created!!");
    }

    function getSGB(uint sgbid) returns (uint sbgID, string lat, string lon, uint minBal,string ownerType) {
        return(
            sgbCollection[sgbid].id,
            sgbCollection[sgbid].latitude,
            sgbCollection[sgbid].longitude,
            sgbCollection[sgbid].minBal,
            sgbCollection[sgbid].ownerType
        );
    }

    // uint maxCapacity, address owner, uint fixedCost
    // sgbCollection[sgbid].capacity,sgbCollection[sgbid].owner,sgbCollection[sgbid].fixedUnitCostPerTransaction
}

It is deployed in my private Ethereum chain. I can call getSGB() method from Truffle console and it returns value successfully.

I used the following mechanism in Truffle console:

var contract = SGBFactory.deployed();
contract.getSGB.call(1, {from: "0x85ded4eae096d15de9bee720a6e91eb28603a7e6"}, function(err, res) {
    console.log(res);
});

But when I call the same method from JS file, the method returns nothing, nor there is an error message.

SGBWatcher.js

var accounts;
var coinbase_account;

function getSGBFromFactory() {
    var sgbAdderContract = SGBFactory.deployed();
    console.log(coinbase_account);
    sgbAdderContract.getSGB.call(0, {from: coinbase_account }, function(err, res) {
        if (err != null)
            console.log(err);
        else
            console.log(res);
    });
}

window.onload = function() {
    web3.eth.getAccounts(function(err, accs) {
        if (err != null) {
            alert("There was an error fetching your accounts.");
            console.log(err);
            return;
        }

       if (accs.length == 0) {
           alert("Couldn't get any accounts! Make sure your Ethereum client is configured correctly.");
           return;
       }

       accounts = accs;
       coinbase_account = accounts[0];
   });
}

What could be the issue here? (I already have two SGBs added in the contract, so the indexes 0 and 1 as parameter should be fine.)


texts: How to call write functions via Python web3.py, w3.eth.sendRawTransaction()


texts: In ethereum, what happen if someone controls a large majority of mining power?

texts: If someone manages more than 50% of the mining power, this situation necessarily compromises the integrity of the past blocks and newly generating blocks?


texts: Can't send eth to to contract using the Remix environment

texts:
I have followed the steps of the solidity documentation to preform the work of fallback function.My code is below.

pragma solidity ^0.4.0;

contract Test {
    uint x;

    function () payable {
    }
}

contract Send {
    function sendtest() returns(bool ) {
        Test t = new Test();
        bool res = t.send(100 ether);
        return res;
    }
}

The result of t.send() is false.I don't know what's wrong with it.Whether I use the instance of contract insteading of the contract address or not?


texts: fees when buying on Coinbase/Gemini for eth and eth DeFi tokens

texts:
So when you buy or sell eth on Coinbase/Gemini, i Know there is Coinbase/Gemini(Maker fee). But is there also a eth gas fee in that sell/buy transaction? or is there anyone gas fees if you move the Eth out of Coinbase?
Same question for a coin for buy/selling a coin like AAVE or UNiswap on Coinbase. I now there is a Coinbase fee in every buy sell transaction but is there any other fee in that buy/sell transaction?


texts: Would this three address Ethereum transaction be possible through Geth?

texts:
I would like to store an amount of Ether in an specific wallet, likely a wallet generated in Geth. From there I would like to send the correct amount of Ether, I suppose in the form of Gas, or converted to match the required fee upon deposit, to MEW address with no Ether in it, but several ERC20 tokens in them. From there I would like the Ether to be used as Gas to fuel the transactions of said tokens to a third address.

The flow of transactions would work as follows.

  ETH Address ---> MEW Address --->ETH(AS GAS(+ERC20TOKEN)---> New ETH Address.

Basically is it at least theoretically possible than I can link together a series of Geth commands to execute this from the command prompt, or develop a smart contract to do so?

(Just to clarify, I'm aware that there are only Ethereum addresses, but am specifying between them using the protocols mainly used to generate, access, or otherwise interact with them, so as to make clearer the flow of transactions desired, and the other of said flow.)


texts: how to withdraw ether from smart contract?

texts:
I am writing a smart contract which receives Ether.

How can I transfer Ether from the contract to my personal purse

Can I send Ether from the contract like as I can do with regular wallet?
I would tell the user to send 0.01 ETH to the contract , But I don't know withdraw ETH from smart tract.
Can you help edit code
I did test code in ropsten:
https://ropsten.etherscan.io/address/0x47e8035a8dd94d9c4fd7075125c4693767720b7f

Sorry, I don't Know insert code to in the website:

https://pastebin.com/wCCVaHN7


texts: Pending Transactions after crash - recovery?

texts:
I have a question, is it possible to recover somehow pending transactions if the geth node crash ?

Right now I assume that there is now recovery mechanism. In this case if transactions enter the txPool with pending status and the node crashes we will not be able to recover this transaction ? Am I right ? Maybe it is possible in clustered nodes environment ?


texts: How to call a function in a smart contract from Truffle (or anywhere else)?

texts:
PSA: I'm new to Solidity/Truffle and I'm hoping you guys won't be too harsh on me
I'm trying to figure out how call a function that only the smart contract owner can call. The reason why I want to do this, is because I want to be able to self destruct my contract whenever I want. I've seen guides on how to write the function itself, but that's not exactly in question for me. I just want to know how I can call it as the owner of the smart contract.
Any help would be greatly appreciated, thanks.
Edit: what I currently have
function kaboom() public onlyOwner
        selfdestruct(owner);
}


texts: Could a contract with enough Gas DDoS the network?

texts:
From what I understand, the idea of having to pay Gas for executing contracts is to prevent a malicious (or even non-malicious) contract from getting stuck in an infinite loop and consuming the resources of the network. When the Gas runs out, the contract stops executing.

But what if I load up my infinitely looping contract with enough Gas to keep it looping for a significant length of time? Are there any other failsafes in the network that could shut the contract down?


texts: How to write my first Solidity "Hello World" smart contract?

texts:
I have never written a smart contract before because there is a lot attached to it getting it working. But I finally want to learn it now.

I want to write a simple mininmal working smart contract which prints out something or does something similar to saying "Hello World". Is that possible?

How would such a contract look like? How to deploy it, what tools do I need?


texts: Is it possible to have 15 variables in a struct in solidity?

texts:
I have a struct with two variables bool, nine bytes 32 and three uint. The problems I want to add another bytes32 but I get this error "InternalCompilerError: Stack too deep, try removing local variables."

struct xxxx{

    bytes32 id;
    bool x;
    //bool w;
    uint date;

    bytes32 a;
    bytes32 b;
    bytes32 c;
    bytes32 d;
    bytes32 e;

    bytes32 f;//Nuevo
    bytes32 g;//NUEVO
    bytes32 h;//NUEVO

    uint j;
    uint k;

    bool active;
    //bool active;
}


texts: Lost ETH - Don't remember which wallet was used?

texts:
A year ago I had bought some ETH using a wallet I don't remember. All I have is a password and a contract address 0x03530cC59c873F88EDe35036D3448B450A41381a.

If you see the contract creator there seems to be some balance there.

Any ideas how I can restore the ETH to a wallet (or which wallet it could be)?


texts: Remix IDE Desktop + Geth node as test network

texts:
I'm trying to connect the Remix Desktop client to my local Geth node. as usual i added:

  geth --rpc --rpccorsdomain https://remix.ethereum.org

while starting up the node. This obviously only works connecting to the Webapp version of Remix.
Is there another way i can connect the Remix desktop client directly to my own node as Metamask also only works in chrome?


texts: Running contract code in javascript without deploying on chain

texts:
I am building a state channel battleship game. I have a stateless contract which contains all my gameplay logic and another statechannels contract which contains all the dispute logic.

Ideally, I shouldn't be deploying either contract until there is a dispute.
To move through the game states, my contract accepts a AppState argument and applies the passed Action argument to return a new state. All my functions are pure.

Is there any way to run the contract code without deploying it on any chain?


texts: Convert two int128 variables to Bytes32 and back

texts:
For Bytes32 to 2x int128 I have working code.  I've adapted code from this stack Exchange answer

function bytes32to2xint128(bytes32 z) pure public returns (int128 x, int128 y){
    bytes16[2] memory tmp = [bytes16(0), 0];
    assembly {
        mstore(tmp, z)
        mstore(add(tmp, 16), z)
    }
    x=int128(tmp[0]);
    y=int128(tmp[1]);
}

But for the inverse, 2x int128 to Bytes32, the following doesn't work and always returns

bytes32: 0x0000000000000000000000000000000000000000000000000000000000000000

function int128x2tobytes32(int128 x, int128 y) pure public returns (bytes32 z){
    assembly {
        mstore(z, x)
        mstore(add(z, 16), y)
    }
}

Thanks in advance