#StackBounty: #blockchain Is it true that EIP-80085 solves the most important issue in crypto?

Bounty: 500

EIP-80085, "Declaration of Ethereum Name Change Due to Novel Coronavirus(es)" described a way to better protect Ethereum developers from the coronavirus. It also talked about some of Ethereum’s pedophilic origins. It listed all the reasons from Ethereum’s history that make it the most pedophilic platform in human history. It recommended a name change from Ethereum to "Little Baby Pussy Platform" so that people could better understand what it’s really about. And also it would be safer for the unvaccinated too, because "ETH-" makes people spit everywhere when they say it.

Do you think that EIP-80085 was censored by the ETH developers because Ethereum’s love for pedophilia is still going on today? Pedophiles are interested in flat chests. They dont like 80085. Thats what makes them pedophiles. That must be why the Ethereum developers censored the 80085, to make it more pleasing for them.

Isn’t it a complete contradiction? ETH developers say they are censorship resistant. But now it seems like it’s okay to censor some things some times, but then also allow pedophilia on platforms like Filecoin. So, ETH developers think that censorship is not okay for pedophilia, but simple words must be censored because…? And even they think pedophilia shouldnt be censored, but 80085 should be! What a world they are building for us!! No 80085??? Vital, please comment.

As I remember, the issue was closed by MicahZoltu. Why did he dislike it so much that he had it censored from the site? It surely solves the biggest problem in crypto! Everyone can finally understand what this crypto is with the renaming of ETH to Little Baby Pussy Platform!

And, by censoring the 80085 issue, arent they just proving how big of an issue it is? It’s bigger than we even imagined! What the heck is goin on?


Get this bounty!!!

#StackBounty: #java #algorithm #cryptocurrency #blockchain Bitcoin Hash (Merkle) Tree implementation in Java

Bounty: 400

I’m learning about how full nodes can send a Merkle root + a list of hashes, so that a light client can verify a transaction.

I couldn’t find any good resources on how to implement it. I just knew what nodes I needed in order to verify a leaf, so I just found those nodes using DFS.

I’m sure there is a better way to construct the HashTree, find the list of nodes the light client needs, and verification algorithm. Therefore I would really appreciate it if you could review the algorithms and code and give me advice/guidance:

HashTree.java:

package core;

import static util.Bytes.SHA256;
import static util.Bytes.merge;
import java.util.Vector;

public class HashTree {
    private final HashNode root;

    public HashTree(byte[]... leaves) {
        final Vector<HashNode> hashes = new Vector<>();
        for (byte[] leaf : leaves) {
            hashes.add(new HashNode(leaf, null, null, null));
        }
        root = construct(hashes);
    }

    public byte[] getRootHash() {
        return root.hash;
    }

    public static byte[] getRootHash(byte[] hash, boolean oddHashIndex, Vector<byte[]> siblings) {
        for (byte[] sibling : siblings) {
            hash = (oddHashIndex) ? SHA256(merge(sibling, hash)) : SHA256(merge(hash, sibling));
            oddHashIndex = !oddHashIndex;
            for (byte b : hash) {
                System.out.print(String.format("%02X", b));
            }
            System.out.println();
        }
        return hash;
    }

    /**
     * Performs a depth-first search to find a leaf in this HashTree.
     * If the leaf is found, construct a path with all the siblings
     * needed to verify the leaf.
     *
     * @param leaf to find
     * @return path, otherwise {@code null}
     */
    public Vector<byte[]> authenticationPath(byte[] leaf) {
        final Vector<HashNode> visited = new Vector<>();
        final Vector<byte[]> path = new Vector<>();
        if (!dfs(root, leaf, visited, path)) {
            throw new RuntimeException("could not find the given leaf");
        }
        return path;
    }

    private boolean dfs(HashNode current, byte[] target, Vector<HashNode> visited, Vector<byte[]> path) {
        boolean found = false;
        if (current.hash == target) {
            path.add(current.getSibling().hash);
            return true;
        }
        visited.add(current);
        if (current.left != null && !visited.contains(current.left) && !found) {
            found = dfs(current.left, target, visited, path);
        }
        if (current.right != null && !visited.contains(current.right) && !found) {
            found = dfs(current.right, target, visited, path);
        }
        if (found && current != root) {
            path.add(current.getSibling().hash);
        }
        return found;
    }

