[Tour de SOL] Stage 3 - Details

Introductory Note

Thanks to everyone that participated in Stage 2. With us now moving into April, we’re going to be shifting into Stage 3. The key area of focus for Stage 3 is Smart Contracts. To point everyone in the right direction, we’ve put together a quick-start guide to Smart Contracts on Solana at the end of this thread. As we’ve created a specific compensation category for Smart Contract related bugs in this stage, we encourage everyone to familiarise themselves and take some time to walk through the information.

Stage 3 - Details

  • Start Date/Time: Thursday, 2nd of April, ~10:00am PT
  • Estimated Duration: 4 weeks
  • Malicious behaviour will be incentivised
  • The focus of Stage 3 will be Smart Contracts

Future Stages

  • Additional details will be announced progressively depending on the progress made on the previous stages
  • Within each stage the allowable attack surface will vary depending on engineering goals and any new features enabled with each new release. Similarly, metrics upon which participants will be measured against will vary to suit (i.e. performance may be enabled in future stages with Ramp TPS or some other method, and total stake accumulated would become a metric upon which compensation is tied).
  • Our intention at this point in time is for each Stage to run for up to approximately 4 weeks.
  • Future stages will not start until the previous stage is complete

Note that we reserve the right to change the schedule/duration if required, but we’ll endeavour to provide clear and ample notification if so.

Attack Surface

Each Stage will be configured to behave exactly like the next-in-line upgrade for the Mainnet Beta network at each respective point in time. Participants can expect the attack surface to grow over time as more features are enabled. We’ll be starting with the v1.1.X release line in Stage 3.

Compensation

Compensation slightly reworked since Stage 2, new sections have been indicated in bold for clarity:

1. Participation - This will be measured by multiple factors, including but not limited to if you’ve joined the network, are actively staked, are responsive to issues (i.e. don’t become delinquent, or actively work to resolve the issue if you become delinquent), implement patches/upgrades within a reasonable timeframe and remain so until the end of the stage.

Compensation Amount: 3,500 SOL per participant

2. Security Bug Bounties - We’ll be incentivising participants for identifying security issues within the network. This has been renamed because the previous title gave the impression to participants that an attack had to be successfully executed to be eligible for compensation. This is not the case, participants that reveal a security attack vector to the team, without executing the attack will still be eligible. Security Bugs will still be classified into two separate classes:

  • Critical: Security bugs that take down the network or successfully execute an economic attack. Issues that simply manifest over time due to failure of our software - without deliberate exploitation - will be excluded.
    Compensation Amount: 20,000 SOL each

  • Smart Contracts: Bugs specifically relating to Solana’s smart contract module
    Compensation Amount: 5,000 SOL each

  • Other: Any other security bugs that are identified but don’t fall within the ‘Critical’ category.
    Compensation Amount: 3,000 SOL each

The participant submitting the security bug bounty still must file a github issue, describing the attack to be eligible (amongst registration etc.) for the compensation. Only if the attack was executed/demo’d then it is to remain off-limits and not attempted again until it has been resolved.

3. Compensation for Accidental Bug Identification - Bugs that are accidentally identified by any individual participant during Tour de SOL will still be eligible for compensation. This was retrospectively implemented into Stage 1 as well (congratulations to Everstake and Node-A-Team)

Compensation Amount: 3,000 SOL each

The introduction of this is not to discount the amount of effort required to deliberately identify exploits, but to encourage and incentivize validators for experimenting and exploring the code.

4. Equal Distribution of Compensation for Non-Assigned Bugs Identified - As a small gesture of recognition, all validators that actively participated in Stage 2 will be compensated with additional tokens on top of the the base amount, that will be calculated determined by the # of bugs successfully identified during Stage 1. This will be calculated as follows:

