Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
gskapka Merge pull request #7 from provable-things/fix/fxn-order-in-contract
fix(contract): fxn order in contract & add `_proof` field
Latest commit 9238b94 Jul 11, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
contracts
migrations
test
.gitattributes
.gitignore
LICENSE
README.md
box-img-lg.png
box-img-sm.png
package-lock.json
package.json fix(packages): rebrand `package.json` & update github links Jul 10, 2019
truffle-box.json
truffle.js

README.md

📦 Provable Truffle Box

 

The Provable Truffle box is here! We have created this starter-box to show you how to leverage Provable within the Truffle framework. It contains the Provable API as well as an example smart-contract. There are tests included too showing you how you could set up a full ethereum smart-contract development suite of your own. Get leveraging the power of Provable in your smart-contract projects today!

 


 

📃 Instructions For Unboxing

1) Using your favourite shell, first install Truffle globally:

❍ npm install -g truffle

2) Then create a directory you want to install the box into:

❍ mkdir my-awesome-provable-truffle-box

3) Enter the directory:

❍ cd my-awesome-provable-truffle-box

4) Unbox it!

❍ truffle unbox provable-things/truffle-starter

Now is a great time to have a look around the your new Provable box. You'll see all the Truffle files & folder structure you're used to. Congratulations - you can now compile, migrate and deploy your contracts to your heart's content!

 


 

🎓 How To Use - Test Running Example

When you unboxed this, it installed the dependencies it needs including another part of the Provable ecosystem that we call the Ethereum-Bridge. It allows you to test Provable functionality on local test-nets! Also, did you know that Truffle can spin up a local ethereum blockchain itself in order to speed up development and run tests? These things combined are super useful when developing your smart-contracts, as a fast test-turnover incentivizes more thorough testing which is always a good thing!

To help even more, we've written a script in the package.json that came inside your Truffle box - go and have a peek at it now. It'll start the bridge with the right settings which will make your work super easy and fast, watch:

1) Point your console to your project's directory then start Truffle in develop mode by running:

❍ truffle develop

2) Once Truffle is fired up, in a new console, create the bridge via:

❍ npm run bridge

2) Once the bridge is up, running and listening, go back to the first console and run the tests via:

❍ truffle develop> test

  Contract: ETH Price Tests
    ✓ Should get contract instantiation for listening to events
    ✓ Should have logged a new Provable query on contract creation
    ✓ Callback should have logged a new ETH price (4676ms)
    ✓ Should set ETH price correctly in contract
    ✓ Should revert on second query attempt due to lack of funds (120ms)
    ✓ Should succeed on a second query attempt when sending funds (97ms)
   6 passing (6s)

The more green . . .

check marks . . .

the better!!

Afer you've watched the tests run, go and have a look in the test directory to see the javascript file that contains them. Notice the waitForEvent function in the ./test/utils.js folder too - it means we can wait for events to see what values the Provable calls are returning!

 


 

💻 Get Developing!

Now that you've seen the contents of the Provable box in action, you'll be itching to get on with your own projects. Just remember that if you're using Provable queries in your smart-contracts, you'll need the ethereum-bridge running along side the truffle development console. The bridge is also highly configurable to suit the development environment & version of the ethereum blockchain you're using - you can find out all of it's options here.

There are also tons of other resources to help you out, including:

👊 The Provable docs!

👊 The Truffle docs!

👊 And more of our example contracts!

If you get stuck after looking through the above sources, feel free to ask us questions on our Gitter support channel!

With just this truffle-box you can quickly and easily be leveraging the full power of Provable in your smart-contracts - have fun!

 


 

📣 Get In Touch!

If you want to tell us something, or ask us something, there's loads of ways to get in touch:

We have a Twitter

And a Gitter

Or a Website

Plus a Github

You can’t perform that action at this time.