<commit_before>var Web3 = require('web3');
var web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
var Tx = require('ethereumjs-tx');

function getRawTransactionString(
        privateKey,
        rawTx
) {
        var args = Array.prototype.slice.call(arguments, 0);
        privateKey = new Buffer(privateKey, 'hex');
        var tx = new Tx(rawTx);
        tx.sign(privateKey);
        var serializedTx = tx.serialize();
        console.log(serializedTx.toString('hex'));
}

/** Example
* getRawTransactionString(
*         'e331b6d69882b4cb4ea581d88e0b604039a3de5967688d3dcffdd2270c0fd109',
*         {
*                 nonce: '0x00',
*                 gasPrice: '0x09184e72a000',
*                 gasLimit: '0x2710',
*                 to: '0x0000000000000000000000000000000000000000',
*                 value: '0x00',
*                 data: '0x7f7465737432000000000000000000000000000000000000000000000000000000600057'
*         }
* );
**/
<commit_msg>works for browser now<commit_after>/**
* Include the ethereumjs-tx.js file in the index.html file
* Download it here: https://github.com/ethereumjs/browser-builds
**/

if (typeof web3 !== 'undefined') {
        web3 = new Web3(web3.currentProvider);
} else {
    // set the provider you want from Web3.providers
    web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
}

function getRawTransactionString(
        privateKey,
        rawTx
) {
        var args = Array.prototype.slice.call(arguments, 0);
        privateKey = EthJS.Buffer.Buffer(privateKey, 'hex');
        var tx = new EthJS.Tx(rawTx);
        tx.sign(privateKey);
        var serializedTx = tx.serialize();
        return serializedTx.toString('hex');
}

{'fraction_non_alphanumeric': 0.12565141864504922, 'fraction_numerical': 0.11464968152866242, 'mean_word_length': 2.7729257641921397, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '889836', 'n_tokens_mistral': 667, 'n_tokens_neox': 535, 'n_words': 103}