Inter-Chain Bridged Token Asset Mining
git clone https://github.com/DataHighway-com/mining
cd ./mining
nvm use v11.6.0
Note: Otherwise may get error like no matching constructor for initialization of 'v8:
:Utf8Value'
npm install
npm install -g truffle ganache-cli
Latest beta (see https://github.com/trufflesuite/ganache-cli/releases)
npm uninstall ganache-cli -g
npm install ganache-cli@beta -g
Run Ethereum Client (in separate Terminal tab)
Delete DB folder if starting fresh
rm -rf ./db
Create DB folder
mkdir db && mkdir db/chain_database
Start Ethereum Blockchain Protocol Node Simulation that will be served on http://localhost:8545
Note:
0xce31EeD26ff009f1F5e38408571ea174c5d54f20
is Ethereum address of seed 0x209c205f333b5a65cc428589a51bd9f2621e2fc01de1b02dbf8c0f0b68e4974e
0xe66628e37eFE36098c148d2a3B970074999E95C6
is Ethereum address of seed 0x0edb559026c8f779be17b4c9d8e4dfc14bead6592241de4d6612f77769327f7f
ganache-cli \
--account="0x209c205f333b5a65cc428589a51bd9f2621e2fc01de1b02dbf8c0f0b68e4974e, 50471238800000000000" \
--account="0x0edb559026c8f779be17b4c9d8e4dfc14bead6592241de4d6612f77769327f7f, 100471238800000000000" \
--unlock "0x209c205f333b5a65cc428589a51bd9f2621e2fc01de1b02dbf8c0f0b68e4974e" \
--unlock "0x0edb559026c8f779be17b4c9d8e4dfc14bead6592241de4d6612f77769327f7f" \
--port 8545 \
--hostname localhost \
--seed '0x209c205f333b5a65cc428589a51bd9f2621e2fc01de1b02dbf8c0f0b68e4974e' \
--debug true \
--mem true \
--mnemonic 'end sleep vote expire arctic magic crack wrap toddler lizard acoustic owner' \
--db './db/chain_database' \
--verbose \
--networkId=3 \
--gasLimit=7984452 \
--gasPrice=20000000000;
truffle compile
(only changes since last compile)truffle compile --compile-all
(full compile)truffle migrate
truffle migrate --reset --network ropsten
truffle migrate --reset --network development
truffle migrate -f <number>
truffle migrate --network live
Note: If you get error Could not find suitable configuration file.
then you’re running the command in the wrong directory.
Note: If the above results in a time-out, then instead run the following to try and uncover any other errors:
truffle develop
truffle(develop)> migrate --reset
References:
Build Artifacts (requires Default or Custom Builder such as Webpack to be configured)
npm run build
(same as truffle build
)
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/
brew tap mongodb/brew
brew install mongodb-community@4.2
brew services start mongodb-community@4.2
Drop DB. Build App and Run Dev Server:
npm run drop; npm run dev
Open open http://localhost:8080
in browser
{"token":"xyz"}
)
curl -v POST http://localhost:7000/users/auth/register -d "network=ethereum-testnet-local&publicAddress=0x123&email=ltfschoen@gmail.com&password=123456&name=Luke" -H "Content-Type: application/x-www-form-urlencoded"
curl -v POST http://localhost:7000/users/auth/register -d '{"network": "ethereum-testnet-local", "publicAddress": "0x123", "email":"ltfschoen@gmail.com", "password":"123456", "name":"Luke"}' -H "Content-Type: application/json"
{"nonce":"123"}
)
curl -v GET http://localhost:7000/users/show?network='ethereum-testnet-local&publicAddress=0x123'
{"token":"xyz"}
)
curl -v POST http://localhost:7000/users/auth/login -d "network='ethereum-testnet-local'&publicAddress=0x123&signature=0x456&email=ltfschoen@gmail.com&password=123456" -H "Content-Type: application/x-www-form-urlencoded"
curl -v POST http://localhost:7000/users/auth/login -d '{"network": "ethereum-testnet-local", "publicAddress": "0x123", "signature": "0x456", "email":"ltfschoen@gmail.com", "password":"123456"}' -H "Content-Type: application/json"
curl -v GET http://localhost:7000/users/list -H "Content-Type: application/json" -H "Authorization: Bearer <INSERT_TOKEN>"
curl -v POST http://localhost:7000/users/create --data '[{"network": "ethereum-testnet-local", "publicAddress": "0x123", "signature": "0x456", "email":"test@fake.com", "name":"Test"}]' -H "Content-Type: application/json" -H "Authorization: JWT <INSERT_TOKEN>"
curl -v POST http://localhost:7000/users/create -d "network='ethereum-testnet-local'&publicAddress=0x123&signature=0x456&email=test2@fake.com&name=Test2" -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: JWT <INSERT_TOKEN>"
Within the DApp transfer say 10 wei to Account No. 0x0000000000000000000000000000000000000000000000000000000000000001 that we created on Ethereum TestRPC
Check Account Balances from Terminal by loading External JavaScript file:
truffle exec './scripts/checkAllBalances.js’
$ truffle develop
truffle(develop)> compile
truffle(develop)> migrate
truffle(develop)> exec ./scripts/deployMxc.js
OR truffle exec ./scripts/deployMxc.js --network development
Watch for changes to contracts, app and config files. Rebuild app upon changes.
truffle watch
Reference
truffle test
truffle test ./path/to/test/file.js
OR
$ truffle develop
truffle(develop)> test
Run Linter:
npm run lint
Run REPL on specified network and log communication between Truffle and the RPC
truffle console --network development --verbose-rpc
Try the following commands
web3
// Show existing MXCToken accounts
web3.eth.accounts
i.e.
[ '0xce31EeD26ff009f1F5e38408571ea174c5d54f20',
'0xe66628e37eFE36098c148d2a3B970074999E95C6' ]
web3.eth.blockNumber
Refer to Remix
truffle test
: Transaction was not mined within 50 blocks, please make sure your transaction was properly sent. Be aware that it might still be mined!
?--blockTime 3
mines 1 block every 3 seconds,truffle test
: sender doesn't have enough funds to send tx. The upfront cost is: 1134439500000000000 and the sender's account only has: 320739879999999999
?--account="0x0000000000000000000000000000000000000000000000000000000000000001, 50471238800000000000" \
provides 50 ETH to that account.) or restart the Ganache CLI