Critical Bugs
( total # critical bugs identified x Compensation amount for bug ) / total validators = additional compensation per Validator

Non-Critical Bugs
( total non-critical bugs identified x compensation amount for bug ) / total validators = additional compensation per Validator

Communication Channels for the Event:

  • Primary Channel: We’ve set up a channel titled #tourdesol-announcements which you can join to stay up to date on any major updates related to the events
  • Other channels we’ll also be re-distributing any major announcements via:
    • WeChat: message Dominic#6192 on discord to for an invite
    • E-mail: Your registered email
    • Telegram

Quick-Start Guide

General Documentation:

  1. Our Solana Github
    Solana has been completely open-source from inception. You’ll find all of our code within this repository here

  2. Our Web3 SDK
    This is the Solana Javascript API built on the Solana node RPC

  3. Solana Technical Documentation
    These explain why Solana is useful, how to use it, how it works, and why it will continue to work long in the decades to come

  4. Solana Node RPC

Examples to Dive Right In:

  1. Building a Simple ERC20-Like Token on Solana
    This is a quick example demonstrating how you would use the Solana Javascript API to build, deploy, and interact with an ERC20-like Token example program on the Solana blockchain. For convenience the:

  2. On-Chain Entry Point is here

  3. Client-Side Entry Point is here

  4. On-Chain Program Entry Point is here

  5. Program Entry Point is Dispatched here

Final Words

As always feel free to reach out if you have any queries or concerns. A friendly reminder that participants need to complete registration for us to be able to distribute compensation. If you have issues on that front please also reach out. Introductory Note

2 Likes

Should these things work on a Mac (Catalina)?

I grabbed the example-token code.

did the install – which looks a bit wrong, but seems to have worked, because when I dump the solana object it’s there:

~/SOLANA/example-token$ npm install --save @solana/web3.js
npm WARN deprecated circular-json@0.5.9: CircularJSON is in maintenance only, flatted is its successor.

> fsevents@1.2.12 install /Users/mrsmith/SOLANA/example-token/node_modules/fsevents
> node-gyp rebuild

No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.

gyp: No Xcode or CLT version detected!
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:344:16)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 19.3.0
gyp ERR! command "/usr/local/Cellar/node/12.12.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/mrsmith/SOLANA/example-token/node_modules/fsevents
gyp ERR! node -v v12.12.0
gyp ERR! node-gyp -v v5.0.3
gyp ERR! not ok 
npm WARN ws@7.2.3 requires a peer of bufferutil@^4.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN ws@7.2.3 requires a peer of utf-8-validate@^5.0.2 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

Seems wrong, but looks ok:

~/SOLANA/example-token$ node
Welcome to Node.js v12.12.0.
Type ".help" for more information.
> const solanaWeb3 = require('@solana/web3.js');
undefined
> solanaWeb3
{
  Account: [Function: Account],
  Authorized: [Function: Authorized], .......

But this definitley don’t work:

~/SOLANA/example-token$ npx solana-localnet update
1.0.0
+ docker pull solanalabs/solana:v1.0.11
Saved file tree to doc-filelist.js
Copied JS to doc-script.js
Compiled CSS to doc-style.css
~/SOLANA/example-token$ npx solana-localnet up
1.0.0
+ RUST_LOG=solana_runtime::native_loader=trace,solana_runtime::system_instruction_processor=trace,solana_runtime::bank=debug,solana_bpf_loader=debug,solana_rbpf=debug
+ ARGS=(--detach --name solana-localnet --rm --publish 8899:8899 --publish 8900:8900 --publish 9900:9900 --tty --env "RUST_LOG=$RUST_LOG")
+ [[ -n '' ]]
+ docker run --detach --name solana-localnet --rm --publish 8899:8899 --publish 8900:8900 --publish 9900:9900 --tty --env RUST_LOG=solana_runtime::native_loader=trace,solana_runtime::system_instruction_processor=trace,solana_runtime::bank=debug,solana_bpf_loader=debug,solana_rbpf=debug solanalabs/solana:v1.0.11
Saved file tree to doc-filelist.js
Copied JS to doc-script.js
Compiled CSS to doc-style.css
+ for _ in 1 2 3 4 5
+ curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1, "method":"getTransactionCount"}' http://localhost:8899
curl: (7) Failed to connect to localhost port 8899: Connection refused
+ sleep 1
+ for _ in 1 2 3 4 5
+ curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1, "method":"getTransactionCount"}' http://localhost:8899
curl: (7) Failed to connect to localhost port 8899: Connection refused
+ sleep 1
+ for _ in 1 2 3 4 5
+ curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1, "method":"getTransactionCount"}' http://localhost:8899
curl: (7) Failed to connect to localhost port 8899: Connection refused
+ sleep 1
+ for _ in 1 2 3 4 5
+ curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1, "method":"getTransactionCount"}' http://localhost:8899
curl: (7) Failed to connect to localhost port 8899: Connection refused
+ sleep 1
+ for _ in 1 2 3 4 5
+ curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1, "method":"getTransactionCount"}' http://localhost:8899
curl: (7) Failed to connect to localhost port 8899: Connection refused
+ sleep 1