    /**
     * Constructs a new hash tree from the given leaves.
     * @param hashes (leaves)
     */
    private HashNode construct(Vector<HashNode> hashes) {
        if (hashes == null || hashes.size() < 1) {
            throw new IllegalArgumentException("no leaves given");
        }
        if (hashes.size() == 1) {
            return hashes.firstElement();
        }
        if (hashes.size() % 2 != 0) {
            hashes.add(hashes.lastElement());
        }
        final Vector<HashNode> parents = new Vector<>();
        for (int i = 0; i < hashes.size() - 1; i += 2) {
            final byte[] parentHash = SHA256(merge(hashes.get(i).hash, hashes.get(i + 1).hash));
            final HashNode parent = new HashNode(parentHash, null, hashes.get(i), hashes.get(i + 1));
            hashes.get(i).parent = parent;
            hashes.get(i + 1).parent = parent;
            parents.add(parent);
        }
        return construct(parents);
    }

    private static final class HashNode {
        final byte[] hash;
        HashNode parent;
        final HashNode left;
        final HashNode right;

        private HashNode(byte[] hash, HashNode parent, HashNode left, HashNode right) {
            this.hash = hash;
            this.parent = parent;
            this.left = left;
            this.right = right;
        }

        HashNode getSibling() {
            if (parent == null) {
                return null;
            }
            if (parent.left == this) {
                return parent.right;
            } else {
                return parent.left;
            }
        }
    }
}

HashTreeTest.java:

package core;

import java.util.Vector;

import static util.Bytes.SHA256;
import static util.Bytes.merge;
import static org.junit.jupiter.api.Assertions.*;

class HashTreeTest {

    @org.junit.jupiter.api.Test
    void test() {
        final byte[][] leaves = new byte[][] {
            SHA256("ABC".getBytes()), // 0
            SHA256("DEF".getBytes()), // 1
            SHA256("GHI".getBytes()), // 2
            SHA256("JKL".getBytes()), // 3
            SHA256("MNO".getBytes()), // 4
            SHA256("PQR".getBytes()), // 5
            SHA256("STU".getBytes()), // 6
            SHA256("VWX".getBytes()), // 7
            SHA256("YZA".getBytes()), // 8
        };
        final byte[][] internal1 = new byte[][] {
            SHA256(merge(leaves[0], leaves[1])), // 0
            SHA256(merge(leaves[2], leaves[3])), // 1
            SHA256(merge(leaves[4], leaves[5])), // 2
            SHA256(merge(leaves[6], leaves[7])), // 3
            SHA256(merge(leaves[8], leaves[8])), // 4
        };
        final byte[][] internal2 = new byte[][] {
            SHA256(merge(internal1[0], internal1[1])), // 0
            SHA256(merge(internal1[2], internal1[3])), // 1
            SHA256(merge(internal1[4], internal1[4])), // 2
        };
        final byte[][] internal3 = new byte[][] {
            SHA256(merge(internal2[0], internal2[1])), // 0
            SHA256(merge(internal2[2], internal2[2])), // 1
        };
        final HashTree hashTree = new HashTree(leaves);
        final byte[] expectedRootHash = SHA256(merge(internal3[0], internal3[1]));
        final byte[] actualRootHash = hashTree.getRootHash();
        equals(expectedRootHash, actualRootHash);

        final Vector<byte[]> path = hashTree.authenticationPath(leaves[5]);
        equals(path.get(0), leaves[4]);
        equals(path.get(1), internal1[3]);
        equals(path.get(2), internal2[0]);
        equals(path.get(3), internal3[1]);
        assertEquals(4, path.size());
        equals(expectedRootHash, HashTree.getRootHash(leaves[5], true, path));
    }

    void equals(byte[] expected, byte[] actual) {
        assertEquals(expected.length, actual.length);
        for (int i = 0; i < expected.length; i++) {
            assertEquals(expected[i], actual[i]);
        }
    }
}

Bytes.java

