diff --git a/package.json b/package.json
index 722e8acf869ed182c9ab8c0e629da5a714bbc30f..a7fa3faf75df0be992d4dd65d6ac1f8bc704f24e 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "steem",
-  "version": "0.5.5",
+  "version": "0.5.6",
   "description": "Steem.js the JavaScript API for Steem blockchain",
   "main": "index.js",
   "scripts": {
@@ -9,7 +9,8 @@
     "build": "npm run build-browser && npm run build-node",
     "build-browser": "rm -rf dist && NODE_ENV=production webpack && gzip -k -f ./dist/*.js && du -h ./dist/*",
     "build-node": "mkdir -p ./lib && cp -r ./src/* ./lib/ && babel ./src --out-dir ./lib",
-    "prepublish": "npm run test && npm run build"
+    "prepublish": "npm run test && npm run build",
+    "postinstall": "scripts/post-install.js"
   },
   "browser": {
     "ws": false,
@@ -36,10 +37,11 @@
     "bluebird": "^3.4.6",
     "browserify-aes": "^1.0.6",
     "bs58": "^4.0.0",
+    "buffer": "^5.0.6",
     "bytebuffer": "^5.0.1",
     "create-hash": "^1.1.2",
     "create-hmac": "^1.1.4",
-    "debug": "^2.2.0",
+    "debug": "^2.6.8",
     "detect-node": "^2.0.3",
     "ecurve": "^1.0.5",
     "lodash": "^4.16.4",
diff --git a/scripts/index.rn.js b/scripts/index.rn.js
new file mode 100644
index 0000000000000000000000000000000000000000..16b346c8caacaf82eeda6bcef0954f80bf033e20
--- /dev/null
+++ b/scripts/index.rn.js
@@ -0,0 +1,21 @@
+/* Patched for react native */
+
+global.Buffer = require('buffer').Buffer;
+global.process = require('process');
+global.process.env.NODE_ENV = __DEV__ ? 'development' : 'production'; // eslint-disable-line
+
+// Needed so that 'stream-http' chooses the right default protocol.
+global.location = { protocol: 'file:' };
+
+// Don't do this in production. You're going to want to patch in
+// https://github.com/mvayngrib/react-native-randombytes or similar.
+global.crypto = {
+  getRandomValues(byteArray) {
+    for (let i = 0; i < byteArray.length; i++) {
+      byteArray[i] = Math.floor(256 * Math.random());
+    }
+  },
+};
+
+require('./dist/steem.min.js');
+module.exports = global.steem;
diff --git a/scripts/post-install.js b/scripts/post-install.js
new file mode 100755
index 0000000000000000000000000000000000000000..cbccbf306b2594258e5bf16a89be0c1c76a961f9
--- /dev/null
+++ b/scripts/post-install.js
@@ -0,0 +1,23 @@
+#!/usr/bin/env node
+console.log('Running post install.js');
+try {
+    const root = __dirname.substr(0, __dirname.indexOf('node_modules/'));
+    if (root === undefined || root.length === 0) { return; }
+    const packageJSON = require(`${root}package.json`);
+    const path = require('path');
+    if (packageJSON.dependencies['react-native']) {
+        const fs = require('fs');
+        const index = path.join(__dirname, '..', 'index.js');
+        const RNIndex = path.join(__dirname, 'index.rn.js');
+        const indexContent = fs.readFileSync(RNIndex, { encoding: 'utf8' })
+        if (indexContent) {
+            fs.unlinkSync(index);
+            fs.writeFileSync(index, indexContent, 'utf8')
+        } else {
+            console.error('could not find index.rn.js');
+        }
+    }
+}
+catch (e) {
+    console.error('Error running postinstall script', e);
+}
\ No newline at end of file