Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [bignumber]

The tag has no usage guidance.

0
votes
1answer
26 views

Contract deployment using web3.eth.contract(abi) with constructor arguments

I'm trying to deploy the following smart contract: pragma solidity ^0.5.00; contract TestContract { address public owner; string public word; constructor(string memory _word) public{ ...
0
votes
1answer
33 views

Error: Please pass numbers as strings or BigNumber objects to avoid precision errors

let result = await instance.joinQuiz({ from: accounts[1], value: web3.utils.toWei(10, "wei") });
0
votes
1answer
16 views

Doubt with ethereum-input-data-decoder when decoding a variable uint256

the input data of the variable uint256 is "22092018" but when using ethereum-input-data-decoder I return "BN: 15118f2". Instead of getting "BN: 15118f2" with the decoder, have the original value of ...
0
votes
1answer
24 views

How to define 2048-bit integers on smart contracts?

As we know solidity supports only 256-bit big integers. But for crypto primitives (sometimes) we need bigger integers, e.g. 2048-bit. Question: how can we define 2048-bit integers on a smart contract ...
0
votes
1answer
24 views

Is there a form of mapping with an even larger space?

I understand from here that the space for mapping() is drawn from a size of 2^256 * 32 bytes storage, which provides a 1 chance in 10^69 of overwrites. If I'm working with contracts on the order of ...
1
vote
1answer
97 views

How can we parse and deal with BigNumber (BN) args in Solidity events?

In the past, web3 events published numeric events like so: BigNumber { s: 1, e: 17, c: [ 1000 ] } } Now with web3.js 1.0, big numbers come down as objects like this: <BN: de0b6b3a7640000> ...
2
votes
2answers
257 views

How to convert big number to normal number?

I am new to testing and I want to know how to convert a big number to a real number. I use bignumber in the following command: console.log(await this.crowdsale.rate()); This is what gets printed in ...
1
vote
3answers
303 views

Error: Number can only safely store up to 53 bits

const result = await myContract.methods.myMethod(1).call(); brings the error from above. There is a simmilar questions here but since I use call gas shouldn't matter. I'm using "web3": "1.0.0-beta.35"...
1
vote
1answer
261 views

WEI to ETHER conversion issue with Web3 and Javascript

So i have a form where the user enters a price for an item in ETHER. I understand the blockchain does not handle floatin point numbers currently, so i am attempting to convert to WEI and store it on ...
1
vote
0answers
38 views

how do you handle token value data type in database?

Ones who do exchange / Investment platforms development, all ERC20 tokens has its atomic unit and only moved by specifying value in its atomic form. for eg: 1 BuritoToken with unit decimals as 18, ...
0
votes
1answer
44 views

how to parse the value returned by truffle? from balanceOf()

My question is nearly identical to: how to parse the value returned by truffle ? Except that when I run: bigNumberValue.toString() i get '[object Promise]' but then if I treat as a promise and ...
0
votes
2answers
369 views

How to store a Big Number?

I need to determine an expiry date for a contract a for this I use the foloowing code as the constructor of the contract : constructor(address _recipient, uint256 duration) public ...
0
votes
1answer
32 views

how do you convert (small) BigNumbers?

i created a variable called startDate using now in a smart contract. when reading it using Contract.startDate() it returns BigNumber { s: 1, e: 9, c: [ 1530272788 ] } how do i convert this to an ...
1
vote
0answers
260 views

How can I configure BigNumber class in Web3 Version 1.0.0?

Prior to version 1.0.0, I could do it like this, for example: web3.BigNumber.config({DECIMAL_PLACES: 100, ROUNDING_MODE: web3.BigNumber.ROUND_DOWN}); At version 1.0.0, it seems that web3.BigNumber ...
0
votes
1answer
252 views

Truffle Test - Solidity: How to access value of Promise object? [object Promise] [BigNumber]

a.getB.call().then(function (f) { console.log(f[1][0]) }); outputs: BigNumber { s: 1, e: 20, c: [ 5000000 ] } How can I access the value in c? How can I save object f to a javascript variable? ...
3
votes
1answer
363 views

How to convert bigNumber array to int array?

