you
hello everyone the ones who are back
from lunch
I'm Hudson Jameson I work for the
foundation doing DevOps documentation a
kind of dap developer just kind of
organizing Devcon doing all that stuff
so I'm really excited to be here and if
you've seen me online my nickname is
soup tacular on there and then a piper
can do it sure
I'm Piper Miriam some of you met me
yesterday at the end of the day I
maintained a lot of the Python tooling
for aetherium I've worked with metallic
a bit on proof-of-concept
implementations for Casper and just kind
of generally theory and developer all
right well let's get started we're going
to teach you about solidity today so
solidity is a high-level language for
etherium contracts so what that means is
so we don't have to go and do like ones
and zeros or like low-level assembly
code or things like that we have a
high-level language that makes it much
easier for humans to be able to code you
know at a level they to understand and
then put it through the compiler into
what will come out and to the etherium
network solidity looks a lot like
JavaScript but with types it's sort of
this interesting amalgamation of of the
two this is a very simple solidity
contract the highest level thing that we
reason about in solidity is the contract
object you can think of a contract kind
of like a class if you're used to
object-oriented programming and the
contracts expose some number of
functions all right so the code is
compiled to the theory and virtual
machine y'all probably been hearing
about that a lot today pretty much it's
just like it takes the human readable
code and then puts it into a bunch of
Garg legal like ones and zeros and makes
it so that the etherium network can read
it
way that the computer can understand
once it's on the EVM it's completely
isolated so that's something a lot of
people forget but once a contract code
is on the etherium network it can't do
things like go and you know ping the
wthr.com and get the latest weather they
have to have a human intermediary
because there is isolated there's no
outside network or other types of
connections and the reason for that
isolation is that everything that
executes and the EVM has to be
completely deterministic which is why
you can't generate random numbers easily
inside of the EVM it requires some
outside interaction contracts are very
contracts are very easy to write but
they're very difficult to write securely
especially if you need to house
value or other people's funds this is a
pretty straightforward looking function
we've gotta withdraw a function for some
wallet contract it checks to make sure
that there's enough in the account to
withdraw it sends the funds that they
asked to withdraw and then it sets the
balance to what - the new balance this
will let somebody completely drain this
contract of funds this is exactly what
happened to the Dow I have this line
underlined because what actually happens
here is that this execute can execute
code on the address this is sending -
and since the account balance is only
deducted on the next line that means
that that contract can call back into
the withdraw method which will execute
that line again and it can do this
circularly at least until it runs out of
gas which means that it can if it can
get through a hundred loops of doing
this it means it can withdraw a hundred
times the amount that it has
yep yes this is me public functions
let's go over these there callable by
anybody so you have this like wallet
that has an asset on it and you're you
know like I'm gonna make a Hudson coin
HUD's coin and you go in there and
you're like I want anybody who has
access to HUD's coins to be able to
check their balance so you make that
function public that means anyone can
call it as we'll see in a second
internal functions are only callable
from inside the contract so as you can
see there's a lot of parallels to many
other programming languages here
internal functions are good for you know
things that you only want other
functions to call so that people can't
manipulate them and do weird things with
them cool your public functions are the
API the expose to the world you can
think of these as your API endpoints but
they're the things that you allow
outside actors to interact with your
contract with one of the interesting
things is that is happening right now is
that some standards are beginning to
emerge for how we write contracts you
can think of these like HTTP web
standards this is the ERC 20 standard
this is the standard interface that
token contracts enter should implement
there's this small set of functions but
this interface is implemented across all
of the major token contracts that are
live on the network right now and that
common interface that like standard that
has emerged is allowing some pretty
awesome things to happen so if anyone's
been to the ether scan web site it's a
very popular aetherium blockchain
Explorer you can go there and they
actually have a search feature where if
any other contract is using the ERC 20
standard you can search for tokens
within that contract
it'll you'll just be able to put the
contract address and it will
tell you you know your balance and give
you everything you need because it's a
standard that's set across any smart
contract that implements it it's very
interesting what we have right here is
actually maker tokens I believe as
because they implemented the ERC 20
interface and there's some variations
people use to do different things with
ERC 20 but for the most part it's pretty
standardized a lot of people are using
the same standard which is great that
the community can come together and do
something like that one of the cool
things that these kind of standards
enable is this which is a completely
decentralized exchange where you can
trade token pairs on the etherion
blockchain yeah so the cool thing about
this like why would we want something
like etherics the reason is it doesn't
have a middleman it's instant settlement
or instant set like pretty close to
instant settlement and you control the
assets so a lot of the time you forget
you know things like this happening and
the reason this happened was because it
wasn't decentralized they mount GOx was
a Bitcoin exchange they had a lot of
people's Bitcoin and then they got
hacked in the Bitcoin stolen if we were
using something like ether X right here
that is less likely to happen because
the contracts just all talk to each
other autonomously within the etherium
network let's see oh so solidity is
about two years old and since then the
communities come together and made a ton
of tools you've seen a lot of these
today from other presenters and you're
going to see more what we have here on
the left is some integrated development
environment so some of the more popular
ones are browser solidity that's a
compiler and basically full solidity
suite for debugging and everything
within your browser we also have a
theorem studio and Visual Studio which
are IDs and plugins and then if you look
at the bottom if you recognize any of
those assembly
that means that your text editor has
support for solidity syntax or solidity
compilation or things like that if you
look at the right we have tools rain
earlier today when Oversoul graph which
is a really really powerful tool we also
have a selenium which is a linter
truffled apple populist and embark which
are frameworks for building dabs so
really you have a ton of different tools
to come in and help you learn because it
can be a rough ride at first so yeah go
ahead so this is browser solidity this
is magic you can go to this in your
browser right now if you can get the
internet to work and write a contract
compile it here in your browser without
any tooling on your machine deploy it to
a testy VM running in your browser
without you needing to install anything
on your machine and interact with it
right here on this website the browser
solidity is an amazing amazing tool and
it is a really easy way to get started
tinkering around with etherium contracts
yeah definitely so I was gonna put a
list of resources like okay I'm out
there in the audience or watching online
I want to get started what do I do what
we've done is if you go to the etherium
subreddit it's like an online forum
there's a post that's at the top of the
homepage of the etherium subreddit and
it has all kinds of links it has a
getting started guide some of the things
that people are going to be familiar
with and that are real easy to use we
have our own Stack Exchange so if you're
a developer with different languages and
you use Stack Exchange aetherium has its
own Stack Exchange that actually has
over 3000 at least 3,500 questions
answered we also have ethics org which
is a community built documentation site
we're looking all the time for people to
come in help out with that effort and we
also have a course aetherium org which
has a short getting started and then on
top of that we have plans in the future
to expand on may be things like examples
tutorials and then of course for
solidity there is a
solidity documentation that is
constantly updated with every release so
it's very very good resource on top of
all that you're in there it's going to
be kind of hectic at first if you've
never used solidity there's a little bit
of a learning curve so come to our git
er chat rooms and that's going to be I
think git er dot i n slash aetherium we
have developers and different channels
there at all times
that'll be happy to help you get started
with aetherium so I think with that the
only other thing I have to remind you
guys go ahead and talk about you um so
I've signed up about 10% of the
conference for DEFCON 2 identities I'd
love to get a much deeper signup so send
me your information I don't know if we
can get the slide yeah it's like it come
up but I will say this if you walked out
early yesterday you missed the most
amazing announcement because what we
have here is a memento on the etherion
blockchain that you can pull up or you
can so so I am issuing one one of these
to every person here that wants one they
won't be issuable after Thursday morning
at 8:00 a.m. and the idea is this is an
experiment to see what can we do with
the ability to let people interact with
something knowing that they were here at
this conference there are some
interesting ideas that I have for what
you could build on top of this one of
them might be if there's another hard
fort proposal at some point we could use
this as the permissions for voting in
one vote to see what this community
thinks about that idea as opposed to the
entire community of people who own ether
might be interesting to see what the
difference between those two boats are
that is oddly interesting yeah all you
have to do is send me your information
yeah Piper's camped out like outside at
a desk with some stickers and if you
come over there with your aetherium
address you'll be in a
once-in-a-lifetime opportunity smart
contract to be able to provide you know
your input and future events potentially
so super exciting stuff I'm really
excited about solidity if you need any
help with it find me on reddit my name
is supe tacular on there it's a great
name it's my yeah and then Piper's on
there as a hyper Miriam hyper Miriam
find him on there - he's super helpful
where nice guys come see us thank you