Git Product home page Git Product logo

ethereum-rlp's People

Contributors

kingaerys avatar kinghodor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ethereum-rlp's Issues

License

Hi,

Great lib! What is the license in order to use it? Can I assume it's MIT?

Cheers,
Ben

Chain ID Calculation needs to be improved

Below two lines in RLP.c must be changed.
Your code just can create right RLP only when chain ID is small number.

totalLength += 1; //tx->signature_v.size

copyPos = wallet_copy_rpl(data + copyPos, &new_tx->signature_v, 1, copyPos);

Add below function and fix your code.
(I know this function is not great but can solve facing problem.)

int calculateLengOfV(uint32_t v) {
    // 1byte
    if ((v & 0xFF) == v) {
        return 1;        
    // 2byte
    } else if ((v & 0xFFFF) == v) {
        return 2;
    // 3byte
    } else if ((v & 0xFFFFFF) == v) {
        return 3;
    // 4byte
    } else if ((v & 0xFFFFFFFF) == v) {
        return 4;
    } else {
        return -1;
    }
}

And fix the code right.

totalLength += calculateLengOfV(new_tx->signature_v);

...

copyPos = wallet_copy_rpl(data + copyPos, &new_tx->signature_v, calculateLengOfV(new_tx->signature_v), copyPos);

the result cannot broadcast

i use the example result to broadcast:
f86c008504a817c80082520894e0defb92145fef3c3a945637705fafd3aa74a241880de0b6b3a7640000001ba009ebb6ca057a0535d6186462bc0b465b561c94a295bdb0621fc19208ab149a9ca0440ffd775ce91a833ab410777204d5341a6f9fa91216a6f3ee2c051fea6a0428

the error message is:
Error: rlp: non-canonical integer (leading zero bytes) for uint64, decoding into (types.Transaction)(types.txdata).AccountNonce

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.