Skip to content

Instantly share code, notes, and snippets.

@dshulyak
dshulyak / rlp.go
Created May 6, 2019 08:32
rlp.go
package main
import (
"fmt"
"github.com/ethereum/go-ethereum/rlp"
)
type Envelope struct {
A uint
0x023a49052089693f23d92fbd0efc7d0fceedf72b
const crypto = require('crypto');
alice = crypto.createECDH('secp256k1')
alice.setPrivateKey('a3a8441a4b5040b438223eb3b273b7c8d3d219f418df2ab9da03c7350f5601a9', 'hex')
bob = Buffer.from([4, 202, 191, 42, 27, 135, 133, 122, 201, 194, 207, 107, 136, 190, 242, 52, 229, 224, 20, 254, 233, 138, 194, 101, 9, 202, 37, 122, 237, 103, 143, 62, 28, 204, 159, 213, 185, 168, 60, 253, 145, 112, 153, 7, 2, 154, 113, 137, 71, 231, 53, 146, 209, 203, 219, 219, 142, 22, 115, 192, 199, 3, 24, 217, 152, 144, 176, 254, 186, 178, 137, 31, 37, 168, 176, 34, 18, 252, 177, 60, 231, 185, 53, 7, 76, 133, 215, 149, 78, 204, 137, 113, 171, 193, 181, 232, 224, 70, 214, 141, 213, 188, 22, 223, 49, 250, 199, 181, 200, 49, 115, 26, 26, 109, 174, 78, 124, 88])
alice.computeSecret(bob.slice(0, 65))
const crypto = require('crypto');
alice = crypto.createECDH('secp256k1')
alice.setPrivateKey('ce9873239e8c1126c1bb92086ab22e3f7c519afd530315f9b5ef92323bbddee3', 'hex')
bob = Buffer.from([4, 202, 191, 42, 27, 135, 133, 122, 201, 194, 207, 107, 136, 190, 242, 52, 229, 224, 20, 254, 233, 138, 194, 101, 9, 202, 37, 122, 237, 103, 143, 62, 28, 204, 159, 213, 185, 168, 60, 253, 145, 112, 153, 7, 2, 154, 113, 137, 71, 231, 53, 146, 209, 203, 219, 219, 142, 22, 115, 192, 199, 3, 24, 217, 152, 144, 176, 254, 186, 178, 137, 31, 37, 168, 176, 34, 18, 252, 177, 60, 231, 185, 53, 7, 76, 133, 215, 149, 78, 204, 137, 113, 171, 193, 181, 232, 224, 70, 214, 141, 213, 188, 22, 223, 49, 250, 199, 181, 200, 49, 115, 26, 26, 109, 174, 78, 124, 88])
alice.computeSecret(bob.slice(0, 65))
package main
import (
"crypto/elliptic"
"crypto/rand"
"fmt"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto/ecies"
@dshulyak
dshulyak / custody.go
Created September 5, 2018 07:23
merklezied proof of custody
package main
import (
"bytes"
"crypto/rand"
"fmt"
"github.com/ethereum/go-ethereum/crypto/sha3"
)
@dshulyak
dshulyak / hash.sol
Created September 3, 2018 06:26
test generate hash
pragma solidity ^0.4.21;
contract TestHash {
bytes32 public result;
constructor() public {}
function generate(bytes input) public {
result = keccak256(input);
@dshulyak
dshulyak / validation.go
Last active August 21, 2018 13:51
validation for addBalance transaction
package main
import (
"bytes"
"crypto/rand"
"math/big"
"strings"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/common"
package main
import (
"bytes"
"crypto/ecdsa"
"fmt"
"math/rand"
"net"
"time"
2069 sudo sysctl -w net.ipv4.neigh.default.gc_thresh1=1024
2071 sudo sysctl -w net.ipv4.neigh.default.gc_thresh2=4096
2072 sudo sysctl -w net.ipv4.neigh.default.gc_thresh3=8192