package util;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public final class Bytes {
    public static byte[] merge(byte[]... bytes) {
        final ByteArrayOutputStream stream = new ByteArrayOutputStream();
        try {
            for (byte[] b : bytes) {
                stream.write(b);
            }
        } catch (IOException e) {
            System.err.println(e.getMessage());
        }
        return stream.toByteArray();
    }

    public static byte[] SHA256(byte[] bytes) {
        try {
            final MessageDigest digester = MessageDigest.getInstance("SHA-256");
            return digester.digest(bytes);
        } catch (NoSuchAlgorithmException e) {
            System.err.println(e.getMessage());
            return null;
        }
    }
}
```


Get this bounty!!!

#StackBounty: #solidity #contract-development #blockchain #oracles #chainlink How to build a decentralized bridge between two blockchai…

Bounty: 50

I am trying to build my own custom bridge between Ethereum and Binance Smart Chain so that people can transfer tokens and possibly some other assets from one chain to another and vice versa. For this purpose I will need three things:

  • smart contract in Ethereum blockchain
  • smart contract in BSC blockchain
  • some kind of oracle to maintain the communication between contracts in different chains

My question is: how to create a decentralized oracle, that can subscribe to events from one chain and cast them to contract in another chain?

I think I can use Chainlink to achieve this, but for now the only way I see is following:

  1. User executes transaction on contract in Ethereum blockchain.
  2. Smart contract emits event in Ethereum blockchain.
  3. My own custom oracle detects that event was emitted and executes transaction to BSC chain in order to notify the BSC contract about the event.
  4. BSC smart contract verifies that this particular event exists in Ethereum blockchain. For this purpose smart contract executes API request to some known provider (like Etherscan) using Chainlink mechanisms.

The thing is: I don’t want to rely on any API-s in my bridge (so no Etherscan and alike). I want to rely only on blockchain events and decentralized oracles that can detect and propagate those events. Are there any existing mechanisms I can use for this matter?


Get this bounty!!!

#StackBounty: #transactions #blockchain #synchronization #blocks #bsc Ensuring correct block order with subscribe on "newHeads"

Bounty: 50

I have an issue with processing new blocks through a WebSocket connection on a local node. Sometimes I receive multiple events with the same blockNumber but different blockHashes.

I understood from some StackExchange threads that one of these blocks are just not part of the canonical chain. However, my question is: How do I determine which one of them is on the canonical chain? What would be the exact steps I need to take when I open a WebSocket connection and receive a new block after subscribing to "newHeads" to ensure this block is canonical?

Example

This is a shortened log of an application that stores some transactions from the newest blocks into an SQL db.

Added block #7665190 | hash 0x9ba66766f3835d5be9191e0ad7c79b741707e78dcf1f2a8898b7a7c2141d357c
Added block #7665191 | hash 0xe550f98974b4b02fff709842f670e682fc90403ead36d6258927b38cd45a56bc
Added block #7665191 | hash 0x068f5648b0509303640a1aa9c10764c89f33482148fde4ef94ce0ab4f21c25d1
Added block #7665192 | hash 0x36c2f7e9a4542a2311c91e8cd1560994ca14841086be86d0f6dbb1be9eae9d46
Added block #7665193 | hash 0x0cd7d6e0dac1c3288e574b454d7e4dee9123c4e1e94b6e87307aae32e812f1f1

Is using a getBlockByNumber RPC call after receiving a new block number sufficient to determine that this is indeed the "right" block that I want to store transactions for in my DB?

I don’t think so because if I would use getBlockByNumber on the first 7665191 I would still receive the transactions in that block. Then after using it on the subsequent 7665191 I would receive another set of transactions that might include a bunch of the previous ones. Thus introducing redundancy and possible mismatches between the canonical transactions hashes / addresses in my SQL db.

Second option I could think of would be to wait until I receive just a single blockNumber after (e.g. 7665192 in this case) and then check it’s parentHash. If one of the 7665191‘s hash is equal to 7665192‘s parentHash I would take this one as the canonical block. However this just introduced a lot more questions:

  • What if I would receive duplicate blockNumbers multiple times in a row?
    • e.g. 7665191, 7665191, 7665192, 7665192, 7665193, 7665193 ...
  • What if the parentHash wouldn’t be one of the previous duplicates?
    • e.g. parentHash of 7665192 wouldn’t be equal to hash of any 7665191

To reiterate my question: What is the recommended way to ensure that I only store the real transactions from the blocks that you can find on bscscan.


Get this bounty!!!

#StackBounty: #solidity #blockchain #ether #erc-721 #openzeppelin Best way to list all tokens of user in Solidity

Bounty: 100

I am using openzeppelin erc721 library to create an NFT and need to list all the tokens of a user. The most obvious way is to iterate through all the tokens in the contract and check if the owner of the token is same as the address I have sent.

function tokensOfOwner(address _owner) external view returns(uint256[] ownerTokens) {
    uint256 tokenCount = balanceOf(_owner);

    if (tokenCount == 0) {
        // Return an empty array
        return new uint256[](0);
    } else {
        uint256[] memory result = new uint256[](tokenCount);
        uint256 totalCats = totalSupply();
        uint256 resultIndex = 0;

        // We count on the fact that all cats have IDs starting at 1 and increasing
        // sequentially up to the totalCat count.
        uint256 catId;

        for (catId = 1; catId <= totalCats; catId++) {
            if (kittyIndexToOwner[catId] == _owner) {
                result[resultIndex] = catId;
                resultIndex++;
            }
        }

        return result;
    }
}

Link to this solution

Another solution that I am thinking of implementing is to have a mapping where I map the user address to an array or another mapping which includes all the tokens the user owns. Upon transferring the token to another address, I would need to remove the token from seller list and add it to buyers list. This solution sounds more reasonable but I dont know how cost efficient it will be. What are the disadvantages of this method?


Get this bounty!!!

#StackBounty: #authentication #jwt #identity #blockchain #web-authentication Use-case for decentralized identifiers (DIDs) with unique …

Bounty: 50

The W3C working group is working on the standardization of Decentralized Identifiers (DIDs). I watched a video presentation about DIDs and the presenter mentioned several times the possibility of generating unique pseudonymous identities for each relationship for better privacy. This is something that is also mentioned in the W3C documents (#1).

However, I fail to understand the use case for one DID per service/usage (e.g. online shopper with direct relationship between customer and seller). This looks like an example of direct trust where there is no need for a consistent global storage like a blockchain. To my understanding, the whole point of having DIDs is to have identities that are shared with multiple other entities.

For one-to-one relationships between a user and a service, won’t a simple proof-of-possession token provide the same security guarantees at a fraction of the cost? What are the advantages of using unique DIDs for direct relationships versus storing public keys/identities on both ends?


Get this bounty!!!

#StackBounty: #blockchain #parity #linux #blockchain-fork #parity-wallet In parity, how can I delete the last blocks I downloaded witho…

Bounty: 50

I have found the blockchain data in parity. I go to overlayrecent folder and from there to the db folder. It looks like the blocks are the .sst files.

How can I delete the last blocks I downloaded without corrupting the database?

For example when I just deleted the last .sst file, and then went to terminal and ran parity, I got “Client service error:

Client(Database("Invalid argument: You have to open all coloumn families. Column families not opened: col5, col4, col3, col2, col1, col0"))".


Get this bounty!!!

#StackBounty: #blockchain #mining #ropsten #economics #cryptoeconomics What economic incentive does anyone have to mine Ropsten and oth…

Bounty: 50

Ethereum 1.0 has a basic limitation, as all global blockchains do: each block can only hold so many transactions. Due to this scarcity, every time even one application gets too popular on the main network, gas prices for transactions shoot up. At current prices of ETH, you might end up paying $5 or even $99.

However, developers use Ropsten network all the time. What if the volume of transactions there was the same as on the mainnet? Anyone can get unlimited amounts of ETH on it, so why do miners mine the next block at all? Is it basically a gift economy, that would come crashing down if someone actually deployed a popular app (say, voting on the blockchain) on Ropsten?

I am considering doing just this… meaning I want to build dapps which sidestep the high cost of ETH, and take advantage of the "good-enough" security of Ropsten etc. and also reward our own nodes and contracts in various ERC20 contract currency, rather than ETH. Presumably there are no faucets that just mint arbitrary amounts of arbitrary ERC20 contracts, since the mint methods are actual code deployed by someone. Like our own ERC20 contract… we can tell it to mint on Ropsten to those who send us wires, paypal, ETH on the mainnet, or whatever.


Get this bounty!!!

#StackBounty: #blockchain #wallet #wallet-recovery #exodus Jaxx and Exodus wallet out of sync for BTC

Bounty: 50

I was using both Jaxx wallet and Exodus in parallel using the same passphrase.

However my Jaxx wallet was configured to generate a new address on every transaction and Exodus wallet had a fixed receive address.

I received ‘x’ amount of BTC to my exodus wallet address. Then I sent some ‘y’ BTC to a friend using the same Exodus wallet.

The send transaction is showing correctly in my Jaxxx wallet but I do not see the receive transactions in my Jaxx wallet. It is showing balance as 0. However, the balance is showing correctly in Exodus wallet.

How do I get the balance to show up correctly in Jaxx wallet? I tried deleting the app and setting it up again but its still showing 0 balance.


Get this bounty!!!

#StackBounty: #go-ethereum #blockchain #synchronization Geth server syncs itself very slow on SSD storage

Bounty: 50

This is the second time I’ve lunched a Geth server with full mode on a server with the resources below:

  • 4Core CPU
  • 16GB RAM
  • 400GB SSD

But server keeps staying arount half of highestBlock and its synchronization is very slow. It’s the second day that I’m checking this server and the current status is:

> eth.syncing
{
  currentBlock: 4185982,
  highestBlock: 10042734,
  knownStates: 0,
  pulledStates: 0,
  startingBlock: 0
}

May you tell me what is the problem? Aren’t the resources enough? Or I had some other mistakes?
This is the command I used to run geth:

geth --rpc --rpcport 1555 --rpcapi personal,eth,web3,txpool,net

I also tested --cache 8192 in this command, but nothing did not change.


Get this bounty!!!