Solana - Smart Contract Challenge

Overview

One of our newest features that we’ve enabled on the latest software release for Solana is Smart Contracts. This is really exciting for us as one of the biggest differentiators with Solana, and keys to scaling is through parallelized smart contract execution.

This will be extremely powerful in general, but even more so in smart contracts used for Open Finance. Whether it be payments, oracles, or in decentralised exchanges.

But first we want to stress test these features. Which is why for Stage 3 of TdS we’ll be introducing Smart Contract Challenges.

Goals:

  • Help our validator/developer community familiarise themselves with how Smart Contracts work on Solana
  • Identify any bugs prior to enabling these features on Mainnet Beta
  • Collect feedback to help us iterate on our developer experience

Frequency:

  • One new challenge introduced each week

The First Challenge: Deploying a BPF (Berkeley Packet Filter) Program

Our first challenge is relatively straightforward. We want to get you all to successfully deploy a BPF Program. This challenge will walk you through:

  • Building a Rust Program
  • A JS Front-End
  • Deploying and Interacting with the Program

You can jump to the walkthrough HERE.

Compensation

  • We’ll be giving out 500 SOL to each participant that completes this first challenge. As with all testnet token distributions these will also be locked, but can be staked.
  • Proof of Completion: Once you create the program, you’ll need to submit the account address of the program HERE so that we can verify it exists with the solana accounts command.
  • Eligibility: Limited to any participants currently involved in Mainnet Beta and or Tour de SOL
  • For any bugs identified relating to Smart Contracts, the Smart Contract bug bounty originally covered in the Stage 3 announcement will be compensated separately to this.

Final Words

Once you’ve gone through, we’d love to get some feedback on the experience in our Discord! Thanks for making the time, this is really important to us and we really appreciate it.

6 Likes

Yes, most of the Solana engineers develop on a Mac!

Looks like you’re using docker.js instead of docker. See here: https://stackoverflow.com/questions/40675829/docker-run-hello-world-not-working

Also, you will probably need to install XCode CLI tools: xcode-select --install

4 Likes

From the output, is the account the program is loaded to the ‘pubkey’, and the account to say hello to the ‘account address’? In the form?

1 Like

Hey @panoukla

In the below example, the account would be:
47bZX1D1tdmw3KWTo5MfBrAwwHBJQQzQL4VnNGT7HtyQ

