Stack Exchange Network

Stack Exchange network consists of 175 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.

1
vote
2answers
15 views

How to convert smallest unit of ERC20 with less than 18 decimals to full coins without rounding errors?

I can just use web3's fromWei function for all token that have 18 decimal places but I'm not sure how to convert token to full token without having to worry about rounding errors. For example convert ...
0
votes
1answer
60 views

BigNumber Error: new BigNumber() not a base 16 number:

I'm new to Ethereum and javascript so hope someone can help me with this as none of the other answers on BigNumber help me understand why this won't work for me. I've tried converting the number to a ...
3
votes
2answers
109 views

How to use bignumbers in truffle tests?

I am testing a smartcontract with Truffle V5. All works well if I do not use all decimals. If I set 18 decimals all explodes. The test code is this (from truffle docs): const MetaCoin = artifacts....
0
votes
1answer
27 views

how to deal with large numbers in Ethereum?

I am confused with the use of large numbers in solidity, ethereum. I have some doubts please help me with them. 1) I am not able to represent the value of p using p.toNumber() but can represent it ...
1
vote
1answer
18 views

Issue with Contract function return value data type

I am using a simple contract Contract code contract Bank { address public owner; mapping(address => uint) private customerBalance; event fallbackCalled(address, uint256); event ...
0
votes
1answer
97 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
92 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
22 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
27 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
39 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
218 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
427 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 ...
2
votes
3answers
628 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
351 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
42 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
56 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
442 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
270 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
289 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
407 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
851 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
403 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
124 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
144 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
14k 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
44 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
484 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
932 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
4k 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
277 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
267 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
268 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
246 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/...
17
votes
1answer
6k 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(...