Skip to main content
replaced http://ethereum.stackexchange.com/ with https://ethereum.stackexchange.com/
Source Link

Using the stripCrLf script in How to load Solidity source file into gethHow to load Solidity source file into geth, I've flattened the source code using the following command:

Using the stripCrLf script in How to load Solidity source file into geth, I've flattened the source code using the following command:

Using the stripCrLf script in How to load Solidity source file into geth, I've flattened the source code using the following command:

Correcting typo
Source Link
BokkyPooBah
  • 40.4k
  • 14
  • 124
  • 195
0x6506077500000000000000000000000000000000000000000000000000000000000000040x650607750000000000000000000000000000000000000000000000000000000000000005 
0x650607750000000000000000000000000000000000000000000000000000000000000004 
0x650607750000000000000000000000000000000000000000000000000000000000000005 
Tidy
Source Link
BokkyPooBah
  • 40.4k
  • 14
  • 124
  • 195
user@Kumquat:~$ echo "var cSource='`stripCrLf C.sol`'" var cSource='contract C { uint[] public numbers; function initNumbers() { numbers.push(1); numbers.push(2); } function stateChanger(uint a) { numbers.push(a); } }' 
user@Kumquat:~$ geth --datadir ~/devdata --dev --mine --minerthreads 1 --unlock 0 --password ~/passwordfile console 
> var cCompiled = web3.eth.compile.solidity(cSource); Version: 0.3.5-0/RelWithDebInfo-Linux/g++/Interpreter path: /usr/bin/solc undefined 
> cCompiled.C.info.abiDefinition [{ constant: false, inputs: [], name: "initNumbers", outputs: [], type: "function" }, { constant: false, inputs: [{ name: "a", type: "uint256" }], name: "stateChanger", outputs: [], type: "function" }, { constant: true, inputs: [{ name: "", type: "uint256" }], name: "numbers", outputs: [{ name: "", type: "uint256" }], type: "function" }] 
> var cContract = web3.eth.contract(cCompiled.C.info.abiDefinition); undefined > var c = cContract.new({ from:web3.eth.accounts[0], data: cCompiled.C.code, gas: 400000}, function(e, contract) { if (!e) { if (!contract.address) { console.log("Contract transaction send: TransactionHash: " + contract.transactionHash + " waiting to be mined..."); } else { console.log("Contract mined! Address: " + contract.address); console.log(contract); } } }) Contract mined! Address: 0x672807a8c0f72a52d759942e86cfe33264e73934 
> c.initNumbers({from:eth.accounts[0], gas: 400000}) "0x3f21e1cdb636a2cf291cd9296282a4e9c4f4ed57c65a13fedc937a97203c3a75" ... > c.numbers(0) 1 > c.numbers(1) 2 > c.numbers(2) 0 
> c.stateChanger(3, {from:eth.accounts[0], gas: 400000}) "0x3ecf3aa6464f93d5b062ad01b76b5dbc4302c190baf70d157a4d7607d4c7c749" ... > c.numbers(2) 3 > c.numbers(3) 0 
echo "var cSource='`stripCrLf C.sol`'" var cSource='contract C { uint[] public numbers; function initNumbers() { numbers.push(1); numbers.push(2); } function stateChanger(uint a) { numbers.push(a); } }' 
geth --datadir ~/devdata --dev --mine --minerthreads 1 --unlock 0 --password ~/passwordfile console 
var cCompiled = web3.eth.compile.solidity(cSource); Version: 0.3.5-0/RelWithDebInfo-Linux/g++/Interpreter path: /usr/bin/solc undefined 
cCompiled.C.info.abiDefinition [{ constant: false, inputs: [], name: "initNumbers", outputs: [], type: "function" }, { constant: false, inputs: [{ name: "a", type: "uint256" }], name: "stateChanger", outputs: [], type: "function" }, { constant: true, inputs: [{ name: "", type: "uint256" }], name: "numbers", outputs: [{ name: "", type: "uint256" }], type: "function" }] 
var cContract = web3.eth.contract(cCompiled.C.info.abiDefinition); var c = cContract.new({ from:web3.eth.accounts[0], data: cCompiled.C.code, gas: 400000}, function(e, contract) { if (!e) { if (!contract.address) { console.log("Contract transaction send: TransactionHash: " + contract.transactionHash + " waiting to be mined..."); } else { console.log("Contract mined! Address: " + contract.address); console.log(contract); } } }) Contract mined! Address: 0x672807a8c0f72a52d759942e86cfe33264e73934 
> c.initNumbers({from:eth.accounts[0], gas: 400000}) "0x3f21e1cdb636a2cf291cd9296282a4e9c4f4ed57c65a13fedc937a97203c3a75" > c.numbers(0) 1 > c.numbers(1) 2 > c.numbers(2) 0 
c.stateChanger(3, {from:eth.accounts[0], gas: 400000}) "0x3ecf3aa6464f93d5b062ad01b76b5dbc4302c190baf70d157a4d7607d4c7c749" ... > c.numbers(2) 3 > c.numbers(3) 0 
user@Kumquat:~$ echo "var cSource='`stripCrLf C.sol`'" var cSource='contract C { uint[] public numbers; function initNumbers() { numbers.push(1); numbers.push(2); } function stateChanger(uint a) { numbers.push(a); } }' 
user@Kumquat:~$ geth --datadir ~/devdata --dev --mine --minerthreads 1 --unlock 0 --password ~/passwordfile console 
> var cCompiled = web3.eth.compile.solidity(cSource); Version: 0.3.5-0/RelWithDebInfo-Linux/g++/Interpreter path: /usr/bin/solc undefined 
> cCompiled.C.info.abiDefinition [{ constant: false, inputs: [], name: "initNumbers", outputs: [], type: "function" }, { constant: false, inputs: [{ name: "a", type: "uint256" }], name: "stateChanger", outputs: [], type: "function" }, { constant: true, inputs: [{ name: "", type: "uint256" }], name: "numbers", outputs: [{ name: "", type: "uint256" }], type: "function" }] 
> var cContract = web3.eth.contract(cCompiled.C.info.abiDefinition); undefined > var c = cContract.new({ from:web3.eth.accounts[0], data: cCompiled.C.code, gas: 400000}, function(e, contract) { if (!e) { if (!contract.address) { console.log("Contract transaction send: TransactionHash: " + contract.transactionHash + " waiting to be mined..."); } else { console.log("Contract mined! Address: " + contract.address); console.log(contract); } } }) Contract mined! Address: 0x672807a8c0f72a52d759942e86cfe33264e73934 
> c.initNumbers({from:eth.accounts[0], gas: 400000}) "0x3f21e1cdb636a2cf291cd9296282a4e9c4f4ed57c65a13fedc937a97203c3a75" ... > c.numbers(0) 1 > c.numbers(1) 2 > c.numbers(2) 0 
> c.stateChanger(3, {from:eth.accounts[0], gas: 400000}) "0x3ecf3aa6464f93d5b062ad01b76b5dbc4302c190baf70d157a4d7607d4c7c749" ... > c.numbers(2) 3 > c.numbers(3) 0 
Tidy
Source Link
BokkyPooBah
  • 40.4k
  • 14
  • 124
  • 195
Loading
Update
Source Link
BokkyPooBah
  • 40.4k
  • 14
  • 124
  • 195
Loading
Update
Source Link
BokkyPooBah
  • 40.4k
  • 14
  • 124
  • 195
Loading
Update
Source Link
BokkyPooBah
  • 40.4k
  • 14
  • 124
  • 195
Loading
deleted 6 characters in body
Source Link
Sebi
  • 5.3k
  • 6
  • 29
  • 52
Loading
Source Link
BokkyPooBah
  • 40.4k
  • 14
  • 124
  • 195
Loading