I have a smart contract method that return an array of uint256, but when I console.log the result I got this : [ BigNumber { s: 1, e: 1, c: [Array] } ] How can we convert it to array of numbers? ...
3
votes
1answer
789 views

Truffle CMD Bignumber to number; hex to string

A function in my contract when called on the truffle develop command line gives output in BigNumber format. Here is what I wrote on the command line: instance = contract.at('deployed address') ...
1
vote
1answer
369 views

how can i convert this number to arguments?

in this img you seen 570.1777 ext TRANSFER by function i want now how can convert this amount to arguments easy
3
votes
2answers
122 views

Ethereum scalability and user wait time

If I create a new app that will work on Ethereum network, it takes few seconds for a transaction to be confirmed at least once (creating a sub contract for example), so I can keep using other ...
3
votes
1answer
140 views

uint doesn't return big number object if function is not constant?

So, I have a contract deployed which has a simple function which returns a uint. If I make the function constant it returns the correct value set as a BigNumber object, but if I remove the constant ...
7
votes
2answers
12k views

How to convert BigNumber to Number in Truffle framework?

I have written an ERC20 token contract and deployed it in test network using truffle framework. When I check the token balance for an account using web3 it was giving the result in BigNumber when I ...
4
votes
1answer
42 views

Can I use the `e` notation on MyEtherWallet?

I just found out about the existence of the "minification" process. You probably know about it already, but if you don't, it basically means that 1000 = 10^3 = 1E3 . So 1000 minified is 1E3. Or 10'...
0
votes
3answers
467 views

eth.getPastLogs() requires exact match 32 byte value, how to get bignumber to emit?

the API eth.getPastLogs() requires 4 topics to match the log indexing capabilities of the EVM. It appears to require a full 32 byte number for the match to work. i.e. eth.getPastLogs((fromBlock:0, ...
1
vote
1answer
905 views

sendTransaction BigNumber Error: new BigNumber() not a number: [object Object]

I am new to Solidity programming and writing smart contracts for one of the application. Here are my two contracts. I am using truffle and testrpc as tool. I am getting error consistently. Need ...
7
votes
3answers
3k views

How do I send the entire ether balance from one account to another account?

I'm trying to use web3 to transfer all (or as much as I can) of the balance of an account to another account. Here is the code I have so far: var sender = web3.eth.accounts[0]; var receiver = web3....
3
votes
1answer
273 views

Ether transferred to Receiver's account is not exact

I'm trying to transfer to send some ether from one account to another in a smart contract written in Solidity. The transfer is successful but the amount received is not exactly matching up with the ...
12
votes
5answers
7k views

Getting Uncaught Error: new BigNumber() not a number: [object Object]

I am quite new to this. Please help me out. I am trying to build a dapp using meteor. I am having a little trouble with calling a function of the contract using web3. Here's the code snippet that's ...
2
votes
0answers
253 views

Optimizing 512-bit bigInt library

I mentioned last time that I was working on a big integer library. After some work, I have managed get 512-bit arithmetic kinda working!!!! Credits to /u/benjaminion for the modSmall function. Here ...
8
votes
1answer
1k views

How to pass numbers greater than 9007199254740991 to contracts?

When I try to call function check() with a number greater than 9007199254740991 I get an error: Error encoding arguments: Error: Assertion failed contract C { function rateCheck(uint rate){ ...
4
votes
0answers
249 views

Gas cost for bigInt library

I am working on a big integer library in the online compiler. Currently having gas/computational time issues with the modulus function. I first implemented it using repeated subtraction: function ...
2
votes
1answer
242 views

Sending tokens getting error

Hi i deployed a token contract in ethereum and managed to interact with it. solidity code : contract Token { mapping (address => uint) public balances; event TokenSent(address sender, address ...
1
vote
2answers
2k views

BigNumber issue — RequireJS and Web3

Here's my main.js file: require.config({ paths: { angular: '//ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min', web3: 'lib/web3', MainController: 'controllers/...
15
votes
1answer
5k views

What are *C*, *E* and *S* properties in message call return object?

(JS) var contract = web3.eth.contract(abiDefinition).at(address); contract.test(value, gotResult); function gotResult(error, result) { if(!error) { console.log(...