New answers tagged

0

Your premise includes a whole bunch of odd assumptions but it isn't exactly clear what you are thinking or why you are thinking it. they will never want to use the address for searching f It's not necessarily about what a user would want to do. Contracts are about what the system must do. mappings are about internal organization so it "can do" it ...


0

You used the tags "solidity" and "contract-development" so I assume your question is from a code point of view. The smart contracts use a data structure called "mapping" to save data to the Blockchain. An exemple of mapping declaration in Solidity can be : mapping( address => uint256) userBalances; This is a kind of ...


1

A smart contract can have lots of functions, so to achieve what you want you would have to test each of them independently. You would have to think about all possible inputs that can be given to the functions. Basic TypeScript example in a mocha test suite: describe("my exhaustive test suite", function() { it("checks that foo doesn't change ...


1

It sounds like you're looking for a low cost way to get random numbers, and the means doesn't really matter. If you use a centralized source like random.org, whatever application your creating can still be attacked and not really random. A simple way to create a random number without it being predictable, and also easy to implement would be to use a ...


3

From this reddit message it was fixed in geth 1.6.5 https://www.reddit.com/r/ethereum/comments/6ene3u/the_attacker_is_back_account_related_to_devcon2/ Pull request with the fix: https://github.com/ethereum/go-ethereum/pull/14570 core/vm: Use a bitmap instead of a map for jumpdest analysis


0

I have a project with Ethereum Blockchain the users send the data to the server and the server writes the data in the blockchain network My question is how do I represent the server in the smart contract? Every interaction with Ethereum contracts is executed via addresses. Your server is just another address. You could define roles and restrict certain ...


0

All sorts of interactions on the Ethereum Blockchain happen via "Transactions". Now these transactions are carried out by - Users via externally owned accounts Smart contracts. You, the user should have a private key(from this a 20-byte address is generated which represents your account on the network). Now to send data to a smart contract via a ...


1

The problem is in King's triggerAddress function. When it is used for transferring ether to SevenKingdoms' contract it will set the gas available to 2300. function triggerAddress(address payable _addr, uint256 valueInWei) public payable { _addr.transfer(valueInWei); } SevenKingdoms' fallback receives 2300 as gas stipend function() external payable { ...


0

There are randomness oracles like Chainlink VRF available nowadays.


1

It is a very general question, so a very general answer. Try-catch is a logical branching technique, and logic errors can have serious security implications. What implications can it have to the security of a function A function should always do exactly what it is supposed to do, in all cases. That should be obvious. It is not always wrong to try-...


2

You could require streamers to overcollateralize, with those that fail to stay overcollateralized being liquidated. With that you can take a lazy update approach, where self-interested actors update the smart contracts in a patchwork pattern. So imagine for example that all streams are required to post collateral for at least 3 hours of streaming. When a ...


0

Do you really need to iterate over all streams each time? You could have a time function that tells you the outgoing total and incoming totals per second, it would be based on just one variable per user which gets updated each time the streams are modified. You could know if an user is undercolaterallized with a simple operation. Have a look at how Pot.sol ...


1

Contracts marked as abstract in Solidity v0.6 and above cannot be initialised. Take the following files: Foo.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.9; contract Foo { function doStuff() external virtual pure returns(string memory) { return "do stuff"; } function doMoreStuff() external virtual pure returns(string memory) { ...


Top 50 recent answers are included