Most Popular

1500 questions
12
votes
3 answers

What is the regex to validate an Ethereum transaction hash?

I am building an application which requires user to paste the transaction hash of a transaction. But i want a regex string i could pass to the pattern attribute of the input element that receives it to validate it. What is the general regexp that…
Oluwatumbi
  • 223
  • 1
  • 2
  • 6
12
votes
1 answer

What if difficulty bomb makes mining impossible before POS release?

As mining difficulty raises and POS is still not ready, I was just wondering if POS release can still be on time compared to the difficulty bomb giving too high difficulty. In simpler words, is there a risk that difficulty become too high to mine…
Nicolas Massart
  • 6,783
  • 2
  • 29
  • 63
12
votes
2 answers

What is an HD wallet for Ether and how to create one using node.js?

I know the basics of blockchain and how to use geth. However, I'm curious to know how to build a wallet using nodejs. What I understand is that you can create a account using geth console (private network) to work on and when pass command…
Shivam Nema
  • 123
  • 1
  • 1
  • 4
12
votes
6 answers

How to check the size of a contract in Solidity?

I want to measure the size of my compiled contract using solc. I can dump the binary using --bin or --bin-runtime and then count how many hexadecimal digits it contains. Is there an easier way to do it?
Shuzheng
  • 1,855
  • 3
  • 19
  • 31
12
votes
2 answers

get the return value of payable function?

Let's say there's a payable Solidity function function doSomething() payable returns(uint) { require(msg.value == 1 ether); return 1; } And you call this function instance.doSomething({ from:_account, value:1 ether …
coindevbw
  • 121
  • 1
  • 3
12
votes
1 answer

How to deploy contracts that take parameters in their initialisers using Truffle?

I'm trying to build a smart contract with Truffle. I can compile it just fine, but when I try to deploy it on the network, I don't get an option to pass in the initialiser parameters and thus the contract fails. How do I pass the parameters to a…
ThePiachu
  • 562
  • 1
  • 6
  • 14
12
votes
3 answers

Geth response: invalid content type, only application/json is supported

I started geth on a remote server running on rinkeby with the parameters --rinkeby --fast --cache=128 --rpc --rpcaddr 0.0.0.0 When I try to test my access to geth using curl -X POST --data…
Athena Wisdom
  • 269
  • 1
  • 2
  • 12
12
votes
1 answer

How growing contract storage increases the gas spending?

I have some further questions about this and this threads. For simplicity, let's imagine that I want to create a cryptocurrency on top of ethereum. The contract that "handles" this cryptocurrency will have a mapping that will associate addresses to…
Henrique Barcelos
  • 2,481
  • 4
  • 20
  • 38
12
votes
3 answers

Using require or modifier?

If you create a function that you only want the owner to interact with would you use require(msg.sender == owner) or modifier onlyOwner() { require(msg.sender == owner); _; } Which would be the most cost efficient for smart contracts,…
JorahFriendzone
  • 517
  • 1
  • 8
  • 22
12
votes
1 answer

How to generate sugared assembly code from Solidity code?

In the Solidity documentation I see a sample assembly code: { mstore(0x40, 0x60) // store the "free memory pointer" // function dispatcher switch div(calldataload(0), exp(2, 226)) case 0xb3de648b { let (r) = f(calldataload(4)) let…
medvedev1088
  • 10,996
  • 5
  • 35
  • 63
12
votes
2 answers

Does knowing half private key provide any useful information?

I have a private key and I want to store a paper version of it. I would like to split it in 2 equal parts (first 32 numbers and last 32 numbers) and store them in 2 different locations. Let's assume I'm 100% sure no one can access both parts, but…
AnotherUser
  • 223
  • 2
  • 8
12
votes
2 answers

Finding and Using Solidity Libraries (ie. Math functions)

How do I find and use any existing Solidity libraries like you might in Javascript? For example, Math functions: How do I implement the equivalent of Math.sqrt(x) in a solidity function? Related: What is --libraries doing in that second question…
Bill LaPrise
  • 683
  • 8
  • 17
12
votes
3 answers

What uint type should be declared for unix timestamps?

I try to specify uint type to uint16 instead of just doing uint or uint256 when dealing with time stamps but it says that I must use at least uint24. It works with uint24, but shouldn't uint16 be plenty enough?
NowsyMe
  • 1,365
  • 1
  • 19
  • 37
12
votes
1 answer

Is there any profit from using pure and view functions modifiers?

I have a function that does not read or modify contract's state: contract C { function add(uint a, uint b) public returns (uint) { uint res = a + b; return res; } } Does it make sense to use pure/view modifier? I mean,…
30mb1
  • 369
  • 3
  • 8
12
votes
2 answers

Should I use 'bytes' or 'string' always?

So after my understandings, bytes and strings are basically doing the same just in different formats and using bytes is cheaper -leading to my question, should I then only use string for data that is longer than 32 bytes and specify byte type for…
6egic
  • 1,327
  • 9
  • 17