Skip to content

Instantly share code, notes, and snippets.

@ltfschoen
ltfschoen / dh-rococo-local.md
Last active Feb 23, 2022
DataHighway rococo-local
View dh-rococo-local.md

I am using an Apple macOS with M1 processor when following the steps here https://docs.substrate.io/tutorials/v3/cumulus/start-relay/ I am using the versions specified here https://docs.substrate.io/tutorials/v3/cumulus/start-relay/#software-versioning (i.e. polkadot v0.9.16, substrate-parachain-template polkadot-v0.9.16 and Polkadot-JS Apps v0.103.2-8 from https://github.com/polkadot-js/apps/commit/0b6e52733181392e823f7c37e833f4f5fd6b16ef)

First I installed Substrate and Rust:

curl https://getsubstrate.io -sSf | bash -s -- --fast
wget -O - https://sh.rustup.rs | sh -s -- -y
PATH=$PATH:/root/.cargo/bin
@ltfschoen
ltfschoen / error-endow-genesis.md
Last active Feb 20, 2022
Errors in polkadot-launch after combining a JSON file with other accounts to be endowed at genesis
View error-endow-genesis.md

I am using an Apple macOS with M1 processor when following the steps here https://docs.substrate.io/tutorials/v3/cumulus/start-relay/ I am using the versions specified here https://docs.substrate.io/tutorials/v3/cumulus/start-relay/#software-versioning (i.e. polkadot v0.9.16, substrate-parachain-template polkadot-v0.9.16)

First I installed Substrate and Rust:

curl https://getsubstrate.io -sSf | bash -s -- --fast
wget -O - https://sh.rustup.rs | sh -s -- -y
PATH=$PATH:/root/.cargo/bin
rustup update stable
View chain_def_westlake.json
This file has been truncated, but you can view the full file.
{
"name": "DataHighway Westlake Mainnet",
"id": "westlake",
"chainType": "Live",
"bootNodes": [
"/ip4/3.127.123.230/tcp/30333/p2p/12D3KooWPSVWEpuNPKE6EJBAMQQRCrKG4RTfyyabFRjT4xqMkuH5",
"/ip4/3.65.196.4/tcp/30333/p2p/12D3KooWPZqAuWSez5uomot7GZvpuRQK198zqLYrLLZt5W7bvqPb",
"/ip4/3.123.21.153/tcp/30333/p2p/12D3KooWAjdURBpSsRVWbvnGRbsqykvueM6Vuoe4x7MhV6cxTtje",
"/ip4/18.184.76.132/tcp/30333/p2p/12D3KooWCWZc5L6ypCFcvDdGeGwsw9Mo4nniCwiVuU5MB6ApA4ZT",
@ltfschoen
ltfschoen / string-conversion.rs
Created Nov 8, 2021 — forked from jimmychu0807/string-conversion.rs
Conversion between String, str, Vec<u8>, Vec<char> in Rust
View string-conversion.rs
use std::str;
fn main() {
// -- FROM: vec of chars --
let src1: Vec<char> = vec!['j','{','"','i','m','m','y','"','}'];
// to String
let string1: String = src1.iter().collect::<String>();
// to str
let str1: &str = &src1.iter().collect::<String>();
// to vec of byte
@ltfschoen
ltfschoen / rotki.md
Created Aug 27, 2020
Rotki release steps to verify checksum
View rotki.md

The following are steps taken to verify the checksum of the Rotki installer on macOS:

  • Downloaded the file (i.e. rotki-darwin-v1.6.2.dmg.sha512) that contains the published SHA512 hash of binaries that we'll use as checksum to verify the integrity of the binary
  • View the checksum in the file with cat rotki-darwin-v1.6.2.dmg.sha512
    • Example output was:
f1be8965f206fb0ae5f745575c0e4da12a302e237188bb5cd41d73a19705965fc409da72508253f8908626ccbfb43990bf0e801f3cfa0ff9e29000c7d177a074  rotki-darwin-v1.6.2.dmg
View acala.md
View dash-core-macos.md

download latest dashcore-0.15.0.0-osx.dmg and SHA256SUMS.asc from https://github.com/dashpay/dash/releases

verify checksums match

cat SHA256SUMS.asc
shasum -a 256 dashcore-0.15.0.0-osx.dmg

installed to:

@ltfschoen
ltfschoen / litecoin-core-macos.md
Last active Jun 30, 2020
litecoin-core-macos
View litecoin-core-macos.md
@ltfschoen
ltfschoen / update-lockdrop-like-test-and-use-mxctoken-and-weenus.md
Last active Jun 22, 2020
update-lockdrop-like-test-and-use-mxctoken-and-weenus
View update-lockdrop-like-test-and-use-mxctoken-and-weenus.md

modified Lockdrop.sol with the changes shown in this commit https://github.com/DataHighway-DHX/mining/commit/18c59a2c646633d1687fcba7adc637e7931f8572 so that the Lock contract that it generates is deployed first, and then we deposit or withdraw from it only after providing approval from the ERC20 token by running its approve function (like what Test.sol did) instead of constructing the contract and performing a deposit before it was possible to grant it permission. so i deployed Lockdrop.sol to 0x5d030d3f45362f6ccc1f3c29c8cdeb617602d814 i deployed MXCToken (that imports StandardToken) on Rinkeby here: 0x6d8fc9e069f8fbab67a0a93d9cb19d3d16e21ccc (the same code that MXC used to deploy it to mainnet) then loaded MXCToken using AtAddress 0x6d8fc9e069f8fbab67a0a93d9cb19d3d16e21ccc Ran the "lock" function in Lockdrop.sol with arguments: `"0x1f7ace08af5c49a5d69fbb98fb9339a729b27161","3","100","0x46765939697a514462737a7a46556b437a65643435547039785062754b4e516e4d563150676b385959444b43573476","0x6d8fc9e069f8fbab67a0

View debug-weenus
i deployed a duplicate of Weenus from my account 0x1f... to 0x2d2c5fdfcc44fb2c9cdaebc468d6cb23a809d5cd
then (using a separate Remix window since different .sol files use different solc versions)
i compiled and deployed Test.sol passing my Weenus contract address as param `0x2d2c5fdfcc44fb2c9cdaebc468d6cb23a809d5cd`
it was deployed to 0x6ccadfd4e2233656e77b41d6c55bc8deb9753497
then loaded WeenusToken using `AtAddress` 0x2d2c5fdfcc44fb2c9cdaebc468d6cb23a809d5cd
and clicked `approve` using argument "0x6ccadfd4e2233656e77b41d6c55bc8deb9753497, 100", and it's mined successfully
and clicked `balanceOf` using argument of my address "0x1f7ace08af5c49a5d69fbb98fb9339a729b27161" and it showed i had 1000 WEENUS
then loaded Test using `AtAddress` 0x6ccadfd4e2233656e77b41d6c55bc8deb9753497
clicked `depositTokens` using argument `1`
and it transfers 1 WEENUS from my account to the Weenus contract. It works in this tx https://rinkeby.etherscan.io/tx/0x27e5d5cf2d5dea6fda463fd378726dbb51a891ed96d69399569783a72cd87921