Connection to cluster established: [http://localhost:8899](http://localhost:8899/) { solana-core: 1.1.2 }
Loading hello world program...
Program loaded to account 47bZX1D1tdmw3KWTo5MfBrAwwHBJQQzQL4VnNGT7HtyQ
Creating account Eys1jdLHdZ2AE56QAKpfadbjziMZ6NAvpL7qsdtM6sbk to say hello to
Saying hello to Eys1jdLHdZ2AE56QAKpfadbjziMZ6NAvpL7qsdtM6sbk
Eys1jdLHdZ2AE56QAKpfadbjziMZ6NAvpL7qsdtM6sbk has been greeted 1 times
Success
1 Like

Hi, newbie here. Need a bit of help/hint in getting the example-helloworld running on Ubuntu Server 18.04.

I tried to run npm run localnet:up command, but keep getting Connection refused error.

binghan@binghan-solana:~/example-helloworld$ npm run localnet:up

> helloworld@0.0.1 localnet:up /home/binghan/example-helloworld
> set -x; solana-localnet down; set -e; solana-localnet up

+ solana-localnet down
Docker version 19.03.6, build 369ce74a3c
++ docker ps --filter 'name=^solana-localnet$' -q
+ [[ -n '' ]]
+ set -e
+ solana-localnet up
Docker version 19.03.6, build 369ce74a3c
+ RUST_LOG=solana=info
+ ARGS=(--detach --name solana-localnet --rm --publish 8899:8899 --publish 8900:8900 --publish 9900:9900 --tty --env "RUST_LOG=$RUST_LOG")
+ [[ -n '' ]]
+ docker run --detach --name solana-localnet --rm --publish 8899:8899 --publish 8900:8900 --publish 9900:9900 --tty --env RUST_LOG=solana=info solanalabs/solana:v1.1.2
f50593da0e9a691a12e1f0c9d701764d65370ca7efad057540c6f0c3e02b405e
+ for _ in 1 2 3 4 5
+ curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1, "method":"getTransactionCount"}' http://localhost:8899
curl: (52) Empty reply from server
+ sleep 1
+ for _ in 1 2 3 4 5
+ curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1, "method":"getTransactionCount"}' http://localhost:8899
curl: (7) Failed to connect to localhost port 8899: Connection refused
+ sleep 1
+ for _ in 1 2 3 4 5
+ curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1, "method":"getTransactionCount"}' http://localhost:8899
curl: (7) Failed to connect to localhost port 8899: Connection refused
+ sleep 1
+ for _ in 1 2 3 4 5
+ curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1, "method":"getTransactionCount"}' http://localhost:8899
curl: (7) Failed to connect to localhost port 8899: Connection refused
+ sleep 1
+ for _ in 1 2 3 4 5
+ curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1, "method":"getTransactionCount"}' http://localhost:8899
curl: (7) Failed to connect to localhost port 8899: Connection refused
+ sleep 1

I’ve also checked the log, but unfortunately it stopped at Docker version:

binghan@binghan-solana:~/example-helloworld$ npm run localnet:logs

> helloworld@0.0.1 localnet:logs /home/binghan/example-helloworld
> solana-localnet logs -f

Docker version 19.03.6, build 369ce74a3c
3 Likes

The connection refused error might be a port forwarding problem for port 8899. Unfortunately, I don’t know which OS you are using. Google for ‘docker port forwarding’ and your OS to get some ideas.

1 Like

The connection refused errors are because the OS is not forwarding requests to Docker. If you are using docker-machine, the command will look like docker-machine ssh default -f -N -L 8899:localhost:8899. I have some other notes (WIP) here: https://github.com/brianlong/example-helloworld/tree/202004-bl-changes

4 Likes

I tried on Gitpod and works …

gitpod /workspace/example-helloworld $ npm run start

> helloworld@0.0.1 start /workspace/example-helloworld
> babel-node src/client/main.js

Let's say hello to a Solana account...
Connection to cluster established: http://devnet.solana.com {
  'solana-core': '1.1.3 [channel=beta commit=0969e87b0876ab06fb5e0f1dc1decf9ac15f7834]'
}
Using account 7zAoEsVR3Md3Rx2bWGBfYyix8BZEQo1sxjYecGixa2GG containing 0.1212708 Sol to pay for fees
Loading hello world program...
Program loaded to account 8y8bCTd9Ey7JMWYhFw7abXm3iiPePhdJBCFfvnyx8iUk
Creating account FNvDzz3qkmhRAVpdzepVVC7YwpdEqekLreDU6MxNhimD to say hello to
Saying hello to FNvDzz3qkmhRAVpdzepVVC7YwpdEqekLreDU6MxNhimD
FNvDzz3qkmhRAVpdzepVVC7YwpdEqekLreDU6MxNhimD has been greeted 1 times
Success
2 Likes

