0

How can I upload a smart contract to the Ethereum blockchain directly from a Raspbian Terminal without Parity, Geth, etc installed?

Hello,

I primarily use a Raspberry Pi 3B with Raspbian OS installed as my main computer.

I would like to upload my smart contracts directly from the terminal to the Ethereum blockchain without using a browser OR parity OR geth etc.

Is it possible and if so how?

Vesa

1

I think it is possible by using a web3 provider that runs on the mainnet. I think that infura (i.e. the same company of metamask) can be used to perform what you ask. Essentially you need this piece of code (taken from this github link):

const Web3 = require('web3')

// connect to Infura node
const web3 = new Web3(new Web3.providers.HttpProvider('https://mainnet.infura.io/INFURA_KEY'))

Then you can actually send transactions (and therefore deploy contracts) as if you were running a geth instance locally, by following the common procedures. You need an infura key that can be obtained on this link.

You will need node and the web3 node package (npm install web3), but this approach does not require neither a graphical user interface nor a synced geth instance on your raspberry.

  • But how do I pay Infura for uploading the contract? The deployment fee I mean. – Vesa Jul 6 '18 at 12:01
  • Deploying a contract to the blockchain is not free, right? – Vesa Jul 6 '18 at 12:01
  • Yes, you have to pay fees for the deploying to the miner. This means that you need to have an Ethereum address with a sufficient amount of Ether to pay the deployment. If you take a look to the GitHub link, you can see that the author specify the address and the private key to sign a transaction. You need to make something analogous. Maybe this link can help you ethereum.stackexchange.com/questions/50362/… – Briomkez Jul 6 '18 at 12:30
  • Really? It's safe to transfer the private key like that? – Vesa Jul 6 '18 at 16:23
  • If you check the link, I do not think it sends the private key, but rather it uses the module ethereumjs-tx to sign a transaction. So the private key is used only locally. You send to infura only the signed transaction... – Briomkez Jul 6 '18 at 16:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.