so smooth using certus one cluster :

RPC_URL=https://tds-faucet.certus.one npm run start

helloworld@0.0.1 start /root/smart_contract_solana/example-helloworld
babel-node src/client/main.js

Let’s say hello to a Solana account…
Connection to cluster established: https://tds-faucet.certus.one { ‘solana-core’: ‘1.1.2 [channel=unknown commit=unknown]’ }
Using account 3UW1r3WAvJPFLdyE4qNKHeweP366dXETdWxB72hkJxw8 containing 0.12160488 Sol to pay for fees
Loading hello world program…
Program loaded to account 6fE8PAhFaiBMvvjMkdKSrhqzXnBnq4HEiyqhrLShWL1q
Creating account 7nNCF5yHo4zQSWGzGP2LzecAyfGZCZxjGkwFU1TdCspN to say hello to
Saying hello to 7nNCF5yHo4zQSWGzGP2LzecAyfGZCZxjGkwFU1TdCspN
7nNCF5yHo4zQSWGzGP2LzecAyfGZCZxjGkwFU1TdCspN has been greeted 1 times
Success

2 Likes

Works Ubuntu 19.10 oke

2 Likes

Hi @dominic, What’s the deadline to complete this?

Stage 3? Or the Smart Contract challenge?

Stage 3, we’re looking to wrap up end of April/early-May. Yet to finalise a specific date yet. But will aim to time it with the next major software release. With how things are going I suspect we’ll want to sit on Smart Contracts a little longer before we implement into Mainnet Beta.

Smart Contract Challenge, we’ll probably just keep it ongoing for now. I think the first example was a good way for folks to dip their feet. We’ll be looking to introduce something slightly different/more complex in future iterations.

helloworld@0.0.1 start /root/example-helloworld
babel-node src/client/main.js

Let’s say hello to a Solana account…
Connection to cluster established: http://devnet.solana.com/ {
‘solana-core’: ‘1.1.8 [channel=beta commit=7cd1c06a5026250f0dcffbc6162f15c1bf6c9604]’
}
[Error: ENOENT: no such file or directory, open ‘src/program/target/bpfel-unknown-unknown/release/solana_bpf_helloworld.so’] {
errno: -2,
code: ‘ENOENT’,
syscall: ‘open’,
path: ‘src/program/target/bpfel-unknown-unknown/release/solana_bpf_helloworld.so’
}
root@sloee:~/example-helloworld

1 Like

Im trying to understand how this smart contract work but im getting this error above

Hey @jay! Did you run npm run build:program?

1 Like

I finally got it to work now thanks

@jay Hi, how did u resolve it?

I am getting below errors when build the on chain program.

helloworld@0.0.1 build:program-rust /root/example-helloworld
./src/program-rust/do.sh build && npm run clean:store

Building /root/example-helloworld/src/program-rust

  • cargo + install xargo
    Updating crates.io index
    Installing xargo v0.3.20
    Compiling libc v0.2.69
    Compiling autocfg v1.0.0
    Compiling cc v1.0.52
    Compiling cfg-if v0.1.10
    Compiling rustc-demangle v0.1.16
    error: linker cc not found
    |
    = note: No such file or directory (os error 2)

error: aborting due to previous error

error: could not compile libc.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish…
error: failed to compile xargo v0.3.20, intermediate artifacts can be found at /tmp/cargo-installoV1piv

Caused by:
build failed
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! helloworld@0.0.1 build:program-rust: ./src/program-rust/do.sh build && npm run clean:store
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the helloworld@0.0.1 build:program-rust script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-05-02T16_20_58_849Z-debug.log